77 std::vector<std::string> ids;
80 ids.push_back(i->first);
140 tempMsg.
writeString(dynamic_cast<MSPerson*>(p)->getNextEdge());
143 int nextStageIndex = 0;
155 tempMsg.
writeInt((
int)edges.size());
156 for (ConstMSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
162 int nextStageIndex = 0;
187 std::string paramName =
"";
208 std::string warning =
"";
228 const bool shouldExist = variable !=
ADD;
230 if (p == 0 && shouldExist) {
252 if (vehicleType == 0) {
265 if (inputStorage.
readInt() != 4) {
269 vehicleParams.
id = id;
293 const int proc = -depart;
301 WRITE_WARNING(
"Departure time for person '" +
id +
"' is in the past; using current time instead.");
303 vehicleParams.
depart = depart;
337 int numParameters = inputStorage.
readInt();
344 if (numParameters != 4) {
359 if (lines.size() == 0) {
377 if (numParameters != 4) {
387 std::string description;
406 if (numParameters != 6) {
409 std::vector<std::string> edgeIDs;
426 if (fabs(arrivalPos) > edges.back()->getLength()) {
429 if (arrivalPos < 0) {
430 arrivalPos += edges.back()->getLength();
463 int nextStageIndex = 0;
470 if (nextStageIndex < 0) {
522 std::string newID = oType.
getID().find(
'@') == std::string::npos ? oType.
getID() +
"@" + t->
getID() : oType.
getID();
SUMOVehicle * getVehicle() const
The vehicle associated with this transportable.
RGBColor color
The vehicle's color, TraCI may change this.
std::map< std::string, MSTransportable * >::const_iterator constVehIt
Definition of the internal transportables map iterator.
double getArrivalPos() const
returns the final arrival pos
double z() const
Returns the z-position.
const MSEdge * getEdge() const
Returns the current edge.
A lane area vehicles can halt at.
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
virtual double getEdgePos() const
Return the position on the edge.
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new person.
unsigned char alpha() const
Returns the alpha-amount of the color.
double y() const
Returns the y-position.
#define CMD_GET_PERSON_VARIABLE
double x() const
Returns the x-position.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
int size() const
Returns the number of known transportables.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
unsigned char blue() const
Returns the blue-amount of the color.
std::vector< const MSEdge * > ConstMSEdgeVector
const std::string & getID() const
Returns the id.
virtual double getSpeed() const
the current speed of the transportable
virtual void writeUnsignedByte(int)
ConstMSEdgeVector getEdges(int next) const
Return the edges of the nth next stage.
const SUMOVehicleParameter & getParameter() const
double getLength() const
return the length of the edge
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
Tag for the last element in the enum for safe int casting.
static bool getVariable(const int variable, const std::string &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
virtual void writeInt(int)
#define WRITE_WARNING(msg)
The car-following model and parameter.
virtual int readUnsignedByte()
static bool getPosition(const std::string &id, Position &p)
Returns the named persons's position.
void removeStage(int next)
removes the nth next stage
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
static MSVehicleType * buildSingularType(const std::string &id, const MSVehicleType *from)
Duplicates the microsim vehicle type giving it a the given id.
static double naviDegree(const double angle)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xce: Change Person State)
Representation of a vehicle.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
A point in 2D or 3D with translation and scaling methods.
void appendStage(Stage *stage)
Appends the given stage to the current plan.
virtual double getAngle() const
return the current angle of the transportable
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
constVehIt loadedBegin() const
Returns the begin of the internal transportables map.
virtual void writeStringList(const std::vector< std::string > &s)
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
#define CMD_SET_VEHICLE_VARIABLE
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
const std::string & getID() const
returns the id of the transportable
virtual std::string readString()
TraCI server used to control sumo by a remote TraCI client.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xae: Get Person Variable)
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
double departPos
(optional) The position the vehicle shall depart from
static bool setVariable(const int cmd, const int variable, const std::string &id, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
virtual void writeString(const std::string &s)
static MSVehicleType & getSingularType(MSTransportable *const t)
Structure representing possible vehicle parameter.
std::string toHex(const T i, std::streamsize numDigits=0)
virtual Position getPosition() const
Return the Network coordinate of the transportable.
unsigned char green() const
Returns the green-amount of the color.
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occured.
#define RESPONSE_GET_PERSON_VARIABLE
const std::string & getID() const
Returns the name of the vehicle type.
constVehIt loadedEnd() const
Returns the end of the internal transportables map.
StageType getStageType(int next) const
the stage type for the nth next stage
void replaceVehicleType(MSVehicleType *type)
replace myVType
virtual void writeDouble(double)
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
const MSEdge * getArrivalEdge() const
returns the final arrival edge
unsigned char red() const
Returns the red-amount of the color.
const MSVehicleType & getVehicleType() const
virtual double getWaitingSeconds() const
the time this transportable spent waiting in seconds
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
#define CMD_SET_PERSON_VARIABLE
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, MTRand *rng=0)
Returns the named vehicle type or a sample from the named distribution.
#define VAR_STAGES_REMAINING
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
virtual const std::string & getID() const =0
Get the vehicle's ID.
DepartDefinition
Possible ways to depart.
int getNumStages() const
Return the total number stages in this persons plan.
std::string id
The vehicle's id.