public class AnnotationLayer extends AbstractLayer
AnnotationLayer
class manages a collection of Annotation
objects
for rendering and picking. AnnotationLayer
delegates to its internal AnnotationRenderer
for rendering and picking operations. The
AnnotationRenderer
is specified by calling setAnnotationRenderer(gov.nasa.worldwind.render.AnnotationRenderer)
.Annotation
,
AnnotationRenderer
Modifier and Type | Field and Description |
---|---|
protected java.util.Collection<Annotation> |
annotations |
protected java.lang.Iterable<Annotation> |
annotationsOverride |
Constructor and Description |
---|
AnnotationLayer()
Creates a new
AnnotationLayer with an empty collection of Annotations. |
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(Annotation annotation)
Adds the specified
annotation to this layer's internal collection. |
void |
addAnnotations(java.lang.Iterable<Annotation> annotations)
Adds the contents of the specified
annotations to this layer's internal collection. |
protected void |
clearAnnotations() |
protected void |
doPick(DrawContext dc,
java.awt.Point pickPoint) |
protected void |
doRender(DrawContext dc) |
protected java.lang.Iterable<Annotation> |
getActiveAnnotations()
Returns the Iterable of currently active Annotations.
|
AnnotationRenderer |
getAnnotationRenderer()
Returns the
AnnotationRenderer this layer delegates to during picking and rendering. |
java.lang.Iterable<Annotation> |
getAnnotations()
Returns the Iterable of Annotations currently in use by this layer.
|
double |
getOpacity()
Returns the layer's opacity value, which is ignored by this layer because each of its annotations has an
attribute with its own opacity control.
|
void |
removeAllAnnotations()
Clears the contents of this layer's internal Annotation collection.
|
void |
removeAnnotation(Annotation annotation)
Removes the specified
annotation from this layer's internal collection, if it exists. |
void |
setAnnotationRenderer(AnnotationRenderer annotationRenderer)
Sets the
AnnotationRenderer this layer delegates to during picking and rendering. |
void |
setAnnotations(java.lang.Iterable<Annotation> annotationIterable)
Overrides the collection of currently active Annotations with the specified
annotationIterable . |
void |
setOpacity(double opacity)
Opacity is not applied to layers of this type because each annotation has an attribute set with opacity control.
|
java.lang.String |
toString() |
createLayerConfigElements, dispose, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setPickEnabled, setScreenCredit
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, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
protected final java.util.Collection<Annotation> annotations
protected java.lang.Iterable<Annotation> annotationsOverride
public AnnotationLayer()
AnnotationLayer
with an empty collection of Annotations.public void addAnnotation(Annotation annotation)
annotation
to this layer's internal collection. If this layer's internal
collection has been overriden with a call to setAnnotations(java.lang.Iterable<gov.nasa.worldwind.render.Annotation>)
, this will throw an exception.annotation
- Annotation to add.java.lang.IllegalArgumentException
- If annotation
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setAnnotations
.public void addAnnotations(java.lang.Iterable<Annotation> annotations)
annotations
to this layer's internal collection. If this layer's
internal collection has been overriden with a call to setAnnotations(java.lang.Iterable<gov.nasa.worldwind.render.Annotation>)
, this will throw an exception.annotations
- Annotations to add.java.lang.IllegalArgumentException
- If annotations
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setAnnotations
.protected void clearAnnotations()
protected void doPick(DrawContext dc, java.awt.Point pickPoint)
doPick
in class AbstractLayer
protected void doRender(DrawContext dc)
doRender
in class AbstractLayer
protected java.lang.Iterable<Annotation> getActiveAnnotations()
setAnnotations(java.lang.Iterable<gov.nasa.worldwind.render.Annotation>)
, this will returns a reference to that Iterable. If the caller passed
setAnnotations
a null parameter, or if setAnnotations
has not been called, this returns
a view of this layer's internal collection of Annotations.public AnnotationRenderer getAnnotationRenderer()
AnnotationRenderer
this layer delegates to during picking and rendering.AnnotationRenderer
used to pick and render Annotations
.public java.lang.Iterable<Annotation> getAnnotations()
setAnnotations(java.lang.Iterable<gov.nasa.worldwind.render.Annotation>)
, this will returns a reference to that Iterable. If the caller passed
setAnnotations
a null parameter, or if setAnnotations
has not been called, this returns
a view of this layer's internal collection of Annotations.public double getOpacity()
getOpacity
in interface Layer
getOpacity
in class AbstractLayer
public void removeAllAnnotations()
setAnnotations(java.lang.Iterable<gov.nasa.worldwind.render.Annotation>)
, this will throw an exception.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setAnnotations
.public void removeAnnotation(Annotation annotation)
annotation
from this layer's internal collection, if it exists. If this
layer's internal collection has been overriden with a call to setAnnotations(java.lang.Iterable<gov.nasa.worldwind.render.Annotation>)
, this will throw an
exception.annotation
- Annotation to remove.java.lang.IllegalArgumentException
- If annotation
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setAnnotations
.public void setAnnotationRenderer(AnnotationRenderer annotationRenderer)
AnnotationRenderer
this layer delegates to during picking and rendering.annotationRenderer
- AnnotationRenderer
used to pick and render Annotations
.java.lang.IllegalArgumentException
- If annotationRenderer
is null.public void setAnnotations(java.lang.Iterable<Annotation> annotationIterable)
annotationIterable
. This
layer will maintain a reference to annotationIterable
strictly for picking and rendering. This layer
will not modify the Iterable reference. However, this will clear the internal collection of Annotations, and will
prevent any modification to its contents via addAnnotation, addAnnotations, or removeAnnotations
.
If the specified annotationIterable
is null, this layer will revert to maintaining its internal
collection.annotationIterable
- Iterable to use instead of this layer's internal collection, or null to use this
layer's internal collection.public void setOpacity(double opacity)
setOpacity
in interface Layer
setOpacity
in class AbstractLayer
opacity
- the current opacity value, which is ignored by this layer.public java.lang.String toString()
toString
in class AbstractLayer