Class TLcdNVGStyle

java.lang.Object
com.luciad.format.nvg.model.TLcdNVGStyle
All Implemented Interfaces:
ILcdCloneable, Cloneable

public class TLcdNVGStyle extends Object implements ILcdCloneable

The NVG style defines how objects should be rendered graphically, with the exception of points. The styling of points is specified by TLcdNVGSymbol. Depending on the geometry the element represents, the attributes of this object specifies how to style the shape outlines, the inside of closed shapes, or text objects.

If a style attribute is not specified, a default value will be used for rendering. These default values are specified by the NVG specification; they are exposed as constants starting with "DEFAULT_"."

Since:
2015.0
  • Field Details

    • DEFAULT_FILL_COLOR

      public static final Color DEFAULT_FILL_COLOR
      Default fill color is null (area not filled).
    • DEFAULT_FILL_OPACITY

      public static final float DEFAULT_FILL_OPACITY
      Default fill opacity is 1.0 (opaque).
      See Also:
    • DEFAULT_FILL_PATTERN

      public static final ELcdNVGFillPattern DEFAULT_FILL_PATTERN
      Default fill pattern is 0 (Blank).
    • DEFAULT_FONT_FAMILY

      public static final String DEFAULT_FONT_FAMILY
      Default font family name is null which will result in a default AWT font (which is system specific).
    • DEFAULT_FONT_STYLE

      public static final ELcdNVGFontStyle DEFAULT_FONT_STYLE
      Default font style is ELcdNVGFontStyle#NORMAL.
    • DEFAULT_FONT_WEIGHT

      public static final ELcdNVGFontWeight DEFAULT_FONT_WEIGHT
      Default font weight is ELcdNVGFontWeight#NORMAL.
    • DEFAULT_FONT_COLOR

      public static final Color DEFAULT_FONT_COLOR
      Default font color is black.
    • DEFAULT_FONT_SIZE

      public static final TLcdNVGFontSize DEFAULT_FONT_SIZE
      Default font size is 12 pixels.
    • DEFAULT_TEXT_ALIGN

      public static final ELcdNVGHorizontalAlignment DEFAULT_TEXT_ALIGN
      Default text alignment is ELcdNVGHorizontalAlignment#CENTER.
    • DEFAULT_VERTICAL_ALIGN

      public static final ELcdNVGVerticalAlignment DEFAULT_VERTICAL_ALIGN
      Default vertical alignment is ELcdNVGVerticalAlignment#MIDDLE.
    • DEFAULT_STROKE_COLOR

      public static final Color DEFAULT_STROKE_COLOR
      Default stroke color is black.
    • DEFAULT_STROKE_WIDTH

      public static final float DEFAULT_STROKE_WIDTH
      Default stroke width is 1 pixel.
      See Also:
    • DEFAULT_STROKE_OPACITY

      public static final float DEFAULT_STROKE_OPACITY
      Default stroke opacity is 1.0 (opaque).
      See Also:
    • DEFAULT_STROKE_DASH

      public static final float[] DEFAULT_STROKE_DASH
      Default stroke dash is an empty array, which means no dashing is used (a solid line).
    • DEFAULT_LINE_PATTERN_BEGIN

      public static final ELcdNVGLinePattern DEFAULT_LINE_PATTERN_BEGIN
      Default line pattern at the beginning of the line.
    • DEFAULT_LINE_PATTERN_BEGIN_SIZE

      public static final int DEFAULT_LINE_PATTERN_BEGIN_SIZE
      Default line pattern size at the beginning of the line.
      See Also:
    • DEFAULT_LINE_PATTERN_END

      public static final ELcdNVGLinePattern DEFAULT_LINE_PATTERN_END
      Default line pattern at the end of the line.
    • DEFAULT_LINE_PATTERN_END_SIZE

      public static final int DEFAULT_LINE_PATTERN_END_SIZE
      Default line pattern size at the end of the line.
      See Also:
  • Constructor Details

    • TLcdNVGStyle

      public TLcdNVGStyle()
      public constructor with every attributes set to null.
    • TLcdNVGStyle

      public TLcdNVGStyle(boolean useDefault)
      If useDefault is true, the attributes are set to the default ones defined in the different style interfaces. If not, the attributes are null.
      Parameters:
      useDefault - a flag to set the attribute to default or null.
  • Method Details

    • getFillColor

      public Color getFillColor()
      Get the fill color.
      Returns:
      The color to fill the area with, can be null.
    • getFillOpacity

      public Float getFillOpacity()
      Get the opacity of the area.
      Returns:
      The opacity of the area expressed as a decimal value between 0 (completely transparent) and 1 (opaque), can be null.
    • getFillPattern

      public ELcdNVGFillPattern getFillPattern()
      Get the fill pattern of the area, null if there is no fill pattern set.
      Returns:
      The fill pattern of this area, can be null.
    • setFillPattern

      public void setFillPattern(ELcdNVGFillPattern aFillPattern)
      Set the fill pattern.
      Parameters:
      aFillPattern - the fill pattern.
    • setFillColor

      public void setFillColor(Color aFillColor)
      Set the fill color.
      Parameters:
      aFillColor - The fill color.
    • setFillOpacity

      public void setFillOpacity(Float aFillOpacity)
      Set the fill opacity
      Parameters:
      aFillOpacity - The opacity of the area expressed as a decimal value between 0 (completely transparent) and 1 (opaque).
    • getStrokeColor

      public Color getStrokeColor()
      Get the stroke color or null if it wasn't explicitly set.
      Returns:
      The color of the stroke, can be null.
    • getStrokeOpacity

      public Float getStrokeOpacity()
      Get the opacity of the stroke.
      Returns:
      The opacity of the stroke, expressed as a decimal value between 0 (completely transparent) and 1 (opaque), can be null.
    • getLinePatternBegin

      public ELcdNVGLinePattern getLinePatternBegin()
      Get the line pattern at the beginning of the line.
      Returns:
      a Line Pattern
    • getLinePatternBeginSize

      public Integer getLinePatternBeginSize()
      Get the line pattern size at the beginning of the line. Possible values are 1,2 and 3. 1 means that the pattern is twice larger that the stroke width. 2 means three times larger and 3 5 times.
      Returns:
      a integer between 1 and 3.
    • getLinePatternEnd

      public ELcdNVGLinePattern getLinePatternEnd()
      Get the line pattern at the end of the line.
      Returns:
      a Line Pattern
    • getLinePatternEndSize

      public Integer getLinePatternEndSize()
      Get the line pattern size at the end of the line. Possible values are 1,2 and 3. 1 means that the pattern is twice larger that the stroke width. 2 means three times larger and 3 5 times.
      Returns:
      a integer between 1 and 3.
    • getStrokeDash

      public float[] getStrokeDash()
      Get the dashed representation of the stroke.
      Returns:
      The dash array of the stroke, can be null.
    • getStrokeWidth

      public Float getStrokeWidth()
      Get the width of the stroke.
      Returns:
      The width of the stroke, can be null.
    • setStrokeColor

      public void setStrokeColor(Color aStrokeColor)
      Set the stroke color.
      Parameters:
      aStrokeColor - The color of the stroke.
    • setStrokeWidth

      public void setStrokeWidth(Float aStrokeWidth)
      Set the stroke width of the stroke.
      Parameters:
      aStrokeWidth - The stroke width of the stroke.
    • setLinePatternBegin

      public void setLinePatternBegin(ELcdNVGLinePattern aLinePatternBegin)
      Set the line pattern at the beginning of the line.
      Parameters:
      aLinePatternBegin - a Line pattern
    • setLinePatternBeginSize

      public void setLinePatternBeginSize(Integer aLinePatternBeginSize)
      Set the line pattern size at the beginning of the line.
      Parameters:
      aLinePatternBeginSize - a integer between 1 and 3.
      See Also:
    • setLinePatternEnd

      public void setLinePatternEnd(ELcdNVGLinePattern aLinePatternEnd)
      Set the line pattern at the end of the line.
      Parameters:
      aLinePatternEnd - a Line pattern
    • setLinePatternEndSize

      public void setLinePatternEndSize(Integer aLinePatternEndSize)
      Set the line pattern size at the beginning of the line.
      Parameters:
      aLinePatternEndSize - a integer between 1 and 3.
      See Also:
    • setStrokeOpacity

      public void setStrokeOpacity(Float aStrokeOpacity)
      Set the opacity of the Stroke. The value is clamped between 0 and 1.
      Parameters:
      aStrokeOpacity - The opacity of the stroke, expressed as a decimal value between 0 (completely transparent) and 1 (opaque).
    • setStrokeDash

      public void setStrokeDash(float[] aStrokeDash) throws IllegalArgumentException
      Set the dashed representation of the stroke.
      Parameters:
      aStrokeDash - The dash array of the stroke.
      Throws:
      IllegalArgumentException
    • getFontFamily

      public String getFontFamily()
      Get the font family name.
      Returns:
      The font family name, can be null.
    • getFontStyle

      public ELcdNVGFontStyle getFontStyle()
      Get the font style. Possible values are ELcdNVGFontStyle#NORMAL or ELcdNVGFontStyle#ITALIC.
      Returns:
      The font style, can be null.
    • getFontWeight

      public ELcdNVGFontWeight getFontWeight()
      Get the font weight. Possible values are ELcdNVGFontWeight#NORMAL or ELcdNVGFontWeight#BOLD.
      Returns:
      The font weight.
    • getFontColor

      public Color getFontColor()
      Get the font color.
      Returns:
      The font color, can be null.
    • getFontSize

      public TLcdNVGFontSize getFontSize()
      Get the font size as a TLcdNVGFontSize instance.
      Returns:
      The font size, can be null.
    • getTextAlign

      public ELcdNVGHorizontalAlignment getTextAlign()
      Get the horizontal text alignment. Possible values are ELcdNVGHorizontalAlignment#LEFT, ELcdNVGHorizontalAlignment#CENTER or ELcdNVGHorizontalAlignment#RIGHT.
      Returns:
      The horizontal text alignment, can be null.
    • getVerticalAlign

      public ELcdNVGVerticalAlignment getVerticalAlign()
      Get the vertical text alignment. Possible values are ELcdNVGVerticalAlignment#TOP, ELcdNVGVerticalAlignment#MIDDLE or ELcdNVGVerticalAlignment#BOTTOM.
      Returns:
      The vertical alignment, can be null.
    • setFontFamily

      public void setFontFamily(String aFontFamily)
      Set the font family name. Keep in mind that the required font may or may not exist in the system rendering the document. In that case, the system will use the default font name.
      Parameters:
      aFontFamily - The font family name.
    • setFontStyle

      public void setFontStyle(ELcdNVGFontStyle aFontStyle)
      Set the font style.
      Parameters:
      aFontStyle - The ELcdNVGStyle to set.
    • setFontWeight

      public void setFontWeight(ELcdNVGFontWeight aFontWeight)
      Set the font weight.
      Parameters:
      aFontWeight - The ELcdNVGWeight to set.
    • setFontColor

      public void setFontColor(Color aFontColor)
      Set the font color.
      Parameters:
      aFontColor - The new font color.
    • setFontSize

      public void setFontSize(TLcdNVGFontSize aFontSize)
      Set the font size.
      Parameters:
      aFontSize - A new font size .
    • setTextAlign

      public void setTextAlign(ELcdNVGHorizontalAlignment aTextAlign)
      Set the horizontal text alignment.
      Parameters:
      aTextAlign - The ELcdNVGHorizontalAlignment to set..
    • setVerticalAlign

      public void setVerticalAlign(ELcdNVGVerticalAlignment aVerticalAlign)
      Set the vertical text alignment.
      Parameters:
      aVerticalAlign - The ELcdNVGVerticalAlignment to set..
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public TLcdNVGStyle clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object