|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectColorMap
public class ColorMap
Colors associated to categories. This is the parameter type for the
Recolor
operation.
Recolor
,
Serialized Form
modules/library/coverage (gt-coverage.jar)
Field Summary | |
---|---|
static CharSequence |
ANY_QUANTITATIVE_CATEGORY
A special category name meaning "any quantitative value". |
Constructor Summary | |
---|---|
ColorMap()
Creates an initially empty color map. |
|
ColorMap(Color[] colors)
Creates a color map initialized to the specified color ramp to be applied on any quantitative category. |
|
ColorMap(Map<? extends CharSequence,Color[]> colorMap)
Creates a color map initialized to the specified map. |
Method Summary | |
---|---|
boolean |
equals(Object object)
Compares this color map with the specified object for equality. |
Color[] |
getColors(CharSequence category)
Returns the color ramp for the given category. |
MeasurementRange<?> |
getGeophysicsRange(CharSequence category)
Returns the range of geophysics values for the given category. |
NumberRange |
getRelativeRange(CharSequence category)
Returns the relative range of values for the given category. |
boolean |
getResetUnspecifiedColors()
If true , the ARGB values corresponding to any category
not specified in this color map will be reset to the color specified
by the category. |
int |
hashCode()
Returns a hash code value for this color map. |
GridSampleDimension |
recolor(GridSampleDimension sampleDimension,
int[] ARGB)
Applies to the specified sample dimension the colors given to this color map. |
void |
setColor(CharSequence category,
Color color)
Applies a uniform color to the given (usually qualitative) category. |
void |
setColors(CharSequence category,
Color[] colors)
Applies a color ramp to the given (usually quantitative) category. |
void |
setGeophysicsRange(CharSequence category,
MeasurementRange<?> range)
Sets a range of geophysics values for the color ramp associated with a quantitative category. |
void |
setRelativeRange(CharSequence category,
NumberRange<?> range)
Sets a relative range of values for the color ramp associated to a quantitative category. |
void |
setResetUnspecifiedColors(boolean reset)
If true , the ARGB values corresponding to any category
not specified in this color map will be reset to the color specified
by the category. |
String |
toString()
Returns a string representation of this color map. |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final CharSequence ANY_QUANTITATIVE_CATEGORY
Constructor Detail |
---|
public ColorMap()
public ColorMap(Color[] colors)
colors
- The colors to be given to this map.public ColorMap(Map<? extends CharSequence,Color[]> colorMap)
colorMap
- A map of (category name,
colors) pairs.Method Detail |
---|
public void setColor(CharSequence category, Color color)
category
- The name of the category
for which to set the color.color
- A uniform color to apply to the specified category, or null
for removing the color mapping.recolor(org.geotools.coverage.GridSampleDimension, int[])
public void setColors(CharSequence category, Color[] colors)
category
- The name of the category for which to set
the colors, or ANY_QUANTITATIVE_CATEGORY
if the colors should apply to
any quantitative category.colors
- The colors to apply to the specified category, or null
or an empty array for removing the color mapping.recolor(org.geotools.coverage.GridSampleDimension, int[])
public Color[] getColors(CharSequence category)
category
- The category name, or
ANY_QUANTITATIVE_CATEGORY
for fetching the colors to
apply to any quantitative category.
null
if none.public void setGeophysicsRange(CharSequence category, MeasurementRange<?> range)
setRelativeRange("Height", new MeasurementRange(0, 100, SI.METRE)); setColors("Height", myColorPalette);
ThenmyColorPalette
will applies to pixel values in the range [100..400] instead of [0..500]. This is typically used in order to augment the contrast in a range of values of special interest.This method is exclusive with
setRelativeRange(java.lang.CharSequence, org.geotools.util.NumberRange>)
.
- Parameters:
category
- The name of the category for which to set the geophysics range.range
- The minimal and maximal values for the color ramp. Anull
value removes the range mapping.- See Also:
recolor(org.geotools.coverage.GridSampleDimension, int[])
public void setRelativeRange(CharSequence category, NumberRange<?> range)
setRelativeRange("Height", new NumberRange(20, 80)); setColors("Height", myColorPalette);
ThenmyColorPalette
will applies to pixel values in the range [40..160] instead of [0..200]. This is typically used in order to augment the contrast in a range of values of special interest.This method is exclusive with
setGeophysicsRange(java.lang.CharSequence, org.geotools.util.MeasurementRange>)
.
- Parameters:
category
- The name of the category for which to set the relative range.range
- The minimal and maximal relative values for the color ramp, as percentages between 0 and 100. Anull
value removes the range mapping.- See Also:
recolor(org.geotools.coverage.GridSampleDimension, int[])
public MeasurementRange<?> getGeophysicsRange(CharSequence category)
category
- The category name, or
ANY_QUANTITATIVE_CATEGORY
for fetching the range to
apply to any quantitative category.
null
if none.public NumberRange getRelativeRange(CharSequence category)
category
- The category name, or
ANY_QUANTITATIVE_CATEGORY
for fetching the relative
range to apply to any quantitative category.
null
if none.public void setResetUnspecifiedColors(boolean reset)
true
, the ARGB values corresponding to any category
not specified in this color map will be reset to the color specified
by the category. The default value is false
.
reset
- true
if unspecified colors should be reset to the colors given in
the category object.public boolean getResetUnspecifiedColors()
true
, the ARGB values corresponding to any category
not specified in this color map will be reset to the color specified
by the category. The default value is false
.
true
if unspecified colors should be reset to the colors given in
the category object.public GridSampleDimension recolor(GridSampleDimension sampleDimension, int[] ARGB)
recolor
method is invoked on that category and the result
inserted into a new sample dimension to be returned.
If the optional ARGB
array is non-null, then the ARGB colors for recolorized
categories will be written in this array. Only the elements with index in the
category range will be overwritten; other elements
will not be modified.
NOTE: The geophysics and
relative ranges are taken in account for the
ARGB
array only; they do not have impact on the categories to be
included in the returned sample dimension.
sampleDimension
- The sample dimension to recolorize.ARGB
- An optional array where to store the ARGB values of recolorized categories,
or null
if none.
sampleDimension
if no color change were applied.Category.recolor(java.awt.Color[])
public int hashCode()
hashCode
in class Object
public boolean equals(Object object)
equals
in class Object
object
- The object to compare with this color map.
true
if the given object is equals to this color map.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |