Class BasicStyle

java.lang.Object
com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle
All Implemented Interfaces:
AlphaSetting, Style, Cloneable, SLDImporter.FillStyle, SLDImporter.StrokeFillStyle, SLDImporter.StrokeStyle
Direct Known Subclasses:
XBasicStyle

public class BasicStyle extends Object implements Style, SLDImporter.StrokeFillStyle, AlphaSetting
  • Field Details

    • RGB_ATTRIBUTE_NAME

      public static final String RGB_ATTRIBUTE_NAME
      See Also:
    • DEFAULT_FILL_COLOR

      public static final Color DEFAULT_FILL_COLOR
    • DEFAULT_LINE_COLOR

      public static final Color DEFAULT_LINE_COLOR
    • DEFAULT_FILL_STROKE

      public static final BasicStroke DEFAULT_FILL_STROKE
  • Constructor Details

    • BasicStyle

      public BasicStyle(Color fillColor)
    • BasicStyle

      public BasicStyle()
  • Method Details

    • isRenderingFillPattern

      public boolean isRenderingFillPattern()
    • setRenderingFillPattern

      public BasicStyle setRenderingFillPattern(boolean renderingFillPattern)
    • getFillPattern

      public Paint getFillPattern()
    • setFillPattern

      public BasicStyle setFillPattern(Paint fillPattern)
      Remember to call #setRenderingFillPattern(true).
    • getLinePattern

      public String getLinePattern()
    • getRenderingVertices

      public boolean getRenderingVertices()
    • setRenderingVertices

      public void setRenderingVertices(boolean renderingVertices)
    • setLinePattern

      public BasicStyle setLinePattern(String linePattern)
      The actual dash pattern used internally will be the given dash pattern multiplied by the line length. Remember to call #setRenderingLinePattern(true).
      Specified by:
      setLinePattern in interface SLDImporter.StrokeStyle
      Parameters:
      linePattern - e.g. "5,2,3,2"
      Returns:
      a basic style
    • 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.
    • paint

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

      public Object clone()
      Uses Object.clone() method which performs a shallow copy of this object, creating a new instance of the same class and copying attribute values of this object to the clone.
      Specified by:
      clone in interface Style
      Overrides:
      clone in class Object
      Returns:
      a clone of this BasicStyle
    • isRenderingFill

      public boolean isRenderingFill()
    • isRenderingLine

      public boolean isRenderingLine()
    • isRenderingLinePattern

      public boolean isRenderingLinePattern()
    • setRenderingFill

      public void setRenderingFill(boolean renderingFill)
    • setRenderingLine

      public void setRenderingLine(boolean renderingLine)
    • setRenderingLinePattern

      public BasicStyle setRenderingLinePattern(boolean renderingLinePattern)
      Specified by:
      setRenderingLinePattern in interface SLDImporter.StrokeStyle
      Parameters:
      renderingLinePattern - whether to use a LinePattern or not
      Returns:
      a basic style
    • setFillColor

      public void setFillColor(Color fillColor)
      Specified by:
      setFillColor in interface SLDImporter.FillStyle
      Parameters:
      fillColor - a Color
    • setLineColor

      public void setLineColor(Color lineColor)
      Specified by:
      setLineColor in interface SLDImporter.StrokeStyle
      Parameters:
      lineColor - line Color
    • setLineWidth

      public void setLineWidth(int lineWidth)
      Specified by:
      setLineWidth in interface SLDImporter.StrokeStyle
      Parameters:
      lineWidth - line width
    • setFractionalLineWidth

      public void setFractionalLineWidth(float lineWidth)
    • hasInteriorBorder

      public boolean hasInteriorBorder()
    • setInteriorBorder

      public void setInteriorBorder(boolean interiorBorder)
    • toArray

      public static float[] toArray(String linePattern, float lineWidth)
    • getAlpha

      public int getAlpha()
      Specified by:
      getAlpha in interface AlphaSetting
      Returns:
      0-255 (255 is opaque)
    • getFillColor

      public Color getFillColor()
    • getLineColor

      public Color getLineColor()
    • getLineWidth

      public int getLineWidth()
    • setAlpha

      public void setAlpha(int alpha)
      Specified by:
      setAlpha in interface AlphaSetting
      Specified by:
      setAlpha in interface SLDImporter.FillStyle
      Specified by:
      setAlpha in interface SLDImporter.StrokeStyle
      Parameters:
      alpha - 0-255 (255 is opaque)
    • getLineStroke

      public BasicStroke getLineStroke()
    • getFeatureColor

      public Color getFeatureColor(Feature f)
      - Giuseppe Aruta 11-June - 2012 - added code from SkyJUMP to enable color chooser plugIn - - Original comments from SkyJUMP developers - Looks for an Attribute field that contains the RGB color code and returns it or null if the RGB hex string is empty or ill-formed.
      Parameters:
      f - the Feature containing the RGB Attribute to be parsed.
      Returns:
      the Color represented by the R_B_G hex value with the current Alpha value inserted. Warning: returns null in many "normal" cases.