Package gov.nasa.worldwind.render
Class SurfacePolyline
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractSurfaceObject
-
- gov.nasa.worldwind.render.AbstractSurfaceShape
-
- gov.nasa.worldwind.render.SurfacePolyline
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,Exportable
,ExtentHolder
,MeasurableArea
,MeasurableLength
,Movable
,Movable2
,Attributable
,Highlightable
,OrderedRenderable
,PreRenderable
,Renderable
,SurfaceObject
,SurfaceRenderable
,SurfaceShape
,Restorable
,Combinable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
- Direct Known Subclasses:
DirectedSurfacePolyline
public class SurfacePolyline extends AbstractSurfaceShape implements Exportable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
AbstractSurfaceShape.GeometryKey, AbstractSurfaceShape.SurfaceShapeStateKey
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
closed
protected java.lang.Iterable<? extends LatLon>
locations
-
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
activeAttrs, activeGeometry, activeOutlineGeometry, areaMeasurer, areaMeasurerLastModifiedTime, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_MAX_EDGE_INTERVALS, DEFAULT_MIN_EDGE_INTERVALS, DEFAULT_OUTLINE_MATERIAL, DEFAULT_PATH_TYPE, DEFAULT_TEXELS_PER_EDGE_INTERVAL, defaultAttrs, dragEnabled, draggableSupport, geometryCache, highlightAttrs, highlighted, maxEdgeIntervals, minEdgeIntervals, normalAttrs, pathType, sectorCache, stackHandler, texelsPerEdgeInterval, texture, vertexBuffer
-
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, uniqueId, visible
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description SurfacePolyline()
Constructs a new surface polyline with the default attributes and no locations.SurfacePolyline(ShapeAttributes normalAttrs)
Constructs a new surface polyline with the specified normal (as opposed to highlight) attributes and no locations.SurfacePolyline(ShapeAttributes normalAttrs, java.lang.Iterable<? extends LatLon> iterable)
Constructs a new surface polyline with the specified normal (as opposed to highlight) attributes and the specified iterable of locations.SurfacePolyline(SurfacePolyline source)
Creates a shallow copy of the specified source shape.SurfacePolyline(java.lang.Iterable<? extends LatLon> iterable)
Constructs a new surface polyline with the default attributes and the specified iterable of locations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canContainPole()
Indicates whether the shape is a closed polygon that can enclose a pole, or an open path that cannot.protected java.util.List<java.util.List<LatLon>>
createGeometry(Globe globe, double edgeIntervalsPerDegree)
protected void
doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
protected void
doMoveTo(Position oldReferencePosition, Position newReferencePosition)
protected void
doMoveTo(Globe globe, Position oldReferencePosition, Position newReferencePosition)
protected void
doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
protected void
drawInterior(DrawContext dc, SurfaceTileDrawContext sdc)
protected void
exportAsKML(java.lang.Object output)
Export the polyline to KML as a<Placemark>
element.java.lang.Iterable<? extends LatLon>
getLocations()
java.lang.Iterable<? extends LatLon>
getLocations(Globe globe)
Returns the shape's locations as they appear on the specifiedglobe
, or null if the shape has no locations.Position
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.boolean
isClosed()
protected void
legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
Restores state values from previous versions of the SurfaceShape state XML.void
setClosed(boolean closed)
void
setLocations(java.lang.Iterable<? extends LatLon> iterable)
-
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
addIntermediateLocations, applyInteriorState, applyInteriorTextureState, applyModelviewTransform, applyOutlineState, beginDrawing, clearCaches, combine, combineBounds, combineContours, computeEdgeIntervalsPerDegree, computeEdgeIntervalsPerDegree, computeSectors, computeSectors, containsPole, createActiveAttributes, createGeometry, createGeometryKey, cutAlongDateLine, determineActiveAttributes, determineActiveGeometry, doCombineContour, doCombineContours, doDrag, doDrawGeographic, doTessellateInterior, drag, drawGeographic, drawLineStrip, drawOutline, endDrawing, export, generateIntermediateLocations, getActiveAttributes, getActiveGeometry, getArea, getArea, getAttributes, getCachedGeometry, getExtent, getHeight, getHighlightAttributes, getInteriorTexture, getLength, getMinAndMaxEdgeIntervals, getPathType, getPerimeter, getRestorableState, getSectors, getStateKey, getTexelsPerEdgeInterval, getWidth, handleUnsuccessfulInteriorTessellation, isDragEnabled, isExportFormatSupported, isHighlighted, isSectorEmpty, makeOrderedPreRenderable, move, moveTo, moveTo, pathTypeFromString, repeatAroundDateline, restoreState, setAttributes, setDragEnabled, setHighlightAttributes, setHighlighted, setMinAndMaxEdgeIntervals, setPathType, setTexelsPerEdgeInterval, setupAreaMeasurer, tessellateInterior, tessellateInteriorVertices
-
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
buildPickRepresentation, computeExtent, computeExtent, createPickedObject, createPickTileBuilder, drawBoundingSectors, drawOrderedRenderable, drawPickRepresentation, getDelegateOwner, getDistanceFromEye, getExtent, getUniqueId, intersectsFrustum, intersectsPickFrustum, intersectsVisibleSector, isDrawBoundingSectors, isEnableBatchPicking, isVisible, makeOrderedRenderable, nextUniqueId, onShapeChanged, pick, pickBatched, pickOrderedRenderable, preRender, render, setDelegateOwner, setDrawBoundingSectors, setEnableBatchPicking, setVisible, updateModifiedTime
-
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
-
Methods inherited from interface gov.nasa.worldwind.Exportable
export, isExportFormatSupported
-
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
-
Methods inherited from interface gov.nasa.worldwind.render.SurfaceObject
getDelegateOwner, getDistanceFromEye, getExtent, isEnableBatchPicking, isVisible, pick, preRender, setDelegateOwner, setEnableBatchPicking, setVisible
-
-
-
-
Field Detail
-
closed
protected boolean closed
-
locations
protected java.lang.Iterable<? extends LatLon> locations
-
-
Constructor Detail
-
SurfacePolyline
public SurfacePolyline()
Constructs a new surface polyline with the default attributes and no locations.
-
SurfacePolyline
public SurfacePolyline(SurfacePolyline source)
Creates a shallow copy of the specified source shape.- Parameters:
source
- the shape to copy.
-
SurfacePolyline
public SurfacePolyline(ShapeAttributes normalAttrs)
Constructs a new surface polyline with the specified normal (as opposed to highlight) attributes and no locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.- Parameters:
normalAttrs
- the normal attributes. May be null, in which case default attributes are used.
-
SurfacePolyline
public SurfacePolyline(java.lang.Iterable<? extends LatLon> iterable)
Constructs a new surface polyline with the default attributes and the specified iterable of locations.Note: If fewer than two locations is specified, no polyline is drawn.
- Parameters:
iterable
- the polyline locations.- Throws:
java.lang.IllegalArgumentException
- if the locations iterable is null.
-
SurfacePolyline
public SurfacePolyline(ShapeAttributes normalAttrs, java.lang.Iterable<? extends LatLon> iterable)
Constructs a new surface polyline with the specified normal (as opposed to highlight) attributes and the specified iterable of locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.Note: If fewer than two locations is specified, no polyline is drawn.
- Parameters:
normalAttrs
- the normal attributes. May be null, in which case default attributes are used.iterable
- the polyline locations.- Throws:
java.lang.IllegalArgumentException
- if the locations iterable is null.
-
-
Method Detail
-
isClosed
public boolean isClosed()
-
setClosed
public void setClosed(boolean closed)
-
getLocations
public java.lang.Iterable<? extends LatLon> getLocations(Globe globe)
Description copied from interface:SurfaceShape
Returns the shape's locations as they appear on the specifiedglobe
, or null if the shape has no locations.- Specified by:
getLocations
in interfaceSurfaceShape
- Parameters:
globe
- the globe the shape is related to.- Returns:
- the shapes locations on the globe, or null if the shape has no locations.
-
getLocations
public java.lang.Iterable<? extends LatLon> getLocations()
-
setLocations
public void setLocations(java.lang.Iterable<? extends LatLon> iterable)
-
getReferencePosition
public Position getReferencePosition()
Description copied from interface:Movable
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:
getReferencePosition
in interfaceMovable
- Specified by:
getReferencePosition
in interfaceMovable2
- Specified by:
getReferencePosition
in classAbstractSurfaceShape
- Returns:
- the object's reference position, or null if no reference position is available.
-
createGeometry
protected java.util.List<java.util.List<LatLon>> createGeometry(Globe globe, double edgeIntervalsPerDegree)
- Specified by:
createGeometry
in classAbstractSurfaceShape
-
doMoveTo
protected void doMoveTo(Position oldReferencePosition, Position newReferencePosition)
- Specified by:
doMoveTo
in classAbstractSurfaceShape
-
doMoveTo
protected void doMoveTo(Globe globe, Position oldReferencePosition, Position newReferencePosition)
- Specified by:
doMoveTo
in classAbstractSurfaceShape
-
drawInterior
protected void drawInterior(DrawContext dc, SurfaceTileDrawContext sdc)
- Overrides:
drawInterior
in classAbstractSurfaceShape
-
canContainPole
protected boolean canContainPole()
Indicates whether the shape is a closed polygon that can enclose a pole, or an open path that cannot. This makes a difference when computing the bounding sector for a shape. For example, consider the positions (-100, 85), (0, 80), (100, 80). If these positions are treated as a closed polygon (a triangle over the North Pole) then the bounding sector is 80 to 90 lat, -180 to 180 lon. But if they are treated as an open path (a line wrapping partway around the pole) then the bounding sector is 80 to 85 lat, -100 to 100 lon. Overridden to treat the shape as an open path if the polyline is not closed.- Overrides:
canContainPole
in classAbstractSurfaceShape
- Returns:
- True if the shape is a closed polygon that can contain a pole, or false if it is treated as an open path that cannot contain a pole.
-
doGetRestorableState
protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
- Overrides:
doGetRestorableState
in classAbstractSurfaceShape
-
doRestoreState
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
- Overrides:
doRestoreState
in classAbstractSurfaceShape
-
legacyRestoreState
protected void legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
Description copied from class:AbstractSurfaceShape
Restores state values from previous versions of the SurfaceShape state XML. These values are stored or named differently than the current implementation. Those values which have not changed are ignored here, and will restored inAbstractSurfaceShape.doRestoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject)
.- Overrides:
legacyRestoreState
in classAbstractSurfaceShape
- Parameters:
rs
- RestorableSupport object which contains the state value properties.context
- active context in the RestorableSupport to read state from.
-
exportAsKML
protected void exportAsKML(java.lang.Object output) throws java.io.IOException, javax.xml.stream.XMLStreamException
Export the polyline to KML as a<Placemark>
element. Theoutput
object will receive the data. This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter- Overrides:
exportAsKML
in classAbstractSurfaceShape
- 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:
AbstractSurfaceShape.export(String, Object)
-
-