Class TLcdColorModelFactory

java.lang.Object
com.luciad.format.raster.TLcdColorModelFactory

public final class TLcdColorModelFactory extends Object

Utility class containing methods to create ColorModel instances.

Since:
2013.1
  • Method Details

    • createColorModel

      public static ColorModel createColorModel(ILcdModel aRasterModel, TLcdColorMap aColorMap)

      Creates a ColorModel for aRasterModel based on the settings in aColorMap. This method assumes the values in the aRasterModel are expressed in the same units as the ones contained in aColorMap. If that is not the case and the raster values still need to be converted, you can use the createColorModel(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 same TLcdColorMap for each model which represents the same measurement. For example to create a ColorModel for elevations, you can always pass the elevation 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 same pixel size and default value.

      Parameters:
      aRasterModel - The raster model (a model which contains raster data and has a TLcdRasterModelDescriptor or a TLcdMultivaluedRasterModelDescriptor).
      aColorMap - The color map which defines the colors and levels which should be used in the returned ColorModel.
      Returns:
      a ColorModel for aRasterModel, or null when no ColorModel could be created.
    • createColorModel

      public static ColorModel createColorModel(ILcdModel aRasterModel, TLcdColorMap aColorMap, ILcdRasterValueConverter aRasterValueConverter)

      Creates a ColorModel for aRasterModel based on the settings in aColorMap. It will use the ILcdRasterValueConverter to map the values in the raster on the settings in the aColorMap.

      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 same TLcdColorMap for each model which represents the same measurement. For example to create a ColorModel for elevations, you can always pass the elevation 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 same pixel size and default value.

      Parameters:
      aRasterModel - The raster model (a model which contains raster data and has a TLcdRasterModelDescriptor or a TLcdMultivaluedRasterModelDescriptor).
      aColorMap - The color map which defines the colors and levels which should be used in the returned ColorModel.
      aRasterValueConverter - The converter which can be used to convert the values contained in the raster model to values matching the values used in aColorMap
      Returns:
      a ColorModel for aRasterModel, or null when no ColorModel could be created.
      See Also:
    • makeDefaultValueInvisible

      public static TLcdColorMap makeDefaultValueInvisible(ILcdModel aRasterModel, TLcdColorMap aInput)

      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 a ColorModel for elevations, you can always pass the elevation 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 same pixel size and default value.

      Parameters:
      aRasterModel - The raster model (a model which contains raster data and has a TLcdRasterModelDescriptor or a TLcdMultivaluedRasterModelDescriptor).
      aInput - The color map which defines the colors and levels which should be used in the returned TLcdColorMap.
      Returns:
      a TLcdColorMap for aRasterModel, or null when no TLcdColorMap could be created.
      See Also:
    • createElevationColorMap

      public static TLcdColorMap createElevationColorMap()
      Creates a TLcdColorMap containing colors and levels optimized for elevation data. The returned TLcdColorMap has its levels expressed in metres, and has a range from TLcdElevationUtil.MINIMUM_ELEVATION to TLcdElevationUtil.MAXIMUM_ELEVATION.
      Returns:
      a TLcdColorMap containing colors and levels optimized for elevation data.