|
SUMO - Simulation of Urban MObility
|
A location in the 2D plane freely positioned on a street. More...
#include <AGPosition.h>
Public Member Functions | |
| AGPosition (const AGStreet &str, SUMOReal pos) throw () | |
| Constructs an AGPosition at a certain point on a street. | |
| AGPosition (const AGStreet &str) throw () | |
| Constructs an AGPosition at a random point on a street. | |
| SUMOReal | distanceTo (const AGPosition &otherPos) const throw () |
| Computes the distance between two AGPosition objects. | |
| SUMOReal | getPosition () const throw () |
| Provides the relative position of this AGPosition on the street. | |
| const AGStreet & | getStreet () const throw () |
| Provides the street this AGPosition is located on. | |
| SUMOReal | minDistanceTo (const std::list< AGPosition > &positions) const throw () |
| Computes the distance to the closest position in a list. | |
| SUMOReal | minDistanceTo (const std::map< int, AGPosition > &positions) const throw () |
| Computes the distance to the closest position in a map. | |
| bool | operator== (const AGPosition &pos) const throw () |
| Tests whether two positions are at the same place. | |
| void | print () const throw () |
| Prints out a summary of the properties of this class on standard output. | |
Private Member Functions | |
| Position | compute2dPosition () const throw () |
Static Private Member Functions | |
| static SUMOReal | randomPositionInStreet (const AGStreet &street) throw () |
| Determines a random relative position on a street. | |
Private Attributes | |
| Position | pos2d |
| SUMOReal | position |
| const AGStreet * | street |
A location in the 2D plane freely positioned on a street.
This class restricts the Position class in the way that it must be a position on a street. As a consequence, this position can be described either by x and y coordinates or by a street and its distance to the beginning of the street (the relative position).
Should this class be derived from Position?
Definition at line 59 of file AGPosition.h.
| AGPosition::AGPosition | ( | const AGStreet & | str, |
| SUMOReal | pos | ||
| ) | throw () |
Constructs an AGPosition at a certain point on a street.
An AGPosition is determined by a street and the relative position on the street. This relative position is the distance from the from node of the street.
param[in] str the street on which the AGPosition is located param[in] pos the distance from the from node of the street
Definition at line 43 of file AGPosition.cpp.
| AGPosition::AGPosition | ( | const AGStreet & | str | ) | throw () |
Constructs an AGPosition at a random point on a street.
This constructor determines the distance from the from node with a random number based on a uniform density.
param[in] str the street on which the AGPosition is located
Definition at line 48 of file AGPosition.cpp.
| Position AGPosition::compute2dPosition | ( | ) | const throw () [private] |
Creates a Position object to the street and position attribute of this class.
This method may only be called when street and position are initialised!
Definition at line 122 of file AGPosition.cpp.
References Position::add(), AGStreet::edge, ROEdge::getFromNode(), AGStreet::getLength(), RONode::getPosition(), ROEdge::getToNode(), Position::mul(), position, street, and Position::sub().
| SUMOReal AGPosition::distanceTo | ( | const AGPosition & | otherPos | ) | const throw () |
Computes the distance between two AGPosition objects.
| [in] | the | other position the distance in computed to |
Definition at line 66 of file AGPosition.cpp.
Referenced by AGChild::alocateASchool(), AGActivity::availableTranspMeans(), AGTrip::getRideBackArrTime(), AGTrip::getTimeTrip(), AGActivity::possibleTranspMean(), and AGActivity::timeToDrive().
| SUMOReal AGPosition::getPosition | ( | ) | const throw () |
Provides the relative position of this AGPosition on the street.
This relative position is the distance from the from node of the associated street.
Definition at line 110 of file AGPosition.cpp.
References position.
Referenced by AGActivityTripWriter::addTrip(), AGWorkAndSchool::carsToTrips(), AGTrip::setArr(), and AGTrip::setDep().
| const AGStreet & AGPosition::getStreet | ( | ) | const throw () |
Provides the street this AGPosition is located on.
Definition at line 104 of file AGPosition.cpp.
References street.
Referenced by AGActivityTripWriter::addTrip(), AGTrip::setArr(), and AGTrip::setDep().
| SUMOReal AGPosition::minDistanceTo | ( | const std::list< AGPosition > & | positions | ) | const throw () |
Computes the distance to the closest position in a list.
minDistanceTo computes the distance to all positions in the given list and returns the minimal distance.
| [in] | positions | the list of positions the distances are computed to |
Definition at line 72 of file AGPosition.cpp.
References SUMOReal.
Referenced by AGActivity::availableTranspMeans(), AGHousehold::isCloseFromPubTransport(), and AGActivity::possibleTranspMean().
| SUMOReal AGPosition::minDistanceTo | ( | const std::map< int, AGPosition > & | positions | ) | const throw () |
Computes the distance to the closest position in a map.
minDistanceTo computes the distance to all positions given as the second elements of a map and returns the minimal distance.
| [in] | positions | the map of positions the distances are computed to |
Definition at line 88 of file AGPosition.cpp.
References SUMOReal.
| bool AGPosition::operator== | ( | const AGPosition & | pos | ) | const throw () |
Tests whether two positions are at the same place.
Compares the x and y coordinates with a threshold (see Position::almostSame)
| [in] | pos | the position with which the comparison is done |
Definition at line 60 of file AGPosition.cpp.
| void AGPosition::print | ( | ) | const throw () |
Prints out a summary of the properties of this class on standard output.
Definition at line 54 of file AGPosition.cpp.
References AGStreet::getLength(), position, and street.
Referenced by AGWorkPosition::print(), and AGTrip::print().
| SUMOReal AGPosition::randomPositionInStreet | ( | const AGStreet & | street | ) | throw () [static, private] |
Determines a random relative position on a street.
Definition at line 116 of file AGPosition.cpp.
References RandHelper::rand().
Position AGPosition::pos2d [private] |
Definition at line 140 of file AGPosition.h.
SUMOReal AGPosition::position [private] |
Definition at line 139 of file AGPosition.h.
Referenced by compute2dPosition(), getPosition(), and print().
const AGStreet* AGPosition::street [private] |
Definition at line 138 of file AGPosition.h.
Referenced by compute2dPosition(), getStreet(), and print().