org.geotools.brewer.color
Class ColorBrewer

java.lang.Object
  extended by org.geotools.brewer.color.ColorBrewer

public class ColorBrewer
extends java.lang.Object

Contains ColorBrewer palettes and suitability data.

Author:
James Macgill, Cory Horner, Refractions Research Inc.

Field Summary
static PaletteType ALL
           
static PaletteType DIVERGING
           
static PaletteType QUALITATIVE
           
static PaletteType SEQUENTIAL
           
static PaletteType SUITABLE_RANGED
           
static PaletteType SUITABLE_UNIQUE
           
 
Constructor Summary
ColorBrewer()
          Creates a new instance of ColorBrewer
 
Method Summary
 java.lang.String getDescription()
           
 java.lang.String getName()
           
 BrewerPalette getPalette(java.lang.String name)
           
 java.lang.String[] getPaletteNames()
          Generates a String array with the names of the palettes in the ColorBrewer instance.
 java.lang.String[] getPaletteNames(int minClasses, int maxClasses)
          Generates an array of palette names for palettes which have at least x classes and at most y classes.
 BrewerPalette[] getPalettes()
           
 BrewerPalette[] getPalettes(PaletteType type)
           
 BrewerPalette[] getPalettes(PaletteType type, int numClasses)
           
 BrewerPalette[] getPalettes(PaletteType type, int numClasses, int requiredViewers)
           
 boolean hasPalette(java.lang.String paletteName)
          Returns true if the palette exists in this ColorBrewer
static ColorBrewer instance()
          Creates a static instance of ColorBrewer containing all default palettes
static ColorBrewer instance(PaletteType type)
          Creates a static instance of ColorBrewer containing a subset of the default palettes.
 boolean isSet(int singleValue, int multipleValue)
           
 void loadPalettes()
          Loads the default ColorBrewer palettes.
 void loadPalettes(java.io.InputStream XMLinput, PaletteType type)
          Loads into the ColorBrewer instance the set of palettes matching the given parameters.
 void loadPalettes(PaletteType type)
          Loads into the ColorBrewer instance the set of palettes which have the PaletteType matching that of the parameter.
 void registerPalette(BrewerPalette pal)
           
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static final PaletteType ALL

SUITABLE_RANGED

public static final PaletteType SUITABLE_RANGED

SUITABLE_UNIQUE

public static final PaletteType SUITABLE_UNIQUE

SEQUENTIAL

public static final PaletteType SEQUENTIAL

DIVERGING

public static final PaletteType DIVERGING

QUALITATIVE

public static final PaletteType QUALITATIVE
Constructor Detail

ColorBrewer

public ColorBrewer()
Creates a new instance of ColorBrewer

Method Detail

instance

public static ColorBrewer instance()
Creates a static instance of ColorBrewer containing all default palettes

Returns:
The ColorBrewer instance with all the default palettes.
Throws:
java.io.IOException

instance

public static ColorBrewer instance(PaletteType type)
                            throws java.io.IOException
Creates a static instance of ColorBrewer containing a subset of the default palettes.

Parameters:
type - A PaletteType object which will be used to configure the returned ColorBrewer.
Returns:
The ColorBrewer instance with the palette from the parameter.
Throws:
java.io.IOException

registerPalette

public void registerPalette(BrewerPalette pal)

hasPalette

public boolean hasPalette(java.lang.String paletteName)
Returns true if the palette exists in this ColorBrewer

Parameters:
paletteName - A String with the name of the palette
Returns:
A boolean, true if the ColorBrewer has a palette of the name given.

getPalettes

public BrewerPalette[] getPalettes()

getPalettes

public BrewerPalette[] getPalettes(PaletteType type)

getPalettes

public BrewerPalette[] getPalettes(PaletteType type,
                                   int numClasses)

getPalettes

public BrewerPalette[] getPalettes(PaletteType type,
                                   int numClasses,
                                   int requiredViewers)

getPaletteNames

public java.lang.String[] getPaletteNames()
Generates a String array with the names of the palettes in the ColorBrewer instance.

Returns:
A String array with the names of the palettes in the ColorBrewer instance.

getPaletteNames

public java.lang.String[] getPaletteNames(int minClasses,
                                          int maxClasses)
Generates an array of palette names for palettes which have at least x classes and at most y classes.

Parameters:
minClasses - x
maxClasses - y
Returns:
A string array of palette names filtered by number of classes.

getPalette

public BrewerPalette getPalette(java.lang.String name)

loadPalettes

public void loadPalettes()
Loads the default ColorBrewer palettes.

Throws:
java.io.IOException

loadPalettes

public void loadPalettes(PaletteType type)
Loads into the ColorBrewer instance the set of palettes which have the PaletteType matching that of the parameter.

Parameters:
type - The PaletteType for the palettes to load.
Throws:
java.io.IOException

loadPalettes

public void loadPalettes(java.io.InputStream XMLinput,
                         PaletteType type)
Loads into the ColorBrewer instance the set of palettes matching the given parameters.

Parameters:
XMLinput -
type - identifier for palettes. use "new PaletteType();"

getName

public java.lang.String getName()

getDescription

public java.lang.String getDescription()

reset

public void reset()

isSet

public boolean isSet(int singleValue,
                     int multipleValue)


Copyright © 1996-2010 Geotools. All Rights Reserved.