*/
boolean tolow=false;
/**
+ * when false, min/max range has been manually set so should not be dynamically adjusted.
+ */
+ boolean autoScale = true;
+ /**
* construct a graduatedColor object from simple parameters
* @param low
* @param high
tolow = oldcs.tolow;
thresholdState = oldcs.thresholdState;
thrsh = oldcs.thrsh;
+ autoScale = oldcs.autoScale;
}
/**
* make a new gradient from an old one with a different scale range
public GraduatedColor(GraduatedColor oldcs, float min, float max)
{
this(oldcs);
- if (max<min)
- {
- base = max;
- range = min-max;
- tolow=true;
- } else {
- base = min;
- range = max-min;
- tolow=false;
- }
+ updateBounds(min, max);
}
public Color getMinColor()
{
{
thrsh = value;
}
+ public float getThresh() {
+ return thrsh;
+ }
public void setThreshType(int aboveThreshold)
{
thresholdState = aboveThreshold;
{
return thresholdState;
}
+ public float getMax()
+ {
+ // regenerate the original values passed in to the constructor
+ return (tolow) ? base : (base + range);
+ }
+ public float getMin()
+ {
+ // regenerate the original value passed in to the constructor
+ return (tolow) ? (base+range) : base;
+ }
+ public boolean isAutoScale()
+ {
+ return autoScale;
+ }
+ public void setAutoScaled(boolean autoscale) {
+ autoScale = autoscale;
+ }
+ /**
+ * update the base and range appropriatly for the given minmax range
+ * @param a float[] {min,max} array containing minmax range for the associated score values
+ */
+ public void updateBounds(float min,float max)
+ {
+ if (max<min)
+ {
+ base = max;
+ range = min-max;
+ tolow=true;
+ } else {
+ base = min;
+ range = max-min;
+ tolow=false;
+ }
+ }
}