39 const std::vector<std::string>& lines,
41 double begPos,
double endPos,
const std::string name,
43 Named(id), myLines(lines), myLane(lane),
44 myBegPos(begPos), myEndPos(endPos), myLastFreePos(endPos),
46 myTransportableCapacity(capacity) {
48 for (
int i = 0; i < capacity; i++) {
87 if (!
fits(pos, forVehicle)) {
90 std::vector<std::pair<double, std::pair<double, const SUMOVehicle*> > > spaces;
92 spaces.push_back(std::make_pair(it.second.first, std::make_pair(it.second.second, it.first)));
95 std::sort(spaces.begin(), spaces.end());
96 std::reverse(spaces.begin(), spaces.end());
98 for (
auto it : spaces) {
103 it.second.second->isParking()
104 || it.second.second->remainingStopDuration() >
TIME2STEPS(10))) {
107 prev = it.second.first - vehGap;
149 if (it->second >= 0) {
163 std::map<const SUMOVehicle*, std::pair<double, double> >::const_iterator i =
myEndPositions.find(veh);
165 return i->second.second;
171 std::vector<MSTransportable*>
173 std::vector<MSTransportable*> result;
175 result.push_back(it->first);
202 if (i->second >= 0) {
221 std::map<const SUMOVehicle*, std::pair<double, double> >::iterator i;
236 if (edge == &std::get<0>(access)->getEdge()) {
237 return std::get<1>(access);
250 const MSLane*
const accLane = std::get<0>(access);
251 if (edge == &accLane->
getEdge()) {
252 const double length = std::get<2>(access);
275 if (lane == std::get<0>(access)) {
279 myAccessPos.push_back(std::make_tuple(lane, pos, length));
std::map< const SUMOVehicle *, std::pair< double, double > > myEndPositions
A map from objects (vehicles) to the areas they acquire after entering the stop.
int getPersonsAbreast() const
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
MSEdge & getEdge() const
Returns the lane's edge.
double getBeginLanePosition() const
Returns the begin position of this stop.
MSStoppingPlace(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, const std::string name="", int capacity=0)
Constructor.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
const double myEndPos
The end position this bus stop is located at.
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
const PositionVector & getShape() const
Returns this lane's shape.
const double SUMO_const_waitingPersonWidth
double getWaitingPositionOnLane(MSTransportable *t) const
Returns the lane position corresponding to getWaitPosition()
std::set< int > myWaitingSpots
const std::string & getMyName() const
double getWidth() const
Returns the lane's width.
virtual ~MSStoppingPlace()
Destructor.
bool hasSpaceForTransportable() const
whether there is still capacity for more transportables
A road/street connecting two junctions.
const MSLane & myLane
The lane this bus stop is located at.
double getEndLanePosition() const
Returns the end position of this stop.
bool fits(double pos, const SUMOVehicle &veh) const
return whether the given vehicle fits at the given position
Representation of a vehicle.
double myLastFreePos
The last free position at this stop (variable)
A point in 2D or 3D with translation and scaling methods.
std::vector< MSTransportable * > getTransportables() const
Returns the tranportables waiting on this stop.
const double SUMO_const_waitingPersonDepth
double getMinGap() const
Get the free space in front of vehicles of this class.
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
virtual Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
Base class for objects which have an id.
bool addTransportable(MSTransportable *p)
adds a transportable to this stop
virtual bool addAccess(MSLane *lane, const double pos, const double length)
adds an access point to this stop
double getAccessDistance(const MSEdge *edge) const
the distance from the access on the given edge to the stop, -1 on failure
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
const std::string myName
The name of the stopping place.
const double myBegPos
The begin position this bus stop is located at.
std::map< MSTransportable *, int > myWaitingTransportables
Persons waiting at this stop (mapped to waiting position)
std::vector< std::tuple< MSLane *, double, double > > myAccessPos
lanes and positions connected to this stop
double interpolateLanePosToGeometryPos(double lanePos) const
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
double getLength() const
Get vehicle's length [m].
void computeLastFreePos()
Computes the last free position on this stop.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
const MSLane & getLane() const
Returns the lane this stop is located at.
double getLastFreePos() const
const int myTransportableCapacity
The number of transportables that can wait here.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double getStoppingPosition(const SUMOVehicle *veh) const
For vehicles at the stop this gives the the actual stopping position of the vehicle. For all others the last free stopping position.
Representation of a lane in the micro simulation.