Class AnnotationLayer

    • Field Detail

      • annotations

        protected final java.util.Collection<Annotation> annotations
      • annotationsOverride

        protected java.lang.Iterable<Annotation> annotationsOverride
    • Constructor Detail

      • AnnotationLayer

        public AnnotationLayer()
        Creates a new AnnotationLayer with an empty collection of Annotations.
    • Method Detail

      • addAnnotation

        public void addAnnotation​(Annotation annotation)
        Adds the specified 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.
        Parameters:
        annotation - Annotation to add.
        Throws:
        java.lang.IllegalArgumentException - If annotation is null.
        java.lang.IllegalStateException - If a custom Iterable has been specified by a call to setAnnotations.
      • addAnnotations

        public void addAnnotations​(java.lang.Iterable<Annotation> annotations)
        Adds the contents of the specified 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.
        Parameters:
        annotations - Annotations to add.
        Throws:
        java.lang.IllegalArgumentException - If annotations is null.
        java.lang.IllegalStateException - If a custom Iterable has been specified by a call to setAnnotations.
      • removeAnnotation

        public void removeAnnotation​(Annotation annotation)
        Removes the specified 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.
        Parameters:
        annotation - Annotation to remove.
        Throws:
        java.lang.IllegalArgumentException - If annotation is null.
        java.lang.IllegalStateException - If a custom Iterable has been specified by a call to setAnnotations.
      • removeAllAnnotations

        public void removeAllAnnotations()
        Clears the contents of this layer's internal Annotation 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.
        Throws:
        java.lang.IllegalStateException - If a custom Iterable has been specified by a call to setAnnotations.
      • clearAnnotations

        protected void clearAnnotations()
      • getAnnotations

        public java.lang.Iterable<Annotation> getAnnotations()
        Returns the Iterable of Annotations currently in use by this layer. If the caller has specified a custom Iterable via 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.
        Returns:
        Iterable of currently active Annotations.
      • getActiveAnnotations

        protected java.lang.Iterable<Annotation> getActiveAnnotations()
        Returns the Iterable of currently active Annotations. If the caller has specified a custom Iterable via 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.
        Returns:
        Iterable of currently active Annotations.
      • setAnnotations

        public void setAnnotations​(java.lang.Iterable<Annotation> annotationIterable)
        Overrides the collection of currently active Annotations with the specified 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.

        Parameters:
        annotationIterable - Iterable to use instead of this layer's internal collection, or null to use this layer's internal collection.
      • setOpacity

        public void setOpacity​(double opacity)
        Opacity is not applied to layers of this type because each annotation has an attribute set with opacity control.
        Specified by:
        setOpacity in interface Layer
        Overrides:
        setOpacity in class AbstractLayer
        Parameters:
        opacity - the current opacity value, which is ignored by this layer.
      • getOpacity

        public 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.
        Specified by:
        getOpacity in interface Layer
        Overrides:
        getOpacity in class AbstractLayer
        Returns:
        The layer opacity, a value between 0 and 1.
      • getAnnotationRenderer

        public AnnotationRenderer getAnnotationRenderer()
        Returns the AnnotationRenderer this layer delegates to during picking and rendering.
        Returns:
        AnnotationRenderer used to pick and render Annotations.
      • setAnnotationRenderer

        public void setAnnotationRenderer​(AnnotationRenderer annotationRenderer)
        Sets the AnnotationRenderer this layer delegates to during picking and rendering.
        Parameters:
        annotationRenderer - AnnotationRenderer used to pick and render Annotations.
        Throws:
        java.lang.IllegalArgumentException - If annotationRenderer is null.