Class PointPlacemark
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.PointPlacemark
-
- All Implemented Interfaces:
AVList,Draggable,MessageListener,Exportable,Locatable,Movable,Highlightable,Renderable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
KMLPointPlacemarkImpl
public class PointPlacemark extends WWObjectImpl implements Renderable, Locatable, Movable, Highlightable, Exportable, Draggable
Represents a point placemark consisting of an image, an optional line linking the image to a corresponding point on the terrain, and an optional label. The image and the label are displayed in the plane of the screen.Point placemarks have separate attributes for normal rendering and highlighted rendering. If highlighting is requested but no highlight attributes are specified, the normal attributes are used. If the normal attributes are not specified, default attributes are used. See
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. SeesetEnableDecluttering(boolean). The default for this flag isfalse. 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
PickedObjectcontains the keyAVKey.LABEL
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePointPlacemark.LODSelectorAn interface to enable application selection of placemark level of detail.classPointPlacemark.OrderedPlacemark
-
Field Summary
Fields Modifier and Type Field Description protected PointPlacemarkAttributesactiveAttributesprotected WWTextureactiveTextureprotected intaltitudeModeprotected booleanalwaysOnTopprotected booleanapplyVerticalExaggerationprotected booleanclipToHorizonprotected static java.lang.DoubleDEFAULT_HIGHLIGHT_SCALEThe scale to use when highlighting if no highlight attributes are specified.protected static OffsetDEFAULT_LABEL_OFFSET_IF_UNSPECIFIEDThe label offset to use if none is specified but an image has been specified.protected static java.lang.DoubleDEFAULT_POINT_SIZEThe point size to use when none is specified.protected static PointPlacemarkAttributesdefaultAttributesThe attributes used if attributes are not specified.protected java.lang.ObjectdelegateOwnerprotected booleandragEnabledprotected DraggableSupportdraggableSupportprotected doubledxprotected doubledyprotected booleanenableBatchPickingprotected booleanenableBatchRenderingprotected booleanenableDeclutteringprotected booleanenableLabelPickingprotected doubleeyeDistanceprotected longframeNumberprotected PointPlacemarkAttributeshighlightAttrsprotected booleanhighlightedprotected java.lang.StringlabelTextprotected booleanlineEnabledprotected intlinePickWidthprotected PointPlacemark.LODSelectorLODSelectorprotected PointPlacemarkAttributesnormalAttrsprotected static intPICK_Y_OFFSETprotected static intPICK_Y_SIZE_DELTAprotected LayerpickLayerprotected PickSupportpickSupportprotected Vec4placePointprotected Positionpositionprotected Vec4screenPointprotected Vec4terrainPointprotected java.util.Map<java.lang.String,WWTexture>texturesprotected static java.lang.StringTRANSPARENT_IMAGE_ADDRESSThe address of the transparent image used when attributes.isDrawImage is false.protected booleanvisible-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description PointPlacemark(Position position)Construct a point placemark.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbeginDrawing(DrawContext dc)Establish the OpenGL state needed to draw Paths.protected WWTexturechooseTexture(PointPlacemarkAttributes attrs)Determines the appropriate texture for the current availability.protected voidcomputeImageBounds(DrawContext dc, PointPlacemark.OrderedPlacemark opm)Computes the screen-space rectangle bounding the placemark image.protected voidcomputeImageOffset(DrawContext dc)protected Vec4computeLabelPoint(DrawContext dc, PointPlacemark.OrderedPlacemark opm)Computes the screen coordinate (lower-left origin) location of this placemark's label.protected voidcomputePlacemarkPoints(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.Applies the placemark's altitude mode when computing the points.protected PickedObjectcreatePickedObject(DrawContext dc, java.awt.Color pickColor)Create aPickedObjectfor this placemark.protected voiddetermineActiveAttributes()Determines which attributes -- normal, highlight or default -- to use each frame.protected voiddoDrag(DragContext dragContext)protected voiddoDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)Draw this placemark as an ordered renderable.If in picking mode, add it to the picked object list of specifiedPickSupport.voiddrag(DragContext dragContext)Drag the object given the providedDragContext.protected voiddrawBatched(DrawContext dc)Draws this ordered renderable and all subsequent PointPlacemark ordered renderables in the ordered renderable list.protected voiddrawLabel(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)Draws the placemark's label if a label is specified.protected voiddrawLine(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)Draws the placemark's line.protected voiddrawOrderedRenderable(DrawContext dc, PointPlacemark.OrderedPlacemark opm)Draws the path as an ordered renderable.protected voiddrawPoint(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)Draws the placemark's line.protected voidendDrawing(DrawContext dc)Pop the state set in beginDrawing.voidexport(java.lang.String mimeType, java.lang.Object output)Export the Placemark.protected voidexportAsKML(java.lang.Object output)Export the placemark to KML as a<Placemark>element.protected PointPlacemarkAttributesgetActiveAttributes()intgetAltitudeMode()Returns the placemark's altitude mode.PointPlacemarkAttributesgetAttributes()Returns the attributes used when the placemark is drawn normally, not highlighted.PointPlacemarkAttributesgetDefaultAttributes()Returns the attributes used if normal attributes are not specified.java.lang.ObjectgetDelegateOwner()Returns the delegate owner of this placemark.doublegetDistanceFromEye()Returns the distance from the current view's eye point to the placemark.PointPlacemarkAttributesgetHighlightAttributes()Returns the attributes used to draw the placemark when it's highlighted.protected java.awt.RectanglegetLabelBounds(DrawContext dc, PointPlacemark.OrderedPlacemark opm)Determines the screen coordinate boundaries of this placemark's label.java.lang.StringgetLabelText()Returns the placemark's label text.intgetLinePickWidth()PointPlacemark.LODSelectorgetLODSelector()Indicates this placemark's level of detail selector.PositiongetPosition()Returns the placemark's position.PositiongetReferencePosition()A position associated with the object that indicates its aggregate geographic position.protected WWTextureinitializeTexture(java.lang.String address)Load a texture.protected booleanintersectsFrustum(DrawContext dc, PointPlacemark.OrderedPlacemark opm)Determines whether the placemark image intersects the view frustum.booleanisAlwaysOnTop()Indicates the state of this placemark's always-on-top flag.booleanisApplyVerticalExaggeration()booleanisClipToHorizon()Indicates whether this placemark is shown if it is beyond the horizon.booleanisDragEnabled()Indicates whether the object is enabled for dragging.protected booleanisDrawLine(DrawContext dc, PointPlacemark.OrderedPlacemark opm)Determines whether the placemark's optional line should be drawn and whether it intersects the view frustum.protected booleanisDrawPoint(DrawContext dc)Indicates whether a point should be drawn when the active texture is null.booleanisEnableBatchPicking()Indicates whether batch picking is enabled.booleanisEnableBatchRendering()Indicates whether batch rendering is enabled.booleanisEnableDecluttering()Indicates whether this placemark participates in global text decluttering.booleanisEnableLabelPicking()Indicates whether picking considers this placemark's label.java.lang.StringisExportFormatSupported(java.lang.String format)Does this object support a certain export format?booleanisHighlighted()Indicates whether the placemark is drawn highlighted.booleanisLineEnabled()Indicates whether a line from the placemark point to the corresponding position on the terrain is drawn.booleanisVisible()Indicates whether the placemark is drawn when in view.protected voidmakeOrderedRenderable(DrawContext dc)If the scene controller is rendering ordered renderables, this method draws this placemark's image as an ordered renderable.voidmove(Position delta)Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.voidmoveTo(Position position)Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.protected booleanmustDrawLabel()Determines if the placemark label will be rendered.voidpick(DrawContext dc, java.awt.Point pickPoint, PointPlacemark.OrderedPlacemark opm)voidrender(DrawContext dc)Causes thisRenderableto render itself using the provided draw context.voidsetAltitudeMode(int altitudeMode)Specifies the placemark's altitude mode.voidsetAlwaysOnTop(boolean alwaysOnTop)Specifies whether this placemark should appear on top of other placemarks and shapes in the scene.voidsetApplyVerticalExaggeration(boolean applyVerticalExaggeration)voidsetAttributes(PointPlacemarkAttributes attrs)Specifies the attributes used when the placemark is drawn normally, not highlighted.voidsetClipToHorizon(boolean clipToHorizon)Specifies whether this placemark is shown if it is beyond the horizon.voidsetDelegateOwner(java.lang.Object owner)Specifies the delegate owner of this placemark.voidsetDragEnabled(boolean enabled)Controls whether the object is enabled for dragging.voidsetEnableBatchPicking(boolean enableBatchPicking)Specifies whether adjacent PointPlacemarks in the ordered renderable list may be pick-tested together if they are contained in the same layer.voidsetEnableBatchRendering(boolean enableBatchRendering)Specifies whether adjacent PointPlacemarks in the ordered renderable list may be rendered together if they are contained in the same layer.voidsetEnableDecluttering(boolean enableDecluttering)Specifies whether this placemark participates in globe text decluttering.voidsetEnableLabelPicking(boolean enableLabelPicking)Specifies whether this placemark's label should be considered during picking.voidsetHighlightAttributes(PointPlacemarkAttributes attrs)Specifies the attributes used to draw the placemark when it's highlighted.voidsetHighlighted(boolean highlighted)Specfies whether the placemark is drawn highlighted.voidsetLabelText(java.lang.String labelText)Specifies the placemark's label text that is displayed alongside the placemark.protected voidsetLineColor(DrawContext dc, PickSupport pickCandidates)Sets the color of the placemark's line during rendering.voidsetLineEnabled(boolean lineEnabled)Specifies whether a line from the placemark point to the corresponding position on the terrain is drawn.voidsetLinePickWidth(int linePickWidth)protected voidsetLineWidth(DrawContext dc)Sets the width of the placemark's line during rendering.voidsetLODSelector(PointPlacemark.LODSelector LODSelector)Specifies this placemark's level of detail selector.protected voidsetPointSize(DrawContext dc)Sets the width of the placemark's point during rendering.voidsetPosition(Position position)Sets the placemark's position.voidsetVisible(boolean visible)Specifies whether the placemark is drawn when in view.-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
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
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
-
-
-
Field Detail
-
DEFAULT_HIGHLIGHT_SCALE
protected static final java.lang.Double DEFAULT_HIGHLIGHT_SCALE
The scale to use when highlighting if no highlight attributes are specified.
-
DEFAULT_LABEL_OFFSET_IF_UNSPECIFIED
protected static final Offset DEFAULT_LABEL_OFFSET_IF_UNSPECIFIED
The label offset to use if none is specified but an image has been specified.
-
DEFAULT_POINT_SIZE
protected static final java.lang.Double DEFAULT_POINT_SIZE
The point size to use when none is specified.
-
TRANSPARENT_IMAGE_ADDRESS
protected static final java.lang.String TRANSPARENT_IMAGE_ADDRESS
The address of the transparent image used when attributes.isDrawImage is false.- See Also:
- Constant Field Values
-
PICK_Y_OFFSET
protected static final int PICK_Y_OFFSET
- See Also:
- Constant Field Values
-
PICK_Y_SIZE_DELTA
protected static final int PICK_Y_SIZE_DELTA
- See Also:
- Constant Field Values
-
defaultAttributes
protected static final PointPlacemarkAttributes defaultAttributes
The attributes used if attributes are not specified.
-
position
protected Position position
-
labelText
protected java.lang.String labelText
-
normalAttrs
protected PointPlacemarkAttributes normalAttrs
-
highlightAttrs
protected PointPlacemarkAttributes highlightAttrs
-
activeAttributes
protected PointPlacemarkAttributes activeAttributes
-
textures
protected java.util.Map<java.lang.String,WWTexture> textures
-
activeTexture
protected WWTexture activeTexture
-
highlighted
protected boolean highlighted
-
dragEnabled
protected boolean dragEnabled
-
draggableSupport
protected DraggableSupport draggableSupport
-
visible
protected boolean visible
-
altitudeMode
protected int altitudeMode
-
lineEnabled
protected boolean lineEnabled
-
applyVerticalExaggeration
protected boolean applyVerticalExaggeration
-
linePickWidth
protected int linePickWidth
-
enableBatchRendering
protected boolean enableBatchRendering
-
enableBatchPicking
protected boolean enableBatchPicking
-
delegateOwner
protected java.lang.Object delegateOwner
-
clipToHorizon
protected boolean clipToHorizon
-
enableDecluttering
protected boolean enableDecluttering
-
enableLabelPicking
protected boolean enableLabelPicking
-
alwaysOnTop
protected boolean alwaysOnTop
-
LODSelector
protected PointPlacemark.LODSelector LODSelector
-
frameNumber
protected long frameNumber
-
placePoint
protected Vec4 placePoint
-
terrainPoint
protected Vec4 terrainPoint
-
screenPoint
protected Vec4 screenPoint
-
eyeDistance
protected double eyeDistance
-
dx
protected double dx
-
dy
protected double dy
-
pickLayer
protected Layer pickLayer
-
pickSupport
protected PickSupport pickSupport
-
-
Constructor Detail
-
PointPlacemark
public PointPlacemark(Position position)
Construct a point placemark.- Parameters:
position- the placemark position.- Throws:
java.lang.IllegalArgumentException- if the position is null.
-
-
Method Detail
-
setPosition
public void setPosition(Position position)
Sets the placemark's position.- Parameters:
position- the placemark position.- Throws:
java.lang.IllegalArgumentException- if the position is null.
-
getPosition
public Position getPosition()
Returns the placemark's position.- Specified by:
getPositionin interfaceLocatable- Returns:
- the placemark's position.
-
isVisible
public boolean isVisible()
Indicates whether the placemark is drawn when in view.- Returns:
- true if the placemark is drawn when in view, otherwise false.
-
setVisible
public void setVisible(boolean visible)
Specifies whether the placemark is drawn when in view.- Parameters:
visible- true if the placemark is drawn when in view, otherwise false.
-
getAltitudeMode
public int getAltitudeMode()
Returns the placemark's altitude mode. SeesetAltitudeMode(int)for a description of the modes.- Returns:
- the placemark's altitude mode.
-
setAltitudeMode
public void setAltitudeMode(int altitudeMode)
Specifies the placemark's altitude mode. Recognized modes are:- @link WorldWind#CLAMP_TO_GROUND} -- the point is placed on the terrain at the latitude and longitude of its position.
- @link WorldWind#RELATIVE_TO_GROUND} -- the point is placed above the terrain at the latitude and longitude of its position and the distance specified by its elevation.
WorldWind.ABSOLUTE-- the point is placed at its specified position.
- Parameters:
altitudeMode- the altitude mode
-
getDistanceFromEye
public double getDistanceFromEye()
Returns the distance from the current view's eye point to the placemark.- Returns:
- the distance from the placemark to the current view's eye point.
-
isLineEnabled
public boolean isLineEnabled()
Indicates whether a line from the placemark point to the corresponding position on the terrain is drawn.- Returns:
- true if the line is drawn, otherwise false.
-
setLineEnabled
public void setLineEnabled(boolean lineEnabled)
Specifies whether a line from the placemark point to the corresponding position on the terrain is drawn.- Parameters:
lineEnabled- true if the line is drawn, otherwise false.
-
setAttributes
public void setAttributes(PointPlacemarkAttributes attrs)
Specifies the attributes used when the placemark is drawn normally, not highlighted.- Parameters:
attrs- the attributes to use in normal mode. May be null to indicate use of default attributes.
-
getAttributes
public PointPlacemarkAttributes getAttributes()
Returns the attributes used when the placemark is drawn normally, not highlighted.- Returns:
- the attributes used in normal mode. May be null to indicate use of default attributes.
-
setHighlightAttributes
public void setHighlightAttributes(PointPlacemarkAttributes attrs)
Specifies the attributes used to draw the placemark when it's highlighted.- Parameters:
attrs- the attributes to use in normal mode. May be null to indicate use of the normal attributes.
-
getHighlightAttributes
public PointPlacemarkAttributes getHighlightAttributes()
Returns the attributes used to draw the placemark when it's highlighted.- Returns:
- the attributes used in normal mode. May be null to indicate use of the normal attributes.
-
getDefaultAttributes
public PointPlacemarkAttributes getDefaultAttributes()
Returns the attributes used if normal attributes are not specified.- Returns:
- the default attributes.
-
isHighlighted
public boolean isHighlighted()
Indicates whether the placemark is drawn highlighted.- Specified by:
isHighlightedin interfaceHighlightable- Returns:
- true if the placemark is drawn highlighted, otherwise false.
-
setHighlighted
public void setHighlighted(boolean highlighted)
Specfies whether the placemark is drawn highlighted.- Specified by:
setHighlightedin interfaceHighlightable- Parameters:
highlighted- true if the placemark is drawn highlighted, otherwise false.
-
getLabelText
public java.lang.String getLabelText()
Returns the placemark's label text.- Returns:
- the placemark's label next, which man be null.
-
setLabelText
public void setLabelText(java.lang.String labelText)
Specifies the placemark's label text that is displayed alongside the placemark.- Parameters:
labelText- the placemark label text. If null, no label is displayed.
-
isApplyVerticalExaggeration
public boolean isApplyVerticalExaggeration()
-
setApplyVerticalExaggeration
public void setApplyVerticalExaggeration(boolean applyVerticalExaggeration)
-
getLinePickWidth
public int getLinePickWidth()
-
setLinePickWidth
public void setLinePickWidth(int linePickWidth)
-
isEnableBatchRendering
public boolean isEnableBatchRendering()
Indicates whether batch rendering is enabled.- Returns:
- true if batch rendering is enabled, otherwise false.
- See Also:
setEnableBatchRendering(boolean)
-
setEnableBatchRendering
public 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. This increases performance and there is seldom a reason to disable it.- Parameters:
enableBatchRendering- true to enable batch rendering, otherwise false.
-
isEnableBatchPicking
public boolean isEnableBatchPicking()
Indicates whether batch picking is enabled.- Returns:
- true if batch rendering is enabled, otherwise false.
- See Also:
setEnableBatchPicking(boolean)
-
getDelegateOwner
public java.lang.Object getDelegateOwner()
Returns the delegate owner of this placemark. If non-null, the returned object replaces the placemark as the pickable object returned during picking. If null, the placemark itself is the pickable object returned during picking.- Returns:
- the object used as the pickable object returned during picking, or null to indicate the the placemark is returned during picking.
-
setDelegateOwner
public void setDelegateOwner(java.lang.Object owner)
Specifies the delegate owner of this placemark. If non-null, the delegate owner replaces the placemark as the pickable object returned during picking. If null, the placemark itself is the pickable object returned during picking.- Parameters:
owner- the object to use as the pickable object returned during picking, or null to return the placemark.
-
getActiveAttributes
protected PointPlacemarkAttributes getActiveAttributes()
-
setEnableBatchPicking
public 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. This increases performance but allows only the top-most of the placemarks to be reported in aSelectEventeven if several of the placemarks are at the pick position.Batch rendering (
setEnableBatchRendering(boolean)) must be enabled in order for batch picking to occur.- Parameters:
enableBatchPicking- true to enable batch rendering, otherwise false.
-
isClipToHorizon
public boolean isClipToHorizon()
Indicates whether this placemark is shown if it is beyond the horizon.- Returns:
- the value of the clip-to-horizon flag.
trueif horizon clipping is enabled, otherwisefalse. The default value istrue.
-
setClipToHorizon
public void setClipToHorizon(boolean clipToHorizon)
Specifies whether this placemark is shown if it is beyond the horizon.- Parameters:
clipToHorizon-trueif this placemark should not be shown when beyond the horizon, otherwisefalse.
-
isEnableDecluttering
public boolean isEnableDecluttering()
Indicates whether this placemark participates in global text decluttering.- Returns:
trueif this placemark participates in global text decluttering, otherwise false. The default value isfalse. Only the placemark's label is considered during decluttering.
-
setEnableDecluttering
public void setEnableDecluttering(boolean enableDecluttering)
Specifies whether this placemark participates in globe text decluttering.- Parameters:
enableDecluttering-trueif the placemark participates in global text decluttering, otherwisefalse. The default value isfalse. Only the placemark lable is considered during decluttering.
-
isEnableLabelPicking
public boolean isEnableLabelPicking()
Indicates whether picking considers this placemark's label.- Returns:
trueif this placemark's label is considered during picking, otherwisefalse.
-
setEnableLabelPicking
public void setEnableLabelPicking(boolean enableLabelPicking)
Specifies whether this placemark's label should be considered during picking. The default is not to consider the placemark's label during picking.- Parameters:
enableLabelPicking-trueto consider the label during picking, otherwisefalse.
-
isAlwaysOnTop
public boolean isAlwaysOnTop()
Indicates the state of this placemark's always-on-top flag.- Returns:
trueif the always-on-top flag is set, otherwisefalse.
-
setAlwaysOnTop
public void setAlwaysOnTop(boolean alwaysOnTop)
Specifies whether this placemark should appear on top of other placemarks and shapes in the scene. If the flag istrue, 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.- Parameters:
alwaysOnTop-trueif the placemark should appear always on top, otherwisefalse.
-
getLODSelector
public PointPlacemark.LODSelector getLODSelector()
Indicates this placemark's level of detail selector.- Returns:
- this placemark's level of detail selector, or null if one has not been specified.
-
setLODSelector
public void setLODSelector(PointPlacemark.LODSelector LODSelector)
Specifies this placemark's level of detail selector.- Parameters:
LODSelector- the level of detail selector. May be null, the default, to indicate no level of detail selector.
-
isDrawPoint
protected boolean isDrawPoint(DrawContext dc)
Indicates whether a point should be drawn when the active texture is null.- Parameters:
dc- the current draw context.- Returns:
- true if a point should be drawn, otherwise false.
-
pick
public void pick(DrawContext dc, java.awt.Point pickPoint, PointPlacemark.OrderedPlacemark opm)
-
render
public void render(DrawContext dc)
Description copied from interface:RenderableCauses thisRenderableto render itself using the provided draw context.- Specified by:
renderin interfaceRenderable- Parameters:
dc- theDrawContextto be used- See Also:
DrawContext
-
makeOrderedRenderable
protected void makeOrderedRenderable(DrawContext dc)
If the scene controller is rendering ordered renderables, this method draws this placemark's image as an ordered renderable. Otherwise the method determines whether this instance should be added to the ordered renderable list.The Cartesian and screen points of the placemark are computed during the first call per frame and re-used in subsequent calls of that frame.
- Parameters:
dc- the current draw context.
-
intersectsFrustum
protected boolean intersectsFrustum(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
Determines whether the placemark image intersects the view frustum.- Parameters:
dc- the current draw context.opm- The placemark to check.- Returns:
- true if the image intersects the frustum, otherwise false.
-
beginDrawing
protected void beginDrawing(DrawContext dc)
Establish the OpenGL state needed to draw Paths.- Parameters:
dc- the current draw context.
-
endDrawing
protected void endDrawing(DrawContext dc)
Pop the state set in beginDrawing.- Parameters:
dc- the current draw context.
-
drawOrderedRenderable
protected void drawOrderedRenderable(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
Draws the path as an ordered renderable.- Parameters:
dc- the current draw context.opm- The object to draw.
-
drawBatched
protected void drawBatched(DrawContext dc)
Draws this ordered renderable and all subsequent PointPlacemark ordered renderables in the ordered renderable list.- Parameters:
dc- the current draw context.
-
doDrawOrderedRenderable
protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
Draw this placemark as an ordered renderable.If in picking mode, add it to the picked object list of specifiedPickSupport. ThePickSupportmay not be the one associated with this instance. During batch picking thePickSupportof the instance initiating the batch picking is used so that all shapes rendered in batch are added to the same pick list.- Parameters:
dc- the current draw context.pickCandidates- a pick support holding the picked object list to add this shape to.opm- The placemark to draw.
-
createPickedObject
protected PickedObject createPickedObject(DrawContext dc, java.awt.Color pickColor)
Create aPickedObjectfor this placemark. The PickedObject returned by this method will be added to the pick list to represent the current placemark.- Parameters:
dc- Active draw context.pickColor- Unique color for this PickedObject.- Returns:
- A new picked object.
-
mustDrawLabel
protected boolean mustDrawLabel()
Determines if the placemark label will be rendered.- Returns:
- True if the label must be drawn.
-
getLabelBounds
protected java.awt.Rectangle getLabelBounds(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
Determines the screen coordinate boundaries of this placemark's label.- Parameters:
dc- the current draw context.opm- the ordered renderable for the placemark.- Returns:
- the label bounds, in lower-left origin screen coordinates, or null if there is no label.
-
drawLabel
protected void drawLabel(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
Draws the placemark's label if a label is specified.- Parameters:
dc- the current draw context.pickCandidates- The list of pick candidates.opm- The placemark to label.
-
drawLine
protected void drawLine(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
Draws the placemark's line.- Parameters:
dc- the current draw context.pickCandidates- the pick support object to use when adding this as a pick candidate.opm- The placemark to draw the line for.
-
drawPoint
protected void drawPoint(DrawContext dc, PickSupport pickCandidates, PointPlacemark.OrderedPlacemark opm)
Draws the placemark's line.- Parameters:
dc- the current draw context.pickCandidates- the pick support object to use when adding this as a pick candidate.opm- The placemark to draw the point for.
-
isDrawLine
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.- Parameters:
dc- the current draw context.opm- The placemark to check.- Returns:
- true if the line should be drawn and it intersects the view frustum, otherwise false.
-
setLineWidth
protected void setLineWidth(DrawContext dc)
Sets the width of the placemark's line during rendering.- Parameters:
dc- the current draw context.
-
setPointSize
protected void setPointSize(DrawContext dc)
Sets the width of the placemark's point during rendering.- Parameters:
dc- the current draw context.
-
setLineColor
protected void setLineColor(DrawContext dc, PickSupport pickCandidates)
Sets the color of the placemark's line during rendering.- Parameters:
dc- the current draw context.pickCandidates- the pick support object to use when adding this as a pick candidate.
-
determineActiveAttributes
protected void determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.
-
chooseTexture
protected WWTexture chooseTexture(PointPlacemarkAttributes attrs)
Determines the appropriate texture for the current availability.- Parameters:
attrs- the attributes specifying the placemark image and properties.- Returns:
- the appropriate texture, or null if an image is not available.
-
initializeTexture
protected WWTexture initializeTexture(java.lang.String address)
Load a texture. If the texture source is not available locally, this method requests the texture source and returns null.- Parameters:
address- Path or URL to the image to load into a texture.- Returns:
- The new texture, or null if the texture could not be created because the resource is not yet available locally.
-
computePlacemarkPoints
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.Applies the placemark's altitude mode when computing the points.- Parameters:
dc- the current draw context.opm- The placemark to compute the location of.
-
computeImageBounds
protected void computeImageBounds(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
Computes the screen-space rectangle bounding the placemark image.- Parameters:
dc- the current draw context.opm- the ordered placemark.
-
computeLabelPoint
protected Vec4 computeLabelPoint(DrawContext dc, PointPlacemark.OrderedPlacemark opm)
Computes the screen coordinate (lower-left origin) location of this placemark's label.- Parameters:
dc- the current draw context.opm- the ordered renderable for the placemark.- Returns:
- the 2D label location, or null if there is no label.
-
computeImageOffset
protected void computeImageOffset(DrawContext dc)
-
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)
-
getReferencePosition
public Position getReferencePosition()
A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.- Specified by:
getReferencePositionin interfaceMovable- Returns:
- the object's reference position, or null if no reference position is available.
-
move
public void move(Position delta)
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
-
moveTo
public void moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
-
isDragEnabled
public boolean isDragEnabled()
Description copied from interface:DraggableIndicates whether the object is enabled for dragging.- Specified by:
isDragEnabledin interfaceDraggable- Returns:
- true if the object is enabled, else false.
-
setDragEnabled
public void setDragEnabled(boolean enabled)
Description copied from interface:DraggableControls whether the object is enabled for dragging.- Specified by:
setDragEnabledin interfaceDraggable- Parameters:
enabled-trueif the object is enabled, elsefalse.
-
drag
public void drag(DragContext dragContext)
Description copied from interface:DraggableDrag the object given the providedDragContext.- Specified by:
dragin interfaceDraggable- Parameters:
dragContext- theDragContextof this dragging event.
-
doDrag
protected void doDrag(DragContext dragContext)
-
export
public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOExceptionExport 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.- See Also:
Exportable.isExportFormatSupported(String)
-
exportAsKML
protected void exportAsKML(java.lang.Object output) throws java.io.IOException, javax.xml.stream.XMLStreamExceptionExport the placemark to KML as a<Placemark>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 KMLjava.io.IOException- if an exception occurs while exporting the data.- See Also:
export(String, Object)
-
-