Package org.esa.snap.core.datamodel
Class ColorPaletteDef
java.lang.Object
org.esa.snap.core.datamodel.ColorPaletteDef
- All Implemented Interfaces:
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 implementation 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.
- Version:
- $Revision$ $Date$
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionColorPaletteDef(double minSample, double maxSample) ColorPaletteDef(double minSample, double centerSample, double maxSample) ColorPaletteDef(ColorPaletteDef.Point[] points) ColorPaletteDef(ColorPaletteDef.Point[] points, int numColors) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(ColorPaletteDef.Point point) final Objectclone()Deprecated.booleancreatePointAfter(int index, Scaling scaling) creates a new point between the point at the given indexvoiddispose()Releases all of the resources used by this color palette definition and all of its owned children.booleanstatic ColorgetCenterColor(Color c1, Color c2) Creates the center color between the given two colors.Color[]doubledoubleintintgetPointAt(int index) doubledoubleinthashCode()voidinsertPointAfter(int index, ColorPaletteDef.Point point) booleanbooleanbooleanbooleanstatic ColorPaletteDefloadColorPaletteDef(File file) Deprecated.static ColorPaletteDefloadColorPaletteDef(Path path) Loads a color palette definition from the given file pathstatic ColorPaletteDefLoads a color palette definition from the given cpt format filereadFileIntoArrayList(File file) voidremovePointAt(int index) voidsetAutoDistribute(boolean autoDistribute) voidsetDiscrete(boolean discrete) voidsetLogScaled(boolean logScaled) voidsetNumColors(int numColors) voidsetNumPoints(int numPoints) voidsetPoints(ColorPaletteDef.Point[] points) voidsetSourceFileMax(double sourceFileMax) voidsetSourceFileMin(double sourceFileMin) static voidstoreColorPaletteDef(ColorPaletteDef colorPaletteDef, File file) Deprecated.static voidstoreColorPaletteDef(ColorPaletteDef colorPaletteDef, Path path) static voidstoreCpt(ColorPaletteDef colorPaletteDef, File file) Stores color palette in cpt formatstatic voidstorePal(ColorPaletteDef colorPaletteDef, File file) Stores a 256 point generic color palettestatic Colorstring2Color(String redString, String greenString, String blueString)
-
Constructor Details
-
ColorPaletteDef
public ColorPaletteDef(double minSample, double maxSample) -
ColorPaletteDef
public ColorPaletteDef(double minSample, double centerSample, double maxSample) -
ColorPaletteDef
-
ColorPaletteDef
-
-
Method Details
-
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) -
isFullyOpaque
public boolean isFullyOpaque()- Returns:
- true, if all the colors in the palette definitions are fully opaque.
- Since:
- SNAP 0.5
-
isAutoDistribute
public boolean isAutoDistribute() -
setAutoDistribute
public void setAutoDistribute(boolean autoDistribute) -
getPointAt
-
getFirstPoint
-
getLastPoint
-
getMinDisplaySample
public double getMinDisplaySample() -
getMaxDisplaySample
public double getMaxDisplaySample() -
insertPointAfter
-
createPointAfter
creates a new point between the point at the given index- Parameters:
index- the indexscaling- the scaling- Returns:
- true, if a point has been inserted
-
getCenterColor
Creates the center color between the given two colors.- Parameters:
c1- 1st colorc2- 2nd color- Returns:
- the center color
-
removePointAt
public void removePointAt(int index) -
addPoint
-
getPoints
-
setPoints
-
getIterator
-
clone
-
createDeepCopy
Deprecated. -
loadColorPaletteDef
Deprecated.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
-
loadColorPaletteDef
Loads a color palette definition from the given file path- Parameters:
path- the file path- Returns:
- the color palette definition, never null
- Throws:
IOException- if an I/O error occurs
-
loadCpt
Loads a color palette definition from the given cpt format file- Parameters:
file- cpt format file- Returns:
- the color palette definition, never null
- Throws:
IOException- if an I/O error occurs
-
string2Color
-
readFileIntoArrayList
- Throws:
IOException
-
storeColorPaletteDef
@Deprecated public static void storeColorPaletteDef(ColorPaletteDef colorPaletteDef, File file) throws IOException Deprecated.Stores this color palette definition in the given file- Parameters:
colorPaletteDef- thje color palette definitionfile- the file- Throws:
IOException- if an I/O error occurs
-
storeColorPaletteDef
public static void storeColorPaletteDef(ColorPaletteDef colorPaletteDef, Path path) throws IOException - Throws:
IOException
-
storePal
Stores a 256 point generic color palette- Parameters:
colorPaletteDef- the color palette definitionfile- the file- Throws:
IOException- if an I/O error occurs
-
storeCpt
Stores color palette in cpt format- Parameters:
colorPaletteDef- the color palette definitionfile- 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
-
equals
-
hashCode
public int hashCode() -
isLogScaled
public boolean isLogScaled() -
setLogScaled
public void setLogScaled(boolean logScaled) -
getSourceFileMin
public double getSourceFileMin() -
setSourceFileMin
public void setSourceFileMin(double sourceFileMin) -
getSourceFileMax
public double getSourceFileMax() -
setSourceFileMax
public void setSourceFileMax(double sourceFileMax)
-