Class TLcdColorModelFactory
Utility class containing methods to create ColorModel
instances.
- Since:
- 2013.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic ColorModel
createColorModel
(ILcdModel aRasterModel, TLcdColorMap aColorMap) Creates aColorModel
foraRasterModel
based on the settings inaColorMap
.static ColorModel
createColorModel
(ILcdModel aRasterModel, TLcdColorMap aColorMap, ILcdRasterValueConverter aRasterValueConverter) Creates aColorModel
foraRasterModel
based on the settings inaColorMap
.static TLcdColorMap
Creates aTLcdColorMap
containing colors and levels optimized for elevation data.static TLcdColorMap
makeDefaultValueInvisible
(ILcdModel aRasterModel, TLcdColorMap aInput) Creates a newTLcdColorMap
based on the given input color map that ensures that the default raster value is invisible.
-
Method Details
-
createColorModel
Creates a
ColorModel
foraRasterModel
based on the settings inaColorMap
. This method assumes the values in theaRasterModel
are expressed in the same units as the ones contained inaColorMap
. If that is not the case and the raster values still need to be converted, you can use thecreateColorModel(com.luciad.model.ILcdModel, com.luciad.util.TLcdColorMap, ILcdRasterValueConverter)
method.The current implementation will reduce the range of color map to make sure the default raster value is not included. As a result, the default raster value will be mapped to a transparent color. This is also the case for all values outside the range of the
TLcdColorMap
. This behavior allows to always pass in the sameTLcdColorMap
for each model which represents the same measurement. For example to create aColorModel
for elevations, you can always pass theelevation color map
as argument, independent on the default value of the raster. This is illustrated in the following snippet:ILcdModel dtedModel = ...; ColorModel elevationColorModel = TLcdColorModelFactory.createColorModel( dtedModel, TLcdColorModelFactory.createElevationColorMap() );
Currently, this method can only construct a
ColorModel
when the model is a raster model where all rasters have the samepixel size
anddefault value
.- Parameters:
aRasterModel
- The raster model (a model which contains raster data and has aTLcdRasterModelDescriptor
or aTLcdMultivaluedRasterModelDescriptor
).aColorMap
- The color map which defines the colors and levels which should be used in the returnedColorModel
.- Returns:
- a
ColorModel
foraRasterModel
, ornull
when noColorModel
could be created.
-
createColorModel
public static ColorModel createColorModel(ILcdModel aRasterModel, TLcdColorMap aColorMap, ILcdRasterValueConverter aRasterValueConverter) Creates a
ColorModel
foraRasterModel
based on the settings inaColorMap
. It will use theILcdRasterValueConverter
to map the values in the raster on the settings in theaColorMap
.The current implementation will reduce the range of color map to make sure the default raster value is not included. As a result, the default raster value will be mapped to a transparent color. This is also the case for all values outside the range of the
TLcdColorMap
. This behavior allows to always pass in the sameTLcdColorMap
for each model which represents the same measurement. For example to create aColorModel
for elevations, you can always pass theelevation color map
as argument, independent on the default value of the raster.Currently, this method can only construct a
ColorModel
when the model is a raster model where all rasters have the samepixel size
anddefault value
.- Parameters:
aRasterModel
- The raster model (a model which contains raster data and has aTLcdRasterModelDescriptor
or aTLcdMultivaluedRasterModelDescriptor
).aColorMap
- The color map which defines the colors and levels which should be used in the returnedColorModel
.aRasterValueConverter
- The converter which can be used to convert the values contained in the raster model to values matching the values used inaColorMap
- Returns:
- a
ColorModel
foraRasterModel
, ornull
when noColorModel
could be created. - See Also:
-
makeDefaultValueInvisible
Creates a new
TLcdColorMap
based on the given input color map that ensures that the default raster value is invisible. This is done by reducing the range of the returned color map by making sure that the default raster value lies outside the range. As a result, the default raster value (and all other values outside the new range) will be mapped to a transparent color.This behavior allows to always pass in the same
TLcdColorMap
for each model which represents the same measurement. For example to create aColorModel
for elevations, you can always pass theelevation color map
as argument, independent on the default value of the raster. The modified color map created by this method will make sure that the data is correctly displayed.Currently, this method can only construct a
TLcdColorMap
when the model is a raster model where all rasters have the samepixel size
anddefault value
.- Parameters:
aRasterModel
- The raster model (a model which contains raster data and has aTLcdRasterModelDescriptor
or aTLcdMultivaluedRasterModelDescriptor
).aInput
- The color map which defines the colors and levels which should be used in the returnedTLcdColorMap
.- Returns:
- a
TLcdColorMap
foraRasterModel
, ornull
when noTLcdColorMap
could be created. - See Also:
-
createElevationColorMap
Creates aTLcdColorMap
containing colors and levels optimized for elevation data. The returnedTLcdColorMap
has its levels expressed in metres, and has a range fromTLcdElevationUtil.MINIMUM_ELEVATION
toTLcdElevationUtil.MAXIMUM_ELEVATION
.- Returns:
- a
TLcdColorMap
containing colors and levels optimized for elevation data.
-