Class ColorThemingStyle

java.lang.Object
com.vividsolutions.jump.workbench.ui.renderer.style.ColorThemingStyle
All Implemented Interfaces:
AlphaSetting, Style, Cloneable

public class ColorThemingStyle extends Object implements Style, AlphaSetting
A Style mapping different basic styles for different attribute values.
  • Constructor Details

    • ColorThemingStyle

      public ColorThemingStyle()
    • ColorThemingStyle

      public ColorThemingStyle(String attributeName, Map<Object, BasicStyle> attributeValueToBasicStyleMap, BasicStyle defaultStyle)
      Parameters:
      attributeName - name of the attribute used to choose the feature Style
      attributeValueToBasicStyleMap - map attribute values (or range) to styles
      defaultStyle - style used for features with a null attribute value. null to prevent drawing features with a null attribute value.
    • ColorThemingStyle

      public ColorThemingStyle(String attributeName, Map<Object, BasicStyle> attributeValueToBasicStyleMap, Map<Object,String> attributeValueToLabelMap, BasicStyle defaultStyle)
      Parameters:
      attributeName - name of the attribute used to choose the feature Style
      attributeValueToBasicStyleMap - map attribute values (or range) to styles
      attributeValueToLabelMap - map attribute values (or range) to labels
      defaultStyle - style used for features with a null attribute value. null to prevent drawing features with a null attribute value.
  • Method Details

    • setAlpha

      public void setAlpha(int alpha)
      Call this method after calling #setAttributeValueToBasicStyleMap rather than before.
      Specified by:
      setAlpha in interface AlphaSetting
    • setLineWidth

      public void setLineWidth(int lineWidth)
      Call this method after calling #setAttributeValueToBasicStyleMap rather than before.
    • paint

      public void paint(Feature f, Graphics2D g, Viewport viewport) throws Exception
      Specified by:
      paint in interface Style
      Throws:
      Exception
    • trimIfString

      public static Object trimIfString(Object object)
    • clone

      public Object clone()
      Specified by:
      clone in interface Style
      Overrides:
      clone in class Object
    • getAttributeName

      public String getAttributeName()
      Returns:
      null if the layer has no non-spatial attributes
    • setAttributeValueToBasicStyleMap

      public void setAttributeValueToBasicStyleMap(Map<Object, BasicStyle> attributeValueToBasicStyleMap)
      You can set the keys to Ranges if the Map is a Range.RangeTreeMap. But don't mix Ranges and non-Ranges -- the UI expects homogeneity in this regard (i.e. to test whether or not there are ranges, only the first attribute value is tested).
    • setAttributeValueToLabelMap

      public void setAttributeValueToLabelMap(Map<Object,String> attributeValueToLabelMap)
      You can set the keys to Ranges if the Map is a Range.RangeTreeMap. But don't mix Ranges and non-Ranges -- the UI expects homogeneity in this regard (i.e. to test whether or not there are ranges, only the first attribute value is tested).
    • setAttributeName

      public void setAttributeName(String attributeName)
    • getAttributeValueToBasicStyleMap

      public Map<Object, BasicStyle> getAttributeValueToBasicStyleMap()
    • getAttributeValueToLabelMap

      public Map<Object,String> getAttributeValueToLabelMap()
    • initialize

      public void initialize(Layer layer)
      Description copied from interface: Style
      Called before #paint is applied to each Feature.
      Specified by:
      initialize in interface Style
      Parameters:
      layer - the layer on which to apply this style
    • setEnabled

      public void setEnabled(boolean enabled)
      Specified by:
      setEnabled in interface Style
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface Style
      Returns:
      false if #paint should not be called e.g. because vertices are not shown. Don't need to check whether the layer is visible.
    • get

      public static ColorThemingStyle get(Layer layer)
      Creates a default ColorThemingStyle for this layer if none is already set.
    • getDefaultStyle

      public BasicStyle getDefaultStyle()
    • setDefaultStyle

      public void setDefaultStyle(BasicStyle defaultStyle)
    • isGlobalTransparencyEnabled

      public boolean isGlobalTransparencyEnabled()
    • setGlobalTransparencyEnabled

      public void setGlobalTransparencyEnabled(boolean globalTransparencyEnabled)
    • isGlobalLineWidthEnabled

      public boolean isGlobalLineWidthEnabled()
    • setGlobalLineWidthEnabled

      public void setGlobalLineWidthEnabled(boolean globalLineWidthEnabled)
    • isVertexStyleEnabled

      public boolean isVertexStyleEnabled()
    • setVertexStyleEnabled

      public void setVertexStyleEnabled(boolean vertexStyleEnabled)
    • getAlpha

      public int getAlpha()
      Specified by:
      getAlpha in interface AlphaSetting