Package com.luciad.format.nvg.model
Class TLcdNVGStyle
java.lang.Object
com.luciad.format.nvg.model.TLcdNVGStyle
- All Implemented Interfaces:
ILcdCloneable
,Cloneable
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 Summary
Modifier and TypeFieldDescriptionstatic final Color
Default fill color is null (area not filled).static final float
Default fill opacity is 1.0 (opaque).static final ELcdNVGFillPattern
Default fill pattern is 0 (Blank).static final Color
Default font color is black.static final String
Default font family name is null which will result in a default AWT font (which is system specific).static final TLcdNVGFontSize
Default font size is 12 pixels.static final ELcdNVGFontStyle
Default font style isELcdNVGFontStyle#NORMAL
.static final ELcdNVGFontWeight
Default font weight isELcdNVGFontWeight#NORMAL
.static final ELcdNVGLinePattern
Default line pattern at the beginning of the line.static final int
Default line pattern size at the beginning of the line.static final ELcdNVGLinePattern
Default line pattern at the end of the line.static final int
Default line pattern size at the end of the line.static final Color
Default stroke color is black.static final float[]
Default stroke dash is an empty array, which means no dashing is used (a solid line).static final float
Default stroke opacity is 1.0 (opaque).static final float
Default stroke width is 1 pixel.static final ELcdNVGHorizontalAlignment
Default text alignment isELcdNVGHorizontalAlignment#CENTER
.static final ELcdNVGVerticalAlignment
Default vertical alignment isELcdNVGVerticalAlignment#MIDDLE
. -
Constructor Summary
ConstructorDescriptionpublic constructor with every attributes set to null.TLcdNVGStyle
(boolean useDefault) If useDefault is true, the attributes are set to the default ones defined in the different style interfaces. -
Method Summary
Modifier and TypeMethodDescriptionclone()
MakesObject.clone()
public.boolean
Get the fill color.Get the opacity of the area.Get the fill pattern of the area, null if there is no fill pattern set.Get the font color.Get the font family name.Get the font size as a TLcdNVGFontSize instance.Get the font style.Get the font weight.Get the line pattern at the beginning of the line.Get the line pattern size at the beginning of the line.Get the line pattern at the end of the line.Get the line pattern size at the end of the line.Get the stroke color or null if it wasn't explicitly set.float[]
Get the dashed representation of the stroke.Get the opacity of the stroke.Get the width of the stroke.Get the horizontal text alignment.Get the vertical text alignment.int
hashCode()
void
setFillColor
(Color aFillColor) Set the fill color.void
setFillOpacity
(Float aFillOpacity) Set the fill opacityvoid
setFillPattern
(ELcdNVGFillPattern aFillPattern) Set the fill pattern.void
setFontColor
(Color aFontColor) Set the font color.void
setFontFamily
(String aFontFamily) Set the font family name.void
setFontSize
(TLcdNVGFontSize aFontSize) Set the font size.void
setFontStyle
(ELcdNVGFontStyle aFontStyle) Set the font style.void
setFontWeight
(ELcdNVGFontWeight aFontWeight) Set the font weight.void
setLinePatternBegin
(ELcdNVGLinePattern aLinePatternBegin) Set the line pattern at the beginning of the line.void
setLinePatternBeginSize
(Integer aLinePatternBeginSize) Set the line pattern size at the beginning of the line.void
setLinePatternEnd
(ELcdNVGLinePattern aLinePatternEnd) Set the line pattern at the end of the line.void
setLinePatternEndSize
(Integer aLinePatternEndSize) Set the line pattern size at the beginning of the line.void
setStrokeColor
(Color aStrokeColor) Set the stroke color.void
setStrokeDash
(float[] aStrokeDash) Set the dashed representation of the stroke.void
setStrokeOpacity
(Float aStrokeOpacity) Set the opacity of the Stroke.void
setStrokeWidth
(Float aStrokeWidth) Set the stroke width of the stroke.void
setTextAlign
(ELcdNVGHorizontalAlignment aTextAlign) Set the horizontal text alignment.void
setVerticalAlign
(ELcdNVGVerticalAlignment aVerticalAlign) Set the vertical text alignment.toString()
-
Field Details
-
DEFAULT_FILL_COLOR
Default fill color is null (area not filled). -
DEFAULT_FILL_OPACITY
public static final float DEFAULT_FILL_OPACITYDefault fill opacity is 1.0 (opaque).- See Also:
-
DEFAULT_FILL_PATTERN
Default fill pattern is 0 (Blank). -
DEFAULT_FONT_FAMILY
Default font family name is null which will result in a default AWT font (which is system specific). -
DEFAULT_FONT_STYLE
Default font style isELcdNVGFontStyle#NORMAL
. -
DEFAULT_FONT_WEIGHT
Default font weight isELcdNVGFontWeight#NORMAL
. -
DEFAULT_FONT_COLOR
Default font color is black. -
DEFAULT_FONT_SIZE
Default font size is 12 pixels. -
DEFAULT_TEXT_ALIGN
Default text alignment isELcdNVGHorizontalAlignment#CENTER
. -
DEFAULT_VERTICAL_ALIGN
Default vertical alignment isELcdNVGVerticalAlignment#MIDDLE
. -
DEFAULT_STROKE_COLOR
Default stroke color is black. -
DEFAULT_STROKE_WIDTH
public static final float DEFAULT_STROKE_WIDTHDefault stroke width is 1 pixel.- See Also:
-
DEFAULT_STROKE_OPACITY
public static final float DEFAULT_STROKE_OPACITYDefault stroke opacity is 1.0 (opaque).- See Also:
-
DEFAULT_STROKE_DASH
public static final float[] DEFAULT_STROKE_DASHDefault stroke dash is an empty array, which means no dashing is used (a solid line). -
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_SIZEDefault line pattern size at the beginning of the line.- See Also:
-
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_SIZEDefault 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
Get the fill color.- Returns:
- The color to fill the area with, can be null.
-
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
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
Set the fill pattern.- Parameters:
aFillPattern
- the fill pattern.
-
setFillColor
Set the fill color.- Parameters:
aFillColor
- The fill color.
-
setFillOpacity
Set the fill opacity- Parameters:
aFillOpacity
- The opacity of the area expressed as a decimal value between 0 (completely transparent) and 1 (opaque).
-
getStrokeColor
Get the stroke color or null if it wasn't explicitly set.- Returns:
- The color of the stroke, can be null.
-
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
Get the line pattern at the beginning of the line.- Returns:
- a Line Pattern
-
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
Get the line pattern at the end of the line.- Returns:
- a Line Pattern
-
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
Get the width of the stroke.- Returns:
- The width of the stroke, can be null.
-
setStrokeColor
Set the stroke color.- Parameters:
aStrokeColor
- The color of the stroke.
-
setStrokeWidth
Set the stroke width of the stroke.- Parameters:
aStrokeWidth
- The stroke width of the stroke.
-
setLinePatternBegin
Set the line pattern at the beginning of the line.- Parameters:
aLinePatternBegin
- a Line pattern
-
setLinePatternBeginSize
Set the line pattern size at the beginning of the line.- Parameters:
aLinePatternBeginSize
- a integer between 1 and 3.- See Also:
-
setLinePatternEnd
Set the line pattern at the end of the line.- Parameters:
aLinePatternEnd
- a Line pattern
-
setLinePatternEndSize
Set the line pattern size at the beginning of the line.- Parameters:
aLinePatternEndSize
- a integer between 1 and 3.- See Also:
-
setStrokeOpacity
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
Set the dashed representation of the stroke.- Parameters:
aStrokeDash
- The dash array of the stroke.- Throws:
IllegalArgumentException
-
getFontFamily
Get the font family name.- Returns:
- The font family name, can be null.
-
getFontStyle
Get the font style. Possible values areELcdNVGFontStyle#NORMAL
orELcdNVGFontStyle#ITALIC
.- Returns:
- The font style, can be null.
-
getFontWeight
Get the font weight. Possible values areELcdNVGFontWeight#NORMAL
orELcdNVGFontWeight#BOLD
.- Returns:
- The font weight.
-
getFontColor
Get the font color.- Returns:
- The font color, can be null.
-
getFontSize
Get the font size as a TLcdNVGFontSize instance.- Returns:
- The font size, can be null.
-
getTextAlign
Get the horizontal text alignment. Possible values areELcdNVGHorizontalAlignment#LEFT
,ELcdNVGHorizontalAlignment#CENTER
orELcdNVGHorizontalAlignment#RIGHT
.- Returns:
- The horizontal text alignment, can be null.
-
getVerticalAlign
Get the vertical text alignment. Possible values areELcdNVGVerticalAlignment#TOP
,ELcdNVGVerticalAlignment#MIDDLE
orELcdNVGVerticalAlignment#BOTTOM
.- Returns:
- The vertical alignment, can be null.
-
setFontFamily
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
Set the font style.- Parameters:
aFontStyle
- TheELcdNVGStyle
to set.
-
setFontWeight
Set the font weight.- Parameters:
aFontWeight
- TheELcdNVGWeight
to set.
-
setFontColor
Set the font color.- Parameters:
aFontColor
- The new font color.
-
setFontSize
Set the font size.- Parameters:
aFontSize
- A new font size .
-
setTextAlign
Set the horizontal text alignment.- Parameters:
aTextAlign
- TheELcdNVGHorizontalAlignment
to set..
-
setVerticalAlign
Set the vertical text alignment.- Parameters:
aVerticalAlign
- TheELcdNVGVerticalAlignment
to set..
-
toString
-
equals
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.clone()
public.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 interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-
hashCode
public int hashCode()
-