98 :
GUIGLObjectPopupMenu(app, parent, o), myVehiclesAdditionalVisualizations(additionalVisualizations) {
219 if (microVeh !=
nullptr) {
221 if (microVeh->
getLane() !=
nullptr) {
251 if (i->first->getTrackedID() ==
getGlID()) {
252 i->first->stopTrack();
254 while (i->first->removeAdditionalGLVisualisation(
this));
295 new FXMenuSeparator(ret);
297 new FXMenuCommand(ret,
"Start Tracking",
nullptr, ret,
MID_START_TRACK);
299 new FXMenuCommand(ret,
"Stop Tracking",
nullptr, ret,
MID_STOP_TRACK);
301 new FXMenuCommand(ret,
"Select Foes",
nullptr, ret,
MID_SHOW_FOES);
306 new FXMenuSeparator(ret);
335 const double degAngle =
RAD2DEG(angle +
M_PI / 2.);
338 glRotated(degAngle, 0, 0, 1);
343 double upscaleLength = upscale;
344 if (upscale > 1 && length > 5) {
346 upscaleLength =
MAX2(1.0, upscaleLength * (5 + sqrt(length - 5)) / length);
348 glScaled(upscale, upscaleLength, 1);
360 bool drawCarriages =
false;
372 glTranslated(0, 0, .1);
383 glColor3d(0., 1., 0.);
386 glVertex2d(0., minGap);
387 glVertex2d(-.5, minGap);
388 glVertex2d(.5, minGap);
393 glColor3d(1., 0., 0.);
396 glVertex2d(0., brakeGap);
397 glVertex2d(-.5, brakeGap);
398 glVertex2d(.5, brakeGap);
403 glColor3d(1., 0., 0.);
408 glTranslated(0, 0, .1);
425 if (!drawCarriages) {
479 glTranslated(0,
MIN2(length / 2,
double(5)), -
getType());
480 glScaled(1 / upscale, 1 / upscaleLength, 1);
481 glRotated(-degAngle, 0, 0, 1);
484 glRotated(-s.
angle, 0, 0, 1);
486 glRotated(s.
angle, 0, 0, 1);
490 glRotated(-s.
angle, 0, 0, 1);
492 glRotated(s.
angle, 0, 0, 1);
497 if (!drawCarriages) {
501 const Position back = (p1 +
Position(-length * upscaleLength, 0)).rotateAround2D(angle, p1);
502 computeSeats(p1, back, totalSeats, upscale, requiredSeats);
524 glTranslated(0, 0,
getType() - .1);
537 for (
int i = noReroutePlus1 - 1; i >= 0; i--) {
538 double darken = double(0.4) / double(noReroutePlus1) * double(i);
555 glTranslated(pos.
x(), pos.
y(), -.1);
559 glTranslated(-pos.
x(), -pos.
y(), .1);
574 switch (activeScheme) {
630 double hue = 180. + atan2(center.
x() - p.
x(), center.
y() - p.
y()) * 180. /
M_PI;
639 double hue = 180. + atan2(center.
x() - p.
x(), center.
y() - p.
y()) * 180. /
M_PI;
648 double hue = 180. + atan2(pb.
x() - pe.
x(), pb.
y() - pe.
y()) * 180. /
M_PI;
651 double sat = pb.
distanceTo(pe) / minp.distanceTo(maxp);
656 std::hash<const MSBaseVehicle*> ptr_hash;
657 const double hue = (double)(ptr_hash(veh) % 360);
658 const double sat = ((ptr_hash(veh) / 360) % 67) / 100.0 + 0.33;
695 glGetDoublev(GL_CURRENT_COLOR, colors);
719 if (route !=
nullptr) {
737 for (std::vector<MSTransportable*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
746 int containerIndex = 0;
747 for (std::vector<MSTransportable*>::const_iterator i = cs.begin(); i != cs.end(); ++i) {
749 assert(container != 0);
754 #ifdef DRAW_BOUNDING_BOX 759 boundingBox.push_back(boundingBox.front());
763 glColor3d(0.5, .8, 0);
774 if (
getVType().getParameter().carriageLength > 0) {
808 if (requiredSeats <= 0) {
814 const int rowSize =
MAX2(1, (
int)floor(vehWidth / seatOffset));
815 const double rowOffset = (length - 1) / ceil((
double)maxSeats / rowSize);
816 const double sideOffset = (rowSize - 1) / 2 * seatOffset;
817 double rowPos = 1 - rowOffset;
818 for (
int i = 0; requiredSeats > 0 && i < maxSeats; i++) {
819 int seat = (i % rowSize);
824 seat * seatOffset - sideOffset));
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
bool drawBrakeGap
Information whether the brake gap shall be drawn.
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
static const RGBColor BLUE
show vehicle's current continued from the current position
double ymin() const
Returns minimum y-coordinate.
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
double xmax() const
Returns maximum x-coordinate.
RGBColor color
The vehicle's color, TraCI may change this.
Representation of a vehicle in the micro simulation.
double scale
information about a lane's width (temporary, used for a single view)
virtual void drawAction_drawVehicleBlueLight() const
int size() const
Return the number of passengers / containers.
A vehicle from the mesoscopic point of view.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
const ConstMSEdgeVector & getEdges() const
bool showBlinker
Information whether vehicle blinkers shall be drawn.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
virtual void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r, bool future) const =0
Draws the route.
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length)
draw vehicle as a Box
MSLane * getLane() const
Returns the lane the vehicle is on.
const MSVehicleType & getVType() const
A shortcut to myVehicle.myType.
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb.htm.
static const RGBColor WHITE
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
bool showBTRange
Information whether the communication range shall be drawn.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Stores the information about how to visualize structures.
const MSDevice_Transportable * getPersonDevice() const
double y() const
Returns the y-position.
Hide all vehicle's routes.
void computeSeats(const Position &front, const Position &back, int maxSeats, double exaggeration, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
bool drawLaneChangePreference
Information whether the lane change preference shall be drawn.
show vehicle's best lanes
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
virtual void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
MSDevice_Vehroutes * myRoutes
GUIVisualizationTextSettings vehicleName
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
double x() const
Returns the x-position.
virtual void drawAction_drawLinkItems(const GUIVisualizationSettings &) const
void drawRoute(const GUIVisualizationSettings &s, int routeNo, double darken, bool future=false) const
Chooses the route to draw and draws it, darkening it as given.
static double getRange()
Returns the configured range.
const RGBColor & getColor() const
Returns the color.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const MSRoute & getRoute() const
Returns the current route.
The vehicle got vaporized.
const double SUMO_const_waitingPersonWidth
bool addAdditionalGLVisualisation(const GUIGlObject *const which)
Adds an object to call its additional visualisation method.
virtual void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const =0
draws the given guiShape with distinct carriages/modules
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate)
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
The base class for microscopic and mesoscopic vehicles.
virtual void stopTrack()
stop track
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
virtual void selectBlockingFoes() const =0
adds the blocking foes to the current selection
int getPersonCapacity() const
Get this vehicle type's person capacity.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the type parameter window.
int getNumberReroutes() const
Returns the number of new routes this vehicle got.
int getContainerCapacity() const
Get this vehicle type's container capacity.
A class that stores a 2D geometrical boundary.
bool removeAdditionalGLVisualisation(const GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
Hide vehicle's best lanes.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Start to track a vehicle.
static MSDevice_Vehroutes * buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice *> &into, int maxRoutes=std::numeric_limits< int >::max())
Build devices for the given vehicle, if needed.
bool wasSet(int what) const
Returns whether the given parameter was set.
PositionVector mySeatPositions
positions of seats in the vehicle (updated at every drawing step)
virtual double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const =0
gets the color value according to the current scheme index
GUIColorer vehicleColorer
The vehicle colorer.
const std::string getOptionalName() const
Returns the value for generic parameter 'name' or ''.
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length)
draw vehicle as a triangle
virtual GUIGlID getTrackedID() const
get tracked id
virtual void startTrack(int)
star track
static const RGBColor GREEN
GUIVisualizationTextSettings vehicleValue
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Show vehicle's best lanes.
A point in 2D or 3D with translation and scaling methods.
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
double scaledSize(double scale, double constFactor=0.1) const
get scale size
bool drawMinGap
Information whether the minimum gap shall be drawn.
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void setPositionInVehicle(const Position &pos)
render as a (city) rail without locomotive
double xmin() const
Returns minimum x-coordinate.
static void drawOutlineCircle(double width, double iwidth, int steps=8)
Draws an unfilled circle around (0,0)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
A MSVehicle extended by some values for usage within the gui.
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
int getNumPassengers() const
return the number of passengers
Boundary & grow(double by)
extends the boundary by the given amount
double getMinGap() const
Get the free space in front of vehicles of this class.
double angle
The current view rotation angle.
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
const T getColor(const double value) const
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Show vehicle's current route.
bool drawAction_drawVehicleAsPolyWithCarriagges(const GUIVisualizationSettings &s, bool asImage=false) const
draw vehicle body and return whether carriages are being drawn
const int VEHPARS_COLOR_SET
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Hide vehicle's future route.
std::string line
The vehicle's line (mainly for public transport)
const RGBColor & getColor() const
Returns this type's color.
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
void setPositionInVehicle(const Position &pos)
remove a vehice or person
GUIBaseVehicle(MSBaseVehicle &vehicle)
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
static const RGBColor RED
named colors
~GUIBaseVehicle()
destructor
Show all vehicle's routes.
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
render as a arbitrary ship
A MSNet extended by some values for usage within the gui.
virtual bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
const Position & getSeatPosition(int personIndex) const
returns the seat position for the person with the given index
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
show all vehicle's routes
virtual double getAngle() const =0
Returns the vehicle's direction in radians.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
double getLength() const
Get vehicle's length [m].
Show vehicle's future route.
bool wasSet(int what) const
Returns whether the given parameter was set.
render as an emergency vehicle
GUIGlID getGlID() const
Returns the numerical id of the object.
Position getCenter() const
Returns the center of the boundary.
const MSDevice_Transportable * getContainerDevice() const
static bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, const std::string &file, const GUIGlObject *o, const double width, double length)
try to draw vehicle as raster image and return true if sucessful
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
GUIVisualizationSizeSettings vehicleSize
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
virtual void drawBestLanes() const
Draws the vehicle's best lanes.
const MSRoute * getRoute(int index) const
Called on route retrieval.
int vehicleQuality
The quality of vehicle drawing.
MSBaseVehicle & myVehicle
The vehicle to which all calls should be delegated.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
FXDEFMAP(GUIBaseVehicle::GUIBaseVehiclePopupMenu) GUIBaseVehiclePopupMenuMap[]
double ymax() const
Returns maximum y-coordinate.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
static bool setFunctionalColor(int activeScheme, const MSBaseVehicle *veh)
sets the color according to the current scheme index and some vehicle function
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
virtual double getSpeed() const =0
Returns the vehicle's current speed.
virtual void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
show vehicle's current route
const int VTYPEPARS_COLOR_SET
void vaporizeCar(MEVehicle *v)
remove the given car and clean up the relevant data structures
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Hide vehicle's current route.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
virtual void drawAction_drawVehicleBlinker(double) const
int getNumContainers() const
return the number of passengers