public class Style
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Each Layer object has a default Style object that is used to draw its elements.
| Modifier and Type | Field and Description |
|---|---|
static int |
ARROW_BACKWARD
Constant defining an backward arrow
|
static int |
ARROW_FORWARD
Constant defining a forward arrow
|
static int |
ARROW_NONE
Constant defining the arrow style to none
|
protected float |
arrowPosition |
protected int |
arrowType |
protected int |
borderColor |
protected KStroke |
borderStroker |
protected int |
borderThickness |
protected float |
borderTransparency |
protected boolean |
drawHandles |
protected byte[] |
encodedSymbolData
Contains the raster symbol encoded image source.
|
protected int |
fillColor |
protected java.lang.String |
fontName |
protected int |
fontSize |
protected int |
fontStyle |
protected int |
lineColor |
protected int |
lineThickness |
protected static int |
OBJECT_VERSION_ID_6_5 |
protected int |
objectVersionId |
protected int |
outlineColor |
protected boolean |
outlined |
protected KPaint |
painter |
protected boolean |
painterInvalidated |
protected int |
patternColor |
protected int[] |
patternData |
protected KPaint |
plainPainter |
protected int |
proportionalSymbolRefScale |
protected KRenderingHints |
renderingHints |
protected KStroke |
stroker |
protected Symbol |
symbol |
protected float |
symbolAngle |
protected boolean |
symbolAngleLocked |
protected int[] |
symbolData
Deprecated.
use
encodedSymbolData instead. |
protected int |
symbolOffsetX |
protected int |
symbolOffsetY |
protected float |
symbolScale |
protected int |
textColor |
protected float |
transparency |
protected boolean |
transparentFill |
protected boolean |
transparentPatternFill |
protected boolean |
useProportionalSymbol |
| Constructor and Description |
|---|
Style()
Constructs a new Style object with all members initialized to their default
values.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Constructs a new Style object cloned on this style.
|
protected void |
clone(Style style) |
void |
createSelectedRasterSymbol(java.awt.Color selectionColor)
If the current symbol is a RasterSymbol instance, applies a RGB filter
to that symbol using the specified selection color.
|
void |
drawSample(GraphicsRef gr,
Rectangle rect,
int type)
Draws a sample of the specified type of element using this style.
|
void |
drawSample(GraphicsRef gr,
Rectangle rect,
int type,
boolean drawSymbolOffset)
Draws a sample of the specified type of element using this style.
|
void |
drawSample(GraphicsRef gr,
Rectangle rect,
int type,
boolean drawSymbolOffset,
boolean fitSymbolToRect)
Draws a sample of the specified type of element using this style.
|
boolean |
equals(java.lang.Object o) |
float |
getArrowPosition()
Gets the arrow position
|
int |
getArrowType()
Gets the arrow type
|
java.awt.Color |
getBorderColor()
Gets the color that is currently used to draw borders for
different types of elements on the layer.
|
KStroke |
getBorderStroker()
Returns the stroker to use when drawing geometry borders.
|
int |
getBorderThickness()
Gets the thickness that is currently used to draw borders for
different types of elements on the layer.
|
float |
getBorderTransparency()
Returns the transparency factor [0f - 1f] of the border, 1f means full transparency.
|
java.awt.Color |
getFillColor()
Gets the color that will be used to fill the interior of different types of
elements on the layer.
|
java.awt.Font |
getFont()
Returns the current font used for drawing character symbols.
|
java.awt.Color |
getLineColor()
Gets the color that is currently used to draw lines (or borders) for
different types of elements on the layer.
|
int |
getLineThickness()
Gets the thickness that is currently used to draw lines for
different types of elements on the layer.
|
java.awt.Color |
getOutlineColor()
Returns the outline color used to draw text.
|
KPaint |
getPainter()
Returns the painter to use when filling geometries, if any.
|
java.awt.Color |
getPatternColor()
Returns the pattern color.
|
KPaint |
getPlainPainter()
Returns a painter instance that was not filled with the pattern nor the fill color.
|
KRenderingHints |
getRenderingHints()
Return rendering hints to use.
|
KStroke |
getStroker()
Returns the stroker to use when drawing linear geometries.
|
Symbol |
getSymbol()
Returns the current symbol.
|
float |
getSymbolAngle()
Returns the symbol angle.
|
float |
getSymbolScale()
Returns the symbol scale factor to use to draw K2DPoint elements on a view.
|
java.awt.Color |
getTextColor()
Gets the color that is currently used to draw text on the layer.
|
float |
getTransparency()
Returns the transparency factor [0f - 1f], 1f means full transparency.
|
boolean |
getTransparentFill()
Gets the state of the transparency flag.
|
boolean |
getTransparentPatternFill()
Returns the state of the pattern transparency flag.
|
boolean |
isDrawHandles()
Returns whether or not to draw handles.
|
boolean |
isOutlined()
Returns whether or not text should be drawn with an outline.
|
boolean |
isSymbolAngleLocked()
Returns true if the symbol angle is locked with
the rotation of the view.
|
void |
setArrowPosition(float position)
Sets the arrow position
|
void |
setArrowType(int type)
Sets the arrow type
|
void |
setBorderColor(java.awt.Color color)
Sets the color that will be used to draw borders for different
types of elements on the layer.
|
void |
setBorderStroker(KStroke borderStroker)
Sets the stroker to use when drawing geometry borders.
|
void |
setBorderThickness(int borderThickness)
Sets the thickness that will be used to draw borders for
different types of elements on the layer.
|
void |
setBorderTransparency(float factor)
Sets the border transparency factor.
|
void |
setDrawHandles(boolean drawHandles)
Sets whether or not to draw handles.
|
void |
setFillColor(java.awt.Color color)
Sets the color that will be used to fill the interior of different types of
elements on the layer.
|
void |
setFont(java.awt.Font font)
Changes the current font used for drawing character symbols.
|
void |
setLineColor(java.awt.Color color)
Sets the color that will be used to draw lines (or borders) for different
types of elements on the layer.
|
void |
setLineThickness(int lineThickness)
Sets the thickness that will be used to draw lines (or borders) for
different types of elements on the layer.
|
void |
setOutlineColor(java.awt.Color outlineColor)
Sets the outline color used to draw text.
|
void |
setOutlined(boolean outlined)
Sets whether or not text should be drawn with an outline.
|
void |
setPainter(KPaint painter)
Sets the painter to use.
|
void |
setPatternColor(java.awt.Color patternColor)
Sets the pattern color.
|
void |
setRenderingHints(KRenderingHints renderingHints)
Sets the rendering hints to use.
|
void |
setStroker(KStroke stroker)
Sets the stroker to use when drawing linear geometries.
|
void |
setStyleFromExisting(Style style)
Initializes this style parameters using the values of the specified style
|
void |
setSymbol(Symbol symbol)
Sets the current symbol.
|
void |
setSymbolAngle(float symbolAngle)
Sets the symbol angle.
|
void |
setSymbolAngleLocked(boolean symbolAngleLocked)
If
true, the symbol angle will follow the
view rotation. |
void |
setSymbolScale(float scale)
Sets the symbol scale factor to use to draw the symbol on the view.
|
void |
setTextColor(java.awt.Color color)
Sets the color that will be used to draw text on the layer.
|
void |
setTransparency(float factor)
Sets the transparency factor.
|
void |
setTransparentFill(boolean flag)
Specifies how to draw the interior of certain types of elements
(transparency flag).
|
void |
setTransparentPatternFill(boolean flag)
Specifies how to draw the interior of certain types of elements when you
have a pattern (transparency flag).
|
protected void |
validateObjectImpl() |
protected static final int OBJECT_VERSION_ID_6_5
public static final int ARROW_NONE
public static final int ARROW_FORWARD
public static final int ARROW_BACKWARD
protected int objectVersionId
protected int lineColor
protected int borderColor
protected int fillColor
protected int textColor
protected int patternColor
protected int outlineColor
protected int arrowType
protected float arrowPosition
protected boolean transparentFill
protected boolean transparentPatternFill
protected float symbolScale
protected float symbolAngle
protected boolean symbolAngleLocked
protected int[] patternData
protected Symbol symbol
@Deprecated protected int[] symbolData
encodedSymbolData instead.protected byte[] encodedSymbolData
protected boolean useProportionalSymbol
protected int proportionalSymbolRefScale
protected java.lang.String fontName
protected int fontStyle
protected int fontSize
protected boolean outlined
protected int lineThickness
protected int borderThickness
protected KRenderingHints renderingHints
protected KStroke stroker
protected KStroke borderStroker
protected KPaint painter
protected transient boolean painterInvalidated
protected transient KPaint plainPainter
protected float transparency
protected float borderTransparency
protected boolean drawHandles
protected int symbolOffsetX
protected int symbolOffsetY
public Style()
public KStroke getStroker()
Strokepublic KStroke getBorderStroker()
Strokepublic void setStroker(KStroke stroker)
stroker - the stroker to use.Strokepublic void setBorderStroker(KStroke borderStroker)
borderStroker - the stroker to use.Strokepublic KPaint getPainter()
Paintpublic KPaint getPlainPainter()
public void setPainter(KPaint painter)
painter - the painter to use.Paintpublic KRenderingHints getRenderingHints()
RenderingHintspublic void setRenderingHints(KRenderingHints renderingHints)
renderingHints - rendering hints to use.RenderingHintspublic void setTransparentFill(boolean flag)
flag - if true, the interior of the elements will be transparent,
otherwise the interior will be drawn using the style current
fillColor.public void setTransparentPatternFill(boolean flag)
flag - if true, the interior of the elements will be transparent,
otherwise the interior will be drawn using the style current
patternfillColor.public boolean getTransparentFill()
setTransparentFill(boolean)public boolean getTransparentPatternFill()
setTransparentPatternFill(boolean)public float getSymbolScale()
public void setSymbolScale(float scale)
scale - the new scale factorpublic void setBorderColor(java.awt.Color color)
color - the new color to usepublic void setLineColor(java.awt.Color color)
color - the new color to usepublic java.awt.Color getLineColor()
public java.awt.Color getBorderColor()
public void setTextColor(java.awt.Color color)
color - the new color to usepublic java.awt.Color getTextColor()
public void setLineThickness(int lineThickness)
lineThickness - the new thickness to usepublic void setBorderThickness(int borderThickness)
borderThickness - the new thickness to usepublic int getLineThickness()
public int getBorderThickness()
public void setFillColor(java.awt.Color color)
color - the new color to usepublic java.awt.Color getFillColor()
protected void clone(Style style)
public java.lang.Object clone()
clone in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic void setStyleFromExisting(Style style)
style - public void createSelectedRasterSymbol(java.awt.Color selectionColor)
selectionColor - the color to apply on the raster symbol.public void drawSample(GraphicsRef gr, Rectangle rect, int type)
gr - the GraphicsRef object used to draw withrect - the rectangle inside which the sample must be drawntype - the type of elementpublic void drawSample(GraphicsRef gr, Rectangle rect, int type, boolean drawSymbolOffset)
gr - the GraphicsRef object used to draw withrect - the rectangle inside which the sample must be drawntype - the type of elementdrawSymbolOffset - Draw or not the symbol offset and the grid.public void drawSample(GraphicsRef gr, Rectangle rect, int type, boolean drawSymbolOffset, boolean fitSymbolToRect)
gr - the GraphicsRef object used to draw withrect - the rectangle inside which the sample must be drawntype - the type of elementdrawSymbolOffset - Draw or not the symbol offset and the grid.fitSymbolToRect - (Point style only) If the symbol is bigger than rect, fit it to specified rect. Default is true.public int getArrowType()
public void setArrowType(int type)
type - integer representing the arrow typepublic float getArrowPosition()
public void setArrowPosition(float position)
position - the position to set the arrowpublic float getTransparency()
public void setTransparency(float factor)
factor - the transparency factor to set. (value between 0f and 1f).getTransparency()public float getBorderTransparency()
public void setBorderTransparency(float factor)
factor - the transparency factor to set. (value between 0f and 1f).getTransparency()public java.awt.Font getFont()
public void setFont(java.awt.Font font)
font - the new font object to usepublic java.awt.Color getOutlineColor()
public void setOutlineColor(java.awt.Color outlineColor)
outlineColor - the outline color to set.public java.awt.Color getPatternColor()
getPainter()public void setPatternColor(java.awt.Color patternColor)
patternColor - the pattern color to set.public Symbol getSymbol()
public void setSymbol(Symbol symbol)
symbol - the new symbol.public boolean isDrawHandles()
public void setDrawHandles(boolean drawHandles)
drawHandles - whether or not to draw handles.public float getSymbolAngle()
public void setSymbolAngle(float symbolAngle)
symbolAngle - public boolean isSymbolAngleLocked()
public void setSymbolAngleLocked(boolean symbolAngleLocked)
true, the symbol angle will follow the
view rotation.symbolAngleLocked - public void setOutlined(boolean outlined)
outlined - the flag state.public boolean isOutlined()
protected void validateObjectImpl()