Class 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 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$
    • Constructor Detail

      • ColorPaletteDef

        public ColorPaletteDef​(double minSample,
                               double maxSample)
      • ColorPaletteDef

        public ColorPaletteDef​(double minSample,
                               double centerSample,
                               double maxSample)
    • 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)
      • 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)
      • getMinDisplaySample

        public double getMinDisplaySample()
      • getMaxDisplaySample

        public double getMaxDisplaySample()
      • 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
      • 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)
      • getIterator

        public Iterator getIterator()
      • 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
      • loadColorPaletteDef

        public static ColorPaletteDef loadColorPaletteDef​(Path path)
                                                   throws IOException
        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

        public static ColorPaletteDef loadCpt​(File file)
                                       throws IOException
        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
      • 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
      • storePal

        public static void storePal​(ColorPaletteDef colorPaletteDef,
                                    File file)
                             throws IOException
        Stores a 256 point generic color palette
        Parameters:
        colorPaletteDef - thje color palette definition
        file - the file
        Throws:
        IOException - if an I/O error occurs
      • storeCpt

        public static void storeCpt​(ColorPaletteDef colorPaletteDef,
                                    File file)
                             throws IOException
        Stores color palette in cpt format
        Parameters:
        colorPaletteDef - the 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()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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)