Class AbstractSurfaceShape
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractSurfaceObject
-
- gov.nasa.worldwind.render.AbstractSurfaceShape
-
- All Implemented Interfaces:
AVList,Draggable,MessageListener,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:
SurfaceBox,SurfaceEllipse,SurfaceMultiPolygon,SurfacePolygon,SurfacePolyline,SurfacePolylines,SurfaceQuad,SurfaceSector
public abstract class AbstractSurfaceShape extends AbstractSurfaceObject implements SurfaceShape, Movable, Movable2, Combinable, Draggable
Common superclass for surface conforming shapes such asSurfacePolygon,SurfacePolyline,SurfaceEllipse,SurfaceQuad, andSurfaceSector.SurfaceShapes have separate attributes for normal display and highlighted display. If no attributes are specified, default attributes are used. See
DEFAULT_INTERIOR_MATERIAL,DEFAULT_OUTLINE_MATERIAL, andDEFAULT_HIGHLIGHT_MATERIAL.AbstractSurfaceShape extends from
AbstractSurfaceObject, and therefore inherits AbstractSurfaceObject's batch rendering capabilities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractSurfaceShape.GeometryKeyprotected static classAbstractSurfaceShape.SurfaceShapeStateKeyRepresents a surface shapes's current state.-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey
-
-
Field Summary
Fields Modifier and Type Field Description protected ShapeAttributesactiveAttrsprotected java.util.List<java.util.List<LatLon>>activeGeometryprotected java.util.List<java.util.List<LatLon>>activeOutlineGeometryprotected AreaMeasurerareaMeasurerprotected longareaMeasurerLastModifiedTimeprotected static MaterialDEFAULT_HIGHLIGHT_MATERIALThe default highlight color.protected static MaterialDEFAULT_INTERIOR_MATERIALThe default interior color.protected static intDEFAULT_MAX_EDGE_INTERVALSThe default maximum number of shape edge intervals.protected static intDEFAULT_MIN_EDGE_INTERVALSThe default minimum number of shape edge intervals.protected static MaterialDEFAULT_OUTLINE_MATERIALThe default outline color.protected static java.lang.StringDEFAULT_PATH_TYPEThe default path type.protected static intDEFAULT_TEXELS_PER_EDGE_INTERVALThe default number of texels per shape edge interval.protected static ShapeAttributesdefaultAttrsThe attributes used if attributes are not specified.protected booleandragEnabledprotected DraggableSupportdraggableSupportprotected java.util.Map<java.lang.Object,AbstractSurfaceObject.CacheEntry>geometryCacheprotected ShapeAttributeshighlightAttrsprotected booleanhighlightedprotected intmaxEdgeIntervalsprotected intminEdgeIntervalsprotected ShapeAttributesnormalAttrsprotected java.lang.StringpathTypeprotected java.util.Map<java.lang.Object,AbstractSurfaceObject.CacheEntry>sectorCacheprotected OGLStackHandlerstackHandlerprotected doubletexelsPerEdgeIntervalprotected WWTexturetextureprotected static java.nio.FloatBuffervertexBuffer-
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, uniqueId, visible
-
-
Constructor Summary
Constructors Constructor Description AbstractSurfaceShape()Constructs a new surface shape with the default attributes.AbstractSurfaceShape(AbstractSurfaceShape source)Creates a shallow copy of the specified source shape.AbstractSurfaceShape(ShapeAttributes normalAttrs)Constructs a new surface shape with the specified normal (as opposed to highlight) attributes.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddIntermediateLocations(LatLon a, LatLon b, double edgeIntervalsPerDegree, java.util.List<LatLon> locations)protected voidapplyInteriorState(DrawContext dc, SurfaceTileDrawContext sdc, ShapeAttributes attributes, WWTexture texture, LatLon refLocation)protected voidapplyInteriorTextureState(DrawContext dc, SurfaceTileDrawContext sdc, ShapeAttributes attributes, WWTexture texture, LatLon refLocation)protected voidapplyModelviewTransform(DrawContext dc, SurfaceTileDrawContext sdc)protected voidapplyOutlineState(DrawContext dc, ShapeAttributes attributes)protected voidbeginDrawing(DrawContext dc, SurfaceTileDrawContext sdc)protected booleancanContainPole()Indicates whether the shape is a closed polygon that can enclose a pole, or an open path that cannot.protected voidclearCaches()Clears this SurfaceObject's internal extent cache.voidcombine(CombineContext cc)Causes this Combinable to draw its contours using the GLU tessellator attached to the provided CombineContext.protected voidcombineBounds(CombineContext cc)protected voidcombineContours(CombineContext cc)protected doublecomputeEdgeIntervalsPerDegree(double resolution)protected doublecomputeEdgeIntervalsPerDegree(SurfaceTileDrawContext sdc)protected java.util.List<Sector>computeSectors(Globe globe)Computes the bounding sectors for the shape.protected java.util.List<Sector>computeSectors(DrawContext dc)Computes the bounding sectors for the shape.protected java.lang.StringcontainsPole(java.lang.Iterable<? extends LatLon> locations)Determine if a list of geographic locations encloses either the North or South pole.protected ShapeAttributescreateActiveAttributes()protected abstract java.util.List<java.util.List<LatLon>>createGeometry(Globe globe, double edgeIntervalsPerDegree)protected java.util.List<java.util.List<LatLon>>createGeometry(Globe globe, SurfaceTileDrawContext sdc)protected java.lang.ObjectcreateGeometryKey(DrawContext dc, SurfaceTileDrawContext sdc)protected java.util.List<LatLon>cutAlongDateLine(java.util.List<LatLon> locations, java.lang.String pole, Globe globe)Divide a list of locations that encloses a pole along the international date line.protected voiddetermineActiveAttributes()Determines which attributes -- normal, highlight or default -- to use each frame.protected voiddetermineActiveGeometry(DrawContext dc, SurfaceTileDrawContext sdc)protected voiddoCombineContour(CombineContext cc, java.lang.Iterable<? extends LatLon> contour)protected voiddoCombineContours(CombineContext cc)protected voiddoDrag(DragContext dragContext)protected voiddoDrawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)protected voiddoGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)protected abstract voiddoMoveTo(Position oldReferencePosition, Position newReferencePosition)protected abstract voiddoMoveTo(Globe globe, Position oldReferencePosition, Position newReferencePosition)protected voiddoRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)protected java.lang.IntegerdoTessellateInterior(DrawContext dc)voiddrag(DragContext dragContext)Drag the object given the providedDragContext.protected voiddrawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)Causes the SurfaceObject to render itself to the specified region in geographic coordinates.protected voiddrawInterior(DrawContext dc, SurfaceTileDrawContext sdc)protected voiddrawLineStrip(DrawContext dc, java.util.List<LatLon> locations)protected voiddrawOutline(DrawContext dc, SurfaceTileDrawContext sdc)protected voidendDrawing(DrawContext dc)voidexport(java.lang.String mimeType, java.lang.Object output)Export the Polygon.protected voidexportAsKML(java.lang.Object output)protected voidgenerateIntermediateLocations(java.lang.Iterable<? extends LatLon> iterable, double edgeIntervalsPerDegree, boolean makeClosedPath, java.util.List<LatLon> locations)protected ShapeAttributesgetActiveAttributes()protected java.util.List<java.util.List<LatLon>>getActiveGeometry()doublegetArea(Globe globe)Returns the object's area in square meters.doublegetArea(Globe globe, boolean terrainConformant)Returns the shapes's area in square meters.ShapeAttributesgetAttributes()Returns the surface shape's normal (as opposed to highlight) attributes.protected java.util.List<java.util.List<LatLon>>getCachedGeometry(DrawContext dc, SurfaceTileDrawContext sdc)ExtentgetExtent(Globe globe, double verticalExaggeration)Returns this SurfaceShape's enclosing volume as anExtentin model coordinates, given a specifiedGlobeand vertical exaggeration (seeSceneController.getVerticalExaggeration().doublegetHeight(Globe globe)Returns the latitudanl length of the object in meters.ShapeAttributesgetHighlightAttributes()Returns the surface shape's highlight attributes.protected WWTexturegetInteriorTexture()doublegetLength(Globe globe)Returns the object's length in meters.int[]getMinAndMaxEdgeIntervals()Returns the minimum and maximum number of interpolated intervals that may be added to each shape edge.java.lang.StringgetPathType()Returns the path type used to interpolate between locations on this SurfaceShape.doublegetPerimeter(Globe globe)Returns the length of the object's perimeter in meters.abstract PositiongetReferencePosition()A position associated with the object that indicates its aggregate geographic position.java.lang.StringgetRestorableState()Returns an XML document string describing the object's state.java.util.List<Sector>getSectors(DrawContext dc)Returns a list of sectors indicating the geographic region that bounds this renderable for the specified draw context.java.lang.ObjectgetStateKey(DrawContext dc)Returns an object that uniquely identifies this renderable's state for the specified draw context.doublegetTexelsPerEdgeInterval()Returns the number of texels per shape edge interval.doublegetWidth(Globe globe)Returns the longitudinal length of the object in meters.protected voidhandleUnsuccessfulInteriorTessellation(DrawContext dc)booleanisDragEnabled()Indicates whether the object is enabled for dragging.java.lang.StringisExportFormatSupported(java.lang.String format)Does this object support a certain export format?booleanisHighlighted()Indicates whether to highlight the surface shape.protected static booleanisSectorEmpty(Sector sector)protected voidlegacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)Restores state values from previous versions of the SurfaceShape state XML.protected voidmakeOrderedPreRenderable(DrawContext dc)Overridden to determine the shape's active attributes during preRendering, prior to building the shape's pickable representation and the SceneController's composite representation.voidmove(Position position)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.voidmoveTo(Globe globe, Position position)Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.protected java.lang.StringpathTypeFromString(java.lang.String s)protected java.util.List<java.util.List<LatLon>>repeatAroundDateline(java.util.List<LatLon> locations)Returns a list containing two copies of the specified list of locations crossing the dateline: one that extends across the -180 longitude boundary and one that extends across the +180 longitude boundary.voidrestoreState(java.lang.String stateInXml)Restores the object's state to what is described in the specified XML document string.voidsetAttributes(ShapeAttributes normalAttrs)Specifies the surface shape's normal (as opposed to highlight) attributes.voidsetDragEnabled(boolean enabled)Controls whether the object is enabled for dragging.voidsetHighlightAttributes(ShapeAttributes highlightAttrs)Specifies the surface shape's highlight attributes.voidsetHighlighted(boolean highlighted)Specifies whether the surface shape is highlighted.voidsetMinAndMaxEdgeIntervals(int minEdgeIntervals, int maxEdgeIntervals)Sets the minimum and maximum number of interpolated intervals that may be added to each shape edge.voidsetPathType(java.lang.String pathType)Sets the path type used to interpolate between locations on this SurfaceShape.voidsetTexelsPerEdgeInterval(double texelsPerEdgeInterval)Sets the number of texels per shape edge interval.protected AreaMeasurersetupAreaMeasurer(Globe globe)protected java.lang.IntegertessellateInterior(DrawContext dc)protected java.lang.IntegertessellateInteriorVertices(com.jogamp.opengl.glu.GLUtessellator tess)-
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.render.Renderable
render
-
Methods inherited from interface gov.nasa.worldwind.render.SurfaceObject
getDelegateOwner, getDistanceFromEye, getExtent, isEnableBatchPicking, isVisible, pick, preRender, setDelegateOwner, setEnableBatchPicking, setVisible
-
Methods inherited from interface gov.nasa.worldwind.render.SurfaceShape
getLocations
-
-
-
-
Field Detail
-
DEFAULT_INTERIOR_MATERIAL
protected static final Material DEFAULT_INTERIOR_MATERIAL
The default interior color.
-
DEFAULT_OUTLINE_MATERIAL
protected static final Material DEFAULT_OUTLINE_MATERIAL
The default outline color.
-
DEFAULT_HIGHLIGHT_MATERIAL
protected static final Material DEFAULT_HIGHLIGHT_MATERIAL
The default highlight color.
-
DEFAULT_PATH_TYPE
protected static final java.lang.String DEFAULT_PATH_TYPE
The default path type.- See Also:
- Constant Field Values
-
DEFAULT_TEXELS_PER_EDGE_INTERVAL
protected static final int DEFAULT_TEXELS_PER_EDGE_INTERVAL
The default number of texels per shape edge interval.- See Also:
- Constant Field Values
-
DEFAULT_MIN_EDGE_INTERVALS
protected static final int DEFAULT_MIN_EDGE_INTERVALS
The default minimum number of shape edge intervals.- See Also:
- Constant Field Values
-
DEFAULT_MAX_EDGE_INTERVALS
protected static final int DEFAULT_MAX_EDGE_INTERVALS
The default maximum number of shape edge intervals.- See Also:
- Constant Field Values
-
defaultAttrs
protected static final ShapeAttributes defaultAttrs
The attributes used if attributes are not specified.
-
highlighted
protected boolean highlighted
-
dragEnabled
protected boolean dragEnabled
-
draggableSupport
protected DraggableSupport draggableSupport
-
normalAttrs
protected ShapeAttributes normalAttrs
-
highlightAttrs
protected ShapeAttributes highlightAttrs
-
activeAttrs
protected ShapeAttributes activeAttrs
-
pathType
protected java.lang.String pathType
-
texelsPerEdgeInterval
protected double texelsPerEdgeInterval
-
minEdgeIntervals
protected int minEdgeIntervals
-
maxEdgeIntervals
protected int maxEdgeIntervals
-
activeGeometry
protected java.util.List<java.util.List<LatLon>> activeGeometry
-
activeOutlineGeometry
protected java.util.List<java.util.List<LatLon>> activeOutlineGeometry
-
texture
protected WWTexture texture
-
sectorCache
protected java.util.Map<java.lang.Object,AbstractSurfaceObject.CacheEntry> sectorCache
-
geometryCache
protected java.util.Map<java.lang.Object,AbstractSurfaceObject.CacheEntry> geometryCache
-
stackHandler
protected OGLStackHandler stackHandler
-
vertexBuffer
protected static java.nio.FloatBuffer vertexBuffer
-
areaMeasurer
protected AreaMeasurer areaMeasurer
-
areaMeasurerLastModifiedTime
protected long areaMeasurerLastModifiedTime
-
-
Constructor Detail
-
AbstractSurfaceShape
public AbstractSurfaceShape()
Constructs a new surface shape with the default attributes.
-
AbstractSurfaceShape
public AbstractSurfaceShape(ShapeAttributes normalAttrs)
Constructs a new surface shape with the specified normal (as opposed to highlight) attributes. 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.
-
AbstractSurfaceShape
public AbstractSurfaceShape(AbstractSurfaceShape source)
Creates a shallow copy of the specified source shape.- Parameters:
source- the shape to copy.
-
-
Method Detail
-
isHighlighted
public boolean isHighlighted()
Indicates whether to highlight the surface shape.- Specified by:
isHighlightedin interfaceHighlightable- Specified by:
isHighlightedin interfaceSurfaceShape- Returns:
- true if highlighted, otherwise false.
- See Also:
SurfaceShape.setHighlighted(boolean),SurfaceShape.setHighlightAttributes(ShapeAttributes)
-
setHighlighted
public void setHighlighted(boolean highlighted)
Specifies whether the surface shape is highlighted.- Specified by:
setHighlightedin interfaceHighlightable- Specified by:
setHighlightedin interfaceSurfaceShape- Parameters:
highlighted- true to highlight the surface shape, otherwise false. The default value is false.- See Also:
SurfaceShape.setHighlightAttributes(ShapeAttributes)
-
getAttributes
public ShapeAttributes getAttributes()
Returns the surface shape's normal (as opposed to highlight) attributes. Modifying the contents of the returned reference causes this shape's appearance to change accordingly.- Specified by:
getAttributesin interfaceAttributable- Specified by:
getAttributesin interfaceSurfaceShape- Returns:
- the surface shape's normal attributes. May be null.
-
setAttributes
public void setAttributes(ShapeAttributes normalAttrs)
Specifies the surface shape's normal (as opposed to highlight) attributes. Modifying the attribute reference after calling setAttributes() causes this shape's appearance to change accordingly.- Specified by:
setAttributesin interfaceAttributable- Specified by:
setAttributesin interfaceSurfaceShape- Parameters:
normalAttrs- the normal attributes. May be null, in which case default attributes are used.
-
getHighlightAttributes
public ShapeAttributes getHighlightAttributes()
Returns the surface shape's highlight attributes. Modifying the contents of the returned reference causes this shape's appearance to change accordingly.- Specified by:
getHighlightAttributesin interfaceAttributable- Specified by:
getHighlightAttributesin interfaceSurfaceShape- Returns:
- the surface shape's highlight attributes. May be null.
-
setHighlightAttributes
public void setHighlightAttributes(ShapeAttributes highlightAttrs)
Specifies the surface shape's highlight attributes. Modifying the attribute reference after calling setHighlightAttributes() causes this shape's appearance to change accordingly.- Specified by:
setHighlightAttributesin interfaceAttributable- Specified by:
setHighlightAttributesin interfaceSurfaceShape- Parameters:
highlightAttrs- the highlight attributes. May be null, in which case default attributes are used.
-
getPathType
public java.lang.String getPathType()
Description copied from interface:SurfaceShapeReturns the path type used to interpolate between locations on this SurfaceShape.- Specified by:
getPathTypein interfaceSurfaceShape- Returns:
- path interpolation type.
-
setPathType
public void setPathType(java.lang.String pathType)
Description copied from interface:SurfaceShapeSets the path type used to interpolate between locations on this SurfaceShape. This should be one of- gov.nasa.worldwind.avlist.AVKey.GREAT_CIRCLE
- gov.nasa.worldwind.avlist.AVKey.LINEAR
- gov.nasa.worldwind.avlist.AVKey.LOXODROME
- gov.nasa.worldwind.avlist.AVKey.RHUMB
- Specified by:
setPathTypein interfaceSurfaceShape- Parameters:
pathType- path interpolation type.
-
getTexelsPerEdgeInterval
public double getTexelsPerEdgeInterval()
Description copied from interface:SurfaceShapeReturns the number of texels per shape edge interval.- Specified by:
getTexelsPerEdgeIntervalin interfaceSurfaceShape- Returns:
- texels per shape edge interval.
- See Also:
SurfaceShape.setTexelsPerEdgeInterval(double)
-
setTexelsPerEdgeInterval
public void setTexelsPerEdgeInterval(double texelsPerEdgeInterval)
Description copied from interface:SurfaceShapeSets the number of texels per shape edge interval. This value controls how many interpolated intervals are added to each shape edge, depending on size of the original edge in texels. Each shape is responsible for defining what an edge is, though for most shapes it is defined as the edge between implicit or caller-specified shape locations. The number of interpolated intervals is limited by the values set in a call toSurfaceShape.setMinAndMaxEdgeIntervals(int, int).- Specified by:
setTexelsPerEdgeIntervalin interfaceSurfaceShape- Parameters:
texelsPerEdgeInterval- the size, in texels, of each interpolated edge interval.- See Also:
SurfaceShape.setMinAndMaxEdgeIntervals(int, int)
-
getMinAndMaxEdgeIntervals
public int[] getMinAndMaxEdgeIntervals()
Description copied from interface:SurfaceShapeReturns the minimum and maximum number of interpolated intervals that may be added to each shape edge.- Specified by:
getMinAndMaxEdgeIntervalsin interfaceSurfaceShape- Returns:
- array of two elements, the first element is minEdgeIntervals, the second element is maxEdgeIntervals.
- See Also:
SurfaceShape.setMinAndMaxEdgeIntervals(int, int)
-
setMinAndMaxEdgeIntervals
public void setMinAndMaxEdgeIntervals(int minEdgeIntervals, int maxEdgeIntervals)Description copied from interface:SurfaceShapeSets the minimum and maximum number of interpolated intervals that may be added to each shape edge. The minimum and maximum values may be 0, or any positive integer. Note that Setting either ofminEdgeIntervalsormaxEdgeIntervalstoo large may adversely impact surface shape rendering performance.- Specified by:
setMinAndMaxEdgeIntervalsin interfaceSurfaceShape- Parameters:
minEdgeIntervals- the minimum number of interpolated edge intervals.maxEdgeIntervals- the maximum number of interpolated edge intervals.- See Also:
SurfaceShape.setTexelsPerEdgeInterval(double)
-
getStateKey
public java.lang.Object getStateKey(DrawContext dc)
Returns an object that uniquely identifies this renderable's state for the specified draw context.Callers can perform an equality test on two state keys using
Object.equals(Object)in order to determine whether or not a renderable has changed. The returned object is guaranteed to be globally unique with respect to other SurfaceRenderable state keys; an equality test with a state key from another renderable always returns false.The returned state key is constructed the SurfaceShape's unique ID, last modified time, and its active attributes. The returned state key has no dependency on the
Globe. Subclasses that depend on the Globe should return a state key that include the globe's state key.- Specified by:
getStateKeyin interfaceSurfaceRenderable- Overrides:
getStateKeyin classAbstractSurfaceObject- Parameters:
dc- the draw context for which to determine this renderable's current state.- Returns:
- an object representing this renderable's current state.
-
getSectors
public java.util.List<Sector> getSectors(DrawContext dc)
Description copied from interface:SurfaceRenderableReturns a list of sectors indicating the geographic region that bounds this renderable for the specified draw context.The returned list typically contains one sector that bounds this renderable in geographic coordinates. When this renderable spans the anti-meridian - the +/- 180 degree meridian - the returned list contains two sectors, one on either side of the anti-meridian.
- Specified by:
getSectorsin interfaceSurfaceRenderable- Parameters:
dc- the draw context for which to determine this renderable's geographic bounds.- Returns:
- a list of one or two sectors that bound this renderable.
-
computeSectors
protected java.util.List<Sector> computeSectors(DrawContext dc)
Computes the bounding sectors for the shape. There will be more than one if the shape crosses the date line, but does not enclose a pole.- Parameters:
dc- Current draw context.- Returns:
- Bounding sectors for the shape.
-
computeSectors
protected java.util.List<Sector> computeSectors(Globe globe)
Computes the bounding sectors for the shape. There will be more than one if the shape crosses the date line, but does not enclose a pole.- Parameters:
globe- Current globe.- Returns:
- Bounding sectors for the shape.
-
isSectorEmpty
protected static boolean isSectorEmpty(Sector sector)
-
getExtent
public Extent getExtent(Globe globe, double verticalExaggeration)
Returns this SurfaceShape's enclosing volume as anExtentin model coordinates, given a specifiedGlobeand vertical exaggeration (seeSceneController.getVerticalExaggeration().- Specified by:
getExtentin interfaceExtentHolder- Parameters:
globe- the Globe this SurfaceShape is related to.verticalExaggeration- the vertical exaggeration of the scene containing this SurfaceShape.- Returns:
- this SurfaceShape's Extent in model coordinates.
- Throws:
java.lang.IllegalArgumentException- if the Globe is null.
-
getRestorableState
public java.lang.String getRestorableState()
Description copied from interface:RestorableReturns an XML document string describing the object's state. This state can be restored later by callingrestoreStateand passing the XML document.- Specified by:
getRestorableStatein interfaceRestorable- Returns:
- an XML document string describing the object's state.
-
restoreState
public void restoreState(java.lang.String stateInXml)
Description copied from interface:RestorableRestores the object's state to what is described in the specified XML document string.- Specified by:
restoreStatein interfaceRestorable- Parameters:
stateInXml- an XML document string describing an object's state.
-
getArea
public double getArea(Globe globe)
Description copied from interface:MeasurableAreaReturns the object's area in square meters. If the object conforms to terrain, the area returned is the surface area of the terrain, including its hillsides and other undulations.- Specified by:
getAreain interfaceMeasurableArea- Parameters:
globe- The globe the object is related to.- Returns:
- the object's area in square meters. Returns -1 if the object does not form an area due to an insufficient number of vertices or any other condition.
-
getArea
public double getArea(Globe globe, boolean terrainConformant)
Description copied from interface:SurfaceShapeReturns the shapes's area in square meters. IfterrainConformantis true, the area returned is the surface area of the terrain, including its hillsides and other undulations.- Specified by:
getAreain interfaceSurfaceShape- Parameters:
globe- the globe the shape is related to.terrainConformant- whether or not the returned area should treat the shape as conforming to the terrain.- Returns:
- the shape's area in square meters. Returns -1 if the object does not form an area due to an insufficient number of vertices or any other condition.
-
getPerimeter
public double getPerimeter(Globe globe)
Description copied from interface:MeasurableAreaReturns the length of the object's perimeter in meters. If the object conforms to terrain, the perimeter is that along the terrain, including its hillsides and other undulations.- Specified by:
getPerimeterin interfaceMeasurableArea- Parameters:
globe- The globe the object is related to.- Returns:
- the object's perimeter in meters. Returns -1 if the object does not form an area due to an insufficient number of vertices or any other condition.
-
getWidth
public double getWidth(Globe globe)
Description copied from interface:MeasurableAreaReturns the longitudinal length of the object in meters. The length is the distance from the object's west-most point to its east-most. If the object is terrain conforming then the- Specified by:
getWidthin interfaceMeasurableArea- Parameters:
globe- The globe the object is related to.- Returns:
- the width of the object in meters.
-
getHeight
public double getHeight(Globe globe)
Description copied from interface:MeasurableAreaReturns the latitudanl length of the object in meters. The length is the distance from the objects south-most point to its east-most position.- Specified by:
getHeightin interfaceMeasurableArea- Parameters:
globe- The globe the object is related to.- Returns:
- the height of the object in meters.
-
getLength
public double getLength(Globe globe)
Description copied from interface:MeasurableLengthReturns the object's length in meters. If the object conforms to terrain, the length is that along the terrain, including its hillsides and other undulations.- Specified by:
getLengthin interfaceMeasurableLength- Parameters:
globe- The globe the object is related to.- Returns:
- the object's length in meters.
-
move
public void move(Position position)
Description copied from interface:MovableShift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
-
moveTo
public void moveTo(Position position)
Description copied from interface:MovableMove the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
-
moveTo
public void moveTo(Globe globe, Position position)
Description copied from interface:Movable2Move 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)
-
combine
public void combine(CombineContext cc)
Causes this Combinable to draw its contours using the GLU tessellator attached to the provided CombineContext. When the CombineContext is in bounding sector mode, this adds the Combinable's geographic bounding sector to the CombineContext's bounding sector list. See the interface documentation for more information.- Specified by:
combinein interfaceCombinable- Parameters:
cc- the CombineContext to be used.- See Also:
CombineContext
-
getReferencePosition
public abstract Position getReferencePosition()
Description copied from interface:MovableA 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- Specified by:
getReferencePositionin interfaceMovable2- Returns:
- the object's reference position, or null if no reference position is available.
-
doMoveTo
protected abstract void doMoveTo(Position oldReferencePosition, Position newReferencePosition)
-
doMoveTo
protected abstract void doMoveTo(Globe globe, Position oldReferencePosition, Position newReferencePosition)
-
clearCaches
protected void clearCaches()
Clears this SurfaceObject's internal extent cache.Overridden to clear this SurfaceShape's internal sector and geometry caches.
- Overrides:
clearCachesin classAbstractSurfaceObject
-
makeOrderedPreRenderable
protected void makeOrderedPreRenderable(DrawContext dc)
Overridden to determine the shape's active attributes during preRendering, prior to building the shape's pickable representation and the SceneController's composite representation.- Overrides:
makeOrderedPreRenderablein classAbstractSurfaceObject- Parameters:
dc- the current draw context.
-
drawGeographic
protected void drawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)
Description copied from class:AbstractSurfaceObjectCauses the SurfaceObject to render itself to the specified region in geographic coordinates. The specified viewport denotes the geographic region and its corresponding screen viewport.- Specified by:
drawGeographicin classAbstractSurfaceObject- Parameters:
dc- the current draw context.sdc- the context containing a geographic region and screen viewport corresponding to a surface tile.
-
beginDrawing
protected void beginDrawing(DrawContext dc, SurfaceTileDrawContext sdc)
-
endDrawing
protected void endDrawing(DrawContext dc)
-
doDrawGeographic
protected void doDrawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)
-
applyModelviewTransform
protected void applyModelviewTransform(DrawContext dc, SurfaceTileDrawContext sdc)
-
determineActiveAttributes
protected void determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.
-
createActiveAttributes
protected ShapeAttributes createActiveAttributes()
-
getActiveAttributes
protected ShapeAttributes getActiveAttributes()
-
determineActiveGeometry
protected void determineActiveGeometry(DrawContext dc, SurfaceTileDrawContext sdc)
-
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.- 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.
-
containsPole
protected java.lang.String containsPole(java.lang.Iterable<? extends LatLon> locations)
Determine if a list of geographic locations encloses either the North or South pole. The list is treated as a closed loop. (If the first and last positions are not equal the loop will be closed for purposes of this computation.)- Parameters:
locations- Locations to test.- Returns:
- AVKey.NORTH if the North Pole is enclosed, AVKey.SOUTH if the South Pole is enclosed, or null if neither
pole is enclosed. Always returns null if
canContainPole()returns false.
-
cutAlongDateLine
protected java.util.List<LatLon> cutAlongDateLine(java.util.List<LatLon> locations, java.lang.String pole, Globe globe)
Divide a list of locations that encloses a pole along the international date line. This method determines where the locations cross the date line, and inserts locations to the pole, and then back to the intersection position. This allows the shape to be "unrolled" when projected in a lat-lon projection.- Parameters:
locations- Locations to cut at date line. This list is not modified.pole- Pole contained by locations, either AVKey.NORTH or AVKey.SOUTH.globe- Current globe.- Returns:
- New location list with locations added to correctly handle date line intersection.
-
repeatAroundDateline
protected java.util.List<java.util.List<LatLon>> repeatAroundDateline(java.util.List<LatLon> locations)
Returns a list containing two copies of the specified list of locations crossing the dateline: one that extends across the -180 longitude boundary and one that extends across the +180 longitude boundary. If the list of locations does not cross the dateline this returns a list containing a copy of the original list.- Parameters:
locations- Locations to repeat. This is list not modified.- Returns:
- A list containing two new location lists, one copy for either side of the date line.
-
getActiveGeometry
protected java.util.List<java.util.List<LatLon>> getActiveGeometry()
-
drawInterior
protected void drawInterior(DrawContext dc, SurfaceTileDrawContext sdc)
-
drawOutline
protected void drawOutline(DrawContext dc, SurfaceTileDrawContext sdc)
-
drawLineStrip
protected void drawLineStrip(DrawContext dc, java.util.List<LatLon> locations)
-
getInteriorTexture
protected WWTexture getInteriorTexture()
-
getCachedGeometry
protected java.util.List<java.util.List<LatLon>> getCachedGeometry(DrawContext dc, SurfaceTileDrawContext sdc)
-
createGeometry
protected java.util.List<java.util.List<LatLon>> createGeometry(Globe globe, SurfaceTileDrawContext sdc)
-
createGeometry
protected abstract java.util.List<java.util.List<LatLon>> createGeometry(Globe globe, double edgeIntervalsPerDegree)
-
createGeometryKey
protected java.lang.Object createGeometryKey(DrawContext dc, SurfaceTileDrawContext sdc)
-
computeEdgeIntervalsPerDegree
protected double computeEdgeIntervalsPerDegree(SurfaceTileDrawContext sdc)
-
computeEdgeIntervalsPerDegree
protected double computeEdgeIntervalsPerDegree(double resolution)
-
combineBounds
protected void combineBounds(CombineContext cc)
-
combineContours
protected void combineContours(CombineContext cc)
-
doCombineContours
protected void doCombineContours(CombineContext cc)
-
doCombineContour
protected void doCombineContour(CombineContext cc, java.lang.Iterable<? extends LatLon> contour)
-
applyInteriorState
protected void applyInteriorState(DrawContext dc, SurfaceTileDrawContext sdc, ShapeAttributes attributes, WWTexture texture, LatLon refLocation)
-
applyOutlineState
protected void applyOutlineState(DrawContext dc, ShapeAttributes attributes)
-
applyInteriorTextureState
protected void applyInteriorTextureState(DrawContext dc, SurfaceTileDrawContext sdc, ShapeAttributes attributes, WWTexture texture, LatLon refLocation)
-
generateIntermediateLocations
protected void generateIntermediateLocations(java.lang.Iterable<? extends LatLon> iterable, double edgeIntervalsPerDegree, boolean makeClosedPath, java.util.List<LatLon> locations)
-
addIntermediateLocations
protected void addIntermediateLocations(LatLon a, LatLon b, double edgeIntervalsPerDegree, java.util.List<LatLon> locations)
-
tessellateInterior
protected java.lang.Integer tessellateInterior(DrawContext dc)
-
doTessellateInterior
protected java.lang.Integer doTessellateInterior(DrawContext dc)
-
tessellateInteriorVertices
protected java.lang.Integer tessellateInteriorVertices(com.jogamp.opengl.glu.GLUtessellator tess)
-
handleUnsuccessfulInteriorTessellation
protected void handleUnsuccessfulInteriorTessellation(DrawContext dc)
-
setupAreaMeasurer
protected AreaMeasurer setupAreaMeasurer(Globe globe)
-
doGetRestorableState
protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
-
doRestoreState
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
-
legacyRestoreState
protected void legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
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 indoRestoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject).- Parameters:
rs- RestorableSupport object which contains the state value properties.context- active context in the RestorableSupport to read state from.
-
pathTypeFromString
protected java.lang.String pathTypeFromString(java.lang.String s)
-
isExportFormatSupported
public java.lang.String isExportFormatSupported(java.lang.String format)
Does this object support a certain export format?- Parameters:
format- Mime type for the export format.- Returns:
- One of
Exportable.FORMAT_SUPPORTED,Exportable.FORMAT_NOT_SUPPORTED, orExportable.FORMAT_PARTIALLY_SUPPORTED. - See Also:
export(String, Object)
-
export
public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException, java.lang.UnsupportedOperationExceptionExport the Polygon. 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- 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.
-
exportAsKML
protected void exportAsKML(java.lang.Object output) throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
-