- 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.MultiMapLayer<BusItineraryLayer>
-
- org.arakhne.afc.gis.bus.layer.BusLineLayer
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<BusItineraryLayer>,EventListener,AttributeChangeListener,AttributeCollection,AttributeProvider,BusLayer,GISLayerContainer<BusItineraryLayer>,BoundedGISElement,GISBrowsable,GISCloneable<MapLayer>,GISContainer<BusItineraryLayer>,GISContentElement<GISLayerContainer<?>>,GISEditable,GISElement,GISPrimitive,GISTreeBrowsable<BusItineraryLayer>,BoundedElement2afp<Rectangle2d>,InformedIterable<BusItineraryLayer>,JsonableObject
public class BusLineLayer extends MultiMapLayer<BusItineraryLayer> implements BusLayer
This class permits to display a bus line.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:56
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisbus
-
-
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.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 BusLineLayer(UUID id, AttributeCollection attributeProvider, BusLine line)Create a new layer.BusLineLayer(UUID id, AttributeCollection attributeProvider, BusLine line, boolean autoUpdate)Create a new layer.BusLineLayer(UUID id, BusLine line)Create a new layer.BusLineLayer(UUID id, BusLine line, boolean autoUpdate)Create a new layer.BusLineLayer(AttributeCollection attributeProvider, BusLine line)Create a new layer.BusLineLayer(AttributeCollection attributeProvider, BusLine line, boolean autoUpdate)Create a new layer.BusLineLayer(BusLine line)Create a new layer.BusLineLayer(BusLine line, boolean autoUpdate)Create a new layer.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Rectangle2dcalcBounds()Compute the bounds of this element.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.protected voidfireBusLineChanged()Send an event to notify listeners that the bus line has changed.BusLinegetBusLine()Replies the bus line displayed by this layer.intgetColor()Replies the color of this element or the color of the container.BusPrimitiveInvaliditygetInvalidityReason()Replies the explanation of the invalidity of the primitive.StringgetName()Replies the name of the element.IntegergetRawColor()Replies the color stored inside this element.Shape2d<?>getShape()Replies the shape of this this element.protected voidinitializeElements()Run the initialization of the elements from the current bus line.booleanisLayerAutoUpdated()Replies if this layer is automatically updated when a bus itinerary was removed or added.booleanisValidLayer()Replies if this layer and its content is marked as valid.protected booleanonAllBusItineraryRemoved()Invoked when all the bus itineraries were removed from the attached line.protected booleanonBusItineraryAdded(BusItinerary itinerary, int index)Invoked when a bus itinerary was added in the attached line.protected booleanonBusItineraryChanged(BusItinerary itinerary, int index)Invoked when a bus itinerary was changed in the attached line.protected booleanonBusItineraryRemoved(BusItinerary itinerary, int index)Invoked when a bus itinerary was removed from the attached line.voidresetBoundingBox()Clear the current bounding box to force the computation of it at the next call toAbstractBoundedGISElement.getBoundingBox().voidrevalidate()Check if the validity of this layer is correctly set and change its values if necessary.voidsetColor(int color)Set the color of this element.voidsetLayerAutoUpdated(boolean update)Set if this layer is automatically updated when a bus itinerary was removed or added.voidsetName(String name)Set the name of the element.voidtoJson(JsonBuffer buffer)Replies the Json representation of this node.-
Methods inherited from class org.arakhne.afc.gis.maplayer.MultiMapLayer
addMapLayer, addMapLayer, bindChangeListener, calcVisibleBounds, clear, clone, fireElementChanged, fireLayerAddedEvent, fireLayerAttributeChangedEvent, fireLayerContentChangedEvent, fireLayerHierarchyChangedEvent, fireLayerMovedDownEvent, fireLayerMovedUpEvent, fireLayerRemoveAllEvent, fireLayerRemovedEvent, getAllMapLayers, getBottomUpIterator, getChildAt, getChildCount, getElementType, getMapLayerAt, getMapLayerCount, getParent, getTopDownIterator, getVisibleBoundingBox, indexOf, isBottomLayer, isTopLayer, iterator, moveLayerDown, moveLayerDown, moveLayerUp, moveLayerUp, onAttributeChangeEvent, removeMapLayer, removeMapLayerAt, reverseIterator, setMapLayerAt, size
-
Methods inherited from class org.arakhne.afc.gis.maplayer.MapLayer
addGISEditableChangeListener, addLayerListener, contains, contains, fireLayerAttributeChangedEvent, getGeoLocation, getListeners, getParentName, indexInParent, intersects, isClickable, isContainerColorUsed, isReadOnlyObject, isRemovable, isTemporaryLayer, isVisible, removeGISEditableChangeListener, removeLayerListener, repaint, setClickable, 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, 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, toMap, toMap, toString
-
Methods inherited from class java.lang.Object
equals, 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
getParentName, isVisible, setVisible, setVisible
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISContentElement
getContainer, getTopContainer
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISElement
copyAttributes, hashKey
-
Methods inherited from interface org.arakhne.afc.gis.maplayer.GISLayerContainer
addLayerListener, removeLayerListener
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoId, getGeoLocation, getUUID
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
BusLineLayer
public BusLineLayer(BusLine line)
Create a new layer.- Parameters:
line- is the embedded line
-
BusLineLayer
public BusLineLayer(UUID id, BusLine line)
Create a new layer.- Parameters:
id- is the unique identifier of this element, ornullif unknown.line- is the embedded line- Since:
- 4.0
-
BusLineLayer
public BusLineLayer(AttributeCollection attributeProvider, BusLine line)
Create a new layer.- Parameters:
attributeProvider- is the attribute collection associated to this layer.line- is the embedded line
-
BusLineLayer
public BusLineLayer(BusLine line, boolean autoUpdate)
Create a new layer.- Parameters:
line- is the embedded lineautoUpdate- indicates if this layer is automatically updated when the given line has changed.- Since:
- 4.0
-
BusLineLayer
public BusLineLayer(UUID id, BusLine line, boolean autoUpdate)
Create a new layer.- Parameters:
id- is the unique identifier of this element, ornullif unknown.line- is the embedded lineautoUpdate- indicates if this layer is automatically updated when the given line has changed.- Since:
- 4.0
-
BusLineLayer
public BusLineLayer(AttributeCollection attributeProvider, BusLine line, boolean autoUpdate)
Create a new layer.- Parameters:
attributeProvider- is the attribute collection associated to this layer.line- is the embedded lineautoUpdate- indicates if this layer is automatically updated when the given line has changed.- Since:
- 4.0
-
BusLineLayer
public BusLineLayer(UUID id, AttributeCollection attributeProvider, BusLine line)
Create a new layer.- Parameters:
id- is the unique identifier of this element, ornullif unknown.attributeProvider- is the attribute collection associated to this layer.line- is the embedded line- Since:
- 4.0
-
BusLineLayer
public BusLineLayer(UUID id, AttributeCollection attributeProvider, BusLine line, boolean autoUpdate)
Create a new layer.- Parameters:
id- is the unique identifier of this element, ornullif unknown.attributeProvider- is the attribute collection associated to this layer.line- is the embedded lineautoUpdate- indicates if this layer is automatically updated when the given line has changed.- Since:
- 4.0
-
-
Method Detail
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObjectReplies the Json representation of this node.- Specified by:
toJsonin interfaceJsonableObject- Overrides:
toJsonin classMultiMapLayer<BusItineraryLayer>- Parameters:
buffer- the Json buffer.
-
finalize
@Deprecated(since="17.0", forRemoval=true) protected void finalize() throws Throwable
Deprecated, for removal: This API element is subject to removal in a future version.
-
initializeElements
protected void initializeElements()
Run the initialization of the elements from the current bus line.This function is invoked by the constructor of BusLineLayer if its parameter autoUpdate is
true, and not invoked if this parameter isfalse.
-
onBusItineraryAdded
protected boolean onBusItineraryAdded(BusItinerary itinerary, int index)
Invoked when a bus itinerary was added in the attached line.This function exists to allow be override to provide a specific behaviour when a bus itinerary has been added.
- Parameters:
itinerary- is the new itinerary.index- is the index of the bus itinerary.- Returns:
trueif the events was fired, otherwisefalse.
-
onBusItineraryRemoved
protected boolean onBusItineraryRemoved(BusItinerary itinerary, int index)
Invoked when a bus itinerary was removed from the attached line.This function exists to allow be override to provide a specific behaviour when a bus itinerary has been removed.
- Parameters:
itinerary- is the removed itinerary.index- is the index of the bus itinerary.- Returns:
trueif the events was fired, otherwisefalse.
-
onAllBusItineraryRemoved
protected boolean onAllBusItineraryRemoved()
Invoked when all the bus itineraries were removed from the attached line.This function exists to allow be override to provide a specific behaviour when a bus itinerary has been removed.
- Returns:
trueif the events was fired, otherwisefalse.
-
onBusItineraryChanged
protected boolean onBusItineraryChanged(BusItinerary itinerary, int index)
Invoked when a bus itinerary was changed in the attached line.This function exists to allow be override to provide a specific behaviour when a bus itinerary has changed.
- Parameters:
itinerary- is the changed itinerary.index- is the index of the bus itinerary.- Returns:
trueif the events was fired, otherwisefalse.
-
fireBusLineChanged
protected void fireBusLineChanged()
Send an event to notify listeners that the bus line has changed.
-
isLayerAutoUpdated
public boolean isLayerAutoUpdated()
Replies if this layer is automatically updated when a bus itinerary was removed or added.- Returns:
trueif the layer is automatically updated,false.
-
setLayerAutoUpdated
public void setLayerAutoUpdated(boolean update)
Set if this layer is automatically updated when a bus itinerary was removed or added.- Parameters:
update- istrueif the layer should be automatically updated,false.
-
getName
public String getName()
Description copied from interface:GISElementReplies the name of the element.- Specified by:
getNamein interfaceGISContainer<BusItineraryLayer>- Specified by:
getNamein interfaceGISEditable- Specified by:
getNamein interfaceGISElement- Overrides:
getNamein classAbstractGISElement<GISLayerContainer<?>,MapLayer>- Returns:
- the name
-
getRawColor
public Integer getRawColor()
Description copied from interface:GISEditableReplies the color stored inside this element.- Specified by:
getRawColorin interfaceGISEditable- Overrides:
getRawColorin classMapLayer- Returns:
- the color of this element, or
null.
-
getColor
public int getColor()
Description copied from interface:GISEditableReplies the color of this element or the color of the container.- Specified by:
getColorin interfaceGISContainer<BusItineraryLayer>- Specified by:
getColorin interfaceGISEditable- Overrides:
getColorin classMapLayer- Returns:
- the color.
- See Also:
GISEditable.getRawColor()
-
setName
public void setName(String name)
Description copied from interface:GISElementSet the name of the element.- Specified by:
setNamein interfaceGISBrowsable- Specified by:
setNamein interfaceGISEditable- Specified by:
setNamein interfaceGISElement- Overrides:
setNamein classAbstractGISElement<GISLayerContainer<?>,MapLayer>- Parameters:
name- the new name.
-
setColor
public void setColor(int color)
Description copied from interface:GISBrowsableSet the color of this element.- Specified by:
setColorin interfaceGISBrowsable- Specified by:
setColorin interfaceGISEditable- Overrides:
setColorin classMapLayer- Parameters:
color- the new color.
-
calcBounds
protected Rectangle2d calcBounds()
Description copied from class:AbstractBoundedGISElementCompute the bounds of this element. This function does not update the internal attribute replied byAbstractBoundedGISElement.getBoundingBox()- Overrides:
calcBoundsin classMultiMapLayer<BusItineraryLayer>- Returns:
- the bounds
-
getShape
public Shape2d<?> getShape()
Description copied from interface:BoundedGISElementReplies the shape of this this element.The bounding box replied by
BoundedElement2afp.getBoundingBox()encloses the replied shape.- Specified by:
getShapein interfaceBoundedGISElement- Overrides:
getShapein classMultiMapLayer<BusItineraryLayer>- Returns:
- the shape or
nullif not applicable.
-
resetBoundingBox
public void resetBoundingBox()
Description copied from class:MapLayerClear the current bounding box to force the computation of it at the next call toAbstractBoundedGISElement.getBoundingBox().- Specified by:
resetBoundingBoxin interfaceBoundedGISElement- Specified by:
resetBoundingBoxin interfaceGISContainer<BusItineraryLayer>- Overrides:
resetBoundingBoxin classMultiMapLayer<BusItineraryLayer>
-
getBusLine
public BusLine getBusLine()
Replies the bus line displayed by this layer.- Returns:
- the bus line displayed by this layer.
-
isValidLayer
public boolean isValidLayer()
Description copied from interface:BusLayerReplies if this layer and its content is marked as valid.The validity of a bus primitive depends on the type of this primitive. Please refers to the documentation of that primitive.
- Specified by:
isValidLayerin interfaceBusLayer- Returns:
trueif the layer is valid, otherwisefalse
-
getInvalidityReason
public BusPrimitiveInvalidity getInvalidityReason()
Description copied from interface:BusLayerReplies the explanation of the invalidity of the primitive.- Specified by:
getInvalidityReasonin interfaceBusLayer- Returns:
- the invalidity reason.
-
revalidate
public void revalidate()
Description copied from interface:BusLayerCheck if the validity of this layer is correctly set and change its values if necessary. This function revalidate also all the layers and primitives inside this layer.- Specified by:
revalidatein interfaceBusLayer
-
-