Class Style

java.lang.Object
com.kheops.jmap.client.layers.Style
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
AbstractAnimation, StyleReference

public class Style extends Object implements Cloneable, Serializable
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 Details

    • OBJECT_VERSION_ID_6_5

      protected static final int OBJECT_VERSION_ID_6_5
      See Also:
    • ARROW_NONE

      public static final int ARROW_NONE
      Constant defining the arrow style to none
      See Also:
    • ARROW_FORWARD

      public static final int ARROW_FORWARD
      Constant defining a forward arrow
      See Also:
    • ARROW_BACKWARD

      public static final int ARROW_BACKWARD
      Constant 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

      protected Symbol symbol
    • symbolData

      @Deprecated protected int[] symbolData
      Deprecated.
      use encodedSymbolData instead.
    • encodedSymbolData

      protected byte[] encodedSymbolData
      Contains the raster symbol encoded image source.
      Since:
      7.0
    • useProportionalSymbol

      protected boolean useProportionalSymbol
    • proportionalSymbolRefScale

      protected int proportionalSymbolRefScale
    • fontName

      protected String fontName
    • fontStyle

      protected int fontStyle
    • fontSize

      protected int fontSize
    • outlined

      protected boolean outlined
    • lineThickness

      protected int lineThickness
    • borderThickness

      protected int borderThickness
    • renderingHints

      protected KRenderingHints renderingHints
    • stroker

      protected KStroke stroker
    • borderStroker

      protected KStroke borderStroker
    • painter

      protected KPaint painter
    • painterInvalidated

      protected transient boolean painterInvalidated
    • plainPainter

      protected transient KPaint 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

      public KStroke getStroker()
      Returns the stroker to use when drawing linear geometries.
      Returns:
      the stroker to use.
      See Also:
    • getBorderStroker

      public KStroke getBorderStroker()
      Returns the stroker to use when drawing geometry borders.
      Returns:
      the stroker to use.
      See Also:
    • setStroker

      public void setStroker(KStroke stroker)
      Sets the stroker to use when drawing linear geometries.
      Parameters:
      stroker - the stroker to use.
      See Also:
    • setBorderStroker

      public void setBorderStroker(KStroke borderStroker)
      Sets the stroker to use when drawing geometry borders.
      Parameters:
      borderStroker - the stroker to use.
      See Also:
    • getPainter

      public KPaint getPainter()
      Returns the painter to use when filling geometries, if any.
      Returns:
      the painter to use.
      See Also:
    • getPlainPainter

      public KPaint getPlainPainter()
      Returns a painter instance that was not filled with the pattern nor the fill color.
      Returns:
      the plain painter instance.
    • setPainter

      public void setPainter(KPaint painter)
      Sets the painter to use.
      Parameters:
      painter - the painter to use.
      See Also:
    • getRenderingHints

      public KRenderingHints getRenderingHints()
      Return rendering hints to use. May be used or not by the system.
      Returns:
      rendering hints to use.
      See Also:
    • setRenderingHints

      public void setRenderingHints(KRenderingHints renderingHints)
      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

      public void setBorderColor(Color color)
      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

      public void setLineColor(Color color)
      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

      public Color 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

      public 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

      public void setTextColor(Color color)
      Sets the color that will be used to draw text on the layer.
      Parameters:
      color - the new color to use
    • getTextColor

      public Color 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

      public void setFillColor(Color color)
      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

      public Color 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

      protected void clone(Style style)
    • clone

      public Object clone()
      Constructs a new Style object cloned on this style.
      Overrides:
      clone in class Object
      Returns:
      a new style object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • setStyleFromExisting

      public void setStyleFromExisting(Style style)
      Initializes this style parameters using the values of the specified style
      Parameters:
      style -
    • createSelectedRasterSymbol

      public void createSelectedRasterSymbol(Color selectionColor)
      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

      public void drawSample(GraphicsRef gr, Rectangle rect, int type)
      Draws a sample of the specified type of element using this style.
      Parameters:
      gr - the GraphicsRef object used to draw with
      rect - the rectangle inside which the sample must be drawn
      type - the type of element
    • drawSample

      public void drawSample(GraphicsRef gr, Rectangle rect, int type, boolean drawSymbolOffset)
      Draws a sample of the specified type of element using this style.
      Parameters:
      gr - the GraphicsRef object used to draw with
      rect - the rectangle inside which the sample must be drawn
      type - the type of element
      drawSymbolOffset - 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 with
      rect - the rectangle inside which the sample must be drawn
      type - the type of element
      drawSymbolOffset - 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.
    • 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

      public Font getFont()
      Returns the current font used for drawing character symbols.
      Returns:
      the currently used font object
    • setFont

      public void setFont(Font font)
      Changes the current font used for drawing character symbols.
      Parameters:
      font - the new font object to use
    • getOutlineColor

      public Color getOutlineColor()
      Returns the outline color used to draw text.
      Returns:
      the outline color.
    • setOutlineColor

      public void setOutlineColor(Color outlineColor)
      Sets the outline color used to draw text.
      Parameters:
      outlineColor - the outline color to set.
    • getPatternColor

      public Color getPatternColor()
      Returns the pattern color.
      Returns:
      the pattern color to set.
      See Also:
    • setPatternColor

      public void setPatternColor(Color patternColor)
      Sets the pattern color.
      Parameters:
      patternColor - the pattern color to set.
    • getSymbol

      public Symbol getSymbol()
      Returns the current symbol.
      Returns:
      the current symbol.
    • setSymbol

      public void setSymbol(Symbol symbol)
      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)
      If true, 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()