org.ala.layers.legend
Class Legend

java.lang.Object
  extended by org.ala.layers.legend.Legend
Direct Known Subclasses:
LegendEqualArea, LegendEqualSize, LegendEvenInterval, LegendEvenIntervalLog, LegendEvenIntervalLog10

public abstract class Legend
extends java.lang.Object

Author:
Adam

Field Summary
static int[] colours
           
 
Constructor Summary
Legend()
           
 
Method Summary
 void determineGroupSizes(float[] d)
          size is represented by number of unique values.
 double evaluateStdDev(float[] d)
          range better on features lower is better
 double evaluateStdDevArea(float[] d)
          range better on area lower is better
 void exportImage(float[] d, int width, java.lang.String filename, int scaleDownBy, boolean minValueTransparent)
          save to a file as a type (filename extension).
 void exportSLD(Grid g, java.lang.String outputfilename, java.lang.String units, boolean hasNoDataValue, boolean minAsTransparent)
           
 void generate(float[] d)
          generate the legend cutoff points.
abstract  void generate(float[] d, int divisions)
          generate the legend cutoff points.
 void generateLegend(java.lang.String filename)
          Produce image legend
static int getColour(double d, double min, double max)
          colourize input between provided ranges.
 int getColour(float d)
          Only correct when Legend is created with 10 divisions.
 float[] getCutoffFloats()
          get cutoff's
 java.lang.String getCutoffs()
          get cutoff values as String includes group sizes if calculated
static int getLinearColour(double d, double min, double max, int startColour, int endColour)
           
 float[] getMinMax()
           
abstract  java.lang.String getTypeName()
          return nice name for the method that this class uses to generate the cutoff points
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colours

public static final int[] colours
Constructor Detail

Legend

public Legend()
Method Detail

generate

public void generate(float[] d)
generate the legend cutoff points. default number of cutoffs = 10

Parameters:
d - asc sorted float []

generate

public abstract void generate(float[] d,
                              int divisions)
generate the legend cutoff points.

Parameters:
d - asc sorted float []
divisions - number of cut points

getTypeName

public abstract java.lang.String getTypeName()
return nice name for the method that this class uses to generate the cutoff points

Returns:
name as String

determineGroupSizes

public void determineGroupSizes(float[] d)
size is represented by number of unique values.

Parameters:
d - float [] sorted in ascending order

evaluateStdDev

public double evaluateStdDev(float[] d)
range better on features lower is better

Parameters:
d -
Returns:

evaluateStdDevArea

public double evaluateStdDevArea(float[] d)
range better on area lower is better

Parameters:
d -
Returns:

exportImage

public void exportImage(float[] d,
                        int width,
                        java.lang.String filename,
                        int scaleDownBy,
                        boolean minValueTransparent)
save to a file as a type (filename extension). Option to scale down image size by discarding values/pixels

Parameters:
d - float [] of raster data to have legend applied
width - row width
filename - output filename

getColour

public int getColour(float d)
Only correct when Legend is created with 10 divisions.

Parameters:
d - asc sorted float []
Returns:
colour of d after applying cutoff's.

getColour

public static int getColour(double d,
                            double min,
                            double max)
colourize input between provided ranges.

Parameters:
d - value to colourize as float
min - minimum of range as float
max - maximum of range as float
Returns:
colour of d scaled between min and max as int ARGB with A == 0xFF. Defaults to black.

getLinearColour

public static int getLinearColour(double d,
                                  double min,
                                  double max,
                                  int startColour,
                                  int endColour)

getCutoffs

public java.lang.String getCutoffs()
get cutoff values as String includes group sizes if calculated

Returns:
String of cutoff values

getCutoffFloats

public float[] getCutoffFloats()
get cutoff's

Returns:
cutoff upper segment values as float[] (missing min value)

getMinMax

public float[] getMinMax()
Returns:
float[] of [min, max]

exportSLD

public void exportSLD(Grid g,
                      java.lang.String outputfilename,
                      java.lang.String units,
                      boolean hasNoDataValue,
                      boolean minAsTransparent)

generateLegend

public void generateLegend(java.lang.String filename)
Produce image legend

Parameters:
filename - output filename. Must end with .png.


Copyright © 2014. All Rights Reserved.