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

public abstract class Symbol extends Observable implements Visibility, Observer
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 Details

  • Constructor Details

    • Symbol

      public Symbol()
    • Symbol

      public Symbol(double minScale, double maxScale, AlphaComposite alpha)
  • Method Details

    • getType

      public abstract int getType()
    • clone

      public abstract Object clone()
    • clone

      public Object clone(Symbol s)
    • toString

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

      public abstract void setColor(Color paint)
      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

      public abstract 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

      public abstract void setFillColor(Color paint)
      Set the fill color for this symbol
    • getFillColor

      public abstract Color getFillColor()
      Get the fill color used for this symbol
    • setLineColor

      public abstract void setLineColor(Color paint)
      Set the line color for this symbol
    • getLineColor

      public abstract Color 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 object
      shape - the feature to symbolize
      scale - 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 feature
      af - the world to page transform
      isScaled - 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 interface Visibility
    • getMinScale

      public double getMinScale()
      Get the minimm scale at which this symbol would be rendered
      Specified by:
      getMinScale in interface Visibility
    • setMaxScale

      public void setMaxScale(double scale)
      Set the maximum scale at which this symbol would be rendered
      Specified by:
      setMaxScale in interface Visibility
    • getMaxScale

      public double getMaxScale()
      Get the minimm scale at which this symbol would be rendered
      Specified by:
      getMaxScale in interface Visibility
    • setAlpha

      public Visibility setAlpha(AlphaComposite alpha)
      Set the compositing value (transparancy) for this symbol
      Specified by:
      setAlpha in interface Visibility
    • getAlpha

      public AlphaComposite getAlpha()
      Get the compositing value (transparancy) for this symbol
      Specified by:
      getAlpha in interface Visibility
    • isStandardVisibility

      public boolean isStandardVisibility()
      Test if this symbol has standard visibility (no minimum or maximum scale, no compositing)
    • setVisibility

      public Symbol setVisibility(double minScale, double maxScale, AlphaComposite alpha)
      Set the suite of visibility parameters
    • getTypeForName

      @Deprecated public static int getTypeForName(String name)
      Deprecated.
      Get the constant number for a legacy color set name. This method is deprecated. Use the values in the ColorPalette class instead.
    • random

      public static Symbol random(int type)
      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

      public static Symbol getDefaultSelectedSymbol(int type)
      Get the default selected symbol for a given symbol type

      For exmaple,

       symbol = Symbol.getDefaultSelectedSymbol(Symbol.FILL);
       
      Parameters:
      type - one of the values of FILL, LINE or POINT
    • getDefault

      public static Symbol getDefault(int type, int theme, int index)
      Get the default symbol for a given symbol type and colorset.
      Parameters:
      type - one of the values of FILL, LINE or POINT
      theme - a color set constant (e.g. Symbol.EARTH)
      index - an index of the color to choose from the colorset
    • getDefault

      public static Symbol getDefault(int type, Color c)
      Get the default symbol for a given symbol type and color
      Parameters:
      type - one of the values of FILL, LINE or POINT
      c - the color to use
    • getUnclassified

      public static Symbol getUnclassified(int type)
      Get the default unclassified symbol for a given symbol type

      For exmaple,

       symbol = Symbol.getUnclassified(Symbol.FILL);
       
      Parameters:
      type - one of the values of FILL, LINE or POINT
    • getColor

      public static Color getColor(int theme, int index)
      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

      public static Color[] getColorSet(int theme)
      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

      public static Color getRandomColor()
      Get a random color
    • getCustomizer

      public abstract Component getCustomizer(boolean scaledSymbol)
      Get a GUI component that can be used to customize this symbol
    • update

      public void update(Observable obs, Object arg)
      Specified by:
      update in interface Observer