Package com.kheops.jmap.client.layers
Class Style
java.lang.Object
com.kheops.jmap.client.layers.Style
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
AbstractAnimation,StyleReference
A Style object contains all the information necessary to render the elements
in a view. It defines their appearance (colors, line widths, fonts, etc).
There is only one type of Style objects for all types of elements so not all
members are used a given type of element.
Each Layer object has a default Style object that is used to draw its elements.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant defining an backward arrowstatic final intConstant defining a forward arrowstatic final intConstant defining the arrow style to noneprotected floatprotected intprotected intprotected KStrokeprotected intprotected floatprotected booleanprotected byte[]Contains the raster symbol encoded image source.protected intprotected Stringprotected intprotected intprotected intprotected intprotected static final intprotected intprotected intprotected booleanprotected KPaintprotected booleanprotected intprotected int[]protected KPaintprotected intprotected KRenderingHintsprotected KStrokeprotected Symbolprotected floatprotected booleanprotected int[]Deprecated.protected intprotected intprotected floatprotected intprotected floatprotected booleanprotected booleanprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionStyle()Constructs a new Style object with all members initialized to their default values. -
Method Summary
Modifier and TypeMethodDescriptionclone()Constructs a new Style object cloned on this style.protected voidvoidcreateSelectedRasterSymbol(Color selectionColor) If the current symbol is a RasterSymbol instance, applies a RGB filter to that symbol using the specified selection color.voiddrawSample(GraphicsRef gr, Rectangle rect, int type) Draws a sample of the specified type of element using this style.voiddrawSample(GraphicsRef gr, Rectangle rect, int type, boolean drawSymbolOffset) Draws a sample of the specified type of element using this style.voiddrawSample(GraphicsRef gr, Rectangle rect, int type, boolean drawSymbolOffset, boolean fitSymbolToRect) Draws a sample of the specified type of element using this style.booleanfloatGets the arrow positionintGets the arrow typeGets the color that is currently used to draw borders for different types of elements on the layer.Returns the stroker to use when drawing geometry borders.intGets the thickness that is currently used to draw borders for different types of elements on the layer.floatReturns the transparency factor [0f - 1f] of the border, 1f means full transparency.Gets the color that will be used to fill the interior of different types of elements on the layer.getFont()Returns the current font used for drawing character symbols.Gets the color that is currently used to draw lines (or borders) for different types of elements on the layer.intGets the thickness that is currently used to draw lines for different types of elements on the layer.Returns the outline color used to draw text.Returns the painter to use when filling geometries, if any.Returns the pattern color.Returns a painter instance that was not filled with the pattern nor the fill color.Return rendering hints to use.Returns the stroker to use when drawing linear geometries.Returns the current symbol.floatReturns the symbol angle.floatReturns the symbol scale factor to use to draw K2DPoint elements on a view.Gets the color that is currently used to draw text on the layer.floatReturns the transparency factor [0f - 1f], 1f means full transparency.booleanGets the state of the transparency flag.booleanReturns the state of the pattern transparency flag.booleanReturns whether to draw handles.booleanReturns whether text should be drawn with an outline.booleanReturns true if the symbol angle is locked with the rotation of the view.voidsetArrowPosition(float position) Sets the arrow positionvoidsetArrowType(int type) Sets the arrow typevoidsetBorderColor(Color color) Sets the color that will be used to draw borders for different types of elements on the layer.voidsetBorderStroker(KStroke borderStroker) Sets the stroker to use when drawing geometry borders.voidsetBorderThickness(int borderThickness) Sets the thickness that will be used to draw borders for different types of elements on the layer.voidsetBorderTransparency(float factor) Sets the border transparency factor.voidsetDrawHandles(boolean drawHandles) Sets whether to draw handles.voidsetFillColor(Color color) Sets the color that will be used to fill the interior of different types of elements on the layer.voidChanges the current font used for drawing character symbols.voidsetLineColor(Color color) Sets the color that will be used to draw lines (or borders) for different types of elements on the layer.voidsetLineThickness(int lineThickness) Sets the thickness that will be used to draw lines (or borders) for different types of elements on the layer.voidsetOutlineColor(Color outlineColor) Sets the outline color used to draw text.voidsetOutlined(boolean outlined) Sets whether text should be drawn with an outline.voidsetPainter(KPaint painter) Sets the painter to use.voidsetPatternColor(Color patternColor) Sets the pattern color.voidsetRenderingHints(KRenderingHints renderingHints) Sets the rendering hints to use.voidsetStroker(KStroke stroker) Sets the stroker to use when drawing linear geometries.voidsetStyleFromExisting(Style style) Initializes this style parameters using the values of the specified stylevoidSets the current symbol.voidsetSymbolAngle(float symbolAngle) Sets the symbol angle.voidsetSymbolAngleLocked(boolean symbolAngleLocked) Iftrue, the symbol angle will follow the view rotation.voidsetSymbolScale(float scale) Sets the symbol scale factor to use to draw the symbol on the view.voidsetTextColor(Color color) Sets the color that will be used to draw text on the layer.voidsetTransparency(float factor) Sets the transparency factor.voidsetTransparentFill(boolean flag) Specifies how to draw the interior of certain types of elements (transparency flag).voidsetTransparentPatternFill(boolean flag) Specifies how to draw the interior of certain types of elements when you have a pattern (transparency flag).protected void
-
Field Details
-
OBJECT_VERSION_ID_6_5
protected static final int OBJECT_VERSION_ID_6_5- See Also:
-
ARROW_NONE
public static final int ARROW_NONEConstant defining the arrow style to none- See Also:
-
ARROW_FORWARD
public static final int ARROW_FORWARDConstant defining a forward arrow- See Also:
-
ARROW_BACKWARD
public static final int ARROW_BACKWARDConstant defining an backward arrow- See Also:
-
objectVersionId
protected int objectVersionId -
lineColor
protected int lineColor -
borderColor
protected int borderColor -
fillColor
protected int fillColor -
textColor
protected int textColor -
patternColor
protected int patternColor -
outlineColor
protected int outlineColor -
arrowType
protected int arrowType -
arrowPosition
protected float arrowPosition -
transparentFill
protected boolean transparentFill -
transparentPatternFill
protected boolean transparentPatternFill -
symbolScale
protected float symbolScale -
symbolAngle
protected float symbolAngle -
symbolAngleLocked
protected boolean symbolAngleLocked -
patternData
protected int[] patternData -
symbol
-
symbolData
Deprecated.useencodedSymbolDatainstead. -
encodedSymbolData
protected byte[] encodedSymbolDataContains the raster symbol encoded image source.- Since:
- 7.0
-
useProportionalSymbol
protected boolean useProportionalSymbol -
proportionalSymbolRefScale
protected int proportionalSymbolRefScale -
fontName
-
fontStyle
protected int fontStyle -
fontSize
protected int fontSize -
outlined
protected boolean outlined -
lineThickness
protected int lineThickness -
borderThickness
protected int borderThickness -
renderingHints
-
stroker
-
borderStroker
-
painter
-
painterInvalidated
protected transient boolean painterInvalidated -
plainPainter
-
transparency
protected float transparency -
borderTransparency
protected float borderTransparency -
drawHandles
protected boolean drawHandles -
symbolOffsetX
protected int symbolOffsetX -
symbolOffsetY
protected int symbolOffsetY
-
-
Constructor Details
-
Style
public Style()Constructs a new Style object with all members initialized to their default values.
-
-
Method Details
-
getStroker
Returns the stroker to use when drawing linear geometries.- Returns:
- the stroker to use.
- See Also:
-
getBorderStroker
Returns the stroker to use when drawing geometry borders.- Returns:
- the stroker to use.
- See Also:
-
setStroker
Sets the stroker to use when drawing linear geometries.- Parameters:
stroker- the stroker to use.- See Also:
-
setBorderStroker
Sets the stroker to use when drawing geometry borders.- Parameters:
borderStroker- the stroker to use.- See Also:
-
getPainter
Returns the painter to use when filling geometries, if any.- Returns:
- the painter to use.
- See Also:
-
getPlainPainter
Returns a painter instance that was not filled with the pattern nor the fill color.- Returns:
- the plain painter instance.
-
setPainter
Sets the painter to use.- Parameters:
painter- the painter to use.- See Also:
-
getRenderingHints
Return rendering hints to use. May be used or not by the system.- Returns:
- rendering hints to use.
- See Also:
-
setRenderingHints
Sets the rendering hints to use. May be used or not by the system.- Parameters:
renderingHints- rendering hints to use.- See Also:
-
setTransparentFill
public void setTransparentFill(boolean flag) Specifies how to draw the interior of certain types of elements (transparency flag).- Parameters:
flag- if true, the interior of the elements will be transparent, otherwise the interior will be drawn using the style current fillColor.
-
setTransparentPatternFill
public void setTransparentPatternFill(boolean flag) Specifies how to draw the interior of certain types of elements when you have a pattern (transparency flag).- Parameters:
flag- if true, the interior of the elements will be transparent, otherwise the interior will be drawn using the style current patternfillColor.
-
getTransparentFill
public boolean getTransparentFill()Gets the state of the transparency flag.- Returns:
- the state of the transparency flag
- See Also:
-
getTransparentPatternFill
public boolean getTransparentPatternFill()Returns the state of the pattern transparency flag.- Returns:
- the state of the pattern transparency flag
- See Also:
-
getSymbolScale
public float getSymbolScale()Returns the symbol scale factor to use to draw K2DPoint elements on a view.- Returns:
- the current scale factor of the symbol
-
setSymbolScale
public void setSymbolScale(float scale) Sets the symbol scale factor to use to draw the symbol on the view.- Parameters:
scale- the new scale factor
-
setBorderColor
Sets the color that will be used to draw borders for different types of elements on the layer.- Parameters:
color- the new color to use
-
setLineColor
Sets the color that will be used to draw lines (or borders) for different types of elements on the layer.- Parameters:
color- the new color to use
-
getLineColor
Gets the color that is currently used to draw lines (or borders) for different types of elements on the layer.- Returns:
- the currently used color
-
getBorderColor
Gets the color that is currently used to draw borders for different types of elements on the layer.- Returns:
- the currently used color
-
setTextColor
Sets the color that will be used to draw text on the layer.- Parameters:
color- the new color to use
-
getTextColor
Gets the color that is currently used to draw text on the layer.- Returns:
- the currently used color
-
setLineThickness
public void setLineThickness(int lineThickness) Sets the thickness that will be used to draw lines (or borders) for different types of elements on the layer.- Parameters:
lineThickness- the new thickness to use
-
setBorderThickness
public void setBorderThickness(int borderThickness) Sets the thickness that will be used to draw borders for different types of elements on the layer.- Parameters:
borderThickness- the new thickness to use
-
getLineThickness
public int getLineThickness()Gets the thickness that is currently used to draw lines for different types of elements on the layer.- Returns:
- the currently used thickness
-
getBorderThickness
public int getBorderThickness()Gets the thickness that is currently used to draw borders for different types of elements on the layer.- Returns:
- the currently used thickness
-
setFillColor
Sets the color that will be used to fill the interior of different types of elements on the layer.- Parameters:
color- the new color to use
-
getFillColor
Gets the color that will be used to fill the interior of different types of elements on the layer.- Returns:
- the currently used color
-
clone
-
clone
Constructs a new Style object cloned on this style. -
equals
-
setStyleFromExisting
Initializes this style parameters using the values of the specified style- Parameters:
style-
-
createSelectedRasterSymbol
If the current symbol is a RasterSymbol instance, applies a RGB filter to that symbol using the specified selection color.- Parameters:
selectionColor- the color to apply on the raster symbol.
-
drawSample
Draws a sample of the specified type of element using this style.- Parameters:
gr- the GraphicsRef object used to draw withrect- the rectangle inside which the sample must be drawntype- the type of element
-
drawSample
Draws a sample of the specified type of element using this style.- Parameters:
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.
-
drawSample
public void drawSample(GraphicsRef gr, Rectangle rect, int type, boolean drawSymbolOffset, boolean fitSymbolToRect) Draws a sample of the specified type of element using this style.- Parameters:
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 thanrect, fit it to specifiedrect. Default is true.
-
getArrowType
public int getArrowType()Gets the arrow type- Returns:
- arrowType
-
setArrowType
public void setArrowType(int type) Sets the arrow type- Parameters:
type- integer representing the arrow type
-
getArrowPosition
public float getArrowPosition()Gets the arrow position- Returns:
- the arrow position
-
setArrowPosition
public void setArrowPosition(float position) Sets the arrow position- Parameters:
position- the position to set the arrow
-
getTransparency
public float getTransparency()Returns the transparency factor [0f - 1f], 1f means full transparency.- Returns:
- the transparency factor.
-
setTransparency
public void setTransparency(float factor) Sets the transparency factor.- Parameters:
factor- the transparency factor to set. (value between 0f and 1f).- See Also:
-
getBorderTransparency
public float getBorderTransparency()Returns the transparency factor [0f - 1f] of the border, 1f means full transparency.- Returns:
- the transparency factor.
-
setBorderTransparency
public void setBorderTransparency(float factor) Sets the border transparency factor.- Parameters:
factor- the transparency factor to set. (value between 0f and 1f).- See Also:
-
getFont
Returns the current font used for drawing character symbols.- Returns:
- the currently used font object
-
setFont
Changes the current font used for drawing character symbols.- Parameters:
font- the new font object to use
-
getOutlineColor
Returns the outline color used to draw text.- Returns:
- the outline color.
-
setOutlineColor
Sets the outline color used to draw text.- Parameters:
outlineColor- the outline color to set.
-
getPatternColor
Returns the pattern color.- Returns:
- the pattern color to set.
- See Also:
-
setPatternColor
Sets the pattern color.- Parameters:
patternColor- the pattern color to set.
-
getSymbol
Returns the current symbol.- Returns:
- the current symbol.
-
setSymbol
Sets the current symbol.- Parameters:
symbol- the new symbol.
-
isDrawHandles
public boolean isDrawHandles()Returns whether to draw handles.- Returns:
- whether to draw handles.
-
setDrawHandles
public void setDrawHandles(boolean drawHandles) Sets whether to draw handles.- Parameters:
drawHandles- whether to draw handles.
-
getSymbolAngle
public float getSymbolAngle()Returns the symbol angle.- Returns:
- the symbol angle.
-
setSymbolAngle
public void setSymbolAngle(float symbolAngle) Sets the symbol angle.- Parameters:
symbolAngle-
-
isSymbolAngleLocked
public boolean isSymbolAngleLocked()Returns true if the symbol angle is locked with the rotation of the view.- Returns:
- true if locked with the view rotation.
-
setSymbolAngleLocked
public void setSymbolAngleLocked(boolean symbolAngleLocked) Iftrue, the symbol angle will follow the view rotation.- Parameters:
symbolAngleLocked-
-
setOutlined
public void setOutlined(boolean outlined) Sets whether text should be drawn with an outline.- Parameters:
outlined- the flag state.
-
isOutlined
public boolean isOutlined()Returns whether text should be drawn with an outline.- Returns:
- whether text should be drawn with an outline.
-
validateObjectImpl
protected void validateObjectImpl()
-
encodedSymbolDatainstead.