public class AnnotationAttributes extends java.lang.Object implements Restorable
Annotation
attributes set. All AbstractAnnotation
objects start life referencing a new instance of
this object. This class also defines a static default attributes bundle containing default values for all
attributes. New AnnotationAttributes
refer this static bundle as their default values source when an
attribute has not been set.
New AnnotationAttributes
set have all their attributes pointing to
the default values until they are set by the application. Most attributes refer to the default value by using minus
one (-1
) for numerics and null
for objects.
The default attributes set can be changed for a non static one under the application control. The process can be extended or cascaded to handle multiple levels of inheritance for default attributes.
AbstractAnnotation
,
MultiLineTextRenderer
Modifier and Type | Field and Description |
---|---|
protected boolean |
unresolved |
Constructor and Description |
---|
AnnotationAttributes() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAdjustWidthToText()
Get whether the callout width should adjust to follow the wrapped text bounding rectangle width, which may be
smaller or larger then the preferred size depending on the text.
|
protected int |
getAntiAliasHint()
Get the
GL antialias hint used for rendering the callout border line. |
java.awt.Color |
getBackgroundColor()
Get the callout background
Color . |
WWTexture |
getBackgroundTexture(DrawContext dc)
Get the background image as a
WWTexture for the specified draw context. |
java.awt.Color |
getBorderColor()
Get the callout border
Color . |
int |
getBorderStippleFactor()
Get the stipple factor used for the callout border line.
|
short |
getBorderStipplePattern()
Get the stipple pattern used for the callout border line.
|
double |
getBorderWidth()
Get the callout border line width.
|
int |
getCornerRadius()
Get the callout shape rounded corners radius in pixels.
|
double |
getDistanceMaxScale()
Get the maximum scale that can be applied to an annotation when it gets closer to the eye than the view lookat
point.
|
double |
getDistanceMinOpacity()
Get the minimum opacity an annotation can have when fading away from the eye (0 to 1).
|
double |
getDistanceMinScale()
Get the minimum scale that can be applied to an annotation when it gets farther away from the eye than the view
lookat point.
|
java.awt.Point |
getDrawOffset()
Get the callout displacement offset in pixels from the globe Position or screen point at which it is associated.
|
java.lang.String |
getEffect()
Get the effect used to decorate the text.
|
java.awt.Font |
getFont()
Get the
Font used for text rendering. |
java.lang.String |
getFrameShape()
Get the callout frame shape.
|
double |
getHighlightScale()
Get the scaling factor applied to highlighted
Annotations . |
java.awt.Point |
getImageOffset()
Get the background image offset in pixels (before background scaling).
|
double |
getImageOpacity()
Get the opacity of the background image (0 to 1).
|
java.lang.String |
getImageRepeat()
Get the repeat behavior or the background image.
|
double |
getImageScale()
Get the background image scaling factor.
|
java.lang.Object |
getImageSource()
Get the background image source.
|
java.awt.Insets |
getInsets()
Get the callout
Insets dimensions in pixels. |
java.lang.String |
getLeader()
Get the callout shape leader type.
|
int |
getLeaderGapWidth()
Get the callout shape leader gap width in pixels.
|
double |
getOpacity()
Get the opacity factor applied to the annotation.
|
java.lang.String |
getPath()
Get the path to the image used for background image.
|
java.lang.String |
getRestorableState()
Returns an XML state document String describing attributes that have been set by the application (attributes not
pointing to their default value).
|
double |
getScale()
Get the scaling factor applied to the annotation.
|
java.awt.Dimension |
getSize()
Get the annotation callout preferred total dimension in pixels.
|
java.lang.String |
getTextAlign()
Get the text alignement.
|
java.awt.Color |
getTextColor()
Get the text
Color . |
boolean |
isHighlighted()
Get whether the
Annotation is highlighted and should be drawn bigger - see setHighlightScale(). |
boolean |
isUnresolved()
Indicates whether one or more members of this remain unresolved because they must be retrieved from an
external source.
|
boolean |
isVisible()
Get whether the annotation is visible and should be rendered.
|
void |
restoreState(java.lang.String stateInXml)
Restores attribute values found in the specified XML state document String.
|
void |
setAdjustWidthToText(java.lang.String state)
Set whether the callout width should adjust to follow the wrapped text bounding rectangle width which may be
smaller or larger then the preferred size depending on the text.
|
protected void |
setAntiAliasHint(int hint)
Set the
GL antialias hint used for rendering the callout border line. |
void |
setBackgroundColor(java.awt.Color color)
Set the callout background
Color . |
void |
setBorderColor(java.awt.Color color)
Set the callout border
Color . |
void |
setBorderStippleFactor(int factor)
Set the stipple factor used for the callout border line.
|
void |
setBorderStipplePattern(short pattern)
Set the stipple pattern used for the callout border line.
|
void |
setBorderWidth(double width)
Set the callout border line width.
|
void |
setCornerRadius(int radius)
Set the callout shape rounded corners radius in pixels.
|
void |
setDefaults(AnnotationAttributes attr)
Set the fallback default attributes set.
|
void |
setDistanceMaxScale(double scale)
Set the maximum scale that can be applied to an annotation when it gets closer to the eye than the view lookat
point.
|
void |
setDistanceMinOpacity(double opacity)
Set the minimum opacity an annotation can have when fading away from the eye (0 to 1).
|
void |
setDistanceMinScale(double scale)
Set the minimum scale that can be applied to an annotation when it gets farther away from the eye than the view
lookat point.
|
void |
setDrawOffset(java.awt.Point offset)
Set the callout displacement offset in pixels from the globe Position or screen point at which it is associated.
|
void |
setEffect(java.lang.String effect)
Set the effect used to decorate the text.
|
void |
setFont(java.awt.Font font)
Set the
Font used for text rendering. |
void |
setFrameShape(java.lang.String shape)
Set the callout frame shape.
|
void |
setHighlighted(boolean highlighted)
Set whether the
Annotation is highlighted and should be drawn bigger - see setHighlightScale(). |
void |
setHighlightScale(double highlightScale)
Set the scaling factor applied to highlighted
Annotations . |
void |
setImageOffset(java.awt.Point offset)
Set the background image offset in pixels (before background scaling).
|
void |
setImageOpacity(double opacity)
Set the opacity of the background image (0 to 1).
|
void |
setImageRepeat(java.lang.String repeat)
Set the repeat behavior or the background image.
|
void |
setImageScale(double scale)
Set the background image scaling factor.
|
void |
setImageSource(java.lang.Object imageSource)
Set the background image source.
|
void |
setInsets(java.awt.Insets insets)
Set the callout
Insets dimensions in pixels. |
void |
setLeader(java.lang.String leader)
Set the callout shape leader type.
|
void |
setLeaderGapWidth(int width)
Set the callout shape leader gap width in pixels.
|
void |
setOpacity(double opacity)
Set the opacity factor to apply to the annotation.
|
void |
setScale(double scale)
Set the scaling factor to apply to the annotation.
|
void |
setSize(java.awt.Dimension size)
Set the annotation callout preferred total dimension in pixels.
|
void |
setTextAlign(java.lang.String align)
Set the text alignement.
|
void |
setTextColor(java.awt.Color color)
Set the text
Color . |
void |
setUnresolved(boolean unresolved)
Specifies whether one or more fields of this remain unresolved because they must be retrieved from an
external source.
|
void |
setVisible(boolean visible)
Set whether the annotation is visible and should be rendered.
|
public java.lang.String getAdjustWidthToText()
AVKey.SIZE_FIXED
or AVKey.SIZE_FIT_TEXT
.protected int getAntiAliasHint()
GL
antialias hint used for rendering the callout border line. Can be one of Annotation
.ANTIALIAS_DONT_CARE, ANTIALIAS_FASTEST (default) or ANTIALIAS_NICEST.GL
antialias hint used for rendering the callout border line.public java.awt.Color getBackgroundColor()
Color
.Color
.public WWTexture getBackgroundTexture(DrawContext dc)
WWTexture
for the specified draw context. This returns null if the
background image source returned by getImageSource()
is null.dc
- the current draw context.public java.awt.Color getBorderColor()
Color
.Color
.public int getBorderStippleFactor()
zero
(default) means no pattern
is applied.public short getBorderStipplePattern()
public double getBorderWidth()
zero
means no border is being drawn.public int getCornerRadius()
zero
means no rounded corners.public double getDistanceMaxScale()
public double getDistanceMinOpacity()
public double getDistanceMinScale()
public java.awt.Point getDrawOffset()
public java.lang.String getEffect()
AVKey.TEXT_EFFECT_SHADOW
, AVKey.TEXT_EFFECT_OUTLINE
or AVKey.TEXT_EFFECT_NONE
(default).public java.awt.Font getFont()
Font
used for text rendering.Font
used for text rendering.public java.lang.String getFrameShape()
AVKey.SHAPE_RECTANGLE
(default),
AVKey.SHAPE_ELLIPSE
or AVKey.SHAPE_NONE
.public double getHighlightScale()
Annotations
.Annotations
.public java.awt.Point getImageOffset()
public double getImageOpacity()
public java.lang.String getImageRepeat()
Annotation
.IMAGE_REPEAT_X, IMAGE_REPEAT_Y,
IMAGE_REPEAT_XY (default) or IMAGE_REPEAT_NONE.public double getImageScale()
public java.lang.Object getImageSource()
String
providing the path to a local image, a BufferedImage
or null
.public java.awt.Insets getInsets()
Insets
dimensions in pixels. The text is drawn inside the callout frame while
keeping a distance from the callout border defined in the Insets.Insets
dimensions in pixels.public java.lang.String getLeader()
AVKey.SHAPE_TRIANGLE
(default) or
AVKey.SHAPE_NONE
.public int getLeaderGapWidth()
public double getOpacity()
public java.lang.String getPath()
null
if the image source is null or a
memory BufferedImage.public java.lang.String getRestorableState()
getRestorableState
in interface Restorable
public double getScale()
public java.awt.Dimension getSize()
public java.lang.String getTextAlign()
public java.awt.Color getTextColor()
Color
.Color
.public boolean isHighlighted()
Annotation
is highlighted and should be drawn bigger - see setHighlightScale().public boolean isUnresolved()
public boolean isVisible()
public void restoreState(java.lang.String stateInXml)
stateInXml
must be a well formed XML document String, or this will throw an
IllegalArgumentException. Unknown structures in stateInXml
are benign, because they will simply be
ignored.restoreState
in interface Restorable
stateInXml
- an XML document String describing an AnnotationAttributes.java.lang.IllegalArgumentException
- If stateInXml
is null, or if stateInXml
is not a well
formed XML document String.public void setAdjustWidthToText(java.lang.String state)
AVKey.SIZE_FIXED
(default)
or AVKey.SIZE_FIT_TEXT
. Setting this attribute to SIZE_FIT_TEXT
would have the callout drawn
at its exact width (see setSize()).state
- whether the callout width should adjust to follow the text bounding rectangle width.protected void setAntiAliasHint(int hint)
GL
antialias hint used for rendering the callout border line. Can be one of Annotation
.ANTIALIAS_DONT_CARE, ANTIALIAS_FASTEST (default) or ANTIALIAS_NICEST. Set to minus one
(-1
) to use the default value.hint
- the GL
antialias hint used for rendering the callout border line.public void setBackgroundColor(java.awt.Color color)
Color
. Set to null
to use the default value.color
- the callout background Color
.public void setBorderColor(java.awt.Color color)
Color
. Set to null
to use the default value.color
- the callout border Color
.public void setBorderStippleFactor(int factor)
zero
(default) means no pattern
will be applied. Set to minus one (-1
) to use the default value.factor
- the stipple factor used for the callout border line.public void setBorderStipplePattern(short pattern)
0x0000
to use the default value.pattern
- the stipple pattern used for the callout border line.public void setBorderWidth(double width)
zero
means no border will is drawn. Set to minus one
(-1
) to use the default value.width
- the callout border line width.public void setCornerRadius(int radius)
zero
means no rounded corners.
Set this attribute to minus one (-1
) to use the default value.radius
- the callout shape rounded corners radius in pixels.public void setDefaults(AnnotationAttributes attr)
attr
- the default attributes set.public void setDistanceMaxScale(double scale)
-1
) to use the default value.scale
- the maximum scale that can be applied to an annotation when it gets closer to the eyepublic void setDistanceMinOpacity(double opacity)
-1
) to use the default value.opacity
- the minimum opacity an annotation can have when fading away from the eye.public void setDistanceMinScale(double scale)
-1
) to use the default value.scale
- the minimum scale that can be applied to an annotation when it gets away from the eyepublic void setDrawOffset(java.awt.Point offset)
null
to use the default offset.offset
- the callout displacement offset in pixelspublic void setEffect(java.lang.String effect)
AVKey.TEXT_EFFECT_SHADOW
, AVKey.TEXT_EFFECT_OUTLINE
or AVKey.TEXT_EFFECT_NONE
(default). Set to null
to use the
default value.effect
- the effect to use for text renderingpublic void setFont(java.awt.Font font)
Font
used for text rendering. Set to null
to use the default value.font
- the Font
used for text rendering.public void setFrameShape(java.lang.String shape)
AVKey.SHAPE_RECTANGLE
(default),
AVKey.SHAPE_ELLIPSE
or AVKey.SHAPE_NONE
. Set to null
to use the default
shape. Note that AVKey.SHAPE_ELLIPSE
draws an ellipse inside the callout bounding
rectangle set by its size (see setSize()) or its text bounding rectangle (see setAdjustWidthToText() and
setSize() with height set to zero). It is often necessary to have larger Insets dimensions (see setInsets()) to
avoid having the text drawn outside the shape border.
shape
- the callout frame shape.public void setHighlighted(boolean highlighted)
Annotation
is highlighted and should be drawn bigger - see setHighlightScale().highlighted
- true if highlighted.public void setHighlightScale(double highlightScale)
Annotations
. Set to minus one (-1
) to use
the default value.highlightScale
- the scaling factor applied to highlighted Annotations
.public void setImageOffset(java.awt.Point offset)
null
to use the
default value.offset
- the background image offset in pixelspublic void setImageOpacity(double opacity)
-1
) to use the default value.opacity
- the opacity of the background image (0 to 1).public void setImageRepeat(java.lang.String repeat)
Annotation
.IMAGE_REPEAT_X, IMAGE_REPEAT_Y,
IMAGE_REPEAT_XY (default) or IMAGE_REPEAT_NONE. Set to null
to use the default value.repeat
- the repeat behavior or the background image.public void setImageScale(double scale)
-1
) to use the default value.scale
- the background image scaling factor.public void setImageSource(java.lang.Object imageSource)
String
providing the path to a local image or a BufferedImage
. Set to null for no background image rendering.imageSource
- the background image source.public void setInsets(java.awt.Insets insets)
Insets
dimensions in pixels. The text will be drawn inside the callout frame while
keeping a distance from the callout border defined in the Insets. Set to null
to use the default
Insets.insets
- the callout Insets
dimensions in pixels.public void setLeader(java.lang.String leader)
AVKey.SHAPE_TRIANGLE
(default) or
AVKey.SHAPE_NONE
.leader
- the callout shape leader type.public void setLeaderGapWidth(int width)
-1
) to use the
default value.width
- the callout shape leader gap width in pixels.public void setOpacity(double opacity)
-1
) to use the
default value.opacity
- the opacity factor to apply to the annotationpublic void setScale(double scale)
-1
) to use the
default value.scale
- the scaling factor to apply to the annotationpublic void setSize(java.awt.Dimension size)
If necessary, the text will be wrapped into
several lines so as not to exceed the callout preferred width
(minus the Insets
left
and right
dimensions - see setInsets
).
However, if setAdjustWidthToText
is set to AVKey.SIZE_FIT_TEXT, the final
callout width will follow that of the final text bounding rectangle.
If necessary, the text will also be
truncated so as not to exceed the given height
. A zero
value (default) will have
the callout follow the final text bounding rectangle height (including the Insets
top
and bottom
).
null
to use the default size.size
- the callout preferred total dimension in pixels.public void setTextAlign(java.lang.String align)
AVKey.LEFT
(default), AVKey.CENTER
or AVKey.RIGHT
.
Set to null
to use the default value.align
- the text alignement.public void setTextColor(java.awt.Color color)
Color
. Set to null
to use the default value.color
- the text Color
.public void setUnresolved(boolean unresolved)
unresolved
- true if there are unresolved fields, false if no fields remain unresolved.public void setVisible(boolean visible)
visible
- true if the annotation is visible and should be rendered.