38 const std::vector<std::string>& lines,
40 double begPos,
double endPos,
const std::string name,
42 double parkingLength) :
43 Named(id), myLines(lines), myLane(lane),
44 myBegPos(begPos), myEndPos(endPos), myLastFreePos(endPos),
46 myTransportableCapacity(capacity),
47 myParkingFactor(parkingLength <= 0 ? 1 : (endPos - begPos) / parkingLength) {
49 for (
int i = 0; i < capacity; i++) {
93 if (!
fits(pos, forVehicle)) {
96 std::vector<std::pair<double, std::pair<double, const SUMOVehicle*> > > spaces;
98 spaces.push_back(std::make_pair(it.second.first, std::make_pair(it.second.second, it.first)));
101 std::sort(spaces.begin(), spaces.end());
102 std::reverse(spaces.begin(), spaces.end());
104 for (
auto it : spaces) {
108 if (prev - it.first + NUMERICAL_EPS >= vehLength && (
109 it.second.second->isParking()
110 || it.second.second->remainingStopDuration() >
TIME2STEPS(10))) {
113 prev = it.second.first - vehGap;
155 if (it->second >= 0) {
172 return i->second.second;
178 std::vector<MSTransportable*>
180 std::vector<MSTransportable*> result;
182 result.push_back(it->first);
209 if (i->second >= 0) {
242 if (edge == &std::get<0>(access)->getEdge()) {
243 return std::get<1>(access);
256 const MSLane*
const accLane = std::get<0>(access);
257 if (edge == &accLane->
getEdge()) {
258 const double length = std::get<2>(access);
281 if (lane == std::get<0>(access)) {
285 myAccessPos.push_back(std::make_tuple(lane, pos, length));
289 std::vector<const SUMOVehicle*>
291 std::vector<const SUMOVehicle*> result;
293 result.push_back(item.first);
302 into.push_back(item.first->getID());
304 std::sort(into.begin(), into.end());
const double SUMO_const_waitingPersonDepth
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
const double SUMO_const_waitingPersonWidth
A road/street connecting two junctions.
static bool gLefthand
Whether lefthand-drive is being simulated.
Representation of a lane in the micro simulation.
MSEdge & getEdge() const
Returns the lane's edge.
const PositionVector & getShape() const
Returns this lane's shape.
double interpolateLanePosToGeometryPos(double lanePos) const
double getWidth() const
Returns the lane's width.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
std::vector< const SUMOVehicle * > getStoppedVehicles() const
get list of vehicles waiting at this stop
std::vector< MSTransportable * > getTransportables() const
Returns the tranportables waiting on this stop.
double getWaitingPositionOnLane(MSTransportable *t) const
Returns the lane position corresponding to getWaitPosition()
const double myBegPos
The begin position this bus stop is located at.
double getBeginLanePosition() const
Returns the begin position of this stop.
const MSLane & myLane
The lane this bus stop is located at.
bool hasSpaceForTransportable() const
whether there is still capacity for more transportables
std::map< const SUMOVehicle *, std::pair< double, double >, ComparatorNumericalIdLess > myEndPositions
A map from objects (vehicles) to the areas they acquire after entering the stop.
std::map< MSTransportable *, int > myWaitingTransportables
Persons waiting at this stop (mapped to waiting position)
void clearState()
Remove all vehicles before quick-loading state.
std::set< int > myWaitingSpots
const double myParkingFactor
the scaled space capacity for parking vehicles
MSStoppingPlace(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, const std::string name="", int capacity=0, double parkingLength=0)
Constructor.
bool fits(double pos, const SUMOVehicle &veh) const
return whether the given vehicle fits at the given position
bool addTransportable(MSTransportable *p)
adds a transportable to this stop
const std::string myName
The name of the stopping place.
double getAccessDistance(const MSEdge *edge) const
the distance from the access on the given edge to the stop, -1 on failure
const double myEndPos
The end position this bus stop is located at.
int getPersonsAbreast() const
double getEndLanePosition() const
Returns the end position of this stop.
std::vector< std::tuple< MSLane *, double, double > > myAccessPos
lanes and positions connected to this stop
void enter(SUMOVehicle *veh, bool parking)
Called if a vehicle enters this stop.
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
double getStoppingPosition(const SUMOVehicle *veh) const
For vehicles at the stop this gives the the actual stopping position of the vehicle....
virtual ~MSStoppingPlace()
Destructor.
void computeLastFreePos()
Computes the last free position on this stop.
void getWaitingPersonIDs(std::vector< std::string > &into) const
get IDs of persons waiting at this stop
const MSLane & getLane() const
Returns the lane this stop is located at.
const int myTransportableCapacity
The number of transportables that can wait here.
const std::string & getMyName() const
virtual Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
double myLastFreePos
The last free position at this stop (variable)
double getLastFreePos() const
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
virtual bool addAccess(MSLane *lane, const double pos, const double length)
adds an access point to this stop
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
double getMinGap() const
Get the free space in front of vehicles of this class.
double getLength() const
Get vehicle's length [m].
Base class for objects which have an id.
A point in 2D or 3D with translation and scaling methods.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
virtual double getSpeed() const =0
Returns the object's current speed.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.