public class BasicBalloonAttributes extends BasicShapeAttributes implements BalloonAttributes
BalloonAttributes
interface. Extends
BasicShapeAttributes
to include attributes for WorldWind Balloon
shapes.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
balloonShape
Indicates the shape of the balloon's frame.
|
protected int |
cornerRadius
Indicates the radius of each rounded corner on the balloon's rectangular frame, in pixels.
|
protected java.awt.Font |
font
Indicates the font used to display the balloon's text.
|
protected java.awt.Point |
imageOffset
Indicates the location of the image source in pixels.
|
protected double |
imageOpacity
Indicates the balloon texture's opacity as a floating-point value from 0.0 to 1.0.
|
protected java.lang.String |
imageRepeat
Specifies the balloon texture's horizontal and vertical repeat mode.
|
protected java.awt.Insets |
insets
Indicates the padding between the balloon's content and its frame, in pixels.
|
protected java.lang.String |
leaderShape
Indicates the shape of the balloon's leader.
|
protected int |
leaderWidth
Indicates the width of the balloon's leader, in pixels.
|
protected Size |
maxSize
Indicates the maximum width and height of the balloon's shape in the viewport.
|
protected Offset |
offset
Indicates the location at which the balloon's lower left corner is aligned.
|
protected Size |
size
Indicates the width and height of the balloon's shape in the viewport.
|
protected java.awt.Color |
textColor
Indicates the color used to display the balloon's text.
|
drawInterior, drawOutline, enableAntialiasing, enableLighting, imageScale, imageSource, interiorMaterial, interiorOpacity, outlineMaterial, outlineOpacity, outlineStippleFactor, outlineStipplePattern, outlineWidth, unresolved
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Constructor and Description |
---|
BasicBalloonAttributes()
Creates a new
BasicBalloonAttributes with the default attributes. |
BasicBalloonAttributes(BalloonAttributes attributes)
Creates a new
BasicBalloonAttributes configured with the specified attributes . |
Modifier and Type | Method and Description |
---|---|
ShapeAttributes |
copy()
Returns a new ShapeAttributes instance of the same type as this ShapeAttributes who's properties are configured
exactly as this ShapeAttributes.
|
void |
copy(ShapeAttributes attributes)
Copies the specified ShapeAttributes' properties into this object's properties.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getBalloonShape()
Indicates the shape of the balloon's frame.
|
int |
getCornerRadius()
Indicates the radius of each rounded corner on the balloon's rectangular frame, in pixels.
|
java.awt.Font |
getFont()
Indicates the font used to display the balloon's text.
|
java.awt.Point |
getImageOffset()
Indicates the location of the balloon's texture (in pixels) relative to the balloon's upper left corner.
|
double |
getImageOpacity()
Indicates the opacity of the balloon's texture as a floating-point value in the range 0.0 to 1.0.
|
java.lang.String |
getImageRepeat()
Indicates the balloon texture's horizontal and vertical repeat mode.
|
java.awt.Insets |
getInsets()
Indicates the amount of space between the balloon's content and its frame, in pixels.
|
java.lang.String |
getLeaderShape()
Indicates the shape of the balloon's leader.
|
int |
getLeaderWidth()
Indicates the width of the balloon's leader, in pixels.
|
Size |
getMaximumSize()
Indicates the maximum width and height of the balloon's shape in the viewport.
|
Offset |
getOffset()
Indicates the location relative to the balloon's screen reference point at which the balloon's frame shape is
aligned.
|
void |
getRestorableState(RestorableSupport restorableSupport,
RestorableSupport.StateObject context)
Saves the attributes' current state in the specified
RestorableSupport . |
Size |
getSize()
Indicates the width and height of the balloon's shape in the viewport.
|
java.awt.Color |
getTextColor()
Indicates the color used to display the balloon's text.
|
int |
hashCode() |
void |
restoreState(RestorableSupport restorableSupport,
RestorableSupport.StateObject context)
Restores the state of any attributes contained in the specified
RestorableSupport . |
void |
setBalloonShape(java.lang.String shape)
Specifies the shape of the balloon's frame.
|
void |
setCornerRadius(int radius)
Specifies the radius of the rounded corner's on the balloon's rectangular frame in pixels.
|
void |
setFont(java.awt.Font font)
Specifies the font in which to display the balloon's text.
|
void |
setImageOffset(java.awt.Point offset)
Specifies the location of the balloon's texture (in pixels) relative to the balloon's upper left corner.
|
void |
setImageOpacity(double opacity)
Specifies the opacity of the balloon's texture as a floating-point value in the range 0.0 to 1.0.
|
void |
setImageRepeat(java.lang.String repeat)
Specifies the balloon texture's horizontal and vertical repeat mode.
|
void |
setInsets(java.awt.Insets insets)
Specifies the amount of space (in pixels) between the balloon's content and the edges of the balloon's frame.
|
void |
setLeaderShape(java.lang.String shape)
Specifies the shape of the balloon's leader.
|
void |
setLeaderWidth(int width)
Specifies the width of the balloon's leader, in pixels.
|
void |
setMaximumSize(Size maxSize)
Specifies the maximum width and height of the balloon's shape in the viewport.
|
void |
setOffset(Offset offset)
Specifies a location relative to the balloon's screen reference point at which to align the balloon's frame
shape.
|
void |
setSize(Size size)
Specifies the width and height of the balloon's shape in the viewport.
|
void |
setTextColor(java.awt.Color color)
Specifies the color in which to display the balloon's text.
|
export, exportAsKML, getImageScale, getImageSource, getInteriorMaterial, getInteriorOpacity, getOutlineMaterial, getOutlineOpacity, getOutlineStippleFactor, getOutlineStipplePattern, getOutlineWidth, isDrawInterior, isDrawOutline, isEnableAntialiasing, isEnableLighting, isExportFormatSupported, isUnresolved, setDrawInterior, setDrawOutline, setEnableAntialiasing, setEnableLighting, setImageScale, setImageSource, setInteriorMaterial, setInteriorOpacity, setOutlineMaterial, setOutlineOpacity, setOutlineStippleFactor, setOutlineStipplePattern, setOutlineWidth, setUnresolved
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getImageScale, getImageSource, getInteriorMaterial, getInteriorOpacity, getOutlineMaterial, getOutlineOpacity, getOutlineStippleFactor, getOutlineStipplePattern, getOutlineWidth, isDrawInterior, isDrawOutline, isEnableAntialiasing, isEnableLighting, isUnresolved, setDrawInterior, setDrawOutline, setEnableAntialiasing, setEnableLighting, setImageScale, setImageSource, setInteriorMaterial, setInteriorOpacity, setOutlineMaterial, setOutlineOpacity, setOutlineStippleFactor, setOutlineStipplePattern, setOutlineWidth, setUnresolved
export, isExportFormatSupported
protected java.lang.String balloonShape
null
.protected int cornerRadius
protected java.awt.Font font
null
.protected java.awt.Point imageOffset
null
.protected double imageOpacity
protected java.lang.String imageRepeat
null
.protected java.awt.Insets insets
null
.protected java.lang.String leaderShape
null
.protected int leaderWidth
protected Size maxSize
null
.protected Offset offset
null
.protected Size size
null
.protected java.awt.Color textColor
null
.public BasicBalloonAttributes()
BasicBalloonAttributes
with the default attributes. The default attributes are as
follows:
Attribute | Default Value |
---|---|
unresolved | true |
drawInterior | true |
drawOutline | true |
enableAntialiasing | true |
enableLighting | false |
interiorMaterial | Material.WHITE |
outlineMaterial | 171, 171, 171 (red, green, blue) |
interiorOpacity | 1.0 |
outlineOpacity | 1.0 |
outlineWidth | 1.0 |
outlineStippleFactor | 0 |
outlineStipplePattern | 0xF0F0 |
interiorImageSource | null |
interiorImageScale | 1.0 |
size | 350x350 pixels (width x height) |
maximumSize | null |
offset | 40,60 pixels (x, y) |
insets | 30,15,15,15 (top, left, bottom, right) |
balloonShape | AVKey.SHAPE_RECTANGLE |
leaderShape | AVKey.SHAPE_TRIANGLE |
leaderWidth | 40.0 |
cornerRadius | 20.0 |
font | Arial Plain 12 |
textColor | Color.BLACK |
imageOffset | 0,0 (x, y) |
imageOpacity | 1 |
imageRepeat | AVKey.REPEAT_XY |
public BasicBalloonAttributes(BalloonAttributes attributes)
BasicBalloonAttributes
configured with the specified attributes
.attributes
- the attributes to configure the new BasicBalloonAttributes
with.java.lang.IllegalArgumentException
- if attributes
is null
.public ShapeAttributes copy()
BasicBalloonAttributes
.copy
in interface ShapeAttributes
copy
in class BasicShapeAttributes
public void copy(ShapeAttributes attributes)
null
.
Extends the superclass' behavior to copy BalloonAttributes
if the specified attributes
is an instance of BalloonAttributes
.copy
in interface ShapeAttributes
copy
in class BasicShapeAttributes
attributes
- the attributes to copy.public boolean equals(java.lang.Object o)
equals
in class BasicShapeAttributes
public java.lang.String getBalloonShape()
getBalloonShape
in interface BalloonAttributes
AVKey.SHAPE_NONE
, AVKey.SHAPE_RECTANGLE
, or AVKey.SHAPE_ELLIPSE
.BalloonAttributes.setBalloonShape(String)
public int getCornerRadius()
AVKey.SHAPE_ELLIPSE
.getCornerRadius
in interface BalloonAttributes
BalloonAttributes.setCornerRadius(int)
public java.awt.Font getFont()
getFont
in interface BalloonAttributes
BalloonAttributes.setFont(java.awt.Font)
public java.awt.Point getImageOffset()
getImageOffset
in interface BalloonAttributes
BalloonAttributes.setImageOffset(java.awt.Point)
public double getImageOpacity()
getImageOpacity
in interface BalloonAttributes
BalloonAttributes.setImageOpacity(double)
public java.lang.String getImageRepeat()
getImageRepeat
in interface BalloonAttributes
AVKey.REPEAT_NONE
, AVKey.REPEAT_X
, AVKey.REPEAT_Y
, or AVKey.REPEAT_XY
BalloonAttributes.setImageRepeat(String)
public java.awt.Insets getInsets()
getInsets
in interface BalloonAttributes
BalloonAttributes.setInsets(java.awt.Insets)
public java.lang.String getLeaderShape()
getLeaderShape
in interface BalloonAttributes
AVKey.SHAPE_NONE
or AVKey.SHAPE_TRIANGLE
.BalloonAttributes.setLeaderShape(String)
public int getLeaderWidth()
getLeaderWidth
in interface BalloonAttributes
BalloonAttributes.setLeaderWidth(int)
public Size getMaximumSize()
AVKey.SHAPE_RECTANGLE
, then the returned Size
indicates the rectangle's maximum width
and height. If the balloon's shape is AVKey.SHAPE_ELLIPSE
, then the returned Size
indicates the ellipse's maximum x- and y-radii. This returns null
if the balloon has no maximum
size.getMaximumSize
in interface BalloonAttributes
null
if the balloon
has no maximum size.public Offset getOffset()
offset
.getOffset
in interface BalloonAttributes
BalloonAttributes.setOffset(Offset)
public void getRestorableState(RestorableSupport restorableSupport, RestorableSupport.StateObject context)
RestorableSupport
. If the
StateObject
is not null
the state is appended to it. Otherwise the state is added to
the RestorableSupport
root. This state can be restored later by calling ShapeAttributes.restoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject)
.getRestorableState
in interface ShapeAttributes
getRestorableState
in class BasicShapeAttributes
restorableSupport
- the RestorableSupport
that receives the attributes' state.context
- the StateObject
the state is appended to, if not null
.public Size getSize()
AVKey.SHAPE_RECTANGLE
, then the returned Size
indicates the rectangle's width and
height. If the balloon's shape is AVKey.SHAPE_ELLIPSE
, then the returned Size
indicates
the ellipse's x- and y-radii.getSize
in interface BalloonAttributes
public java.awt.Color getTextColor()
getTextColor
in interface BalloonAttributes
BalloonAttributes.setTextColor(java.awt.Color)
public int hashCode()
hashCode
in class BasicShapeAttributes
public void restoreState(RestorableSupport restorableSupport, RestorableSupport.StateObject context)
RestorableSupport
. If the
StateObject
is not null
it's searched for attribute state values, otherwise the
RestorableSupport
root is searched.restoreState
in interface ShapeAttributes
restoreState
in class BasicShapeAttributes
restorableSupport
- the RestorableSupport
that contains the attributes' state.context
- the StateObject
to search for state values, if not null
.public void setBalloonShape(java.lang.String shape)
shape
may be one of the following:
If the shape
is AVKey.SHAPE_NONE
, the balloon's content is displayed in a rectangle in
the viewport without any decoration. The rectangle's dimension in the viewport are specified by calling BalloonAttributes.setSize(Size)
.
If the shape
is AVKey.SHAPE_RECTANGLE
, the balloon is displayed as a rectangle in the
viewport with optionally rounded corners. The rectangle's dimension in the viewport are specified by calling
BalloonAttributes.setSize(Size)
. The rectangle's corner radius in pixels is specified by calling BalloonAttributes.setCornerRadius(int)
.
If the shape
is AVKey.SHAPE_ELLIPSE
, the balloon is displayed as an ellipse in the
viewport. The ellipse's x- and y-radii are specified by calling BalloonAttributes.setSize(Size)
. The balloon's corner
radius attribute is ignored.setBalloonShape
in interface BalloonAttributes
shape
- the frame shape to use, either AVKey.SHAPE_NONE
AVKey.SHAPE_RECTANGLE
or
AVKey.SHAPE_ELLIPSE
.BalloonAttributes.getBalloonShape()
public void setCornerRadius(int radius)
radius
must be zero or a positive integer. Specifying a radius
of zero causes the
shape's rectangular frame to have sharp corners. This does nothing if the balloon's shape is
AVKey.SHAPE_ELLIPSE
.setCornerRadius
in interface BalloonAttributes
radius
- the desired radius, in pixels.BalloonAttributes.getCornerRadius()
public void setFont(java.awt.Font font)
font
may be ignored if the
balloon's text contains HTML.setFont
in interface BalloonAttributes
font
- the font to use for the balloon's text.BalloonAttributes.getFont()
public void setImageOffset(java.awt.Point offset)
setImageOffset
in interface BalloonAttributes
offset
- the location of the balloon's texture source in pixels.BalloonAttributes.getImageOffset()
public void setImageOpacity(double opacity)
opacity
is multiplied by the shape's interior opacity to determine the texture's final opacity. A
value of 1.0 specifies a completely opaque texture, and 0.0 specifies a completely transparent texture. Values in
between specify a partially transparent texture.setImageOpacity
in interface BalloonAttributes
opacity
- the balloon texture's opacity as a floating-point value from 0.0 to 1.0.BalloonAttributes.getImageOpacity()
public void setImageRepeat(java.lang.String repeat)
repeat
may be one of the
following:
If repeat
is AVKey.REPEAT_NONE
, the balloon's texture is displayed according to its
offset and scale without any repeating pattern.
If repeat
is AVKey.REPEAT_X
, AVKey.REPEAT_Y
, or
AVKey.REPEAT_XY
, the balloon's texture is repeated along the X axis, along the Y axis, or along both
the X and Y axes, respectively. The texture is repeated after its offset and scale are applied.setImageRepeat
in interface BalloonAttributes
repeat
- the texture's repeat mode to use, one of AVKey.REPEAT_NONE
,
AVKey.REPEAT_X
, AVKey.REPEAT_Y
, or AVKey.REPEAT_XY
.BalloonAttributes.getImageRepeat()
public void setInsets(java.awt.Insets insets)
insets
. If the balloon's size and
insets cause the content width or height to become less than 1, then the balloon's content is not displayed.
If the balloon's shape is AVKey.SHAPE_RECTANGLE
, insets
specifies the padding between
the balloon's content area and the rectangle's top, left, bottom, and right.
If the balloon's shape is AVKey.SHAPE_ELLIPSE
, insets
specifies the padding between the
balloon's content area and the ellipse's top, left, bottom, and right apexes.setInsets
in interface BalloonAttributes
insets
- the desired padding between the balloon's content and its frame, in pixels.BalloonAttributes.getInsets()
public void setLeaderShape(java.lang.String shape)
shape
may be one of the following:
If the shape
is AVKey.SHAPE_NONE
, the leader is disabled and does not display.
If the shape
is AVKey.SHAPE_TRIANGLE
, the leader extends from one side of the balloon's
frame and points to the balloon's screen reference point. The width of the leader (in pixels) where it intersects
the balloon's frame is specified by calling BalloonAttributes.setLeaderWidth(int)
.setLeaderShape
in interface BalloonAttributes
shape
- the leader shape to use, either AVKey.SHAPE_NONE
or AVKey.SHAPE_TRIANGLE
.BalloonAttributes.getLeaderShape()
,
BalloonAttributes.setLeaderWidth(int)
public void setLeaderWidth(int width)
width
must be zero or a
positive integer. Specifying a width
of zero disables the balloon's leader.
This does nothing if the balloon's leader shape is AVKey.SHAPE_NONE
.
If the balloon's leader shape is AVKey.SHAPE_TRIANGLE
, this specifies the size of the leader where
it intersects the balloon's frame.setLeaderWidth
in interface BalloonAttributes
width
- the desired leader width, in pixels.BalloonAttributes.getLeaderWidth()
public void setMaximumSize(Size maxSize)
AVKey.SHAPE_RECTANGLE
, then size
specifies the rectangle's maximum width and height. If
the balloon's shape is AVKey.SHAPE_ELLIPSE
, then size
specifies the ellipse's maximum
x- and y-radii. Specifying a null
size causes the balloon to have no maximum size.setMaximumSize
in interface BalloonAttributes
maxSize
- the desired maximum width and height of the balloon's shape in the viewport, or null
if
the balloon should have no maximum size.public void setOffset(Offset offset)
offset
. An offset
of (0, 0) pixels causes the balloon's lower left corner to be placed at the screen reference point. An
offset
of (1, 1) in fraction units causes the balloon's upper right corner to be placed at the
screen reference point.
If the balloon is attached to the globe, the screen reference point is the projection of its geographic position
into the viewport. If the balloon is attached to the screen, the screen reference point is the balloon's screen
point.
If the balloon has a leader shape, the leader extends from one side of the balloon's frame and points to the
screen reference point.setOffset
in interface BalloonAttributes
offset
- a location at which to align the balloon's lower left corner.BalloonAttributes.getOffset()
public void setSize(Size size)
AVKey.SHAPE_RECTANGLE
, then size
specifies the rectangle's width and height. If the
balloon's shape is AVKey.SHAPE_ELLIPSE
, then size
specifies the ellipse's x- and
y-radii.
The balloon's content area is the rectangle obtained by taking the balloon's size
and shrinking it
by the balloon's insets.setSize
in interface BalloonAttributes
size
- the desired width and height of the balloon's shape in the viewport.BalloonAttributes.getSize()
,
BalloonAttributes.getMaximumSize()
,
BalloonAttributes.setInsets(java.awt.Insets)
public void setTextColor(java.awt.Color color)
color
may be ignored if
the balloon's text contains HTML.setTextColor
in interface BalloonAttributes
color
- the color to use for the balloon's text.BalloonAttributes.getTextColor()