ilog.views.maps.rendering
Class IlvIntervalColorModel

java.lang.Object
  extended by java.awt.image.ColorModel
      extended by ilog.views.maps.rendering.IlvIntervalColorModel
All Implemented Interfaces:
IlvPersistentObject, Transparency

public class IlvIntervalColorModel
extends ColorModel
implements IlvPersistentObject

Implements a color model that performs a linear interpolation to compute the pixel colors within intervals specified by the user.
This color model can be used to create images from an IlvMapRaster .
A predefined instance of this color model is adapted to render elevation rasters.

Since:
ILOG JViews 3.0
See Also:
IlvDefaultRasterRenderer.MakeImage(ilog.views.maps.geometry.IlvMapRaster, java.awt.image.ColorModel), MakeElevationColorModel()

Field Summary
 
Fields inherited from class java.awt.image.ColorModel
pixel_bits, transferType
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
IlvIntervalColorModel(Color[] colors, short[] limits)
          Creates an instance of IlvIntervalColorModel.
IlvIntervalColorModel(IlvInputStream stream)
          Reads an IlvIntervalColorModel from an IlvIntervalColorModel.
 
Method Summary
 boolean equals(Object object)
          Compares this color model to the specified object.
 int getAlpha(int pixel)
          Returns the Alpha component for this pixel value.
 int getBlue(int pixel)
          Returns the interpolated Blue component for this pixel value.
 Color[] getColors()
          Returns the color array.
 int getGreen(int pixel)
          Returns the interpolated Green component for this pixel value.
 int getIntervalCount()
          Returns the number of intervals.
 short[] getLimits()
          Returns the limit array.
 int getRed(int pixel)
          Returns the interpolated Red component for this pixel value.
 int getRGB(int pixel)
          Returns the interpolated RGB component for this pixel value.
 int hashCode()
          Returns an hash value for this object.
 boolean isPersistent()
          Returns true.
static ColorModel MakeElevationColorModel()
          Returns a predefined interval color model with values adapted to render elevation rasters.
 void write(IlvOutputStream stream)
          Writes the renderer to an IlvOutputStream.
 
Methods inherited from class java.awt.image.ColorModel
coerceData, createCompatibleSampleModel, createCompatibleWritableRaster, finalize, getAlpha, getAlphaRaster, getBlue, getColorSpace, getComponents, getComponents, getComponentSize, getComponentSize, getDataElement, getDataElement, getDataElements, getDataElements, getDataElements, getGreen, getNormalizedComponents, getNormalizedComponents, getNumColorComponents, getNumComponents, getPixelSize, getRed, getRGB, getRGBdefault, getTransferType, getTransparency, getUnnormalizedComponents, hasAlpha, isAlphaPremultiplied, isCompatibleRaster, isCompatibleSampleModel, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvIntervalColorModel

public IlvIntervalColorModel(Color[] colors,
                             short[] limits)
Creates an instance of IlvIntervalColorModel. The intervals from which the color model will interpolate the values are specified by an array of colors and an array of limits arranged in descending order.

Parameters:
colors - The array of Colors defining the color limits.
limits - The array of short values defining the interval limits. The length of limits should be equal to colors.length - 2

IlvIntervalColorModel

public IlvIntervalColorModel(IlvInputStream stream)
                      throws IlvReadFileException
Reads an IlvIntervalColorModel from an IlvIntervalColorModel.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - if an error occurs while reading.
Method Detail

equals

public boolean equals(Object object)
Compares this color model to the specified object.

Overrides:
equals in class ColorModel
Parameters:
object - The object to compare.
Returns:
true if the two objects are equal.
Since:
JViews 5.0

hashCode

public int hashCode()
Returns an hash value for this object.

Overrides:
hashCode in class ColorModel
Since:
JViews 5.0

getAlpha

public int getAlpha(int pixel)
Returns the Alpha component for this pixel value.

Specified by:
getAlpha in class ColorModel

getRed

public int getRed(int pixel)
Returns the interpolated Red component for this pixel value.

Specified by:
getRed in class ColorModel

getGreen

public int getGreen(int pixel)
Returns the interpolated Green component for this pixel value.

Specified by:
getGreen in class ColorModel

getBlue

public int getBlue(int pixel)
Returns the interpolated Blue component for this pixel value.

Specified by:
getBlue in class ColorModel

getRGB

public int getRGB(int pixel)
Returns the interpolated RGB component for this pixel value.

Overrides:
getRGB in class ColorModel

getColors

public Color[] getColors()
Returns the color array.


getLimits

public short[] getLimits()
Returns the limit array.


getIntervalCount

public int getIntervalCount()
Returns the number of intervals. It is the number of limits + 1.


write

public void write(IlvOutputStream stream)
           throws IOException
Writes the renderer to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Parameters:
stream - the output stream
Throws:
IOException - thrown when an exception occurs during the write operation for this object.

isPersistent

public boolean isPersistent()
Returns true.


MakeElevationColorModel

public static ColorModel MakeElevationColorModel()
Returns a predefined interval color model with values adapted to render elevation rasters.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.