Class MapLayer

    • Field Detail

      • ATTR_USE_CONTAINER_COLOR

        public static final String ATTR_USE_CONTAINER_COLOR
        Name of the attribute that indicates if the element must use its container's color.
        See Also:
        Constant Field Values
      • ATTR_CLICKABLE

        public static final String ATTR_CLICKABLE
        Name of the attribute that indicates if the element could be clicked.
        See Also:
        Constant Field Values
      • ATTR_VISIBLE

        public static final String ATTR_VISIBLE
        Name of the attribute that indicates if the element is visible.
        See Also:
        Constant Field Values
      • ATTR_REMOVABLE

        public static final String ATTR_REMOVABLE
        Name of the attribute that indicates if the element is removabled from its parent.
        See Also:
        Constant Field Values
      • listeners

        protected transient ListenerCollection<?> listeners
        List of listeners on the events.
    • Constructor Detail

      • MapLayer

        public MapLayer​(UUID id,
                        AttributeCollection attributeSource)
        Create a new layer with the specified attribute source.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        attributeSource - is the provider of the layer's attributes.
        Since:
        4.0
      • MapLayer

        public MapLayer​(UUID id,
                        AttributeCollection attributeSource,
                        boolean isTemp)
        Create a new layer with the specified attribute source.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        attributeSource - is the provider of the layer's attributes.
        isTemp - indicates if this layer is temporary.
        Since:
        4.0
    • Method Detail

      • setUUID

        public final void setUUID​(UUID id)
        Set the unique identifier for element.

        A Unique IDentifier (UID) must be unique for all the object instances.

        Overrides:
        setUUID in class AbstractGISElement<GISLayerContainer<?>,​MapLayer>
        Parameters:
        id - is the new identifier
        Since:
        4.0
      • addLayerListener

        public final void addLayerListener​(MapLayerListener listener)
        Add a listener on the layer's events.
        Parameters:
        listener - the listener.
      • removeLayerListener

        public final void removeLayerListener​(MapLayerListener listener)
        Remove a listener on the layer's events.
        Parameters:
        listener - the listener.
      • getListeners

        @Pure
        protected final MapLayerListener[] getListeners()
        Replies the list of listeners on this object.
        Returns:
        the list of listeners on this object.
      • fireLayerHierarchyChangedEvent

        public void fireLayerHierarchyChangedEvent​(MapLayerHierarchyEvent event)
        Fire the event that indicates the hierarchy of layers has changed. Only the MapLayerListener and the container are notified.
        Parameters:
        event - the event.
      • fireLayerContentChangedEvent

        public void fireLayerContentChangedEvent​(MapLayerContentEvent event)
        Forward to the parent layer the event that indicates the content of a child layer was changed. Only the MapLayerListener and the container are notified.
        Parameters:
        event - the event.
      • repaint

        public final void repaint()
        Send a repainting query. Notify listeners about any change in the layer which cause repaint of the panel.
      • fireElementChanged

        public void fireElementChanged()
        Fire the event that indicates this object has changed. Only the GISEditableChangeListener are notified.
      • fireLayerAttributeChangedEvent

        public void fireLayerAttributeChangedEvent​(MapLayerAttributeChangeEvent event)
        Forward to the parent layer the event that indicates the content of a child layer was changed. Only the MapLayerListener and the container are notified.
        Parameters:
        event - the event
      • fireLayerAttributeChangedEvent

        public void fireLayerAttributeChangedEvent​(String attributeName,
                                                   Object oldValue,
                                                   Object newValue)
        Forward to the parent layer the event that indicates the content of a child layer was changed. Only the MapLayerListener and the container are notified.
        Parameters:
        attributeName - is the name of the changed attribute.
        oldValue - is the old value of the attribute.
        newValue - is the new value of the attribute.
      • getParentName

        @Pure
        public String getParentName()
        Description copied from interface: GISBrowsable
        Replies the name of the parent.
        Specified by:
        getParentName in interface GISBrowsable
        Returns:
        the name of the parent.
      • getGeoLocation

        @Pure
        public GeoLocation getGeoLocation()
        Description copied from interface: GISPrimitive
        Replies the geo-location.

        A GeoLocation is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have equal GeoLocations.

        The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):

        
         GISElement obj1 = new MapPolyline(100,10,200,30,300,4);
         GISElement obj2 = new MapPolyline(100,10,200,30,300,4);
         assert( obj1.getGeoId().equals(obj2.getGeoId()) );
         assert( obj2.getGeoId().equals(obj1.getGeoId()) );
         assert( ! obj1.getUid().equals(obj2.getUid()) );
         assert( ! obj2.getUid().equals(obj1.getUid()) );
         
        Specified by:
        getGeoLocation in interface GISPrimitive
        Returns:
        a location
        See Also:
        GISPrimitive.getGeoId(), GISPrimitive.getGeoLocation()
      • contains

        @Pure
        public boolean contains​(Point2D<?,​?> point,
                                double delta)
        Replies if the specified point (x,y) was inside the figure of this MapElement.

        If this MapElement has no associated figure, this method always returns false.

        Parameters:
        point - is a geo-referenced coordinate
        delta - is the geo-referenced distance that corresponds to a approximation distance in the screen coordinate system
        Returns:
        true if this MapElement had an associated figure and the specified point was inside this bounds of this figure, otherwhise false
      • contains

        @Pure
        public final boolean contains​(Point2D<?,​?> point)
        Replies if the specified point (x,y) was inside the figure of this MapElement.

        If this MapElement has no associated figure, this method always returns false.

        Parameters:
        point - is a geo-referenced coordinate
        Returns:
        true if this MapElement had an associated figure and the specified point was inside this bounds of this figure, otherwhise false
      • indexInParent

        @Pure
        public int indexInParent()
        Replies the index of this layer in its parent.
        Returns:
        the index of this layer in its parent, or -1 if not found.
      • intersects

        @Pure
        public boolean intersects​(Shape2d<?> rectangle)
        Replies if this element has an intersection with the specified rectangle.

        If this MapElement has no associated figure, this method always returns false.

        Parameters:
        rectangle - the rectangle.
        Returns:
        true if this MapElement has an associated figure and the specified rectangle intersecting the figure, otherwhise false
      • setContainerColorUse

        public void setContainerColorUse​(boolean useContainerColor)
        Set the flag that indicates if this element use its color or the container's color.
        Parameters:
        useContainerColor - must be true if this element must use the container's color, and must be false to use the element's color.
      • isContainerColorUsed

        @Pure
        public boolean isContainerColorUsed()
        Replies the flag that indicates if this element use its color or the container's color.
        Returns:
        true if this element must use the container's color, and false to use the element's color.
      • getRawColor

        @Pure
        public Integer getRawColor()
        Description copied from interface: GISEditable
        Replies the color stored inside this element.
        Specified by:
        getRawColor in interface GISEditable
        Returns:
        the color of this element, or null.
      • setColor

        public void setColor​(int color)
        Description copied from interface: GISBrowsable
        Set the color of this element.
        Specified by:
        setColor in interface GISBrowsable
        Specified by:
        setColor in interface GISEditable
        Parameters:
        color - the new color.
      • setClickable

        public void setClickable​(boolean clickable)
        Set if this layer accepts the user clicks.
        Parameters:
        clickable - is true to set this layer allowing mouse click events.
      • isClickable

        @Pure
        public boolean isClickable()
        Replies if this layer accepts the user clicks.
        Returns:
        true if this layer allows mouse click events, otherwise false
      • setVisible

        public final void setVisible​(boolean visible)
        Description copied from interface: GISBrowsable
        Set if this element is assumed to be visible inside a displayer. This flag should not be used to adapt the visibility of the element inside the browser.
        Specified by:
        setVisible in interface GISBrowsable
        Parameters:
        visible - must be true if this element is visible, otherwise false
      • setVisible

        public void setVisible​(boolean visible,
                               boolean setChildrenVisibility)
        Description copied from interface: GISBrowsable
        Set if this element is assumed to be visible inside a displayer. This flag should not be used to adapt the visibility of the element inside the browser.
        Specified by:
        setVisible in interface GISBrowsable
        Parameters:
        visible - must be true if this element is visible, otherwise false
        setChildrenVisibility - indicates if the children visibility should be also changed in turn.
      • isTemporaryLayer

        @Pure
        public final boolean isTemporaryLayer()
        Replies if this layer was mark as temporary lyer.

        A temporary layer means that any things inside this layer is assumed to be lost when the layer will be destroyed.

        Returns:
        true if this layer is temporary, otherwise false
      • isReadOnlyObject

        @Pure
        public boolean isReadOnlyObject()
        Description copied from interface: GISEditable
        Replies if this editable object want to be seen as a reed-only object.

        Even if this object replies true, it is possible to change its attributes. The value replied by this function is just a desire from this object. It could be used by the GUI to allow edition or not from a graphical component.

        Specified by:
        isReadOnlyObject in interface GISEditable
        Returns:
        true if this object ant to be assumed as read-only, otherwise false
      • setReadOnlyObject

        public void setReadOnlyObject​(boolean readOnly)
        Replies if this editable object want to be seen as a reed-only object.

        Even if this object replies true, it is possible to change its attributes. The value replied by this function is just a desire from this object. It could be used by the GUI to allow edition or not from a graphical component.

        Parameters:
        readOnly - the read-only flag.
      • isVisible

        @Pure
        public boolean isVisible()
        Description copied from interface: GISBrowsable
        Replies if this element is assumed to be visible inside a displayer. This flag should not be used to adapt the visibility of the element inside the browser.
        Specified by:
        isVisible in interface GISBrowsable
        Returns:
        true if this element is visible, otherwise false
      • setRemovable

        public void setRemovable​(boolean removable)
        Set if this layer is removable from this container. This removal value permits to the container to be informed about the desired removal state from its component. The usage of this state by the container depends only of its implementation.
        Parameters:
        removable - is true to set this layer to be removable from its container, otherwise false
      • isRemovable

        @Pure
        public boolean isRemovable()
        Replies if this layer is removable from this container. This removal value permits to the container to be informed about the desired removal state from its component. The usage of this state by the container depends only of its implementation.
        Returns:
        true if this layer is removable from its container, otherwise false