Package ca.spatial.mapview.symbol
Class Symbol
java.lang.Object
java.util.Observable
ca.spatial.mapview.symbol.Symbol
- All Implemented Interfaces:
Visibility
,Observer
- Direct Known Subclasses:
AbstractPointSymbol
,AbstractPolygonSymbol
,FillSymbol
,HatchSymbol
,SimpleLineSymbol
,SimplePaintSymbol
,SymbolList
The Symbol class is the base class for feature symbology.
Specialized classes are available for point, line and
filled polygon symbology.
This base class also defines several legacy color palettes.
These palettes have been superceded by the ColorPalette
class. See ColorPalette
for more information about
predefined color palettes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int
Apples and oranges color setstatic int
BC Rain forest color setstatic int
Blue Lagoon color setstatic JColorChooser
A color chooser widgetstatic String[]
A list of the color set namesstatic int
Earth tones color setstatic int
Elevation color setstatic int
Constant for a polygon fill symbolstatic int
Gem tones color setstatic int
Jamaican Jam color setstatic int
Constant for a line symbolstatic int
Over the rainbow color setstatic int
Constant for a point symbolstatic int
Primary color setstatic int
Progressive color setstatic int
Queen Charlotte Islands color setstatic int
Soft shades color set -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
clone()
getAlpha()
Get the compositing value (transparancy) for this symbolabstract Color
getColor()
Get the color for this symbol.static Color
getColor(int theme, int index)
Get a color from a legacy colorset.static Color[]
getColorSet(int theme)
Get a list of color from a legacy colorset.abstract Component
getCustomizer(boolean scaledSymbol)
Get a GUI component that can be used to customize this symbolstatic Symbol
getDefault(int type, int theme, int index)
Get the default symbol for a given symbol type and colorset.static Symbol
getDefault(int type, Color c)
Get the default symbol for a given symbol type and colorstatic Symbol
getDefaultSelectedSymbol(int type)
Get the default selected symbol for a given symbol typeabstract Color
Get the fill color used for this symbolabstract Color
Get the line color used for this symbolabstract double
Get the line width used for this symboldouble
Get the minimm scale at which this symbol would be rendereddouble
Get the minimm scale at which this symbol would be renderedstatic Color
Get a random colorabstract int
getType()
static int
getTypeForName(String name)
Deprecated.static Symbol
getUnclassified(int type)
Get the default unclassified symbol for a given symbol typeboolean
isActive()
Test if this symbol should be renderedboolean
isClear()
Test if the symbol is clearboolean
isLocked()
Check if the values in this symbol are locked from modification.boolean
Test if this symbol has standard visibility (no minimum or maximum scale, no compositing)boolean
isVisible(double scale)
Test if the symbol would be visible at this scalestatic Symbol
random(int type)
Get a random symbol for a given symbol type.void
setActive(boolean active)
Set the rendering status of this symbolsetAlpha(AlphaComposite alpha)
Set the compositing value (transparancy) for this symbolabstract void
Set the color for this symbol.abstract void
setFillColor(Color paint)
Set the fill color for this symbolabstract void
setLineColor(Color paint)
Set the line color for this symbolabstract void
setLineWidth(double width)
Set the line width for this symbolvoid
setLocked(boolean locked)
Set the locking status of this symbolvoid
setMaxScale(double scale)
Set the maximum scale at which this symbol would be renderedvoid
setMinScale(double scale)
Set the minimum scale at which this symbol would be renderedsetVisibility(double minScale, double maxScale, AlphaComposite alpha)
Set the suite of visibility parametersvoid
symbolize(Graphics2D g, Shape shape, double scale, int id, AffineTransform af, boolean isScaled)
Render the feature using this symbol.toString()
void
update(Observable obs, Object arg)
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
-
Field Details
-
FILL
public static final int FILLConstant for a polygon fill symbol- See Also:
- Constant Field Values
-
LINE
public static final int LINEConstant for a line symbol- See Also:
- Constant Field Values
-
POINT
public static final int POINTConstant for a point symbol- See Also:
- Constant Field Values
-
EARTH
public static final int EARTHEarth tones color set- See Also:
- Constant Field Values
-
APPLE
public static final int APPLEApples and oranges color set- See Also:
- Constant Field Values
-
GEMS
public static final int GEMSGem tones color set- See Also:
- Constant Field Values
-
SOFT
public static final int SOFTSoft shades color set- See Also:
- Constant Field Values
-
QCI
public static final int QCIQueen Charlotte Islands color set- See Also:
- Constant Field Values
-
JJ
public static final int JJJamaican Jam color set- See Also:
- Constant Field Values
-
PRI
public static final int PRIPrimary color set- See Also:
- Constant Field Values
-
ELEV1
public static final int ELEV1Elevation color set- See Also:
- Constant Field Values
-
BLAG
public static final int BLAGBlue Lagoon color set- See Also:
- Constant Field Values
-
BCRAIN
public static final int BCRAINBC Rain forest color set- See Also:
- Constant Field Values
-
OVER
public static final int OVEROver the rainbow color set- See Also:
- Constant Field Values
-
PRO
public static final int PROProgressive color set- See Also:
- Constant Field Values
-
COLORSETS
A list of the color set names -
colorChooser
A color chooser widget
-
-
Constructor Details
-
Symbol
public Symbol() -
Symbol
-
-
Method Details
-
getType
public abstract int getType() -
clone
-
clone
-
toString
-
isLocked
public boolean isLocked()Check if the values in this symbol are locked from modification. -
setLocked
public void setLocked(boolean locked)Set the locking status of this symbol -
isActive
public boolean isActive()Test if this symbol should be rendered -
setActive
public void setActive(boolean active)Set the rendering status of this symbol -
setColor
Set the color for this symbol. The action that happens depends on the type of symbol:- for a polygon symbol set the fill color, or if null set the outline color
- for a line symbol set the line color
- for a point symbol set the marker color
-
getColor
Get the color for this symbol. The action that happens depends on the type of symbol:- for a polygon symbol get the fill color, or if null get the outline color
- for a line symbol get the line color
- for a point symbol get the marker color
-
setFillColor
Set the fill color for this symbol -
getFillColor
Get the fill color used for this symbol -
setLineColor
Set the line color for this symbol -
getLineColor
Get the line color used for this symbol -
setLineWidth
public abstract void setLineWidth(double width)Set the line width for this symbol -
getLineWidth
public abstract double getLineWidth()Get the line width used for this symbol -
symbolize
public void symbolize(Graphics2D g, Shape shape, double scale, int id, AffineTransform af, boolean isScaled)Render the feature using this symbol.- Parameters:
g
- the graphics context objectshape
- the feature to symbolizescale
- the map scale at which the feature is being symbolized. This may be used to check scale thresholding or feature scaling.id
- the object id of the featureaf
- the world to page transformisScaled
- flag to indicate if scaled symbology should be used
-
isVisible
public boolean isVisible(double scale)Test if the symbol would be visible at this scale -
isClear
public boolean isClear()Test if the symbol is clear -
setMinScale
public void setMinScale(double scale)Set the minimum scale at which this symbol would be rendered- Specified by:
setMinScale
in interfaceVisibility
-
getMinScale
public double getMinScale()Get the minimm scale at which this symbol would be rendered- Specified by:
getMinScale
in interfaceVisibility
-
setMaxScale
public void setMaxScale(double scale)Set the maximum scale at which this symbol would be rendered- Specified by:
setMaxScale
in interfaceVisibility
-
getMaxScale
public double getMaxScale()Get the minimm scale at which this symbol would be rendered- Specified by:
getMaxScale
in interfaceVisibility
-
setAlpha
Set the compositing value (transparancy) for this symbol- Specified by:
setAlpha
in interfaceVisibility
-
getAlpha
Get the compositing value (transparancy) for this symbol- Specified by:
getAlpha
in interfaceVisibility
-
isStandardVisibility
public boolean isStandardVisibility()Test if this symbol has standard visibility (no minimum or maximum scale, no compositing) -
setVisibility
Set the suite of visibility parameters -
getTypeForName
Deprecated.Get the constant number for a legacy color set name. This method is deprecated. Use the values in theColorPalette
class instead. -
random
Get a random symbol for a given symbol type.For exmaple,
symbol = Symbol.getRandom(Symbol.FILL);
- Parameters:
type
- one of the values of FILL, LINE or POINT
-
getDefaultSelectedSymbol
Get the default selected symbol for a given symbol typeFor exmaple,
symbol = Symbol.getDefaultSelectedSymbol(Symbol.FILL);
- Parameters:
type
- one of the values of FILL, LINE or POINT
-
getDefault
Get the default symbol for a given symbol type and colorset.- Parameters:
type
- one of the values of FILL, LINE or POINTtheme
- a color set constant (e.g. Symbol.EARTH)index
- an index of the color to choose from the colorset
-
getDefault
Get the default symbol for a given symbol type and color- Parameters:
type
- one of the values of FILL, LINE or POINTc
- the color to use
-
getUnclassified
Get the default unclassified symbol for a given symbol typeFor exmaple,
symbol = Symbol.getUnclassified(Symbol.FILL);
- Parameters:
type
- one of the values of FILL, LINE or POINT
-
getColor
Get a color from a legacy colorset.This method is deprecated. Use the methods from the
ColorPalette
class instead.- Parameters:
theme
- a color set constant (e.g. Symbol.EARTH)index
- an index of the color to choose from the colorset
-
getColorSet
Get a list of color from a legacy colorset.This method is deprecated. Use the methods from the
ColorPalette
class instead.- Parameters:
theme
- a color set constant (e.g. Symbol.EARTH)
-
getRandomColor
Get a random color -
getCustomizer
Get a GUI component that can be used to customize this symbol -
update
-