ilog.views.maps.graphic.style
Class IlvDoubleIntervalColorModel

java.lang.Object
  extended by java.awt.image.ColorModel
      extended by ilog.views.maps.graphic.style.IlvDoubleIntervalColorModel
All Implemented Interfaces:
IlvPersistentObject, IlvColorIntervalLimitFormat, IlvColorEncoder, Transparency

public class IlvDoubleIntervalColorModel
extends ColorModel
implements IlvColorEncoder, IlvColorIntervalLimitFormat

Implements a color model that performs a linear interpolation to compute the pixel colors within intervals specified by the user.

Since:
JViews 8.1

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
IlvDoubleIntervalColorModel(Color[] colors, double[] limits)
          Creates an instance of IlvIntervalColorModel.
IlvDoubleIntervalColorModel(double min, double max)
          Creates a new IlvDoubleIntervalColorModel instance.
IlvDoubleIntervalColorModel(IlvInputStream stream)
          Reads an IlvIntervalColorModel instance from an IlvIntervalColorModel object.
 
Method Summary
 boolean allowLimitChange()
          Should the color model editor be able to change the value of the limits Returns true.
static double convertToDouble(Object o)
          Converts an IlvFeatureAttribute value to a double value.
 boolean equals(Object object)
          Compares this color model to the specified object.
 String format(int value)
          Formats the value using a DecimalFormat 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, that is, the number of limits + 1.
 double[] 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 getValueRGB(Object value)
          Encodes a graphical object meta data into a color.
 int hashCode()
          Returns a hash value for this object.
 boolean isPersistent()
          Returns true.
 int parse(String limit)
          Parses the limit using a DecimalFormat object.
 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

IlvDoubleIntervalColorModel

public IlvDoubleIntervalColorModel(Color[] colors,
                                   double[] 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 Color objects that define the color limits.
limits - The array of double values that define the interval limits. The length of limits should be equal to colors.length - 2.

IlvDoubleIntervalColorModel

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

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

IlvDoubleIntervalColorModel

public IlvDoubleIntervalColorModel(double min,
                                   double max)
Creates a new IlvDoubleIntervalColorModel instance. The model will contain exactly 2 limits and a black to white color model.

Parameters:
min - The minimum value.
max - The maximum value.
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:
If the two objects are equal, true is returned.
Since:
JViews 5.0

hashCode

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

Overrides:
hashCode in class ColorModel
Returns:
A hash value for this object.
Since:
JViews 5.0

getAlpha

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

Specified by:
getAlpha in class ColorModel
Parameters:
pixel - The pixel value.
Returns:
The alpha component for this pixel value.

getRed

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

Specified by:
getRed in class ColorModel
Parameters:
pixel - The pixel value.
Returns:
The interpolated red component for this pixel value.

getGreen

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

Specified by:
getGreen in class ColorModel
Parameters:
pixel - The pixel value.
Returns:
The interpolated green component for this pixel value.

getBlue

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

Specified by:
getBlue in class ColorModel
Parameters:
pixel - The pixel value.
Returns:
The interpolated blue component for this pixel value.

getRGB

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

Overrides:
getRGB in class ColorModel
Parameters:
pixel - The pixel value.
Returns:
The interpolated RGB component for this pixel value.

getValueRGB

public int getValueRGB(Object value)
Encodes a graphical object meta data into a color.

Specified by:
getValueRGB in interface IlvColorEncoder
Parameters:
value - The metadata to encode.
Returns:
The RGB value encoded to a ColorModel.getRGBdefault() color model.
See Also:
IlvColorEncoder.getValueRGB(java.lang.Object)

convertToDouble

public static double convertToDouble(Object o)
Converts an IlvFeatureAttribute value to a double value.

Parameters:
o - The IlvFeatureAttribute to convert.
Returns:
The corresponding double value or Double.NaN if no conversion is possible.

getColors

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

Returns:
The color array.

getLimits

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

Returns:
The limit array.

getIntervalCount

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

Returns:
The number of intervals.

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.

Returns:
This method always returns true.

allowLimitChange

public boolean allowLimitChange()
Should the color model editor be able to change the value of the limits Returns true.

Specified by:
allowLimitChange in interface IlvColorIntervalLimitFormat
Returns:
true to give user access to insert/delete/change limits.
See Also:
IlvColorIntervalLimitFormat.allowLimitChange()

format

public String format(int value)
Formats the value using a DecimalFormat object.

Specified by:
format in interface IlvColorIntervalLimitFormat
Parameters:
value - The value.
Returns:
The formatted value.
See Also:
IlvColorIntervalLimitFormat.format(int)

parse

public int parse(String limit)
Parses the limit using a DecimalFormat object.

Specified by:
parse in interface IlvColorIntervalLimitFormat
Parameters:
limit - The limit.
Returns:
The parsed value.
See Also:
IlvColorIntervalLimitFormat.parse(java.lang.String)


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