69 #ifdef CHECK_MEMORY_LEAKS 71 #endif // CHECK_MEMORY_LEAKS 85 #pragma warning(disable: 4355) 89 MSVehicle(pars, route, type, speedFactor),
93 #pragma warning(default: 4355) 108 ret->
mkItem(
"position [m]",
true,
110 ret->
mkItem(
"speed [m/s]",
true,
112 ret->
mkItem(
"angle [degree]",
true,
117 ret->
mkItem(
"time gap [s]",
true,
119 ret->
mkItem(
"waiting time [s]",
true,
121 ret->
mkItem(
"impatience",
true,
123 ret->
mkItem(
"last lane change [s]",
true,
138 ret->
mkItem(
"CO2 [mg/s]",
true,
140 ret->
mkItem(
"CO [mg/s]",
true,
142 ret->
mkItem(
"HC [mg/s]",
true,
144 ret->
mkItem(
"NOx [mg/s]",
true,
146 ret->
mkItem(
"PMx [mg/s]",
true,
148 ret->
mkItem(
"fuel [ml/s]",
true,
150 ret->
mkItem(
"noise (Harmonoise) [dB]",
true,
152 std::ostringstream str;
153 for (std::vector<MSDevice*>::const_iterator i =
myDevices.begin(); i !=
myDevices.end(); ++i) {
157 str << (*i)->getID().substr(0, (*i)->getID().find(
getID()));
159 ret->
mkItem(
"devices",
false, str.str());
160 ret->
mkItem(
"persons",
true,
162 ret->
mkItem(
"containers",
true,
166 ret->
mkItem(
"",
false,
"");
167 ret->
mkItem(
"Type Information:",
false,
"");
192 size_t personIndex = 0;
193 for (std::vector<MSTransportable*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
202 size_t containerIndex = 0;
203 for (std::vector<MSTransportable*>::const_iterator i = cs.begin(); i != cs.end(); ++i) {
205 assert(container != 0);
216 if ((*i).myLink == 0) {
219 MSLink* link = (*i).myLink;
223 if ((*i).mySetRequest) {
228 const SUMOTime leaveTime = (*i).myLink->getLeaveTime(
265 #define BLINKER_POS_FRONT .5 266 #define BLINKER_POS_BACK .5 270 glColor3d(1.f, .8f, 0);
306 glColor3f(1.f, .2f, 0);
321 glTranslated(0, 2.5, .5);
331 switch (activeScheme) {
377 std::vector<std::vector<MSVehicle::LaneQ> > bestLanes =
myBestLanes;
380 for (std::vector<std::vector<MSVehicle::LaneQ> >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) {
381 std::vector<MSVehicle::LaneQ>& lanes = *j;
384 for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
385 gmax =
MAX2((*i).length, gmax);
386 rmax =
MAX2((*i).occupation, rmax);
388 for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
391 SUMOReal r = (*i).occupation / rmax;
416 size_t bestLaneIndex = (&r ==
myRoute ? 0 : bestLaneConts.
size());
417 for (; i != r.
end(); ++i) {
419 if (bestLaneIndex < bestLaneConts.size() && bestLaneConts[bestLaneIndex] != 0 && (*i) == &(bestLaneConts[bestLaneIndex]->getEdge())) {
420 lane =
static_cast<GUILane*
>(bestLaneConts[bestLaneIndex]);
423 lane =
static_cast<GUILane*
>((*i)->getLanes()[0]);
446 defaultLength *= exaggeration;
447 if (exaggeration == 0) {
450 carriageGap *= exaggeration;
456 const SUMOReal xCornerCut = 0.3 * exaggeration;
457 const SUMOReal yCornerCut = 0.4 * exaggeration;
459 const int numCarriages = floor(length / (defaultLength + carriageGap) + 0.5);
460 assert(numCarriages > 0);
461 const SUMOReal carriageLengthWithGap = length / numCarriages;
462 const SUMOReal carriageLength = carriageLengthWithGap - carriageGap;
465 int furtherIndex = 0;
468 int backFurtherIndex = furtherIndex;
474 if (requiredSeats > 0) {
480 for (
int i = 0; i < numCarriages; ++i) {
481 while (carriageOffset < 0) {
491 while (carriageBackOffset < 0) {
493 if (prev != backLane) {
497 carriageBackOffset = 0;
508 if (i >= firstPassengerCarriage) {
512 glTranslated(front.
x(), front.
y(),
getType());
513 glRotated(angle, 0, 0, 1);
515 glBegin(GL_TRIANGLE_FAN);
516 glVertex2d(-halfWidth + xCornerCut, 0);
517 glVertex2d(-halfWidth, yCornerCut);
518 glVertex2d(-halfWidth, carriageLength - yCornerCut);
519 glVertex2d(-halfWidth + xCornerCut, carriageLength);
520 glVertex2d(halfWidth - xCornerCut, carriageLength);
521 glVertex2d(halfWidth, carriageLength - yCornerCut);
522 glVertex2d(halfWidth, yCornerCut);
523 glVertex2d(halfWidth - xCornerCut, 0);
527 carriageOffset -= carriageLengthWithGap;
528 carriageBackOffset -= carriageLengthWithGap;
534 glTranslated(front.
x(), front.
y(),
getType());
535 glRotated(angle, 0, 0, 1);
557 if (requiredSeats <= 0) {
566 for (
SUMOReal p = 2; p <= length - 1; p += 1) {
582 std::string result =
"";
590 if (
myStops.front().triggered) {
591 result +=
", triggered";
592 }
else if (
myStops.front().containerTriggered) {
593 result +=
", containerTriggered";
609 std::vector<const SUMOVehicle*> blockingFoes;
610 std::vector<const MSPerson*> blockingPersons;
613 for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
616 #ifdef HAVE_INTERNAL_LANES 618 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
626 for (std::vector<const MSPerson*>::iterator it_p = blockingPersons.begin(); it_p != blockingPersons.end(); ++it_p) {
bool signalSet(int which) const
Returns whether the given signal is on.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void selectBlockingFoes() const
adds the blocking foes to the current selection
const MSVehicleType * myType
This Vehicle's type.
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
const std::vector< SUMOReal > & getShapeRotations() const
bool drawAction_drawCarriageClass(const GUIVisualizationSettings &s, SUMOVehicleShape guiShape, bool asImage) const
draws the given guiShape if it has distinct carriages/modules and returns true if so ...
Representation of a vehicle in the micro simulation.
unsigned int getNumberReroutes() const
Returns the number of new routes this vehicle got.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
std::vector< std::vector< LaneQ > > myBestLanes
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
State myState
This Vehicles driving state (pos and speed)
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
SUMOReal pos() const
Position of this state.
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
SUMOReal getImpatience() const
Returns this vehicles impatience.
void drawBestLanes() const
Draws the vehicle's best lanes.
SUMOReal getLeaveSpeed() const
void drawAction_drawVehicleBrakeLight(SUMOReal length) const
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Stores the information about how to visualize structures.
SUMOReal getLength() const
Returns the lane's length.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
render as a flexible city bus
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
std::string time2string(SUMOTime t)
GUIVisualizationTextSettings vehicleName
SUMOReal getLength() const
Get vehicle's length [m].
SUMOReal getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width, int cornerDetail=0, SUMOReal offset=0)
Draws thick lines.
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
SUMOReal getNaviDegree() const
return the current angle in navigational degrees
unsigned int getPersonNumber() const
Returns the number of persons.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
const MSRoute * myRoute
This Vehicle's route.
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
const std::vector< SUMOReal > & getShapeLengths() const
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
const SUMOVehicleParameter * myParameter
This Vehicle's parameter.
The base class for microscopic and mesoscopic vehicles.
SUMOReal x() const
Returns the x-position.
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
GUIGlID getGlID() const
Returns the numerical id of the object.
#define UNUSED_PARAMETER(x)
void drawAction_drawVehicleBlinker(SUMOReal length) const
The car-following model and parameter.
MSAbstractLaneChangeModel & getLaneChangeModel()
SUMOReal scale
information about a lane's width (temporary, used for a single view)
std::string getStopInfo() const
retrieve information about the current stop state
Right blinker lights are switched on.
PositionVector mySeatPositions
positions of seats in the vehicle (updated at every drawing step)
Representation of a lane in the micro simulation (gui-version)
const std::vector< MSTransportable * > & getPersons() const
Returns the list of persons using this vehicle.
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
const std::string & getID() const
Returns the id.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, SUMOReal length=-1) const
Left blinker lights are switched on.
unsigned int getContainerNumber() const
Returns the number of containers.
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.
const SUMOVTypeParameter & getParameter() const
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
SUMOTime getDepartDelay() const
Returns the depart delay.
A point in 2D or 3D with translation and scaling methods.
std::list< Stop > myStops
The vehicle's list of stops.
ConstMSEdgeVector::const_iterator MSRouteIterator
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
bool isStopped() const
Returns whether the vehicle is at a stop.
MSLane * myLane
The lane the vehicle is on.
Blinker lights on both sides are switched on.
void setPositionInVehicle(const Position &pos)
render as a (city) rail without locomotive
bool isLeader(const MSVehicle *ego, const MSVehicle *foe)
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
std::vector< LinkLeader > LinkLeaders
A MSVehicle extended by some values for usage within the gui.
A blue emergency light is on.
int getNumPassengers() const
return the number of passengers
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOReal myCarriageLength
Variable to set with the length of the last drawn carriage or the vehicle length. ...
const std::vector< MSTransportable * > & getContainers() const
Returns the list of containers using this vehicle.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
unsigned int getPersonCapacity() const
Get this vehicle type's person capacity.
bool isParking() const
Returns whether the vehicle is parking.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
static SUMOReal naviDegree(const SUMOReal angle)
std::string line
The vehicle's line (mainly for public transport)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
void setPositionInVehicle(const Position &pos)
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
void unlock()
release mutex lock
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
Structure representing possible vehicle parameter.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
SUMOReal getAcceleration() const
Returns the vehicle's acceleration in m/s.
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal exagerate)
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
SUMOReal y() const
Returns the y-position.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
SUMOReal getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
const std::string & getID() const
Returns the name of the vehicle type.
void drawAction_drawBlinker(double dir, SUMOReal length)
SUMOReal getSpeed() const
Returns the vehicle's current speed.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
SUMOReal getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
const Position & getSeatPosition(size_t personIndex) const
returns the seat position for the person with the given index
unsigned size() const
Returns the number of edges to pass.
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, SUMOReal defaultLength, SUMOReal carriageGap, int firstPassengerCarriage, bool asImage) const
void move2side(SUMOReal amount)
#define BLINKER_POS_FRONT
unsigned int getContainerCapacity() const
Get this vehicle type's container capacity.
GUIVisualizationSizeSettings vehicleSize
void drawRouteHelper(const MSRoute &r, SUMOReal exaggeration) const
Draws the route.
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
MSLane * getLane() const
Returns the lane the vehicle is on.
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
Representation of a lane in the micro simulation.
MSDevice_Container * myContainerDevice
The containers this vehicle may have.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
A window containing a gl-object's parameter.
SUMOReal getAngle() const
Return current angle.
bool opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, std::vector< const SUMOVehicle * > *collectFoes=0) const
Returns the information whether the link may be passed.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawAction_drawVehicleBlueLight() const
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
int getBestLaneOffset() const
returns the current offset from the best lane
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
const std::string & getID() const
Returns the name of the vehicle.
const PositionVector & getShape() const
static RGBColor getColor()
gets the gl-color
A MSVehicle extended by some values for usage within the gui.