org.esa.beam.framework.datamodel
Class ColorPaletteDef

java.lang.Object
  extended by org.esa.beam.framework.datamodel.ColorPaletteDef
All Implemented Interfaces:
Cloneable

public class ColorPaletteDef
extends Object
implements Cloneable

The ColorPaletteDef class represents a curve that is used to transform the sample values of a geo-physical band into color palette indexes.

This special implemnentation of a gradation curve also provides separate color values for each of the tie points contained in the curve. This allows a better image interpretation because certain colors correspond to certain sample values even if the curve points are used to create color gradient palettes.


Nested Class Summary
static class ColorPaletteDef.Point
           
 
Constructor Summary
ColorPaletteDef(ColorPaletteDef.Point[] points)
           
ColorPaletteDef(ColorPaletteDef.Point[] points, int numColors)
           
ColorPaletteDef(double minSample, double maxSample)
           
ColorPaletteDef(double minSample, double centerSample, double maxSample)
           
 
Method Summary
 void addPoint(ColorPaletteDef.Point point)
           
 Object clone()
           
 Color computeColor(Scaling scaling, double sample)
           
static Color createCenterColor(ColorPaletteDef.Point p1, ColorPaletteDef.Point p2)
          Deprecated. since BEAM 4.2, use getCenterColor(java.awt.Color, java.awt.Color)
 Color[] createColorPalette(Scaling scaling)
           
 ColorPaletteDef createDeepCopy()
           
 boolean createPointAfter(int index, Scaling scaling)
          creates a new point between the point at the given index
 void dispose()
          Releases all of the resources used by this color palette definition and all of its owned children.
static Color getCenterColor(Color c1, Color c2)
          Creates the center color between the given two colors.
 Color[] getColors()
           
 ColorPaletteDef.Point getFirstPoint()
           
 Iterator getIterator()
           
 ColorPaletteDef.Point getLastPoint()
           
 double getMaxDisplaySample()
           
 double getMinDisplaySample()
           
 int getNumColors()
           
 int getNumPoints()
           
 ColorPaletteDef.Point getPointAt(int index)
           
 ColorPaletteDef.Point[] getPoints()
           
 void insertPointAfter(int index, ColorPaletteDef.Point point)
           
 boolean isAutoDistribute()
           
 boolean isDiscrete()
           
static ColorPaletteDef loadColorPaletteDef(File file)
          Loads a color palette definition from the given file
 void removePointAt(int index)
           
 void setAutoDistribute(boolean autoDistribute)
           
 void setDiscrete(boolean discrete)
           
 void setNumColors(int numColors)
           
 void setNumPoints(int numPoints)
           
 void setPoints(ColorPaletteDef.Point[] points)
           
static void storeColorPaletteDef(ColorPaletteDef colorPaletteDef, File file)
          Stores this color palette definition in the given file
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorPaletteDef

public ColorPaletteDef(double minSample,
                       double maxSample)

ColorPaletteDef

public ColorPaletteDef(double minSample,
                       double centerSample,
                       double maxSample)

ColorPaletteDef

public ColorPaletteDef(ColorPaletteDef.Point[] points)

ColorPaletteDef

public ColorPaletteDef(ColorPaletteDef.Point[] points,
                       int numColors)
Method Detail

isDiscrete

public boolean isDiscrete()

setDiscrete

public void setDiscrete(boolean discrete)

getNumColors

public int getNumColors()

setNumColors

public void setNumColors(int numColors)

getNumPoints

public int getNumPoints()

setNumPoints

public void setNumPoints(int numPoints)

isAutoDistribute

public boolean isAutoDistribute()

setAutoDistribute

public void setAutoDistribute(boolean autoDistribute)

getPointAt

public ColorPaletteDef.Point getPointAt(int index)

getFirstPoint

public ColorPaletteDef.Point getFirstPoint()

getLastPoint

public ColorPaletteDef.Point getLastPoint()

getMinDisplaySample

public double getMinDisplaySample()

getMaxDisplaySample

public double getMaxDisplaySample()

insertPointAfter

public void insertPointAfter(int index,
                             ColorPaletteDef.Point point)

createPointAfter

public boolean createPointAfter(int index,
                                Scaling scaling)
creates a new point between the point at the given index

Parameters:
index - the index
scaling - the scaling
Returns:
true, if a point has been inserted

createCenterColor

@Deprecated
public static Color createCenterColor(ColorPaletteDef.Point p1,
                                                 ColorPaletteDef.Point p2)
Deprecated. since BEAM 4.2, use getCenterColor(java.awt.Color, java.awt.Color)

Creates the center color between the colors of the given two points.

Parameters:
p1 - 1st point
p2 - 2nd point
Returns:
the center color

getCenterColor

public static Color getCenterColor(Color c1,
                                   Color c2)
Creates the center color between the given two colors.

Parameters:
c1 - 1st color
c2 - 2nd color
Returns:
the center color

removePointAt

public void removePointAt(int index)

addPoint

public void addPoint(ColorPaletteDef.Point point)

getPoints

public ColorPaletteDef.Point[] getPoints()

setPoints

public void setPoints(ColorPaletteDef.Point[] points)

getIterator

public Iterator getIterator()

clone

public final Object clone()
Overrides:
clone in class Object

createDeepCopy

public ColorPaletteDef createDeepCopy()

loadColorPaletteDef

public static ColorPaletteDef loadColorPaletteDef(File file)
                                           throws IOException
Loads a color palette definition from the given file

Parameters:
file - the file
Returns:
the color palette definition, never null
Throws:
IOException - if an I/O error occurs

storeColorPaletteDef

public static void storeColorPaletteDef(ColorPaletteDef colorPaletteDef,
                                        File file)
                                 throws IOException
Stores this color palette definition in the given file

Parameters:
colorPaletteDef - thje color palette definition
file - the file
Throws:
IOException - if an I/O error occurs

dispose

public void dispose()
Releases all of the resources used by this color palette definition and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.

This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to dispose() are undefined.

Overrides of this method should always call super.dispose(); after disposing this instance.


getColors

public Color[] getColors()

createColorPalette

public Color[] createColorPalette(Scaling scaling)

computeColor

public Color computeColor(Scaling scaling,
                          double sample)


Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.