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 forPointPlacemarks.
-
-
Field Summary
Fields Modifier and Type Field Description protected intantiAliasHintprotected static java.awt.ColorDEFAULT_IMAGE_COLORThe default image color.static OffsetDEFAULT_IMAGE_OFFSETThe image offset to use if none specified.static java.lang.StringDEFAULT_IMAGE_PATHThe image file to use for the placemark's icon if no image file is specified in the placemark attributes.static java.lang.DoubleDEFAULT_IMAGE_SCALEThe image scale to use if none specified.protected static java.awt.ColorDEFAULT_LABEL_COLORThe default label color.static java.awt.FontDEFAULT_LABEL_FONTThe default font to use for the placemark's label.static OffsetDEFAULT_LABEL_OFFSETThe default label offset.static java.lang.DoubleDEFAULT_LABEL_SCALEThe label scale to use if none specified.protected static java.awt.ColorDEFAULT_LINE_COLORThe default line color.protected booleandrawImageprotected booleandrawLabelprotected java.lang.Doubleheadingprotected java.lang.StringheadingReferenceprotected java.awt.image.BufferedImageimageprotected java.lang.StringimageAddressprotected java.awt.ColorimageColorColor to be blended with the image.protected OffsetimageOffsetprotected java.awt.FontlabelFontprotected MateriallabelMaterialprotected OffsetlabelOffsetprotected java.lang.DoublelabelScaleprotected MateriallineMaterialprotected java.lang.DoublelineWidthprotected java.lang.Doublepitchprotected java.lang.Doublescaleprotected booleanunresolvedprotected booleanusePointAsDefaultImage-
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 voidcopy(PointPlacemarkAttributes attrs)Copies all values, including null values, from another instance to this one.voidexport(java.lang.String mimeType, java.lang.Object output)Export the Placemark.protected voidexportAsKML(java.lang.Object output)Export the placemark attributes to KML as a<Style>element.intgetAntiAliasHint()Returns the anti-alias hint.java.lang.DoublegetHeading()Returns the placemark image heading.java.lang.StringgetHeadingReference()Indicates the heading reference.java.awt.image.BufferedImagegetImage()Returns theBufferedImagepreviously specified tosetImage(java.awt.image.BufferedImage).java.lang.StringgetImageAddress()Returns the address of the placemark's image.java.awt.ColorgetImageColor()Sets the image color.OffsetgetImageOffset()Returns the image offset.java.awt.ColorgetLabelColor()Returns the label diffuse component of the label's material color.java.awt.FontgetLabelFont()MaterialgetLabelMaterial()Returns the label material.OffsetgetLabelOffset()Returns the label offset.java.lang.DoublegetLabelScale()Returns the placemark's label scale.java.awt.ColorgetLineColor()Returns the label diffuse component of the label's material color.MaterialgetLineMaterial()Returns the line color.java.lang.DoublegetLineWidth()Returns this instance's line width.java.lang.DoublegetPitch()Indicates the placemark image pitch.java.lang.DoublegetScale()Returns the placemark image scale.booleanisDrawImage()Indicates whether the placemark's image is drawn.booleanisDrawLabel()Indicates whether the placemark's label is drawn.java.lang.StringisExportFormatSupported(java.lang.String format)Does this object support a certain export format?booleanisUnresolved()Indicates whether one or more members of this remain unresolved because they must be retrieved from an external source.booleanisUsePointAsDefaultImage()Indicates whether to draw a point when the current source image is null.voidsetAntiAliasHint(int antiAliasHint)Specifies whether and how line anti-aliasing is performed.voidsetDrawImage(boolean drawImage)Specifies whether to draw the placemark's image.voidsetDrawLabel(boolean drawLabel)Specifies whether to draw the placemark's label.voidsetHeading(java.lang.Double heading)Specifies the placemark image heading, which is used by some placemark implementations to orient the placemark image.voidsetHeadingReference(java.lang.String headingReference)Specifies the heading reference.voidsetImage(java.awt.image.BufferedImage image)Specifies aBufferedImageforPointPlacemarks associated with this attribute bundle.voidsetImageAddress(java.lang.String address)Specifies the address of the placemark's image.voidsetImageColor(java.awt.Color imageColor)Sets the image color.voidsetImageOffset(Offset offset)Specifies a location within the placemark image to align with the placemark point.voidsetLabelColor(java.lang.String labelColorString)Sets the label color as a string in the form 0xAABBGGRR.voidsetLabelFont(java.awt.Font labelFont)voidsetLabelMaterial(Material color)Sets the label material.voidsetLabelOffset(Offset offset)Specifies a location relative to the placemark's image at which to align the label.voidsetLabelScale(java.lang.Double scale)Specifies the placemark label scale.voidsetLineColor(java.lang.String lineColorString)Sets the line color as a string in the form 0xAABBGGRR.voidsetLineMaterial(Material lineColor)Sets the line color.voidsetLineWidth(java.lang.Double lineWidth)Specifies the line width to use when rendering the optional placemark line.voidsetPitch(java.lang.Double pitch)Specifies the placemark image pitch.voidsetScale(java.lang.Double scale)Specifies the placemark image scale.voidsetUnresolved(boolean unresolved)Specifies whether one or more fields of this remain unresolved because they must be retrieved from an external source.voidsetUsePointAsDefaultImage(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 theBufferedImagepreviously 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 aBufferedImageforPointPlacemarks 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
PointPlacemarkinterprets 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:
isExportFormatSupportedin 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:
trueif 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-trueto draw the image, otherwisefalse.
-
isDrawLabel
public boolean isDrawLabel()
Indicates whether the placemark's label is drawn.- Returns:
trueif the label is drawn, otherwisefalse.
-
setDrawLabel
public void setDrawLabel(boolean drawLabel)
Specifies whether to draw the placemark's label.- Parameters:
drawLabel-trueto draw the label, otherwisefalse.
-
export
public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException, java.lang.UnsupportedOperationExceptionExport the Placemark. Theoutputobject 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:
exportin 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 theoutputargument is not of a supported type.- See Also:
Exportable.isExportFormatSupported(String)
-
exportAsKML
protected void exportAsKML(java.lang.Object output) throws javax.xml.stream.XMLStreamExceptionExport the placemark attributes to KML as a<Style>element. Theoutputobject 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)
-
-