public class KMLModelPlacemarkImpl extends WWObjectImpl implements KMLRenderable, ColladaResourceResolver
Modifier and Type | Class and Description |
---|---|
protected static class |
KMLModelPlacemarkImpl.RequestTask
Attempts to find this model link resource file locally, and if that fails attempts to find it remotely.
|
Modifier and Type | Field and Description |
---|---|
protected AtomicReference<ColladaRoot> |
colladaRoot
Reference to the COLLADA root that contains the parsed COLLADA file.
|
protected ColladaTraversalContext |
colladaTraversalContext
Traversal context for rendering the ColladaRoot.
|
protected KMLModel |
model
Model rendered by this class.
|
protected KMLPlacemark |
parent
Placemark that contains the model.
|
protected Map<String,String> |
resourceMap
Map specified by the KML Model's ResourceMap element.
|
protected AtomicLong |
resourceRetrievalTime
Time, in milliseconds since the Epoch, at which this placemark's model resource was last retrieved.
|
Constructor and Description |
---|
KMLModelPlacemarkImpl(KMLTraversalContext tc,
KMLPlacemark placemark,
KMLAbstractGeometry geom)
Create an instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
configureColladaRoot(ColladaRoot root)
Apply the model's position, orientation, and scale to a COLLADA root.
|
protected Map<String,String> |
createResourceMap(KMLModel model)
Build the resource map from the KML Model's ResourceMap element.
|
protected ColladaRoot |
getColladaRoot()
Indicates the Collada resource referenced by this placemark.
|
protected boolean |
mustRetrieveResource()
Returns whether this placemark must retrieve its model resource.
|
void |
preRender(KMLTraversalContext tc,
DrawContext dc)
Pre-render this element.
|
void |
render(KMLTraversalContext tc,
DrawContext dc)
Render this element.
|
protected void |
requestResource(DrawContext dc)
Thread's off a task to determine whether the resource is local or remote and then retrieves it either from disk
cache or a remote server.
|
String |
resolveFilePath(String path)
Resolve COLLADA references relative to the COLLADA document.
|
protected void |
retrieveModel(String address)
Initiates a retrieval of the model referenced by this placemark.
|
protected void |
setColladaRoot(ColladaRoot root)
Specifies the Collada resource referenced by this placemark, or
null if this placemark has no
resource. |
onMessage, propertyChange
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onMessage
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected AtomicReference<ColladaRoot> colladaRoot
protected ColladaTraversalContext colladaTraversalContext
protected KMLModel model
protected KMLPlacemark parent
protected Map<String,String> resourceMap
protected AtomicLong resourceRetrievalTime
-1
, indicating that the resource has not been retrieved.public KMLModelPlacemarkImpl(KMLTraversalContext tc, KMLPlacemark placemark, KMLAbstractGeometry geom)
tc
- the current KMLTraversalContext
.placemark
- the Placemark element containing the Point.geom
- the KMLPoint
geometry.NullPointerException
- if the geometry is null.IllegalArgumentException
- if the parent placemark or the traversal context is null.protected void configureColladaRoot(ColladaRoot root)
root
- COLLADA root to configure.protected Map<String,String> createResourceMap(KMLModel model)
model
- Model from which to create the resource map.protected ColladaRoot getColladaRoot()
null
if this placemark has
no resource.null
to indicate that this placemark has no resource.setColladaRoot(gov.nasa.worldwind.ogc.collada.ColladaRoot)
protected boolean mustRetrieveResource()
false
if this
placemark has no KMLLink
.true
if this placemark must retrieve its model resource, otherwise false
.public void preRender(KMLTraversalContext tc, DrawContext dc)
preRender
in interface KMLRenderable
tc
- the current KML traversal context.dc
- the current draw context.public void render(KMLTraversalContext tc, DrawContext dc)
render
in interface KMLRenderable
tc
- the current KML traversal context.dc
- the current draw context.protected void requestResource(DrawContext dc)
dc
- the current draw context.public String resolveFilePath(String path) throws IOException
resolveFilePath
in interface ColladaResourceResolver
path
- A file path relative to a COLLADA document.IOException
- If an error occurs attempting to locate the resource.protected void retrieveModel(String address) throws IOException, XMLStreamException
setColladaRoot(ColladaRoot)
to specify this link's new network resource, and sends an
AVKey.RETRIEVAL_STATE_SUCCESSFUL
property change event to this
link's property change listeners.
This does nothing if this KMLNetworkLink
has no KMLLink
.address
- the address of the resource to retrieveIOException
XMLStreamException
protected void setColladaRoot(ColladaRoot root)
null
if this placemark has no
resource.root
- the Collada resource referenced by this placemark. May be null
.