Package gov.nasa.worldwind.render
Class PointPlacemarkAttributes
- java.lang.Object
-
- gov.nasa.worldwind.render.PointPlacemarkAttributes
-
- All Implemented Interfaces:
Exportable
public class PointPlacemarkAttributes extends java.lang.Object implements Exportable
Holds attributes forPointPlacemark
s.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
antiAliasHint
protected static java.awt.Color
DEFAULT_IMAGE_COLOR
The default image color.static Offset
DEFAULT_IMAGE_OFFSET
The image offset to use if none specified.static java.lang.String
DEFAULT_IMAGE_PATH
The image file to use for the placemark's icon if no image file is specified in the placemark attributes.static java.lang.Double
DEFAULT_IMAGE_SCALE
The image scale to use if none specified.protected static java.awt.Color
DEFAULT_LABEL_COLOR
The default label color.static java.awt.Font
DEFAULT_LABEL_FONT
The default font to use for the placemark's label.static Offset
DEFAULT_LABEL_OFFSET
The default label offset.static java.lang.Double
DEFAULT_LABEL_SCALE
The label scale to use if none specified.protected static java.awt.Color
DEFAULT_LINE_COLOR
The default line color.protected boolean
drawImage
protected boolean
drawLabel
protected java.lang.Double
heading
protected java.lang.String
headingReference
protected java.awt.image.BufferedImage
image
protected java.lang.String
imageAddress
protected java.awt.Color
imageColor
Color to be blended with the image.protected Offset
imageOffset
protected java.awt.Font
labelFont
protected Material
labelMaterial
protected Offset
labelOffset
protected java.lang.Double
labelScale
protected Material
lineMaterial
protected java.lang.Double
lineWidth
protected java.lang.Double
pitch
protected java.lang.Double
scale
protected boolean
unresolved
protected boolean
usePointAsDefaultImage
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description PointPlacemarkAttributes()
Constructs an instance with default values for image address, image offset, image scale, label offset, label font and label color.PointPlacemarkAttributes(PointPlacemarkAttributes attrs)
Constructs an instance and initializes it to the values in a specified instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copy(PointPlacemarkAttributes attrs)
Copies all values, including null values, from another instance to this one.void
export(java.lang.String mimeType, java.lang.Object output)
Export the Placemark.protected void
exportAsKML(java.lang.Object output)
Export the placemark attributes to KML as a<Style>
element.int
getAntiAliasHint()
Returns the anti-alias hint.java.lang.Double
getHeading()
Returns the placemark image heading.java.lang.String
getHeadingReference()
Indicates the heading reference.java.awt.image.BufferedImage
getImage()
Returns theBufferedImage
previously specified tosetImage(java.awt.image.BufferedImage)
.java.lang.String
getImageAddress()
Returns the address of the placemark's image.java.awt.Color
getImageColor()
Sets the image color.Offset
getImageOffset()
Returns the image offset.java.awt.Color
getLabelColor()
Returns the label diffuse component of the label's material color.java.awt.Font
getLabelFont()
Material
getLabelMaterial()
Returns the label material.Offset
getLabelOffset()
Returns the label offset.java.lang.Double
getLabelScale()
Returns the placemark's label scale.java.awt.Color
getLineColor()
Returns the label diffuse component of the label's material color.Material
getLineMaterial()
Returns the line color.java.lang.Double
getLineWidth()
Returns this instance's line width.java.lang.Double
getPitch()
Indicates the placemark image pitch.java.lang.Double
getScale()
Returns the placemark image scale.boolean
isDrawImage()
Indicates whether the placemark's image is drawn.boolean
isDrawLabel()
Indicates whether the placemark's label is drawn.java.lang.String
isExportFormatSupported(java.lang.String format)
Does this object support a certain export format?boolean
isUnresolved()
Indicates whether one or more members of this remain unresolved because they must be retrieved from an external source.boolean
isUsePointAsDefaultImage()
Indicates whether to draw a point when the current source image is null.void
setAntiAliasHint(int antiAliasHint)
Specifies whether and how line anti-aliasing is performed.void
setDrawImage(boolean drawImage)
Specifies whether to draw the placemark's image.void
setDrawLabel(boolean drawLabel)
Specifies whether to draw the placemark's label.void
setHeading(java.lang.Double heading)
Specifies the placemark image heading, which is used by some placemark implementations to orient the placemark image.void
setHeadingReference(java.lang.String headingReference)
Specifies the heading reference.void
setImage(java.awt.image.BufferedImage image)
Specifies aBufferedImage
forPointPlacemark
s associated with this attribute bundle.void
setImageAddress(java.lang.String address)
Specifies the address of the placemark's image.void
setImageColor(java.awt.Color imageColor)
Sets the image color.void
setImageOffset(Offset offset)
Specifies a location within the placemark image to align with the placemark point.void
setLabelColor(java.lang.String labelColorString)
Sets the label color as a string in the form 0xAABBGGRR.void
setLabelFont(java.awt.Font labelFont)
void
setLabelMaterial(Material color)
Sets the label material.void
setLabelOffset(Offset offset)
Specifies a location relative to the placemark's image at which to align the label.void
setLabelScale(java.lang.Double scale)
Specifies the placemark label scale.void
setLineColor(java.lang.String lineColorString)
Sets the line color as a string in the form 0xAABBGGRR.void
setLineMaterial(Material lineColor)
Sets the line color.void
setLineWidth(java.lang.Double lineWidth)
Specifies the line width to use when rendering the optional placemark line.void
setPitch(java.lang.Double pitch)
Specifies the placemark image pitch.void
setScale(java.lang.Double scale)
Specifies the placemark image scale.void
setUnresolved(boolean unresolved)
Specifies whether one or more fields of this remain unresolved because they must be retrieved from an external source.void
setUsePointAsDefaultImage(boolean usePointAsDefaultImage)
Specifies whether to draw a point when the current source image is null.
-
-
-
Field Detail
-
imageAddress
protected java.lang.String imageAddress
-
image
protected java.awt.image.BufferedImage image
-
scale
protected java.lang.Double scale
-
heading
protected java.lang.Double heading
-
headingReference
protected java.lang.String headingReference
-
pitch
protected java.lang.Double pitch
-
imageOffset
protected Offset imageOffset
-
imageColor
protected java.awt.Color imageColor
Color to be blended with the image. This can be used to render the same image in different colors for different placemarks.
-
lineWidth
protected java.lang.Double lineWidth
-
lineMaterial
protected Material lineMaterial
-
antiAliasHint
protected int antiAliasHint
-
labelFont
protected java.awt.Font labelFont
-
labelOffset
protected Offset labelOffset
-
labelMaterial
protected Material labelMaterial
-
labelScale
protected java.lang.Double labelScale
-
usePointAsDefaultImage
protected boolean usePointAsDefaultImage
-
unresolved
protected boolean unresolved
-
drawImage
protected boolean drawImage
-
drawLabel
protected boolean drawLabel
-
DEFAULT_IMAGE_PATH
public static final java.lang.String DEFAULT_IMAGE_PATH
The image file to use for the placemark's icon if no image file is specified in the placemark attributes.
-
DEFAULT_IMAGE_OFFSET
public static final Offset DEFAULT_IMAGE_OFFSET
The image offset to use if none specified. This value is that required by the default image.
-
DEFAULT_IMAGE_SCALE
public static final java.lang.Double DEFAULT_IMAGE_SCALE
The image scale to use if none specified. This value is appropriate for the default image.
-
DEFAULT_LABEL_SCALE
public static final java.lang.Double DEFAULT_LABEL_SCALE
The label scale to use if none specified.
-
DEFAULT_IMAGE_COLOR
protected static final java.awt.Color DEFAULT_IMAGE_COLOR
The default image color.
-
DEFAULT_LABEL_OFFSET
public static final Offset DEFAULT_LABEL_OFFSET
The default label offset. This value is appropriate for the default image.
-
DEFAULT_LABEL_FONT
public static final java.awt.Font DEFAULT_LABEL_FONT
The default font to use for the placemark's label.
-
DEFAULT_LABEL_COLOR
protected static final java.awt.Color DEFAULT_LABEL_COLOR
The default label color.
-
DEFAULT_LINE_COLOR
protected static final java.awt.Color DEFAULT_LINE_COLOR
The default line color.
-
-
Constructor Detail
-
PointPlacemarkAttributes
public PointPlacemarkAttributes()
Constructs an instance with default values for image address, image offset, image scale, label offset, label font and label color.
-
PointPlacemarkAttributes
public PointPlacemarkAttributes(PointPlacemarkAttributes attrs)
Constructs an instance and initializes it to the values in a specified instance.- Parameters:
attrs
- the instance from which to copy the initial attribute values of this. May be null.
-
-
Method Detail
-
copy
public void copy(PointPlacemarkAttributes attrs)
Copies all values, including null values, from another instance to this one.- Parameters:
attrs
- the instance to copy values from.
-
getLineWidth
public java.lang.Double getLineWidth()
Returns this instance's line width.- Returns:
- the line width.
-
setLineWidth
public void setLineWidth(java.lang.Double lineWidth)
Specifies the line width to use when rendering the optional placemark line.- Parameters:
lineWidth
- the line width. May be null, in which case a width of 1 is used during rendering.
-
getLineMaterial
public Material getLineMaterial()
Returns the line color.- Returns:
- the line color.
-
getLineColor
public java.awt.Color getLineColor()
Returns the label diffuse component of the label's material color.- Returns:
- the label's diffuse color.
-
setLineMaterial
public void setLineMaterial(Material lineColor)
Sets the line color.- Parameters:
lineColor
- the line color. May be null.
-
setLineColor
public void setLineColor(java.lang.String lineColorString)
Sets the line color as a string in the form 0xAABBGGRR.- Parameters:
lineColorString
- the line color. May be null.
-
getImageColor
public java.awt.Color getImageColor()
Sets the image color. The image color is blended with the image, allowing the same image to be rendered in different colors for different placemarks.- Returns:
- The image color.
- See Also:
setImageColor(java.awt.Color)
-
setImageColor
public void setImageColor(java.awt.Color imageColor)
Sets the image color. The image color is blended with the image, allowing the same image to be rendered in different colors for different placemarks.- Parameters:
imageColor
- New image color.- See Also:
getImageColor()
-
getAntiAliasHint
public int getAntiAliasHint()
Returns the anti-alias hint. SeesetAntiAliasHint(int)
for the recognized values.- Returns:
- the anti-alias hint.
-
setAntiAliasHint
public void setAntiAliasHint(int antiAliasHint)
Specifies whether and how line anti-aliasing is performed. Recognized values areGL.GL_NEAREST
,GL.GL_FASTEST
, andGL.GL_NICEST
.- Parameters:
antiAliasHint
- the anti-alias hint.
-
getImageAddress
public java.lang.String getImageAddress()
Returns the address of the placemark's image.- Returns:
- the address of the placemark's image. May be null.
-
setImageAddress
public void setImageAddress(java.lang.String address)
Specifies the address of the placemark's image. The address may be a file path or a URL.- Parameters:
address
- the address of the placemark's image. May be null, in which case a default image is used.
-
getImage
public java.awt.image.BufferedImage getImage()
Returns theBufferedImage
previously specified tosetImage(java.awt.image.BufferedImage)
.- Returns:
- The image previously specified for this attribute bundle.
-
setImage
public void setImage(java.awt.image.BufferedImage image)
Specifies aBufferedImage
forPointPlacemark
s associated with this attribute bundle. When this method is called, this attribute bundle's image address is automatically set to a unique identifier for the image.- Parameters:
image
- the buffered image to use for the associated point placemarks. May be null, in which case this attribute bundle's image address is set to null by this method.
-
getScale
public java.lang.Double getScale()
Returns the placemark image scale. See [@link #setScale} for its description.- Returns:
- the placemark image scale.
-
setScale
public void setScale(java.lang.Double scale)
Specifies the placemark image scale. The scale is applied to the placemark image's width and height during rendering in order to control the rendered size of the image.- Parameters:
scale
- the placemark image scale. May be null, in which case no scaling is applied.
-
getHeading
public java.lang.Double getHeading()
Returns the placemark image heading.- Returns:
- the placemark image heading.
-
setHeading
public void setHeading(java.lang.Double heading)
Specifies the placemark image heading, which is used by some placemark implementations to orient the placemark image.- Parameters:
heading
- the placemark heading in degrees clockwise from North. May be null, in which case no heading is applied during rendering.
-
getHeadingReference
public java.lang.String getHeadingReference()
Indicates the heading reference.- Returns:
- the heading reference.
- See Also:
setHeadingReference(String)
-
setHeadingReference
public void setHeadingReference(java.lang.String headingReference)
Specifies the heading reference. IfAVKey.RELATIVE_TO_SCREEN
, the heading is interpreted as relative to the screen and the placemark icon maintains the heading relative to the screen's vertical edges. IfAVKey.RELATIVE_TO_GLOBE
, the heading is interpreted relative to the globe and the placemark icon maintains the heading relative to the globe's north direction.The default heading reference is null, which
PointPlacemark
interprets asAVKey.RELATIVE_TO_SCREEN
.- Parameters:
headingReference
- the heading reference. See the description for possible values.
-
getPitch
public java.lang.Double getPitch()
Indicates the placemark image pitch.- Returns:
- the placemark image pitch.
-
setPitch
public void setPitch(java.lang.Double pitch)
Specifies the placemark image pitch.- Parameters:
pitch
- the placemark pitch in degrees. May be null, in which case no pitch is applied during rendering.
-
getImageOffset
public Offset getImageOffset()
Returns the image offset.- Returns:
- the image offset.
-
setImageOffset
public void setImageOffset(Offset offset)
Specifies a location within the placemark image to align with the placemark point.- Parameters:
offset
- the hot spot controlling the image's placement relative to the placemark point. May be null to indicate that the image's lower left corner is aligned with the placemark point.
-
isUnresolved
public boolean isUnresolved()
Indicates whether one or more members of this remain unresolved because they must be retrieved from an external source.- Returns:
- true if there are unresolved fields, false if no fields remain unresolved.
-
setUnresolved
public void setUnresolved(boolean unresolved)
Specifies whether one or more fields of this remain unresolved because they must be retrieved from an external source.- Parameters:
unresolved
- true if there are unresolved fields, false if no fields remain unresolved.
-
getLabelFont
public java.awt.Font getLabelFont()
-
setLabelFont
public void setLabelFont(java.awt.Font labelFont)
-
getLabelOffset
public Offset getLabelOffset()
Returns the label offset.- Returns:
- the label offset.
-
setLabelOffset
public void setLabelOffset(Offset offset)
Specifies a location relative to the placemark's image at which to align the label. The label text begins at the point indicated by the offset. A offset of (0, 0) pixels causes the text to start at the lower left corner of the image. An offset of (1, 1) in fraction units causes the text to start at the upper right corner of the image. The text would also start there if the offset is in units of pixels and the X and Y values are the image width and height, respectively.If no offset is specified, the label is placed at the right edge of the image with the top of the text at about the same level as the top of the image. (An offset of (X = 1.0, Y = 0.6, both in fraction units.)
- Parameters:
offset
- the hot spot controlling the image's placement relative to the placemark point. May be null to indicate the default label offset.
-
getLabelMaterial
public Material getLabelMaterial()
Returns the label material.- Returns:
- the label material.
-
getLabelColor
public java.awt.Color getLabelColor()
Returns the label diffuse component of the label's material color.- Returns:
- the label's diffuse color.
-
setLabelMaterial
public void setLabelMaterial(Material color)
Sets the label material.- Parameters:
color
- the line material. May be null.
-
setLabelColor
public void setLabelColor(java.lang.String labelColorString)
Sets the label color as a string in the form 0xAABBGGRR.- Parameters:
labelColorString
- the line color. May be null.
-
getLabelScale
public java.lang.Double getLabelScale()
Returns the placemark's label scale. See [@link #setLabelScale} for its description.- Returns:
- the placemark label scale.
-
setLabelScale
public void setLabelScale(java.lang.Double scale)
Specifies the placemark label scale. The scale is applied to the placemark label's size after the base size is determined by the font.- Parameters:
scale
- the placemark image scale. May be null, in which case no scaling is applied.
-
isUsePointAsDefaultImage
public boolean isUsePointAsDefaultImage()
Indicates whether to draw a point when the current source image is null.- Returns:
- true if a point is drawn when the current source image is null, otherwise false.
- See Also:
setUsePointAsDefaultImage(boolean)
-
setUsePointAsDefaultImage
public void setUsePointAsDefaultImage(boolean usePointAsDefaultImage)
Specifies whether to draw a point when the current source image is null. When drawing the point, the scale of the currently active attributes specifies the diameter of the point in pixels. The point is drawn in the line color of the currently active attributes.- Parameters:
usePointAsDefaultImage
- true to draw a point when the current source image is null, otherwise false.- See Also:
isUsePointAsDefaultImage()
-
isExportFormatSupported
public java.lang.String isExportFormatSupported(java.lang.String format)
Does this object support a certain export format?- Specified by:
isExportFormatSupported
in interfaceExportable
- Parameters:
format
- Desired export format.- Returns:
- One of
Exportable.FORMAT_SUPPORTED
,Exportable.FORMAT_NOT_SUPPORTED
, orExportable.FORMAT_PARTIALLY_SUPPORTED
. - See Also:
Exportable.export(String, Object)
-
isDrawImage
public boolean isDrawImage()
Indicates whether the placemark's image is drawn.- Returns:
true
if the image is drawn, otherwisefalse
.
-
setDrawImage
public void setDrawImage(boolean drawImage)
Specifies whether to draw the placemark's image. When the image is not drawn, the placemark's label, if any, is drawn relative to the placemark's position.- Parameters:
drawImage
-true
to draw the image, otherwisefalse
.
-
isDrawLabel
public boolean isDrawLabel()
Indicates whether the placemark's label is drawn.- Returns:
true
if the label is drawn, otherwisefalse
.
-
setDrawLabel
public void setDrawLabel(boolean drawLabel)
Specifies whether to draw the placemark's label.- Parameters:
drawLabel
-true
to draw the label, otherwisefalse
.
-
export
public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException, java.lang.UnsupportedOperationException
Export the Placemark. Theoutput
object will receive the exported data. The type of this object depends on the export format. The formats and object types supported by this class are:Format Supported output object types ================================================================================ KML (application/vnd.google-earth.kml+xml) java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter
- Specified by:
export
in interfaceExportable
- Parameters:
mimeType
- MIME type of desired export format.output
- An object that will receive the exported data. The type of this object depends on the export format (see above).- Throws:
java.io.IOException
- If an exception occurs writing to the output object.java.lang.UnsupportedOperationException
- if the format is not supported by this object, or if theoutput
argument is not of a supported type.- See Also:
Exportable.isExportFormatSupported(String)
-
exportAsKML
protected void exportAsKML(java.lang.Object output) throws javax.xml.stream.XMLStreamException
Export the placemark attributes to KML as a<Style>
element. Theoutput
object will receive the data. This object must be one of: java.io.Writer
java.io.OutputStream
javax.xml.stream.XMLStreamWriter- Parameters:
output
- Object to receive the generated KML.- Throws:
javax.xml.stream.XMLStreamException
- If an exception occurs while writing the KML- See Also:
export(String, Object)
-
-