org.geotools.renderer.lite.gridcoverage2d
Class LinearColorMap

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<LinearColorMapElement>
          extended by org.geotools.renderer.lite.gridcoverage2d.LinearColorMap
All Implemented Interfaces:
java.lang.Iterable<LinearColorMapElement>, java.util.Collection<LinearColorMapElement>, java.util.List<LinearColorMapElement>, Domain1D<LinearColorMapElement>, PiecewiseTransform1D<LinearColorMapElement>, ColorMapTransform<LinearColorMapElement>, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.MathTransform1D

public final class LinearColorMap
extends java.util.AbstractList<LinearColorMapElement>
implements ColorMapTransform<LinearColorMapElement>

Author:
Simone Giannecchini, GeoSolutions.

Nested Class Summary
static class LinearColorMap.LinearColorMapType
           
 
Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
LinearColorMap(java.lang.CharSequence name, LinearColorMapElement[] standardElements)
          Constructor which creates a LinearColorMap without a NoDataCategory.
LinearColorMap(java.lang.CharSequence name, LinearColorMapElement[] standardElements, java.awt.Color defColor)
           
LinearColorMap(java.lang.CharSequence name, LinearColorMapElement[] standardElements, LinearColorMapElement[] preFilteringElements, java.awt.Color defaultColor)
           
LinearColorMap(java.lang.String string, LinearColorMapElement[] linearColorMapElements, LinearColorMapElement[] linearColorMapElements2)
           
 
Method Summary
 org.opengis.referencing.operation.Matrix derivative(org.opengis.geometry.DirectPosition point)
           
 double derivative(double value)
           
 boolean equals(java.lang.Object o)
           
 LinearColorMapElement findDomainElement(double sample)
          Returns the DomainElement1D of the specified sample value.
 LinearColorMapElement get(int index)
           
 NumberRange<?> getApproximateDomainRange()
          Returns the range of values in this Domain1D.
 java.awt.image.IndexColorModel getColorModel()
          Returns a color model for this category list.
 double getDefaultValue()
          The default value which will be returned when asked to transform a value outside the valid domain elements.
 LinearColorMapElement[] getDomainElements()
           
 org.opengis.util.InternationalString getName()
          Returns the name of this object.
 java.awt.image.SampleModel getSampleModel(int width, int height)
          Creates a SampleModel compatible with the underlying ColorModel having the specified width and height.
 int getSourceDimensions()
           
 int getTargetDimensions()
           
 boolean hasDefaultValue()
          Indicates whether or not this PiecewiseTransform1D has a default value which will be returned when asked to transform a value outside the valid domain elements.
 boolean hasGaps()
          Tell us if there is a gap in this Domain1D which means a range where no DomainElement1D is defined.
 int hashCode()
           
 org.opengis.referencing.operation.MathTransform1D inverse()
           
 boolean isIdentity()
           
 int size()
           
 java.lang.String toWKT()
           
 org.opengis.geometry.DirectPosition transform(org.opengis.geometry.DirectPosition ptSrc, org.opengis.geometry.DirectPosition ptDst)
           
 double transform(double value)
           
 void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
           
 void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
           
 void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
           
 void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Constructor Detail

LinearColorMap

public LinearColorMap(java.lang.CharSequence name,
                      LinearColorMapElement[] standardElements)
Constructor which creates a LinearColorMap without a NoDataCategory. Keep in mind that if the list has gaps, if you try to transform a value that falls into a gap you'll get a nice TransformException!

Parameters:
categories - the array of a categories to use for this LinearColorMap.

LinearColorMap

public LinearColorMap(java.lang.CharSequence name,
                      LinearColorMapElement[] standardElements,
                      java.awt.Color defColor)

LinearColorMap

public LinearColorMap(java.lang.CharSequence name,
                      LinearColorMapElement[] standardElements,
                      LinearColorMapElement[] preFilteringElements,
                      java.awt.Color defaultColor)

LinearColorMap

public LinearColorMap(java.lang.String string,
                      LinearColorMapElement[] linearColorMapElements,
                      LinearColorMapElement[] linearColorMapElements2)
Method Detail

getColorModel

public java.awt.image.IndexColorModel getColorModel()
Returns a color model for this category list. This method builds up the color model from each category's colors (as returned by #getColors ).

Specified by:
getColorModel in interface ColorMapTransform<LinearColorMapElement>
Parameters:
visibleBand - The band to be made visible (usually 0). All other bands, if any will be ignored.
numBands - The number of bands for the color model (usually 1). The returned color model will renderer only the visibleBand and ignore the others, but the existence of all numBands will be at least tolerated. Supplemental bands, even invisible, are useful for processing with Java Advanced Imaging.
Returns:
The requested color model, suitable for RenderedImage objects with values in the #getRange range.

getSampleModel

public java.awt.image.SampleModel getSampleModel(int width,
                                                 int height)
Creates a SampleModel compatible with the underlying ColorModel having the specified width and height.

Specified by:
getSampleModel in interface ColorMapTransform<LinearColorMapElement>
Parameters:
width - represents the width for the final SampleModel
height - represents the height for the final SampleModel
Returns:

get

public LinearColorMapElement get(int index)
Specified by:
get in interface java.util.List<LinearColorMapElement>
Specified by:
get in class java.util.AbstractList<LinearColorMapElement>

size

public int size()
Specified by:
size in interface java.util.Collection<LinearColorMapElement>
Specified by:
size in interface java.util.List<LinearColorMapElement>
Specified by:
size in class java.util.AbstractCollection<LinearColorMapElement>

