Class AbstractGeneralShape
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractShape
-
- gov.nasa.worldwind.render.AbstractGeneralShape
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,Exportable
,ExtentHolder
,Movable
,Movable2
,Attributable
,GeographicExtent
,Highlightable
,OrderedRenderable
,PreRenderable
,Renderable
,Restorable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
- Direct Known Subclasses:
ColladaMeshShape
public abstract class AbstractGeneralShape extends AbstractShape
A shape that is positioned and oriented independently of its defining geometry. This shape typically represents 3D models imported from COLLADA and other 3D file formats. The model's geometry is defined in its own coordinate system; properties of this shape place and orient the model geographically. Specific model types subclass this class to provide their implementation and any additional properties.This class also accepts a resource map to independently link resources named in the model definition (the defining model file) to actual resources. Each map entry's key is a resource name as expressed in the model definition. Each map entry's value is the reference to the actual resource. The reference is interpreted by rules specific to the model format, but typically may be a relative or absolute file reference or a URL to a local or remote resource. If the map or an entry referred to by the model definition is not defined, resource references are typically considered relative to the location of the model definition's location.
In the case of a COLLADA file referenced from a KML file, relative references are considered relative to the location of the KML file. If the file is KMZ, relative references are considered references to resources within the KMZ archive.
This class applies
ShapeAttributes
to the shape, but the effect of some of those attributes, such asShapeAttributes.isDrawOutline()
is dependent on the specific implementation of thisAbstractGeneralShape
. See the class description of those shapes to determine how shape attributes are applied.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractGeneralShape.ShapeData
This class holds globe-specific data for this shape.-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
-
-
Field Summary
Fields Modifier and Type Field Description protected Angle
heading
This shape's heading, positive values are clockwise from north.protected Position
modelPosition
This shape's geographic location.protected Vec4
modelScale
A scale to apply to the model.protected Angle
pitch
This shape's pitch (often called tilt), its rotation about the model's X axis.protected java.util.Map<java.lang.String,java.lang.Object>
resourceMap
A map indicating the actual location of resources named in the model.protected Angle
roll
This shape's roll, its rotation about the model's Y axis.-
Fields inherited from class gov.nasa.worldwind.render.AbstractShape
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_ALTITUDE_MODE, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, dragEnabled, draggableSupport, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, surfaceShape, VBO_THRESHOLD, viewDistanceExpiration, visible
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description AbstractGeneralShape()
Constructs a shape at 0 latitude, longitude and altitude.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
computeEyeDistance(DrawContext dc, AbstractGeneralShape.ShapeData shapeData)
Computes the minimum distance between this shape and the eye point.protected Vec4
computeReferencePoint(Terrain terrain)
protected void
doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter)
Exports shape-specific fields.protected AbstractGeneralShape.ShapeData
getCurrent()
Returns the current shape data cache entry.Angle
getHeading()
Indicates this shape's heading, its rotation clockwise from north.Position
getModelPosition()
Indicates this shape's geographic position.Vec4
getModelScale()
Indicates this shape's scale, if any.Angle
getPitch()
Indicates this shape's pitch -- often referred to as tilt -- the angle to rotate this shape's model about its X axis.Position
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.java.util.Map<java.lang.String,java.lang.Object>
getResourceMap()
Returns this shape's resource map.Angle
getRoll()
Indicates this shape's roll, the angle to rotate this shape's model about its Y axis.Sector
getSector()
Returns the object's geographic extent.protected void
initialize()
Called during construction to establish any subclass-specific state such as different default values than those set by this class.void
moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.void
setHeading(Angle heading)
Specifies this shape's heading, its rotation clockwise from north.void
setModelPosition(Position modelPosition)
Specifies this shape's geographic position.void
setModelScale(Vec4 modelScale)
Specifies this shape's scale.void
setPitch(Angle pitch)
Specifies this shape's pitch -- often referred to as tilt -- the angle to rotate this shape's model about its X axis.void
setResourceMap(java.util.Map<java.lang.String,java.lang.Object> resourceMap)
Specifies this shape's resource map.void
setRoll(Angle roll)
Specifies this shape's roll, the angle to rotate this shape's model about its Y axis.-
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
addOrderedRenderable, beginDrawing, checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, computePoint, countTriangleVertices, createCacheEntry, createPickedObject, createSurfaceShape, determineActiveAttributes, doDrag, doDrawInterior, doDrawOrderedRenderable, doDrawOutline, doGetRestorableState, doMakeOrderedRenderable, doRestoreState, drag, drawBatched, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, fillVBO, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersect, intersectsFrustum, isDragEnabled, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isExportFormatSupported, isHighlighted, isOrderedRenderableValid, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, moveTo, mustApplyLighting, mustApplyLighting, mustApplyTexture, mustCreateNormals, mustCreateNormals, mustDrawInterior, mustDrawOutline, mustRegenerateGeometry, pick, prepareToDrawInterior, prepareToDrawOutline, preRender, render, reset, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setDragEnabled, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible, shouldUseVBOs, updateSurfaceShape
-
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
-
modelPosition
protected Position modelPosition
This shape's geographic location. The altitude is relative to this shapes altitude mode.
-
heading
protected Angle heading
This shape's heading, positive values are clockwise from north. Null is an allowed value.
-
pitch
protected Angle pitch
This shape's pitch (often called tilt), its rotation about the model's X axis. Positive values are clockwise. Null is an allowed value.
-
roll
protected Angle roll
This shape's roll, its rotation about the model's Y axis. Positive values are clockwise. Null is an allowed Value.
-
modelScale
protected Vec4 modelScale
A scale to apply to the model. Null is an allowed value.
-
resourceMap
protected java.util.Map<java.lang.String,java.lang.Object> resourceMap
A map indicating the actual location of resources named in the model. Null is an allowed value.
-
-
Method Detail
-
getCurrent
protected AbstractGeneralShape.ShapeData getCurrent()
Returns the current shape data cache entry.- Returns:
- the current data cache entry.
-
initialize
protected void initialize()
Description copied from class:AbstractShape
Called during construction to establish any subclass-specific state such as different default values than those set by this class.- Specified by:
initialize
in classAbstractShape
-
getResourceMap
public java.util.Map<java.lang.String,java.lang.Object> getResourceMap()
Returns this shape's resource map.- Returns:
- this shape's resource map, or null if this shape has no resource map.
-
setResourceMap
public void setResourceMap(java.util.Map<java.lang.String,java.lang.Object> resourceMap)
Specifies this shape's resource map. The resource map is described above in this class' description.- Parameters:
resourceMap
- the resource map for this shape. May be null, in which case no resource map is used.
-
getModelPosition
public Position getModelPosition()
Indicates this shape's geographic position.- Returns:
- this shape's geographic position. The position's altitude is relative to this shape's altitude mode.
-
setModelPosition
public void setModelPosition(Position modelPosition)
Specifies this shape's geographic position. The position's altitude is relative to this shape's altitude mode.- Parameters:
modelPosition
- this shape's geographic position.- Throws:
java.lang.IllegalArgumentException
- if the position is null.
-
getModelScale
public Vec4 getModelScale()
Indicates this shape's scale, if any.- Returns:
- this shape's scale, or null if no scale has been specified.
-
setModelScale
public void setModelScale(Vec4 modelScale)
Specifies this shape's scale. The scale is applied to the shape's model definition in the model's coordinate system prior to oriented and positioning the model.- Parameters:
modelScale
- this shape's scale. May be null, in which case no scaling is applied.
-
getHeading
public Angle getHeading()
Indicates this shape's heading, its rotation clockwise from north.- Returns:
- this shape's heading, or null if no heading has been specified.
-
setHeading
public void setHeading(Angle heading)
Specifies this shape's heading, its rotation clockwise from north.- Parameters:
heading
- this shape's heading. May be null.
-
getPitch
public Angle getPitch()
Indicates this shape's pitch -- often referred to as tilt -- the angle to rotate this shape's model about its X axis.- Returns:
- this shape's pitch, or null if no pitch has been specified. Positive values are clockwise as observed looking along the model's X axis toward the model's origin.
-
setPitch
public void setPitch(Angle pitch)
Specifies this shape's pitch -- often referred to as tilt -- the angle to rotate this shape's model about its X axis.- Parameters:
pitch
- this shape's pitch. Positive values are clockwise as observed looking along the model's X axis toward the model's origin. May be null.
-
getRoll
public Angle getRoll()
Indicates this shape's roll, the angle to rotate this shape's model about its Y axis.- Returns:
- this shape's roll, or null if no roll has been specified. Positive values are clockwise as observed looking along the model's Y axis toward the origin.
-
setRoll
public void setRoll(Angle roll)
Specifies this shape's roll, the angle to rotate this shape's model about its Y axis.- Parameters:
roll
- this shape's roll. May be null. Positive values are clockwise as observed looking along the model's Y axis toward the origin.
-
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.- Returns:
- the object's reference position, or null if no reference position is available.
-
computeEyeDistance
protected double computeEyeDistance(DrawContext dc, AbstractGeneralShape.ShapeData shapeData)
Computes the minimum distance between this shape and the eye point.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Parameters:
dc
- the current draw context.shapeData
- the current shape data for this shape.- Returns:
- the minimum distance from the shape to the eye point.
-
moveTo
public void moveTo(Position position)
Description copied from interface:Movable
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.- Parameters:
position
- the new position of the shape's reference position.
-
doExportAsKML
protected void doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException
Description copied from class:AbstractShape
Exports shape-specific fields.- Specified by:
doExportAsKML
in classAbstractShape
- Parameters:
xmlWriter
- the export writer to write to.- Throws:
java.io.IOException
- if an IO error occurs while writing to the output destination.javax.xml.stream.XMLStreamException
- if an exception occurs converting this shape's fields to XML.
-
getSector
public Sector getSector()
Returns the object's geographic extent. Not currently supported.- Returns:
- the object's geographic extent.
-
-