org.geotools.renderer.lite.gridcoverage2d
Class SLDColorMapBuilder

java.lang.Object
  extended by org.geotools.renderer.lite.gridcoverage2d.SLDColorMapBuilder

public class SLDColorMapBuilder
extends java.lang.Object

Builder facility for creating a LinearColorMap using elements from RasterSymbolizer ColorMapTransform element.

This class is not intended to be thread safe.

Author:
Simone Giannecchini, GeoSolutions

Field Summary
static java.awt.Color defaultColorForValuesToPreserve
           
static java.awt.Color defaultGapsColor
          Default color to fill gaps.
 
Constructor Summary
SLDColorMapBuilder()
          Default constructor for the SLDColorMapBuilder class.
SLDColorMapBuilder(java.lang.String name)
          Constructor for the SLDColorMapBuilder class.
 
Method Summary
 SLDColorMapBuilder addColorMapEntry(ColorMapEntry colorMapEntry)
          Add a new ColorMapEntry to the list of ColorMapEntry we want to use for building a LinearColorMap.
 SLDColorMapBuilder addValueToPreserve(double value)
          Add a value that we should try to preserve while applying the color map.
 LinearColorMap buildLinearColorMap()
           
 java.awt.Color getColorForValuesToPreserve()
           
 boolean getExtendedColors()
          Getter of the property extendedColors
 int getLinearColorMapType()
          Retrieves the LinearColorMap.LinearColorMapType for this SLDColorMapBuilder .
 int getNumberColorMapEntries()
          Getter of the property numberColorMapEntries
 int getNumberOfColorMapElements()
          Getter of the property numberOfColorMapElements
 double[] getValuesToPreserve()
          Retrieves the values to preserve.
 SLDColorMapBuilder setColorForValuesToPreserve(java.awt.Color color)
          Set the color to use for the values we want to preserve.
 SLDColorMapBuilder setExtendedColors(boolean extendedColors)
          Setter of the property extendedColors
 void setGapsColor(java.awt.Color defaultColor)
          Sets the default Color to use when a value falls outside the range of values for provided color map elements.
 SLDColorMapBuilder setLinearColorMapType(int colorMapType)
          Sets the LinearColorMap.LinearColorMapType for this SLDColorMapBuilder .
 SLDColorMapBuilder setNumberColorMapEntries(int numberColorMapEntries)
          Setter of the property numberColorMapEntries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultColorForValuesToPreserve

public static final java.awt.Color defaultColorForValuesToPreserve

defaultGapsColor

public static final java.awt.Color defaultGapsColor
Default color to fill gaps.

Constructor Detail

SLDColorMapBuilder

public SLDColorMapBuilder()
Default constructor for the SLDColorMapBuilder class.


SLDColorMapBuilder

public SLDColorMapBuilder(java.lang.String name)
Constructor for the SLDColorMapBuilder class.

Parameters:
name - name for the LinearColorMap we will create at the end of this process.
Method Detail

setGapsColor

public void setGapsColor(java.awt.Color defaultColor)
Sets the default Color to use when a value falls outside the range of values for provided color map elements.

Note that once the underlying colormap has been built this method will throw an IllegalStateException if invoked.

In case one would want to unset the default color, he should simply call this method with a null value.

Parameters:
the - default Color to use when a value falls outside the provided color map elements.

setLinearColorMapType

public SLDColorMapBuilder setLinearColorMapType(int colorMapType)
Sets the LinearColorMap.LinearColorMapType for this SLDColorMapBuilder .

Returns:
this SLDColorMapBuilder .
See Also:
LinearColorMap.LinearColorMapType

getLinearColorMapType

public int getLinearColorMapType()
Retrieves the LinearColorMap.LinearColorMapType for this SLDColorMapBuilder .

-1 is returned in case the LinearColorMap.LinearColorMapType is still unspecified.

Returns:
the LinearColorMap.LinearColorMapType for this SLDColorMapBuilder or -1 case the LinearColorMap.LinearColorMapType is still unspecified.

addColorMapEntry

public SLDColorMapBuilder addColorMapEntry(ColorMapEntry colorMapEntry)
Add a new ColorMapEntry to the list of ColorMapEntry we want to use for building a LinearColorMap.

Parameters:
colorMapEntry -
Returns:

getValuesToPreserve

public double[] getValuesToPreserve()
Retrieves the values to preserve.

Returns:
an array of double which represents the values that need to be preserved by the ColorMapTransform we will create.

addValueToPreserve

public SLDColorMapBuilder addValueToPreserve(double value)
Add a value that we should try to preserve while applying the color map.

This means that all the values we add using this method will be mapped to the same color which can be set using setColorForValuesToPreserve(Color).

Returns:
this SLDColorMapBuilder.

setColorForValuesToPreserve

public SLDColorMapBuilder setColorForValuesToPreserve(java.awt.Color color)
Set the color to use for the values we want to preserve.

Returns:
this SLDColorMapBuilder.

getColorForValuesToPreserve

public java.awt.Color getColorForValuesToPreserve()
Returns:

getExtendedColors

public boolean getExtendedColors()
Getter of the property extendedColors

Returns:
Returns the extendedColors.

setExtendedColors

public SLDColorMapBuilder setExtendedColors(boolean extendedColors)
Setter of the property extendedColors

Unless this property is set prior to start working with this SLDColorMapBuilder we will make use of only 256 colors. If we use extended colors, then we'll be able to use up to 65536 colors.

Note that this imposes a limitation on the maximum number of ColorMapEntry we can use.

Parameters:
extendedColors - The extendedColors to set.
Returns:

getNumberColorMapEntries

public int getNumberColorMapEntries()
Getter of the property numberColorMapEntries

Returns:
Returns the numberColorMapEntries.

setNumberColorMapEntries

public SLDColorMapBuilder setNumberColorMapEntries(int numberColorMapEntries)
Setter of the property numberColorMapEntries

Parameters:
numberColorMapEntries - The numberColorMapEntries to set.
Returns:

getNumberOfColorMapElements

public int getNumberOfColorMapElements()
Getter of the property numberOfColorMapElements

Returns:
Returns the numberOfColorMapElements.

buildLinearColorMap

public LinearColorMap buildLinearColorMap()


Copyright © 1996-2010 Geotools. All Rights Reserved.