public class PointPlacemark extends WWObjectImpl implements Renderable, Locatable, Movable, Highlightable, Exportable, Draggable
getDefaultAttributes()
.
This class implements and extends the functionality of a KML Point.
Point placemarks can participate in global text decluttering by setting their decluttering-enabled flag to true
. See setEnableDecluttering(boolean)
. The default for this flag is false
. When participating in
decluttering, only the point placemark's label is considered when determining interference with other text.
When the label of a point placemark is picked, the associated PickedObject
contains
the key AVKey.LABEL
Modifier and Type | Class and Description |
---|---|
static interface |
PointPlacemark.LODSelector
An interface to enable application selection of placemark level of detail.
|
class |
PointPlacemark.OrderedPlacemark |
Modifier and Type | Field and Description |
---|---|
protected PointPlacemarkAttributes |
activeAttributes |
protected WWTexture |
activeTexture |
protected int |
altitudeMode |
protected boolean |
alwaysOnTop |
protected boolean |
applyVerticalExaggeration |
protected boolean |
clipToHorizon |
protected static java.lang.Double |
DEFAULT_HIGHLIGHT_SCALE
The scale to use when highlighting if no highlight attributes are specified.
|
protected static Offset |
DEFAULT_LABEL_OFFSET_IF_UNSPECIFIED
The label offset to use if none is specified but an image has been specified.
|
protected static java.lang.Double |
DEFAULT_POINT_SIZE
The point size to use when none is specified.
|
protected static PointPlacemarkAttributes |
defaultAttributes
The attributes used if attributes are not specified.
|
protected java.lang.Object |
delegateOwner |
protected boolean |
dragEnabled |
protected DraggableSupport |
draggableSupport |
protected double |
dx |
protected double |
dy |
protected boolean |
enableBatchPicking |
protected boolean |
enableBatchRendering |
protected boolean |
enableDecluttering |
protected boolean |
enableLabelPicking |
protected double |
eyeDistance |
protected long |
frameNumber |
protected PointPlacemarkAttributes |
highlightAttrs |
protected boolean |
highlighted |
protected java.lang.String |
labelText |
protected boolean |
lineEnabled |
protected int |
linePickWidth |
protected PointPlacemark.LODSelector |
LODSelector |
protected PointPlacemarkAttributes |
normalAttrs |
protected static int |
PICK_Y_OFFSET |
protected static int |
PICK_Y_SIZE_DELTA |
protected Layer |
pickLayer |
protected PickSupport |
pickSupport |
protected Vec4 |
placePoint |
protected Position |
position |
protected Vec4 |
screenPoint |
protected Vec4 |
terrainPoint |
protected java.util.Map<java.lang.String,WWTexture> |
textures |
protected static java.lang.String |
TRANSPARENT_IMAGE_ADDRESS
The address of the transparent image used when attributes.isDrawImage is false.
|
protected boolean |
visible |
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Constructor and Description |
---|
PointPlacemark(Position position)
Construct a point placemark.
|
Modifier and Type | Method and Description |
---|---|
protected void |
beginDrawing(DrawContext dc)
Establish the OpenGL state needed to draw Paths.
|
protected WWTexture |
chooseTexture(PointPlacemarkAttributes attrs)
Determines the appropriate texture for the current availability.
|
protected void |
computeImageBounds(DrawContext dc,
PointPlacemark.OrderedPlacemark opm)
Computes the screen-space rectangle bounding the placemark image.
|
protected void |
computeImageOffset(DrawContext dc) |
protected Vec4 |
computeLabelPoint(DrawContext dc,
PointPlacemark.OrderedPlacemark opm)
Computes the screen coordinate (lower-left origin) location of this placemark's label.
|
protected void |
computePlacemarkPoints(DrawContext dc,
PointPlacemark.OrderedPlacemark opm)
Computes and stores the placemark's Cartesian location, the Cartesian location of the corresponding point on the
terrain (if the altitude mode requires it), and the screen-space projection of the placemark's point.
|
protected PickedObject |
createPickedObject(DrawContext dc,
java.awt.Color pickColor)
Create a
PickedObject for this placemark. |
protected void |
determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.
|
protected void |
doDrag(DragContext dragContext) |
protected void |
doDrawOrderedRenderable(DrawContext dc,
PickSupport pickCandidates,
PointPlacemark.OrderedPlacemark opm)
Draw this placemark as an ordered renderable.
|
void |
drag(DragContext dragContext)
Drag the object given the provided
DragContext . |
protected void |
drawBatched(DrawContext dc)
Draws this ordered renderable and all subsequent PointPlacemark ordered renderables in the ordered renderable
list.
|
protected void |
drawLabel(DrawContext dc,
PickSupport pickCandidates,
PointPlacemark.OrderedPlacemark opm)
Draws the placemark's label if a label is specified.
|
protected void |
drawLine(DrawContext dc,
PickSupport pickCandidates,
PointPlacemark.OrderedPlacemark opm)
Draws the placemark's line.
|
protected void |
drawOrderedRenderable(DrawContext dc,
PointPlacemark.OrderedPlacemark opm)
Draws the path as an ordered renderable.
|
protected void |
drawPoint(DrawContext dc,
PickSupport pickCandidates,
PointPlacemark.OrderedPlacemark opm)
Draws the placemark's line.
|
protected void |
endDrawing(DrawContext dc)
Pop the state set in beginDrawing.
|
void |
export(java.lang.String mimeType,
java.lang.Object output)
Export the Placemark.
|
protected void |
exportAsKML(java.lang.Object output)
Export the placemark to KML as a
<Placemark> element. |
protected PointPlacemarkAttributes |
getActiveAttributes() |
int |
getAltitudeMode()
Returns the placemark's altitude mode.
|
PointPlacemarkAttributes |
getAttributes()
Returns the attributes used when the placemark is drawn normally, not highlighted.
|
PointPlacemarkAttributes |
getDefaultAttributes()
Returns the attributes used if normal attributes are not specified.
|
java.lang.Object |
getDelegateOwner()
Returns the delegate owner of this placemark.
|
double |
getDistanceFromEye()
Returns the distance from the current view's eye point to the placemark.
|
PointPlacemarkAttributes |
getHighlightAttributes()
Returns the attributes used to draw the placemark when it's highlighted.
|
protected java.awt.Rectangle |
getLabelBounds(DrawContext dc,
PointPlacemark.OrderedPlacemark opm)
Determines the screen coordinate boundaries of this placemark's label.
|
java.lang.String |
getLabelText()
Returns the placemark's label text.
|
int |
getLinePickWidth() |
PointPlacemark.LODSelector |
getLODSelector()
Indicates this placemark's level of detail selector.
|
Position |
getPosition()
Returns the placemark's position.
|
Position |
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.
|
protected WWTexture |
initializeTexture(java.lang.String address)
Load a texture.
|
protected boolean |
intersectsFrustum(DrawContext dc,
PointPlacemark.OrderedPlacemark opm)
Determines whether the placemark image intersects the view frustum.
|
boolean |
isAlwaysOnTop()
Indicates the state of this placemark's always-on-top flag.
|
boolean |
isApplyVerticalExaggeration() |
boolean |
isClipToHorizon()
Indicates whether this placemark is shown if it is beyond the horizon.
|
boolean |
isDragEnabled()
Indicates whether the object is enabled for dragging.
|
protected boolean |
isDrawLine(DrawContext dc,
PointPlacemark.OrderedPlacemark opm)
Determines whether the placemark's optional line should be drawn and whether it intersects the view frustum.
|
protected boolean |
isDrawPoint(DrawContext dc)
Indicates whether a point should be drawn when the active texture is null.
|
boolean |
isEnableBatchPicking()
Indicates whether batch picking is enabled.
|
boolean |
isEnableBatchRendering()
Indicates whether batch rendering is enabled.
|
boolean |
isEnableDecluttering()
Indicates whether this placemark participates in global text decluttering.
|
boolean |
isEnableLabelPicking()
Indicates whether picking considers this placemark's label.
|
java.lang.String |
isExportFormatSupported(java.lang.String format)
Does this object support a certain export format?
|
boolean |
isHighlighted()
Indicates whether the placemark is drawn highlighted.
|
boolean |
isLineEnabled()
Indicates whether a line from the placemark point to the corresponding position on the terrain is drawn.
|
boolean |
isVisible()
Indicates whether the placemark is drawn when in view.
|
protected void |
makeOrderedRenderable(DrawContext dc)
If the scene controller is rendering ordered renderables, this method draws this placemark's image as an ordered
renderable.
|
void |
move(Position delta)
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
void |
moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
protected boolean |
mustDrawLabel()
Determines if the placemark label will be rendered.
|
void |
pick(DrawContext dc,
java.awt.Point pickPoint,
PointPlacemark.OrderedPlacemark opm) |
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
void |
setAltitudeMode(int altitudeMode)
Specifies the placemark's altitude mode.
|
void |
setAlwaysOnTop(boolean alwaysOnTop)
Specifies whether this placemark should appear on top of other placemarks and shapes in the scene.
|
void |
setApplyVerticalExaggeration(boolean applyVerticalExaggeration) |
void |
setAttributes(PointPlacemarkAttributes attrs)
Specifies the attributes used when the placemark is drawn normally, not highlighted.
|
void |
setClipToHorizon(boolean clipToHorizon)
Specifies whether this placemark is shown if it is beyond the horizon.
|
void |
setDelegateOwner(java.lang.Object owner)
Specifies the delegate owner of this placemark.
|
void |
setDragEnabled(boolean enabled)
Controls whether the object is enabled for dragging.
|
void |
setEnableBatchPicking(boolean enableBatchPicking)
Specifies whether adjacent PointPlacemarks in the ordered renderable list may be pick-tested together if they are
contained in the same layer.
|
void |
setEnableBatchRendering(boolean enableBatchRendering)
Specifies whether adjacent PointPlacemarks in the ordered renderable list may be rendered together if they are
contained in the same layer.
|
void |
setEnableDecluttering(boolean enableDecluttering)
Specifies whether this placemark participates in globe text decluttering.
|
void |
setEnableLabelPicking(boolean enableLabelPicking)
Specifies whether this placemark's label should be considered during picking.
|
void |
setHighlightAttributes(PointPlacemarkAttributes attrs)
Specifies the attributes used to draw the placemark when it's highlighted.
|
void |
setHighlighted(boolean highlighted)
Specfies whether the placemark is drawn highlighted.
|
void |
setLabelText(java.lang.String labelText)
Specifies the placemark's label text that is displayed alongside the placemark.
|
protected void |
setLineColor(DrawContext dc,
PickSupport pickCandidates)
Sets the color of the placemark's line during rendering.
|
void |
setLineEnabled(boolean lineEnabled)
Specifies whether a line from the placemark point to the corresponding position on the terrain is drawn.
|
void |
setLinePickWidth(int linePickWidth) |
protected void |
setLineWidth(DrawContext dc)
Sets the width of the placemark's line during rendering.
|
void |
setLODSelector(PointPlacemark.LODSelector LODSelector)
Specifies this placemark's level of detail selector.
|
protected void |
setPointSize(DrawContext dc)
Sets the width of the placemark's point during rendering.
|
void |
setPosition(Position position)
Sets the placemark's position.
|
void |
setVisible(boolean visible)
Specifies whether the placemark is drawn when in view.
|
onMessage, propertyChange
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected PointPlacemarkAttributes activeAttributes
protected WWTexture activeTexture
protected int altitudeMode
protected boolean alwaysOnTop
protected boolean applyVerticalExaggeration
protected boolean clipToHorizon
protected static final java.lang.Double DEFAULT_HIGHLIGHT_SCALE
protected static final Offset DEFAULT_LABEL_OFFSET_IF_UNSPECIFIED
protected static final java.lang.Double DEFAULT_POINT_SIZE
protected static final PointPlacemarkAttributes defaultAttributes
protected java.lang.Object delegateOwner
protected boolean dragEnabled
protected DraggableSupport draggableSupport
protected double dx
protected double dy
protected boolean enableBatchPicking
protected boolean enableBatchRendering
protected boolean enableDecluttering
protected boolean enableLabelPicking
protected double eyeDistance
protected long frameNumber
protected PointPlacemarkAttributes highlightAttrs
protected boolean highlighted
protected java.lang.String labelText
protected boolean lineEnabled
protected int linePickWidth
protected PointPlacemark.LODSelector LODSelector
protected PointPlacemarkAttributes normalAttrs
protected static final int PICK_Y_OFFSET
protected static final int PICK_Y_SIZE_DELTA
protected Layer pickLayer
protected PickSupport pickSupport
protected Vec4 placePoint
protected Position position
protected Vec4 screenPoint
protected Vec4 terrainPoint
protected java.util.Map<java.lang.String,WWTexture> textures
protected static final java.lang.String TRANSPARENT_IMAGE_ADDRESS
protected boolean visible
public PointPlacemark(Position position)
position
- the placemark position.java.lang.IllegalArgumentException
- if the position is null.protected void beginDrawing(DrawContext dc)
dc
- the current draw context.protected WWTexture chooseTexture(PointPlacemarkAttributes attrs)
attrs
- the attributes specifying the placemark image and properties.protected void computeImageBounds(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.opm
- the ordered placemark.protected void computeImageOffset(DrawContext dc)
protected Vec4 computeLabelPoint(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.opm
- the ordered renderable for the placemark.protected void computePlacemarkPoints(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.protected PickedObject createPickedObject(DrawContext dc, java.awt.Color pickColor)
PickedObject
for this placemark. The PickedObject returned by this method will be added to the
pick list to represent the current placemark.dc
- Active draw context.pickColor
- Unique color for this PickedObject.protected void determineActiveAttributes()
protected void doDrag(DragContext dragContext)
protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
PickSupport
. The PickSupport
may not be the one associated with this instance. During batch
picking the PickSupport
of the instance initiating the batch picking is used so that all shapes
rendered in batch are added to the same pick list.dc
- the current draw context.pickCandidates
- a pick support holding the picked object list to add this shape to.public void drag(DragContext dragContext)
Draggable
DragContext
.drag
in interface Draggable
dragContext
- the DragContext
of this dragging event.protected void drawBatched(DrawContext dc)
dc
- the current draw context.protected void drawLabel(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.protected void drawLine(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.pickCandidates
- the pick support object to use when adding this as a pick candidate.protected void drawOrderedRenderable(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.protected void drawPoint(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.pickCandidates
- the pick support object to use when adding this as a pick candidate.protected void endDrawing(DrawContext dc)
dc
- the current draw context.public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException
output
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
export
in interface Exportable
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).java.io.IOException
- If an exception occurs writing to the output object.Exportable.isExportFormatSupported(String)
protected void exportAsKML(java.lang.Object output) throws java.io.IOException, javax.xml.stream.XMLStreamException
<Placemark>
element. The output
object will receive the data.
This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriteroutput
- Object to receive the generated KML.javax.xml.stream.XMLStreamException
- If an exception occurs while writing the KMLjava.io.IOException
- if an exception occurs while exporting the data.export(String, Object)
protected PointPlacemarkAttributes getActiveAttributes()
public int getAltitudeMode()
setAltitudeMode(int)
for a description of the modes.public PointPlacemarkAttributes getAttributes()
public PointPlacemarkAttributes getDefaultAttributes()
public java.lang.Object getDelegateOwner()
public double getDistanceFromEye()
public PointPlacemarkAttributes getHighlightAttributes()
protected java.awt.Rectangle getLabelBounds(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.opm
- the ordered renderable for the placemark.public java.lang.String getLabelText()
public int getLinePickWidth()
public PointPlacemark.LODSelector getLODSelector()
public Position getPosition()
getPosition
in interface Locatable
public Position getReferencePosition()
getReferencePosition
in interface Movable
protected WWTexture initializeTexture(java.lang.String address)
address
- Path or URL to the image to load into a texture.protected boolean intersectsFrustum(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.public boolean isAlwaysOnTop()
true
if the always-on-top flag is set, otherwise false
.public boolean isApplyVerticalExaggeration()
public boolean isClipToHorizon()
true
if horizon clipping is enabled, otherwise false
. The default value is true
.public boolean isDragEnabled()
Draggable
isDragEnabled
in interface Draggable
protected boolean isDrawLine(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
dc
- the current draw context.protected boolean isDrawPoint(DrawContext dc)
dc
- the current draw context.public boolean isEnableBatchPicking()
setEnableBatchPicking(boolean).
public boolean isEnableBatchRendering()
setEnableBatchRendering(boolean).
public boolean isEnableDecluttering()
true
if this placemark participates in global text decluttering, otherwise false. The default
value is false
. Only the placemark's label is considered during decluttering.public boolean isEnableLabelPicking()
true
if this placemark's label is considered during picking, otherwise false
.public java.lang.String isExportFormatSupported(java.lang.String format)
isExportFormatSupported
in interface Exportable
format
- Desired export format.Exportable.FORMAT_SUPPORTED
, Exportable.FORMAT_NOT_SUPPORTED
, or Exportable.FORMAT_PARTIALLY_SUPPORTED
.Exportable.export(String, Object)
public boolean isHighlighted()
isHighlighted
in interface Highlightable
public boolean isLineEnabled()
public boolean isVisible()
protected void makeOrderedRenderable(DrawContext dc)
dc
- the current draw context.public void move(Position delta)
public void moveTo(Position position)
protected boolean mustDrawLabel()
public void pick(DrawContext dc, java.awt.Point pickPoint, PointPlacemark.OrderedPlacemark opm)
public void render(DrawContext dc)
Renderable
Renderable
to render itself using the provided draw context.render
in interface Renderable
dc
- the DrawContext
to be usedDrawContext
public void setAltitudeMode(int altitudeMode)
WorldWind.ABSOLUTE
-- the point is
placed at its specified position. altitudeMode
- the altitude modepublic void setAlwaysOnTop(boolean alwaysOnTop)
true
, this placemark's eye distance is set to 0 so that it will appear visually above other shapes
whose eye distance is greater than 0.alwaysOnTop
- true
if the placemark should appear always on top, otherwise false
.public void setApplyVerticalExaggeration(boolean applyVerticalExaggeration)
public void setAttributes(PointPlacemarkAttributes attrs)
attrs
- the attributes to use in normal mode. May be null to indicate use of default attributes.public void setClipToHorizon(boolean clipToHorizon)
clipToHorizon
- true
if this placemark should not be shown when beyond the horizon, otherwise false
.public void setDelegateOwner(java.lang.Object owner)
owner
- the object to use as the pickable object returned during picking, or null to return the placemark.public void setDragEnabled(boolean enabled)
Draggable
setDragEnabled
in interface Draggable
enabled
- true
if the object is enabled, else false
.public void setEnableBatchPicking(boolean enableBatchPicking)
SelectEvent
even if several of the placemarks are at the pick
position.
Batch rendering (setEnableBatchRendering(boolean)
) must be enabled in order for batch picking to occur.enableBatchPicking
- true to enable batch rendering, otherwise false.public void setEnableBatchRendering(boolean enableBatchRendering)
enableBatchRendering
- true to enable batch rendering, otherwise false.public void setEnableDecluttering(boolean enableDecluttering)
enableDecluttering
- true
if the placemark participates in global text decluttering, otherwise
false
. The default value is false
. Only the placemark lable is
considered during decluttering.public void setEnableLabelPicking(boolean enableLabelPicking)
enableLabelPicking
- true
to consider the label during picking, otherwise false
.public void setHighlightAttributes(PointPlacemarkAttributes attrs)
attrs
- the attributes to use in normal mode. May be null to indicate use of the normal attributes.public void setHighlighted(boolean highlighted)
setHighlighted
in interface Highlightable
highlighted
- true if the placemark is drawn highlighted, otherwise false.public void setLabelText(java.lang.String labelText)
labelText
- the placemark label text. If null, no label is displayed.protected void setLineColor(DrawContext dc, PickSupport pickCandidates)
dc
- the current draw context.pickCandidates
- the pick support object to use when adding this as a pick candidate.public void setLineEnabled(boolean lineEnabled)
lineEnabled
- true if the line is drawn, otherwise false.public void setLinePickWidth(int linePickWidth)
protected void setLineWidth(DrawContext dc)
dc
- the current draw context.public void setLODSelector(PointPlacemark.LODSelector LODSelector)
LODSelector
- the level of detail selector. May be null, the default, to indicate no level of detail
selector.protected void setPointSize(DrawContext dc)
dc
- the current draw context.public void setPosition(Position position)
position
- the placemark position.java.lang.IllegalArgumentException
- if the position is null.public void setVisible(boolean visible)
visible
- true if the placemark is drawn when in view, otherwise false.