Class AbstractGISElement<C extends GISContainer<?>,​T extends AbstractGISElement<C,​T>>

    • Constructor Detail

      • AbstractGISElement

        public AbstractGISElement​(UUID id,
                                  AttributeCollection attributeSource)
        Create a GISElement with the specified attribute provider.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        attributeSource - is the attribute provider to use. If null was specified the new GISElement will use a default attribute provider (most of the time an HeapAttributeCollection
        Since:
        4.0
    • Method Detail

      • isEventFirable

        @Pure
        public boolean isEventFirable()
        Description copied from interface: AttributeCollection
        Replies if the events are fired by this container.
        Specified by:
        isEventFirable in interface AttributeCollection
        Returns:
        true if the events are fired; otherwise false if events are not fired.
      • setEventFirable

        public void setEventFirable​(boolean isFirable)
        Description copied from interface: AttributeCollection
        Set if the events are fired by this container.
        Specified by:
        setEventFirable in interface AttributeCollection
        Parameters:
        isFirable - is true if the events are fired; otherwise false if events are not fired.
      • setContainer

        public boolean setContainer​(C container)
        Sets the container of this MapElement.
        Parameters:
        container - the new container.
        Returns:
        the success state of the operation.
      • getContainer

        @Pure
        public C getContainer()
        Replies the object which contains this MapElement.
        Returns:
        the container or null
      • getTopContainer

        @Pure
        public Object getTopContainer()
        Replies the top-most object which contains this MapElement.
        Returns:
        the top container or null
      • getAttributeCollection

        @Pure
        public AttributeCollection getAttributeCollection()
        Replies the attribute provider associated to this element.
        Returns:
        the attribute provider
      • getAttributeProvider

        @Pure
        public AttributeProvider getAttributeProvider()
        Replies the attribute container associated to this element.
        Returns:
        the attribute container
      • getGeoId

        @Pure
        public final GeoId getGeoId()
        Description copied from interface: GISPrimitive
        Replies an unique identifier for primitive.

        A Geo-Id 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 the same Geo-Id.

        Specified by:
        getGeoId in interface GISPrimitive
        Returns:
        an identifier
        See Also:
        GISPrimitive.getGeoLocation()
      • getUUID

        @Pure
        public UUID getUUID()
        Replies an unique identifier for element.

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

        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:
        getUUID in interface GISPrimitive
        Returns:
        an identifier
        Since:
        4.0
      • setUUID

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

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

        Parameters:
        id - is the new identifier
        Since:
        4.0
      • copyAttributes

        public int copyAttributes​(GISElement container)
        Description copied from interface: GISElement
        Copy all the attributes of the specified container.
        Specified by:
        copyAttributes in interface GISElement
        Parameters:
        container - is the object from which the attributes must be extracted.
        Returns:
        count of copied attributes
      • getName

        @Pure
        public String getName()
        Description copied from interface: GISElement
        Replies the name of the element.
        Specified by:
        getName in interface GISElement
        Returns:
        the name
      • setName

        public void setName​(String name)
        Description copied from interface: GISElement
        Set the name of the element.
        Specified by:
        setName in interface GISElement
        Parameters:
        name - the new name.
      • hasAttribute

        @Pure
        public boolean hasAttribute​(String name)
        Description copied from interface: AttributeProvider
        Replies if the given attribute exists.
        Specified by:
        hasAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        Returns:
        true is an attribute with the given name exists, otherwise false
      • getAllAttributeNames

        @Pure
        public Collection<String> getAllAttributeNames()
        Description copied from interface: AttributeProvider
        Replies all the attribute names. This function never load the attribute values even if they are not inside the storage layer.
        Specified by:
        getAllAttributeNames in interface AttributeProvider
        Returns:
        the list of all attribute names.
      • getAttribute

        @Pure
        public boolean getAttribute​(String name,
                                    boolean defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public int getAttribute​(String name,
                                int defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public long getAttribute​(String name,
                                 long defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public float getAttribute​(String name,
                                  float defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public double getAttribute​(String name,
                                   double defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public String getAttribute​(String name,
                                   String defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public UUID getAttribute​(String name,
                                 UUID defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public URL getAttribute​(String name,
                                URL defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public URI getAttribute​(String name,
                                URI defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public Date getAttribute​(String name,
                                 Date defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public InetAddress getAttribute​(String name,
                                        InetAddress defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public <ET extends Enum<ET>> ET getAttribute​(String name,
                                                     ET defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Type Parameters:
        ET - is the type of the enumeration.
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttribute

        @Pure
        public Class<?> getAttribute​(String name,
                                     Class<?> defaultValue)
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttribute in interface AttributeProvider
        Parameters:
        name - the name.
        defaultValue - is the default value replied if the attribute has no value.
        Returns:
        the value
      • getAttributeAsEnumeration

        @Pure
        public <ET extends Enum<ET>> ET getAttributeAsEnumeration​(String name,
                                                                  Class<ET> type)
                                                           throws AttributeException
        Description copied from interface: AttributeProvider
        Replies the value for the given attribute.
        Specified by:
        getAttributeAsEnumeration in interface AttributeProvider
        Type Parameters:
        ET - is the type of the enumeration to retreive.
        Parameters:
        name - the name.
        type - is the type of the enumeration to retreive.
        Returns:
        the value
        Throws:
        AttributeException - if the attribute was never set.
      • setAttribute

        public Attribute setAttribute​(String name,
                                      boolean value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      int value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      long value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      float value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      double value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      String value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      UUID value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      URL value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      URI value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      Date value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      Enum<?> value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • setAttribute

        public Attribute setAttribute​(String name,
                                      Class<?> value)
        Description copied from interface: AttributeCollection
        Set the value for the given attribute.
        Specified by:
        setAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to set.
        value - is the value to store.
        Returns:
        the changed attribute or null
      • removeAttribute

        public boolean removeAttribute​(String name)
        Description copied from interface: AttributeCollection
        Remove the given attribute.
        Specified by:
        removeAttribute in interface AttributeCollection
        Parameters:
        name - is the name of the attribute to remove.
        Returns:
        true on success, otherwhise false
      • renameAttribute

        public final boolean renameAttribute​(String oldname,
                                             String newname)
        Description copied from interface: AttributeCollection
        Rename the attribute.

        If a attribute named newname already exists, this function will reply false.

        This function is equivalent to renameAttribute(oldname, newname, false).

        Specified by:
        renameAttribute in interface AttributeCollection
        Parameters:
        oldname - is the name of the attribute to rename.
        newname - is the new name of the attribute.
        Returns:
        false if something wrong appends
      • renameAttribute

        public boolean renameAttribute​(String oldname,
                                       String newname,
                                       boolean overwrite)
        Description copied from interface: AttributeCollection
        Rename the attribute .
        Specified by:
        renameAttribute in interface AttributeCollection
        Parameters:
        oldname - is the name of the attribute to rename.
        newname - is the new name of the attribute.
        overwrite - must be true if the value of an existing attribute named by newname must be overwritten by the value of the attribute named oldname.
        Returns:
        false if something wrong appends
      • freeMemory

        public void freeMemory()
        Description copied from interface: AttributeProvider
        Clean the internal memory-storage structures if they exist.

        This function permits to limit the memory usage without removing the attribute value from a hard storage area (database, files...). The attribute which are freed by this method could be reloaded in memory with a call to a getting method.

        Specified by:
        freeMemory in interface AttributeProvider
      • addAttributes

        public void addAttributes​(Map<String,​Object> content)
        Description copied from interface: AttributeCollection
        Put the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.
        Specified by:
        addAttributes in interface AttributeCollection
        Parameters:
        content - is the content to add inside.
        See Also:
        AttributeCollection.setAttributes(Map)
      • flush

        public void flush()
        Description copied from interface: AttributeCollection
        Force this provider to synchronized the memory state of the attributes with a remote storage area.
        Specified by:
        flush in interface AttributeCollection
      • toMap

        @Pure
        public Map<String,​Object> toMap()
        Description copied from interface: AttributeProvider
        Replies the map of the values stored in this attribute provider. The replied map is a copy of or an unmodifiable version of the internal map, if it exists.q
        Specified by:
        toMap in interface AttributeProvider
        Returns:
        the map, never null.
      • toMap

        public void toMap​(Map<String,​Object> mapToFill)
        Description copied from interface: AttributeProvider
        Fill the given map with the values stored in this attribute provider.
        Specified by:
        toMap in interface AttributeProvider
        Parameters:
        mapToFill - is the map to fill, never null.
      • hashKey

        @Pure
        public String hashKey()
        Description copied from interface: GISElement
        Replies a string suitable for hashtables.
        Specified by:
        hashKey in interface GISElement
        Returns:
        a string suitable for hashtables.
      • toJson

        @Pure
        public void toJson​(JsonBuffer buffer)
        Description copied from interface: JsonableObject
        Replies the Json representation of this node.
        Specified by:
        toJson in interface JsonableObject
        Parameters:
        buffer - the Json buffer.