43 const std::vector<std::string>& lines,
45 double begPos,
double endPos,
const std::string name,
52 myLines(lines), myLane(lane),
53 myBegPos(begPos), myEndPos(endPos),
54 myLastFreePos(endPos),
55 myLastParking(nullptr),
57 myTransportableCapacity(capacity),
58 myParkingFactor(parkingLength <= 0 ? 1 : (endPos - begPos) / parkingLength),
63 myTransportableWidth(getDefaultTransportableWidth(myElement)) {
65 for (
int i = 0; i < capacity; i++) {
84 const std::string waitingWidth =
getParameter(
"waitingWidth");
85 if (waitingWidth !=
"") {
89 WRITE_WARNINGF(
"Could not load waitingWidth (m) '%' (%)", waitingWidth, e.what());
92 const std::string waitingDepth =
getParameter(
"waitingDepth");
93 if (waitingDepth !=
"") {
97 WRITE_WARNINGF(
"Could not load waitingDepth (m) '%' (%)", waitingWidth, e.what());
147 if (!
fits(pos, forVehicle)) {
150 std::vector<std::pair<double, std::pair<double, const SUMOVehicle*> > > spaces;
152 spaces.push_back(std::make_pair(it.second.first, std::make_pair(it.second.second, it.first)));
155 std::sort(spaces.begin(), spaces.end());
156 std::reverse(spaces.begin(), spaces.end());
158 for (
auto it : spaces) {
162 if (prev - it.first + NUMERICAL_EPS >= vehLength && (
163 it.second.second->isParking()
164 || it.second.second->remainingStopDuration() >
TIME2STEPS(10))) {
167 prev = it.second.first - vehGap;
213 if (it->second >= 0) {
230 return i->second.second;
236std::vector<const MSTransportable*>
238 std::vector<const MSTransportable*> result;
240 result.push_back(item.first);
267 if (i->second >= 0) {
291 if (item.first->isStoppedParking()) {
305 if (edge == &access.lane->getEdge()) {
306 if (rng ==
nullptr || access.startPos == access.endPos) {
307 return access.endPos;
319 if (edge == &access.lane->getEdge()) {
343 if (lane == access.lane) {
352 myAccessPos.push_back({lane, startPos, endPos, length, exit});
357std::vector<const SUMOVehicle*>
359 std::vector<const SUMOVehicle*> result;
361 result.push_back(item.first);
370 into.push_back(item.first->getID());
372 std::sort(into.begin(), into.end());
#define WRITE_WARNINGF(...)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
const double SUMO_const_waitingPersonDepth
const double SUMO_const_waitingContainerWidth
const double SUMO_const_waitingPersonWidth
const double SUMO_const_waitingContainerDepth
A road/street connecting two junctions.
static bool gLefthand
Whether lefthand-drive is being simulated.
Representation of a lane in the micro simulation.
double interpolateLanePosToGeometryPos(double lanePos) const
virtual const PositionVector & getShape(bool) const
MSEdge & getEdge() const
Returns the lane's edge.
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
int getStoppedVehicleNumber() const
Returns the number of stopped vehicles waiting on this stop.
const SUMOVehicle * myLastParking
The length of the last parking vehicle (or 0 if there is none)
double getWaitingPositionOnLane(MSTransportable *t) const
Returns the lane position corresponding to getWaitPosition()
double myTransportableWidth
the with of waiting transportables
const Access * getAccess(const MSEdge *edge) const
the access on the given edge to the stop, nullptr if there is none
std::map< const MSTransportable *, int > myWaitingTransportables
Persons waiting at this stop (mapped to waiting position)
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.
int getTransportablesAbreast() const
MSStoppingPlace(const std::string &id, SumoXMLTag element, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, const std::string name="", int capacity=0, double parkingLength=0, const RGBColor &color=RGBColor::INVISIBLE, double angle=90)
Constructor.
std::vector< const MSTransportable * > getTransportables() const
Returns the transportables waiting on this stop.
void clearState()
Remove all vehicles before quick-loading state.
virtual void finishedLoading()
perform extra processing after element has been loaded
std::set< int > myWaitingSpots
const double myParkingFactor
the scaled space capacity for parking vehicles
Position getCenterPos() const
the position in the middle of the stop shape
bool fits(double pos, const SUMOVehicle &veh) const
return whether the given vehicle fits at the given position
double myTransportableDepth
row depth of waiting transportables
static double getDefaultTransportableWidth(SumoXMLTag element)
const std::string myName
The name of the stopping place.
std::vector< Access > myAccessPos
lanes and positions connected to this stop
const double myEndPos
The end position this bus stop is located at.
double getEndLanePosition() const
Returns the end position of this stop.
const RGBColor myColor
The color of the stopping place.
void enter(SUMOVehicle *veh, bool parking)
Called if a vehicle enters this stop.
double getStoppingPosition(const SUMOVehicle *veh) const
For vehicles at the stop this gives the actual stopping position of the vehicle. For all others the l...
void removeTransportable(const MSTransportable *p)
Removes a transportable from this stop.
virtual ~MSStoppingPlace()
Destructor.
void computeLastFreePos()
Computes the last free position on this stop.
double myAngle
The angle offset for waiting transportables.
const RGBColor & getColor() const
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
Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
double getAccessPos(const MSEdge *edge, SumoRNG *rng=nullptr) const
the position on the given edge which is connected to this stop, -1 on failure
virtual bool addAccess(MSLane *const lane, const double startPos, const double endPos, double length, const MSStoppingPlace::AccessExit exit)
adds an access point to this stop
static int getDefaultTransportablesAbreast(double length, SumoXMLTag element)
bool addTransportable(const MSTransportable *p)
adds a transportable to this stop
double myLastFreePos
The last free position at this stop (variable)
double getLastFreePos() const
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves 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.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimensions
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.
virtual bool hasStops() const =0
Returns whether the vehicle has to stop somewhere.
virtual SUMOTime remainingStopDuration() const =0
Returns the remaining stop duration for a stopped vehicle or 0.
virtual const std::list< MSStop > & getStops() const =0
virtual double getLength() const =0
Returns the vehicles's length.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter