- 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.bus.layer.BusItineraryLayer
-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,AttributeChangeListener
,AttributeCollection
,AttributeProvider
,BusLayer
,BoundedGISElement
,GISBrowsable
,GISCloneable<MapLayer>
,GISContentElement<GISLayerContainer<?>>
,GISEditable
,GISElement
,GISPrimitive
,BoundedElement2afp<Rectangle2d>
,JsonableObject
public class BusItineraryLayer extends MapLayer implements BusLayer
This class permits to display a bus itinerary.- 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 BusItineraryLayer(UUID id, AttributeCollection attributeProvider, BusItinerary itinerary)
Create a new layer.BusItineraryLayer(UUID id, AttributeCollection attributeProvider, BusItinerary itinerary, boolean autoUpdate)
Create a new layer.BusItineraryLayer(UUID id, BusItinerary itinerary)
Create a new layer.BusItineraryLayer(UUID id, BusItinerary itinerary, boolean autoUpdate)
Create a new layer.BusItineraryLayer(AttributeCollection attributeProvider, BusItinerary itinerary)
Create a new layer.BusItineraryLayer(AttributeCollection attributeProvider, BusItinerary itinerary, boolean autoUpdate)
Create a new layer.BusItineraryLayer(BusItinerary itinerary)
Create a new layer.BusItineraryLayer(BusItinerary itinerary, boolean autoUpdate)
Create a new layer.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Rectangle2d
calcBounds()
Compute the bounds of this element.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.protected void
fireBusItineraryChanged()
Send an event to notify listeners that the bus itinerary has changed.BusItinerary
getBusItinerary()
Replies the bus itinerary displayed by this layer.int
getColor()
Replies the color of this element or the color of the container.BusPrimitiveInvalidity
getInvalidityReason()
Replies the explanation of the invalidity of the primitive.String
getName()
Replies the name of the element.Integer
getRawColor()
Replies the color stored inside this element.Shape2d<?>
getShape()
Replies the shape of this this element.protected void
initializeElements()
Run the initialization of the elements from the current bus itinerary.boolean
isLayerAutoUpdated()
Replies if this layer is automatically updated when a bus itinerary was removed or added.boolean
isValidLayer()
Replies if this layer and its content is marked as valid.protected boolean
onAllBusItineraryHaltRemoved(BusChangeEvent event)
Invoked when all the bus itinerary halts were removed from the attached itinerary.protected boolean
onBusItineraryHaltAdded(BusItineraryHalt halt, int index, BusChangeEvent event)
Invoked when a bus itinerary halt was added in the attached itinerary.protected boolean
onBusItineraryHaltChanged(BusItineraryHalt halt, int index, BusChangeEvent event)
Invoked when a bus itinerary halt was changed in the attached itinerary.protected boolean
onBusItineraryHaltRemoved(BusItineraryHalt halt, int index, BusChangeEvent event)
Invoked when a bus itinerary halt was removed from the attached itinerary.protected boolean
onBusItineraryInverted(BusChangeEvent event)
Invoked when a bus itinerary is inverted.void
resetBoundingBox()
Clear the current bounding box to force the computation of it at the next call toAbstractBoundedGISElement.getBoundingBox()
.void
revalidate()
Check if the validity of this layer is correctly set and change its values if necessary.void
setColor(int color)
Set the color of this element.void
setLayerAutoUpdated(boolean update)
Set if this layer is automatically updated when a bus itinerary was removed or added.void
setName(String name)
Set the name of the element.void
toJson(JsonBuffer buffer)
Replies the Json representation of this node.-
Methods inherited from class org.arakhne.afc.gis.maplayer.MapLayer
addGISEditableChangeListener, addLayerListener, clone, contains, contains, fireElementChanged, fireLayerAttributeChangedEvent, fireLayerAttributeChangedEvent, fireLayerContentChangedEvent, fireLayerHierarchyChangedEvent, getGeoLocation, getListeners, getParentName, indexInParent, intersects, isClickable, isContainerColorUsed, isReadOnlyObject, isRemovable, isTemporaryLayer, isVisible, onAttributeChangeEvent, 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.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.primitive.GISPrimitive
getGeoId, getUUID
-
-
-
-
Constructor Detail
-
BusItineraryLayer
public BusItineraryLayer(BusItinerary itinerary)
Create a new layer.- Parameters:
itinerary
- is the embedded itinerary
-
BusItineraryLayer
public BusItineraryLayer(BusItinerary itinerary, boolean autoUpdate)
Create a new layer.- Parameters:
itinerary
- is the embedded itineraryautoUpdate
- indicates if this layer is automatically updated when the given itinerary has changed.- Since:
- 4.0
-
BusItineraryLayer
public BusItineraryLayer(UUID id, BusItinerary itinerary)
Create a new layer.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.itinerary
- is the embedded itinerary- Since:
- 4.0
-
BusItineraryLayer
public BusItineraryLayer(UUID id, BusItinerary itinerary, boolean autoUpdate)
Create a new layer.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.itinerary
- is the embedded itineraryautoUpdate
- indicates if this layer is automatically updated when the given itinerary has changed.- Since:
- 4.0
-
BusItineraryLayer
public BusItineraryLayer(AttributeCollection attributeProvider, BusItinerary itinerary)
Create a new layer.- Parameters:
attributeProvider
- is the attribute collection associated to this layer.itinerary
- is the itinerary to put in the layer.
-
BusItineraryLayer
public BusItineraryLayer(AttributeCollection attributeProvider, BusItinerary itinerary, boolean autoUpdate)
Create a new layer.- Parameters:
attributeProvider
- is the attribute collection associated to this layer.itinerary
- is the itinerary to put in the layer.autoUpdate
- indicates if this layer is automatically updated when the given itinerary has changed.- Since:
- 4.0
-
BusItineraryLayer
public BusItineraryLayer(UUID id, AttributeCollection attributeProvider, BusItinerary itinerary)
Create a new layer.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeProvider
- is the attribute collection associated to this layer.itinerary
- is the itinerary to put in the layer.- Since:
- 4.0
-
BusItineraryLayer
public BusItineraryLayer(UUID id, AttributeCollection attributeProvider, BusItinerary itinerary, boolean autoUpdate)
Create a new layer.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeProvider
- is the attribute collection associated to this layer.itinerary
- is the itinerary to put in the layer.autoUpdate
- indicates if this layer is automatically updated when the given itinerary has changed.- Since:
- 4.0
-
-
Method Detail
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObject
Replies the Json representation of this node.- Specified by:
toJson
in interfaceJsonableObject
- Overrides:
toJson
in classAbstractBoundedGISElement<GISLayerContainer<?>,MapLayer>
- 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 itinerary.This function is invoked by the constructor of BusItineraryLayer if its parameter autoUpdate is
true
, and not invoked if this parameter isfalse
.
-
onBusItineraryInverted
protected boolean onBusItineraryInverted(BusChangeEvent event)
Invoked when a bus itinerary is inverted.This function exists to allow be override to provide a specific behaviour when a bus itinerary has been inverted.
- Parameters:
event
- is the source of the event.- Returns:
true
if the events was fired, otherwisefalse
.
-
onBusItineraryHaltAdded
protected boolean onBusItineraryHaltAdded(BusItineraryHalt halt, int index, BusChangeEvent event)
Invoked when a bus itinerary halt was added in the attached itinerary.This function exists to allow be override to provide a specific behaviour when a bus itinerary halt has been added.
- Parameters:
halt
- is the new itinerary halt.index
- is the index of the bus halt.event
- is the source of the event.- Returns:
true
if the events was fired, otherwisefalse
.
-
onBusItineraryHaltRemoved
protected boolean onBusItineraryHaltRemoved(BusItineraryHalt halt, int index, BusChangeEvent event)
Invoked when a bus itinerary halt was removed from the attached itinerary.This function exists to allow be override to provide a specific behaviour when a bus itinerary halt has been removed.
- Parameters:
halt
- is the removed itinerary halt.index
- is the index of the bus halt.event
- is the source of the event.- Returns:
true
if the events was fired, otherwisefalse
.
-
onAllBusItineraryHaltRemoved
protected boolean onAllBusItineraryHaltRemoved(BusChangeEvent event)
Invoked when all the bus itinerary halts were removed from the attached itinerary.This function exists to allow be override to provide a specific behaviour when a bus itinerary halt has been removed.
- Parameters:
event
- is the source of the event.- Returns:
true
if the events was fired, otherwisefalse
.
-
onBusItineraryHaltChanged
protected boolean onBusItineraryHaltChanged(BusItineraryHalt halt, int index, BusChangeEvent event)
Invoked when a bus itinerary halt was changed in the attached itinerary.This function exists to allow be override to provide a specific behaviour when a bus itinerary halt has changed.
- Parameters:
halt
- is the changed itinerary halt.index
- is the index of the bus halt.event
- is the source of the event.- Returns:
true
if the events was fired, otherwisefalse
.
-
fireBusItineraryChanged
protected void fireBusItineraryChanged()
Send an event to notify listeners that the bus itinerary has changed.
-
isLayerAutoUpdated
@Pure public boolean isLayerAutoUpdated()
Replies if this layer is automatically updated when a bus itinerary was removed or added.- Returns:
true
if 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
- istrue
if the layer should be automatically updated,false
.
-
getName
@Pure public String getName()
Description copied from interface:GISElement
Replies the name of the element.- Specified by:
getName
in interfaceGISEditable
- Specified by:
getName
in interfaceGISElement
- Overrides:
getName
in classAbstractGISElement<GISLayerContainer<?>,MapLayer>
- Returns:
- the name
-
getRawColor
@Pure public Integer getRawColor()
Description copied from interface:GISEditable
Replies the color stored inside this element.- Specified by:
getRawColor
in interfaceGISEditable
- Overrides:
getRawColor
in classMapLayer
- Returns:
- the color of this element, or
null
.
-
getColor
@Pure public int getColor()
Description copied from interface:GISEditable
Replies the color of this element or the color of the container.- Specified by:
getColor
in interfaceGISEditable
- Overrides:
getColor
in classMapLayer
- Returns:
- the color.
- See Also:
GISEditable.getRawColor()
-
setName
public void setName(String name)
Description copied from interface:GISElement
Set the name of the element.- Specified by:
setName
in interfaceGISBrowsable
- Specified by:
setName
in interfaceGISEditable
- Specified by:
setName
in interfaceGISElement
- Overrides:
setName
in classAbstractGISElement<GISLayerContainer<?>,MapLayer>
- Parameters:
name
- the new name.
-
setColor
public void setColor(int color)
Description copied from interface:GISBrowsable
Set the color of this element.- Specified by:
setColor
in interfaceGISBrowsable
- Specified by:
setColor
in interfaceGISEditable
- Overrides:
setColor
in classMapLayer
- Parameters:
color
- the new color.
-
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.- Specified by:
getShape
in interfaceBoundedGISElement
- Returns:
- the shape or
null
if not applicable.
-
resetBoundingBox
public void resetBoundingBox()
Description copied from class:MapLayer
Clear the current bounding box to force the computation of it at the next call toAbstractBoundedGISElement.getBoundingBox()
.- Specified by:
resetBoundingBox
in interfaceBoundedGISElement
- Overrides:
resetBoundingBox
in classMapLayer
-
getBusItinerary
@Pure public BusItinerary getBusItinerary()
Replies the bus itinerary displayed by this layer.- Returns:
- the bus itinerary displayed by this layer.
-
isValidLayer
@Pure public boolean isValidLayer()
Description copied from interface:BusLayer
Replies 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:
isValidLayer
in interfaceBusLayer
- Returns:
true
if the layer is valid, otherwisefalse
-
getInvalidityReason
@Pure public BusPrimitiveInvalidity getInvalidityReason()
Description copied from interface:BusLayer
Replies the explanation of the invalidity of the primitive.- Specified by:
getInvalidityReason
in interfaceBusLayer
- Returns:
- the invalidity reason.
-
revalidate
public void revalidate()
Description copied from interface:BusLayer
Check 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:
revalidate
in interfaceBusLayer
-
-