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 Summary
Fields Modifier and Type Field Description static ColorDEFAULT_FILL_COLORstatic BasicStrokeDEFAULT_FILL_STROKEstatic ColorDEFAULT_LINE_COLORstatic StringRGB_ATTRIBUTE_NAME
-
Constructor Summary
Constructors Constructor Description BasicStyle()BasicStyle(Color fillColor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()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.intgetAlpha()ColorgetFeatureColor(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.ColorgetFillColor()PaintgetFillPattern()ColorgetLineColor()StringgetLinePattern()BasicStrokegetLineStroke()intgetLineWidth()booleangetRenderingVertices()booleanhasInteriorBorder()voidinitialize(Layer layer)Called before #paint is applied to each Feature.booleanisEnabled()booleanisRenderingFill()booleanisRenderingFillPattern()booleanisRenderingLine()booleanisRenderingLinePattern()voidpaint(Feature f, Graphics2D g, Viewport viewport)voidsetAlpha(int alpha)voidsetEnabled(boolean enabled)voidsetFillColor(Color fillColor)BasicStylesetFillPattern(Paint fillPattern)Remember to call #setRenderingFillPattern(true).voidsetFractionalLineWidth(float lineWidth)voidsetInteriorBorder(boolean interiorBorder)voidsetLineColor(Color lineColor)BasicStylesetLinePattern(String linePattern)The actual dash pattern used internally will be the given dash pattern multiplied by the line length.voidsetLineWidth(int lineWidth)voidsetRenderingFill(boolean renderingFill)BasicStylesetRenderingFillPattern(boolean renderingFillPattern)voidsetRenderingLine(boolean renderingLine)BasicStylesetRenderingLinePattern(boolean renderingLinePattern)voidsetRenderingVertices(boolean renderingVertices)static float[]toArray(String linePattern, float lineWidth)
-
-
-
Field Detail
-
RGB_ATTRIBUTE_NAME
public static final String RGB_ATTRIBUTE_NAME
- See Also:
- Constant Field Values
-
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 Detail
-
BasicStyle
public BasicStyle(Color fillColor)
-
BasicStyle
public BasicStyle()
-
-
Method Detail
-
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:
setLinePatternin interfaceSLDImporter.StrokeStyle- Parameters:
linePattern- e.g. "5,2,3,2"- Returns:
- a basic style
-
initialize
public void initialize(Layer layer)
Description copied from interface:StyleCalled before #paint is applied to each Feature.- Specified by:
initializein interfaceStyle- Parameters:
layer- the layer on which to apply this style
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabledin interfaceStyle
-
isEnabled
public boolean isEnabled()
-
paint
public void paint(Feature f, Graphics2D g, Viewport viewport) 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.
-
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:
setRenderingLinePatternin interfaceSLDImporter.StrokeStyle- Parameters:
renderingLinePattern- whether to use a LinePattern or not- Returns:
- a basic style
-
setFillColor
public void setFillColor(Color fillColor)
- Specified by:
setFillColorin interfaceSLDImporter.FillStyle- Parameters:
fillColor- a Color
-
setLineColor
public void setLineColor(Color lineColor)
- Specified by:
setLineColorin interfaceSLDImporter.StrokeStyle- Parameters:
lineColor- line Color
-
setLineWidth
public void setLineWidth(int lineWidth)
- Specified by:
setLineWidthin interfaceSLDImporter.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:
getAlphain interfaceAlphaSetting- 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:
setAlphain interfaceAlphaSetting- Specified by:
setAlphain interfaceSLDImporter.FillStyle- Specified by:
setAlphain interfaceSLDImporter.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- theFeaturecontaining the RGB Attribute to be parsed.- Returns:
- the
Colorrepresented by the R_B_G hex value with the current Alpha value inserted. Warning: returns null in many "normal" cases.
-
-