Class LinearColorMap
- All Implemented Interfaces:
Iterable<LinearColorMapElement>,Collection<LinearColorMapElement>,List<LinearColorMapElement>,ColorMapTransform<LinearColorMapElement>,Domain1D<LinearColorMapElement>,PiecewiseTransform1D<LinearColorMapElement>
public final class LinearColorMap
extends AbstractList<LinearColorMapElement>
implements ColorMapTransform<LinearColorMapElement>
ColorMapTransform implementation defining a linear colormap transformation- Author:
- Simone Giannecchini, GeoSolutions.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLinearColorMap(CharSequence name, LinearColorMapElement[] standardElements) Constructor which creates aLinearColorMapwithout aNoDataCategory.LinearColorMap(CharSequence name, LinearColorMapElement[] standardElements, Color defColor) LinearColorMap(CharSequence name, LinearColorMapElement[] standardElements, LinearColorMapElement[] preFilteringElements, Color defaultColor) LinearColorMap(String string, LinearColorMapElement[] linearColorMapElements, LinearColorMapElement[] linearColorMapElements2) -
Method Summary
Modifier and TypeMethodDescriptionbooleanfindDomainElement(double sample) Returns theDomainElement1Dof the specified sample value.get(int index) Returns the range of values in thisDomain1D.Returns a color model for this category list.doubleThe default value which will be returned when asked to transform a value outside the valid domain elements.getName()Returns the name of this object.getSampleModel(int width, int height) Creates aSampleModelcompatible with the underlyingColorModelhaving the specified width and height.intintbooleanIndicates whether or not thisPiecewiseTransform1Dhas a default value which will be returned when asked to transform a value outside the valid domain elements.booleanhasGaps()Tell us if there is a gap in thisDomain1Dwhich means a range where noDomainElement1Dis defined.inthashCode()intsize()doubletransform(double value) Transforms the specified value.Methods inherited from class AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, set, subListMethods inherited from class AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface List
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
LinearColorMap
Constructor which creates aLinearColorMapwithout aNoDataCategory. 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 niceTransformException!- Parameters:
categories- the array of a categories to use for thisLinearColorMap.
-
LinearColorMap
-
LinearColorMap
public LinearColorMap(CharSequence name, LinearColorMapElement[] standardElements, LinearColorMapElement[] preFilteringElements, Color defaultColor) -
LinearColorMap
public LinearColorMap(String string, LinearColorMapElement[] linearColorMapElements, LinearColorMapElement[] linearColorMapElements2)
-
-
Method Details
-
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:
getColorModelin interfaceColorMapTransform<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 thevisibleBandand ignore the others, but the existence of allnumBandswill be at least tolerated. Supplemental bands, even invisible, are useful for processing with Java Advanced Imaging.- Returns:
- The requested color model, suitable for
RenderedImageobjects with values in therange.#getRange
-
getSampleModel
Creates aSampleModelcompatible with the underlyingColorModelhaving the specified width and height.- Specified by:
getSampleModelin interfaceColorMapTransform<LinearColorMapElement>- Parameters:
width- represents the width for the finalSampleModelheight- represents the height for the finalSampleModel- Returns:
-
get
- Specified by:
getin interfaceList<LinearColorMapElement>- Specified by:
getin classAbstractList<LinearColorMapElement>
-
size
public int size()- Specified by:
sizein interfaceCollection<LinearColorMapElement>- Specified by:
sizein interfaceList<LinearColorMapElement>- Specified by:
sizein classAbstractCollection<LinearColorMapElement>
-
getDefaultValue
public double getDefaultValue()Description copied from interface:PiecewiseTransform1DThe default value which will be returned when asked to transform a value outside the valid domain elements.In case
PiecewiseTransform1D.hasDefaultValue()returnfalsethis value has no meaning.- Specified by:
getDefaultValuein interfacePiecewiseTransform1D<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:PiecewiseTransform1DIndicates whether or not thisPiecewiseTransform1Dhas a default value which will be returned when asked to transform a value outside the valid domain elements.- Specified by:
hasDefaultValuein interfacePiecewiseTransform1D<LinearColorMapElement>- Returns:
- a
booleanto indicate whether or not thisPiecewiseTransform1Dhas a default value.
-
getApproximateDomainRange
Description copied from interface:Domain1DReturns the range of values in thisDomain1D. This is the union of the range of values of everyDomain1D.- Specified by:
getApproximateDomainRangein interfaceDomain1D<LinearColorMapElement>- Returns:
- The range of values.
-
findDomainElement
Description copied from interface:Domain1DReturns theDomainElement1Dof the specified sample value. If noDomainElement1Dfits, then this method returnsnull.- Specified by:
findDomainElementin interfaceDomain1D<LinearColorMapElement>- Parameters:
sample- The value.- Returns:
- The domain element of the supplied value, or
null.
-
getDomainElements
-
getName
Description copied from interface:Domain1DReturns 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:
getNamein interfaceDomain1D<LinearColorMapElement>- Returns:
-
hasGaps
public boolean hasGaps()Description copied from interface:Domain1DTell us if there is a gap in thisDomain1Dwhich means a range where noDomainElement1Dis defined.- Specified by:
hasGapsin interfaceDomain1D<LinearColorMapElement>- Returns:
truein case a gap exists,falseotherwise.
-
transform
Description copied from interface:PiecewiseTransform1DTransforms the specified value.- Specified by:
transformin interfacePiecewiseTransform1D<LinearColorMapElement>- Parameters:
value- The value to transform.- Returns:
- the transformed value.
- Throws:
TransformationException- if the value can't be transformed.
-
getSourceDimensions
public int getSourceDimensions() -
getTargetDimensions
public int getTargetDimensions() -
transform
- Throws:
TransformationException
-
equals
- Specified by:
equalsin interfaceCollection<LinearColorMapElement>- Specified by:
equalsin interfaceList<LinearColorMapElement>- Overrides:
equalsin classAbstractList<LinearColorMapElement>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<LinearColorMapElement>- Specified by:
hashCodein interfaceList<LinearColorMapElement>- Overrides:
hashCodein classAbstractList<LinearColorMapElement>
-