Module org.arakhne.afc.gis.giscore
Package org.arakhne.afc.gis.maplayer
Class TreeMapElementLayer<E extends MapElement>
- java.lang.Object
-
- org.arakhne.afc.gis.primitive.AbstractGISElement<C,T>
-
- org.arakhne.afc.gis.primitive.AbstractBoundedGISElement<GISLayerContainer<?>,MapLayer>
-
- org.arakhne.afc.gis.maplayer.MapLayer
-
- org.arakhne.afc.gis.maplayer.MapElementLayer<E>
-
- org.arakhne.afc.gis.maplayer.TreeMapElementLayer<E>
-
- Type Parameters:
E
- is the type of the elements inside this layer.
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,EventListener
,AttributeChangeListener
,AttributeCollection
,AttributeProvider
,GISElementContainer<E>
,BoundedGISElement
,GISBrowsable
,GISCloneable<MapLayer>
,GISContainer<E>
,GISContentElement<GISLayerContainer<?>>
,GISEditable
,GISElement
,GISPrimitive
,BoundedElement2afp<Rectangle2d>
,InformedIterable<E>
,JsonableObject
public class TreeMapElementLayer<E extends MapElement> extends MapElementLayer<E>
This class represents a layer that contains map elements stored inside a tree data-structure.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
ArrayMapElementLayer
,GridMapElementLayer
, Serialized Form- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.arakhne.afc.gis.maplayer.MapLayer
MapLayer.SpecialAttributeValue
-
-
Field Summary
-
Fields inherited from class org.arakhne.afc.gis.maplayer.MapElementLayer
ATTR_ELEMENT_ATTRIBUTES_URL, ATTR_ELEMENT_GEOMETRY_PROJECTION, ATTR_ELEMENT_GEOMETRY_URL
-
Fields inherited from class org.arakhne.afc.gis.maplayer.MapLayer
ATTR_CLICKABLE, ATTR_COLOR, ATTR_REMOVABLE, ATTR_USE_CONTAINER_COLOR, ATTR_VISIBLE, listeners
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISElement
ATTR_NAME, NAME_COMPARATOR
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description TreeMapElementLayer()
Create a new layer with the specified attribute source.TreeMapElementLayer(boolean isTemp)
Create a new layer with the specified attribute source.TreeMapElementLayer(boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id, boolean isTemp)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id, boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id, AttributeCollection attributeSource)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id, AttributeCollection attributeSource, boolean isTemp)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id, AttributeCollection attributeSource, boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id, AttributeCollection attributeSource, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.TreeMapElementLayer(UUID id, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.TreeMapElementLayer(AttributeCollection attributeSource)
Create a new layer with the specified attribute source.TreeMapElementLayer(AttributeCollection attributeSource, boolean isTemp)
Create a new layer with the specified attribute source.TreeMapElementLayer(AttributeCollection attributeSource, boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.TreeMapElementLayer(AttributeCollection attributeSource, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.TreeMapElementLayer(Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addMapElement(E element)
Add a map element inside this container.boolean
addMapElements(Collection<? extends E> elements)
Add map elements inside this container.protected Rectangle2d
calcBounds()
Compute the bounds of this element.TreeMapElementLayer<E>
clone()
Clone this object to obtain a valid copy.Set<E>
getAllMapElements()
Replies the map elements as an array.Class<? extends E>
getElementType()
Replies the class of the elements in this iterable object.E
getMapElementAt(int index)
Replies the map element at the specified index.int
getMapElementCount()
Replies the count of map elements.Shape2d<?>
getShape()
Replies the shape of this this element.Iterator<E>
iterator()
Iterator<E>
iterator(Rectangle2afp<?,?,?,?,?,?> bounds)
Iterates on the elements that intersect the specified bounds.boolean
removeAllMapElements()
Remove all the map elements from this container.boolean
removeMapElement(MapElement element)
Remove a map element from this container.int
size()
Replies the count of map elements inside this container.-
Methods inherited from class org.arakhne.afc.gis.maplayer.MapElementLayer
bindChangeListener, fireElementChanged, fireLayerContentChangedEvent, getElementAttributeSourceURL, getElementGeometrySourceProjection, getElementGeometrySourceURL, onMapElementGraphicalAttributeChanged, setElementAttributeSourceURL, setElementGeometrySource, toJson
-
Methods inherited from class org.arakhne.afc.gis.maplayer.MapLayer
addGISEditableChangeListener, addLayerListener, contains, contains, fireLayerAttributeChangedEvent, fireLayerAttributeChangedEvent, fireLayerContentChangedEvent, fireLayerHierarchyChangedEvent, getColor, getGeoLocation, getListeners, getParentName, getRawColor, indexInParent, intersects, isClickable, isContainerColorUsed, isReadOnlyObject, isRemovable, isTemporaryLayer, isVisible, onAttributeChangeEvent, removeGISEditableChangeListener, removeLayerListener, repaint, resetBoundingBox, setClickable, setColor, setContainer, setContainerColorUse, setReadOnlyObject, setRemovable, setUUID, setVisible, setVisible
-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractBoundedGISElement
getBoundingBox, setBoundingBox
-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractGISElement
addAttributeChangeListener, addAttributes, addAttributes, attributes, copyAttributes, flush, freeMemory, getAllAttributeNames, getAllAttributes, getAllAttributesByType, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, getAttributeCollection, getAttributeCount, getAttributeObject, getAttributeProvider, getContainer, getGeoId, getName, getTopContainer, getUUID, hasAttribute, hashKey, isEventFirable, removeAllAttributes, removeAttribute, removeAttributeChangeListener, renameAttribute, renameAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setAttributeType, setEventFirable, setName, toMap, toMap, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeCollection
addAttributeChangeListener, addAttributes, addAttributes, flush, isEventFirable, removeAllAttributes, removeAttribute, removeAttributeChangeListener, renameAttribute, renameAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setAttributeType, setEventFirable
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeProvider
attributes, freeMemory, getAllAttributeNames, getAllAttributes, getAllAttributesByType, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, getAttributeCount, getAttributeObject, hasAttribute, toMap, toMap
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.BoundedElement2afp
getBoundingBox
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISBrowsable
setName
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISContainer
getColor, getName, resetBoundingBox
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISContentElement
getContainer, getTopContainer
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISEditable
getName, setName
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISElement
copyAttributes, getName, hashKey, setName
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoId, getUUID
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
TreeMapElementLayer
public TreeMapElementLayer()
Create a new layer with the specified attribute source.
-
TreeMapElementLayer
public TreeMapElementLayer(AttributeCollection attributeSource)
Create a new layer with the specified attribute source.- Parameters:
attributeSource
- is the provider of the layer's attributes.
-
TreeMapElementLayer
public TreeMapElementLayer(boolean isTemp)
Create a new layer with the specified attribute source.- Parameters:
isTemp
- indicates if this layer is temporary.
-
TreeMapElementLayer
public TreeMapElementLayer(AttributeCollection attributeSource, boolean isTemp)
Create a new layer with the specified attribute source.- Parameters:
attributeSource
- is the provider of the layer's attributes.isTemp
- indicates if this layer is temporary.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id, AttributeCollection attributeSource)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeSource
- is the provider of the layer's attributes.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id, boolean isTemp)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.isTemp
- indicates if this layer is temporary.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id, AttributeCollection attributeSource, boolean isTemp)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeSource
- is the provider of the layer's attributes.isTemp
- indicates if this layer is temporary.
-
TreeMapElementLayer
public TreeMapElementLayer(Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
bounds
- are the bounds of the world used to ease the tree building.
-
TreeMapElementLayer
public TreeMapElementLayer(AttributeCollection attributeSource, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
attributeSource
- is the provider of the layer's attributes.bounds
- are the bounds of the world used to ease the tree building.
-
TreeMapElementLayer
public TreeMapElementLayer(boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
isTemp
- indicates if this layer is temporary.bounds
- are the bounds of the world used to ease the tree building.
-
TreeMapElementLayer
public TreeMapElementLayer(AttributeCollection attributeSource, boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
attributeSource
- is the provider of the layer's attributes.isTemp
- indicates if this layer is temporary.bounds
- are the bounds of the world used to ease the tree building.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.bounds
- are the bounds of the world used to ease the tree building.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id, AttributeCollection attributeSource, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeSource
- is the provider of the layer's attributes.bounds
- are the bounds of the world used to ease the tree building.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id, boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.isTemp
- indicates if this layer is temporary.bounds
- are the bounds of the world used to ease the tree building.
-
TreeMapElementLayer
public TreeMapElementLayer(UUID id, AttributeCollection attributeSource, boolean isTemp, Rectangle2afp<?,?,?,?,?,?> bounds)
Create a new layer with the specified attribute source.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeSource
- is the provider of the layer's attributes.isTemp
- indicates if this layer is temporary.bounds
- are the bounds of the world used to ease the tree building.
-
-
Method Detail
-
clone
@Pure public TreeMapElementLayer<E> clone()
Description copied from class:MapLayer
Clone this object to obtain a valid copy.- Specified by:
clone
in interfaceAttributeCollection
- Specified by:
clone
in interfaceAttributeProvider
- Specified by:
clone
in interfaceGISCloneable<E extends MapElement>
- Specified by:
clone
in interfaceGISElement
- Overrides:
clone
in classMapLayer
- Returns:
- a copy
-
calcBounds
@Pure protected Rectangle2d calcBounds()
Description copied from class:AbstractBoundedGISElement
Compute the bounds of this element. This function does not update the internal attribute replied byAbstractBoundedGISElement.getBoundingBox()
- Specified by:
calcBounds
in classAbstractBoundedGISElement<GISLayerContainer<?>,MapLayer>
- Returns:
- the bounds
-
getShape
public Shape2d<?> getShape()
Description copied from interface:BoundedGISElement
Replies the shape of this this element.The bounding box replied by
BoundedElement2afp.getBoundingBox()
encloses the replied shape.- Returns:
- the shape or
null
if not applicable.
-
size
@Pure public int size()
Description copied from interface:GISContainer
Replies the count of map elements inside this container.- Returns:
- the count of map elements inside this container.
-
getMapElementAt
@Pure public E getMapElementAt(int index)
Description copied from interface:GISElementContainer
Replies the map element at the specified index.- Parameters:
index
- the index.- Returns:
- the element at the given index
-
getAllMapElements
@Pure public Set<E> getAllMapElements()
Description copied from interface:GISElementContainer
Replies the map elements as an array.- Returns:
- all the elements.
-
addMapElements
public boolean addMapElements(Collection<? extends E> elements)
Description copied from interface:GISElementContainer
Add map elements inside this container.- Parameters:
elements
- the new elements.- Returns:
true
if at least one element was added, otherwisefalse
-
addMapElement
public boolean addMapElement(E element)
Description copied from interface:GISElementContainer
Add a map element inside this container.- Parameters:
element
- the new element.- Returns:
true
if the element was added successfully, otherwisefalse
-
removeMapElement
public boolean removeMapElement(MapElement element)
Description copied from interface:GISElementContainer
Remove a map element from this container.- Parameters:
element
- the element to remove.- Returns:
true
if the element was removed successfully, otherwisefalse
-
removeAllMapElements
public boolean removeAllMapElements()
Description copied from interface:GISElementContainer
Remove all the map elements from this container.- Returns:
true
if container has changed, otherwisefalse
-
getElementType
@Pure public Class<? extends E> getElementType()
Description copied from interface:InformedIterable
Replies the class of the elements in this iterable object.- Returns:
- the type of the elements.
-
getMapElementCount
@Pure public int getMapElementCount()
Description copied from interface:GISElementContainer
Replies the count of map elements.- Returns:
- the count of map elements.
-
iterator
@Pure public Iterator<E> iterator(Rectangle2afp<?,?,?,?,?,?> bounds)
Description copied from interface:GISElementContainer
Iterates on the elements that intersect the specified bounds.- Parameters:
bounds
- is the rectangle inside which the replied elements must be located- Returns:
- an iterator on the map elements.
-
-