getDefaultValue

public double getDefaultValue()
Description copied from interface: PiecewiseTransform1D
The default value which will be returned when asked to transform a value outside the valid domain elements.

In case PiecewiseTransform1D.hasDefaultValue() return false this value has no meaning.

Specified by:
getDefaultValue in interface PiecewiseTransform1D<LinearColorMapElement>
Returns:
The default value which will be returned when asked to transform a value outside the valid domain elements.

hasDefaultValue

public boolean hasDefaultValue()
Description copied from interface: PiecewiseTransform1D
Indicates whether or not this PiecewiseTransform1D has a default value which will be returned when asked to transform a value outside the valid domain elements.

Specified by:
hasDefaultValue in interface PiecewiseTransform1D<LinearColorMapElement>
Returns:
a boolean to indicate whether or not this PiecewiseTransform1D has a default value.

getApproximateDomainRange

public NumberRange<?> getApproximateDomainRange()
Description copied from interface: Domain1D
Returns the range of values in this Domain1D. This is the union of the range of values of every Domain1D.

Specified by:
getApproximateDomainRange in interface Domain1D<LinearColorMapElement>
Returns:
The range of values.

findDomainElement

public LinearColorMapElement findDomainElement(double sample)
Description copied from interface: Domain1D
Returns the DomainElement1D of the specified sample value. If no DomainElement1D fits, then this method returns null.

Specified by:
findDomainElement in interface Domain1D<LinearColorMapElement>
Parameters:
sample - The value.
Returns:
The domain element of the supplied value, or null.

getDomainElements

public LinearColorMapElement[] getDomainElements()

getName

public org.opengis.util.InternationalString getName()
Description copied from interface: Domain1D
Returns the name of this object. The default implementation returns the name of what seems to be the "main" domain element (i.e. the domain element with the widest range of values).

Specified by:
getName in interface Domain1D<LinearColorMapElement>
Returns:

hasGaps

public boolean hasGaps()
Description copied from interface: Domain1D
Tell us if there is a gap in this Domain1D which means a range where no DomainElement1D is defined.

Specified by:
hasGaps in interface Domain1D<LinearColorMapElement>
Returns:
true in case a gap exists, false otherwise.

derivative

public double derivative(double value)
                  throws org.opengis.referencing.operation.TransformException
Specified by:
derivative in interface org.opengis.referencing.operation.MathTransform1D
Throws:
org.opengis.referencing.operation.TransformException

transform

public double transform(double value)
                 throws org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.referencing.operation.MathTransform1D
Throws:
org.opengis.referencing.operation.TransformException

derivative

public org.opengis.referencing.operation.Matrix derivative(org.opengis.geometry.DirectPosition point)
                                                    throws org.opengis.geometry.MismatchedDimensionException,
                                                           org.opengis.referencing.operation.TransformException
Specified by:
derivative in interface org.opengis.referencing.operation.MathTransform
Throws:
org.opengis.geometry.MismatchedDimensionException
org.opengis.referencing.operation.TransformException

getSourceDimensions

public int getSourceDimensions()
Specified by:
getSourceDimensions in interface org.opengis.referencing.operation.MathTransform

getTargetDimensions

public int getTargetDimensions()
Specified by:
getTargetDimensions in interface org.opengis.referencing.operation.MathTransform

inverse

public org.opengis.referencing.operation.MathTransform1D inverse()
                                                          throws org.opengis.referencing.operation.NoninvertibleTransformException
Specified by:
inverse in interface org.opengis.referencing.operation.MathTransform
Specified by:
inverse in interface org.opengis.referencing.operation.MathTransform1D
Throws:
org.opengis.referencing.operation.NoninvertibleTransformException

isIdentity

public boolean isIdentity()
Specified by:
isIdentity in interface org.opengis.referencing.operation.MathTransform

toWKT

public java.lang.String toWKT()
                       throws java.lang.UnsupportedOperationException
Specified by:
toWKT in interface org.opengis.referencing.operation.MathTransform
Throws:
java.lang.UnsupportedOperationException

transform

public org.opengis.geometry.DirectPosition transform(org.opengis.geometry.DirectPosition ptSrc,
                                                     org.opengis.geometry.DirectPosition ptDst)
                                              throws org.opengis.geometry.MismatchedDimensionException,
                                                     org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Throws:
org.opengis.geometry.MismatchedDimensionException
org.opengis.referencing.operation.TransformException

transform

public void transform(double[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
               throws org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Throws:
org.opengis.referencing.operation.TransformException

transform

public void transform(float[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
               throws org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Throws:
org.opengis.referencing.operation.TransformException

transform

public void transform(float[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
               throws org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Throws:
org.opengis.referencing.operation.TransformException

transform

public void transform(double[] srcPts,
                      int srcOff,
                      float[] dstPts,
                      int dstOff,
                      int numPts)
               throws org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Throws:
org.opengis.referencing.operation.TransformException

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection<LinearColorMapElement>
Specified by:
equals in interface java.util.List<LinearColorMapElement>
Overrides:
equals in class java.util.AbstractList<LinearColorMapElement>

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<LinearColorMapElement>
Specified by:
hashCode in interface java.util.List<LinearColorMapElement>
Overrides:
hashCode in class java.util.AbstractList<LinearColorMapElement>


Copyright © 1996-2010 Geotools. All Rights Reserved.