- java.lang.Object
-
- org.arakhne.afc.gis.primitive.AbstractGISElement<C,T>
-
- org.arakhne.afc.gis.primitive.AbstractBoundedGISElement<CONTAINER,AbstractBusPrimitive<CONTAINER>>
-
- org.arakhne.afc.gis.bus.network.AbstractBusPrimitive<BusNetwork>
-
- org.arakhne.afc.gis.bus.network.BusStop
-
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,AttributeChangeListener,AttributeCollection,AttributeProvider,BusPrimitive<BusNetwork>,BoundedGISElement,FlagContainer,GISCloneable<AbstractBusPrimitive<BusNetwork>>,GISEditable,GISElement,GISFlagContainer,GISPrimitive,BoundedElement2afp<Rectangle2d>,JsonableObject
public class BusStop extends AbstractBusPrimitive<BusNetwork>
A bus stop is a designated place where buses stop for passengers to board or leave a bus. These are normally positioned on the highway and are distinct from off-highway facilities such as bus hubs. The construction of bus stops tends to reflect the level of usage. Stops at busy locations may have shelters, seating and possibly electronic passenger information systems; less busy stops may use a simple pole and flag to mark the location and 'customary stops' have no specific infrastructure being known by their description. Bus stops may be clustered together into transport hubs allowing interchange between routes from nearby stops and with other public transport modes.
Source: WikiPediaValidation
A bus stop is valid only if the bus stop has a position.- 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
-
-
Field Summary
-
Fields inherited from class org.arakhne.afc.gis.bus.network.AbstractBusPrimitive
ATTR_COLOR, DEFAULT_COLOR
-
Fields inherited from interface org.arakhne.afc.gis.primitive.FlagContainer
FLAG_READONLY, FLAG_SELECTED
-
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 BusStop(String name)Create a stop with attributes stored in memory.BusStop(String name, AttributeCollection attributeProvider)Create a bus stop.BusStop(String name, GeoLocationPoint position)Create a stop with attributes stored in memory.BusStop(String name, GeoLocationPoint position, AttributeCollection attributeProvider)Create a bus stop.BusStop(UUID id, String name)Create a stop with attributes stored in memory.BusStop(UUID id, String name, AttributeCollection attributeProvider)Create a bus stop.BusStop(UUID id, String name, GeoLocationPoint position)Create a stop with attributes stored in memory.BusStop(UUID id, String name, GeoLocationPoint position, AttributeCollection attributeProvider)Create a bus stop.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddBusHalt(BusItineraryHalt halt)Add a bus halt reference.(package private) voidaddBusHub(BusHub hub)Add a hub reference.Iterator<BusHub>busHubIterator()Replies the hubs in which this bus stop is located.Iterable<BusHub>busHubs()Replies the hubs in which this bus stop is located.protected Rectangle2dcalcBounds()Compute the bounds of this element.protected voidcheckPrimitiveValidity()Check if the validity of this primitive is correctly set and change its values if necessary.doubledistance(double x, double y)Replies the distance between the given point and this bus stop.doubledistance(BusItineraryHalt halt)Replies the distance between the given bus itinerary halt and this bus stop.doubledistance(BusStop stop)Replies the distance between the given bus stop and this bus stop.doubledistance(GeoLocationPoint point)Replies the distance between the given point and this bus stop.doubledistance(Point2D<?,?> point)Replies the distance between the given point and this bus stop.protected voidfireValidityChangedFor(Object changedObject, int index, BusPrimitiveInvalidity oldReason, BusPrimitiveInvalidity newReason)Fire the event that indicates the validity of the object has changed.Iterable<BusItineraryHalt>getBindedBusHalts()Replies the bus itinerary halts associated to this bus stop.BusNetworkgetBusNetwork()Replies the bus network in which this primitive is.static StringgetFirstFreeBusStopName(BusNetwork busNetwork)Replies a bus stop name that was not exist in the specified bus network.GeoLocationgetGeoLocation()Replies the geo-location.GeoLocationPointgetGeoPosition()Replies the position of the bus stop.Point2dgetPosition2D()Replies the position of the bus stop.Shape2d<?>getShape()Replies the shape of this this element.intindexInParent()Replies the index of this primitive in its parent.booleaninsideBusHub()Replies if this bus stop is inside a hub.booleanisBusHaltBinded()Replies if this bus stop is associated to a bus itinerary halt.voidrebuild(boolean fireEvents)Rebuild the primitive and all the primitive inside.(package private) voidremoveBusHalt(BusItineraryHalt halt)Remove a bus halt reference.(package private) voidremoveBusHub(BusHub hub)Remove a hub reference.booleansetContainer(BusNetwork container)Sets the container of this MapElement.voidsetName(String name)Set the name of the element.voidsetPosition(GeoLocationPoint position)Set the position of the element.voidtoJson(JsonBuffer buffer)Replies the Json representation of this node.-
Methods inherited from class org.arakhne.afc.gis.bus.network.AbstractBusPrimitive
addBusChangeListener, addGISEditableChangeListener, addListener, finalize, fireGraphicalAttributeChanged, fireGraphicalAttributeChanged, firePrimitiveChanged, firePrimitiveChanged, firePrimitiveChanged, fireShapeChanged, fireShapeChanged, fireValidityChanged, getColor, getColor, getFlags, getInvalidityReason, getRawColor, hasFlag, isReadOnlyObject, isValidPrimitive, onAttributeChanged, rebuild, removeBusChangeListener, removeGISEditableChangeListener, removeListener, revalidate, setColor, setFlag, setPrimitiveValidity, setReadOnlyObject, setUUID, switchFlag, unsetFlag
-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractBoundedGISElement
clone, getBoundingBox, resetBoundingBox, 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, onAttributeChangeEvent, 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.BoundedGISElement
resetBoundingBox
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISEditable
getName
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISElement
clone, copyAttributes, getName, hashKey
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoId, getUUID
-
-
-
-
Constructor Detail
-
BusStop
public BusStop(String name)
Create a stop with attributes stored in memory.- Parameters:
name- is the name of the new bus stop
-
BusStop
public BusStop(UUID id, String name)
Create a stop with attributes stored in memory.- Parameters:
id- is the unique identifier of this element, ornullif unknown.name- is the name of the new bus stop
-
BusStop
public BusStop(String name, AttributeCollection attributeProvider)
Create a bus stop.- Parameters:
name- is the name of the new bus stopattributeProvider- is the provider of attributes used by this bus stop.
-
BusStop
public BusStop(UUID id, String name, AttributeCollection attributeProvider)
Create a bus stop.- Parameters:
id- is the unique identifier of this element, ornullif unknown.name- is the name of the new bus stopattributeProvider- is the provider of attributes used by this bus stop.
-
BusStop
public BusStop(String name, GeoLocationPoint position)
Create a stop with attributes stored in memory.- Parameters:
name- is the name of the new bus stopposition- is the position of the bus stop.
-
BusStop
public BusStop(UUID id, String name, GeoLocationPoint position)
Create a stop with attributes stored in memory.- Parameters:
id- is the unique identifier of this element, ornullif unknown.name- is the name of the new bus stopposition- is the position of the bus stop.
-
BusStop
public BusStop(String name, GeoLocationPoint position, AttributeCollection attributeProvider)
Create a bus stop.- Parameters:
name- is the name of the new bus stopposition- is the position of the bus stop.attributeProvider- is the provider of attributes used by this bus stop.
-
BusStop
public BusStop(UUID id, String name, GeoLocationPoint position, AttributeCollection attributeProvider)
Create a bus stop.- Parameters:
id- is the unique identifier of this element, ornullif unknown.name- is the name of the new bus stop.position- is the position of the bus stop.attributeProvider- is the provider of attributes used by this bus stop.
-
-
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 classAbstractBusPrimitive<BusNetwork>- Parameters:
buffer- the Json buffer.
-
getFirstFreeBusStopName
@Pure public static String getFirstFreeBusStopName(BusNetwork busNetwork)
Replies a bus stop name that was not exist in the specified bus network.- Parameters:
busNetwork- is the bus network for which a free bus stop name may be computed.- Returns:
- a name suitable for bus stop.
-
checkPrimitiveValidity
protected void checkPrimitiveValidity()
Description copied from class:AbstractBusPrimitiveCheck if the validity of this primitive is correctly set and change its values if necessary. This function DO NOT revalidate the primitives inside this primitive.- Specified by:
checkPrimitiveValidityin classAbstractBusPrimitive<BusNetwork>- See Also:
AbstractBusPrimitive.revalidate()
-
fireValidityChangedFor
protected void fireValidityChangedFor(Object changedObject, int index, BusPrimitiveInvalidity oldReason, BusPrimitiveInvalidity newReason)
Description copied from class:AbstractBusPrimitiveFire the event that indicates the validity of the object has changed.- Overrides:
fireValidityChangedForin classAbstractBusPrimitive<BusNetwork>- Parameters:
changedObject- is the object for which the validity has changed.index- is the index of the changedObject in its parent.oldReason- is the old invalidity reason before the change.newReason- is the current invalidity reason after the change.
-
setContainer
public boolean setContainer(BusNetwork container)
Description copied from class:AbstractGISElementSets the container of this MapElement.- Overrides:
setContainerin classAbstractGISElement<BusNetwork,AbstractBusPrimitive<BusNetwork>>- Parameters:
container- the new container.- Returns:
- the success state of the operation.
-
getBusNetwork
@Pure public BusNetwork getBusNetwork()
Description copied from interface:BusPrimitiveReplies the bus network in which this primitive is.- Returns:
- the bus network in which this primitive is.
-
setName
public void setName(String name)
Set the name of the element.- Specified by:
setNamein interfaceGISEditable- Specified by:
setNamein interfaceGISElement- Overrides:
setNamein classAbstractGISElement<BusNetwork,AbstractBusPrimitive<BusNetwork>>- Parameters:
name- the name.
-
setPosition
public void setPosition(GeoLocationPoint position)
Set the position of the element.- Parameters:
position- the position.
-
getGeoPosition
@Pure public GeoLocationPoint getGeoPosition()
Replies the position of the bus stop.- Returns:
- the position or
nullif never set before.
-
getPosition2D
@Pure public Point2d getPosition2D()
Replies the position of the bus stop.- Returns:
- the position
-
rebuild
public void rebuild(boolean fireEvents)
Description copied from interface:BusPrimitiveRebuild the primitive and all the primitive inside. Rebuilding means to reset all the internal values and recompute their values.This function should be invoked when the bus primitive was construct with its flag replied by
AttributeCollection.isEventFirable()set tofalse. This function permits to finalize the construction.In addition, this function automatically invoke
BoundedGISElement.resetBoundingBox()and does the same job asBusPrimitive.revalidate()(but does not invoke it). This function invokesAttributeCollection.setEventFirable(boolean)withtrueas parameter.- Parameters:
fireEvents- indicates if the events should be fired.- See Also:
BusPrimitive.rebuild()
-
calcBounds
@Pure protected Rectangle2d calcBounds()
Description copied from class:AbstractBoundedGISElementCompute the bounds of this element. This function does not update the internal attribute replied byAbstractBoundedGISElement.getBoundingBox()- Specified by:
calcBoundsin classAbstractBoundedGISElement<BusNetwork,AbstractBusPrimitive<BusNetwork>>- 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.- Returns:
- the shape or
nullif not applicable.
-
getGeoLocation
@Pure public GeoLocation getGeoLocation()
Description copied from interface:GISPrimitiveReplies 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:
getGeoLocationin interfaceGISPrimitive- Overrides:
getGeoLocationin classAbstractBusPrimitive<BusNetwork>- Returns:
- a location
- See Also:
GISPrimitive.getGeoId(),GISPrimitive.getGeoLocation()
-
distance
@Pure public double distance(double x, double y)Replies the distance between the given point and this bus stop.- Parameters:
x- x coordinate.y- y coordinate.- Returns:
- the distance to this bus stop
-
distance
@Pure public double distance(BusStop stop)
Replies the distance between the given bus stop and this bus stop.- Parameters:
stop- the stop.- Returns:
- the distance to this bus stop
-
distance
@Pure public double distance(BusItineraryHalt halt)
Replies the distance between the given bus itinerary halt and this bus stop.- Parameters:
halt- the halt.- Returns:
- the distance to this bus stop
-
distance
@Pure public double distance(Point2D<?,?> point)
Replies the distance between the given point and this bus stop.- Parameters:
point- the pint- Returns:
- the distance to this bus stop
-
distance
@Pure public double distance(GeoLocationPoint point)
Replies the distance between the given point and this bus stop.- Parameters:
point- the point.- Returns:
- the distance to this bus stop
-
addBusHub
void addBusHub(BusHub hub)
Add a hub reference.- Parameters:
hub- the hub.
-
removeBusHub
void removeBusHub(BusHub hub)
Remove a hub reference.- Parameters:
hub- the hub.
-
insideBusHub
@Pure public boolean insideBusHub()
Replies if this bus stop is inside a hub.- Returns:
trueif this bus stop is inside a hub, otherwisefalse
-
busHubs
@Pure public Iterable<BusHub> busHubs()
Replies the hubs in which this bus stop is located.- Returns:
- the hubs
-
busHubIterator
@Pure public Iterator<BusHub> busHubIterator()
Replies the hubs in which this bus stop is located.- Returns:
- the hubs
-
addBusHalt
void addBusHalt(BusItineraryHalt halt)
Add a bus halt reference.- Parameters:
halt- the halt.
-
removeBusHalt
void removeBusHalt(BusItineraryHalt halt)
Remove a bus halt reference.- Parameters:
halt- the halt.
-
isBusHaltBinded
@Pure public boolean isBusHaltBinded()
Replies if this bus stop is associated to a bus itinerary halt.- Returns:
trueif this bus stop is associated to a bus itinerary halt, otherwisefalse
-
indexInParent
@Pure public int indexInParent()
Description copied from class:AbstractBusPrimitiveReplies the index of this primitive in its parent.- Specified by:
indexInParentin classAbstractBusPrimitive<BusNetwork>- Returns:
- the index of this primitive in its parent.
-
getBindedBusHalts
@Pure public Iterable<BusItineraryHalt> getBindedBusHalts()
Replies the bus itinerary halts associated to this bus stop.- Returns:
- the bus itinerary halts.
-
-