Eclipse SUMO - Simulation of Urban MObility
GNEVehicle.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Representation of vehicles in NETEDIT
19 /****************************************************************************/
20 #include <cmath>
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEUndoList.h>
24 #include <netedit/GNEViewNet.h>
27 #include <utils/gui/div/GLHelper.h>
32 
33 #include "GNEVehicle.h"
34 #include "GNERouteHandler.h"
35 
36 
37 // ===========================================================================
38 // FOX callback mapping
39 // ===========================================================================
40 FXDEFMAP(GNEVehicle::GNESingleVehiclePopupMenu) GNESingleVehiclePopupMenuMap[] = {
42 };
43 
44 FXDEFMAP(GNEVehicle::GNESelectedVehiclesPopupMenu) GNESelectedVehiclesPopupMenuMap[] = {
46 };
47 
48 // Object implementation
49 FXIMPLEMENT(GNEVehicle::GNESingleVehiclePopupMenu, GUIGLObjectPopupMenu, GNESingleVehiclePopupMenuMap, ARRAYNUMBER(GNESingleVehiclePopupMenuMap))
50 FXIMPLEMENT(GNEVehicle::GNESelectedVehiclesPopupMenu, GUIGLObjectPopupMenu, GNESelectedVehiclesPopupMenuMap, ARRAYNUMBER(GNESelectedVehiclesPopupMenuMap))
51 
52 // ===========================================================================
53 // GNEVehicle::GNESingleVehiclePopupMenu
54 // ===========================================================================
55 
57  GUIGLObjectPopupMenu(app, parent, *vehicle),
58  myVehicle(vehicle),
59  myTransformToVehicle(nullptr),
60  myTransformToVehicleWithEmbeddedRoute(nullptr),
61  myTransformToRouteFlow(nullptr),
62  myTransformToRouteFlowWithEmbeddedRoute(nullptr),
63  myTransformToTrip(nullptr),
64  myTransformToFlow(nullptr) {
65  // build header
66  myVehicle->buildPopupHeader(this, app);
67  // build menu command for center button and copy cursor position to clipboard
68  myVehicle->buildCenterPopupEntry(this);
69  myVehicle->buildPositionCopyEntry(this, false);
70  // buld menu commands for names
71  GUIDesigns::buildFXMenuCommand(this, ("Copy " + myVehicle->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
72  GUIDesigns::buildFXMenuCommand(this, ("Copy " + myVehicle->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
73  new FXMenuSeparator(this);
74  // build selection and show parameters menu
75  myVehicle->getNet()->getViewNet()->buildSelectionACPopupEntry(this, myVehicle);
76  myVehicle->buildShowParamsPopupEntry(this);
77  // add transform functions only in demand mode
78  if (myVehicle->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
79  // Get icons
80  FXIcon* vehicleIcon = GUIIconSubSys::getIcon(GUIIcon::VEHICLE);
81  FXIcon* tripIcon = GUIIconSubSys::getIcon(GUIIcon::TRIP);
82  FXIcon* routeFlowIcon = GUIIconSubSys::getIcon(GUIIcon::ROUTEFLOW);
83  FXIcon* flowIcon = GUIIconSubSys::getIcon(GUIIcon::FLOW);
84  // create menu pane for transform operations
85  FXMenuPane* transformOperation = new FXMenuPane(this);
86  this->insertMenuPaneChild(transformOperation);
87  new FXMenuCascade(this, "transform to", nullptr, transformOperation);
88  // Create menu comands for all transform
89  myTransformToVehicle = GUIDesigns::buildFXMenuCommand(transformOperation, "Vehicle", vehicleIcon, this, MID_GNE_VEHICLE_TRANSFORM);
90  myTransformToVehicleWithEmbeddedRoute = GUIDesigns::buildFXMenuCommand(transformOperation, "Vehicle (embedded route)", vehicleIcon, this, MID_GNE_VEHICLE_TRANSFORM);
91  myTransformToRouteFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "RouteFlow", routeFlowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
92  myTransformToRouteFlowWithEmbeddedRoute = GUIDesigns::buildFXMenuCommand(transformOperation, "RouteFlow (embedded route)", routeFlowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
93  myTransformToTrip = GUIDesigns::buildFXMenuCommand(transformOperation, "Trip", tripIcon, this, MID_GNE_VEHICLE_TRANSFORM);
94  myTransformToFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "Flow", flowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
95  // check what menu command has to be disabled
96  if (myVehicle->getTagProperty().getTag() == SUMO_TAG_VEHICLE) {
97  myTransformToVehicle->disable();
98  } else if (myVehicle->getTagProperty().getTag() == GNE_TAG_VEHICLE_WITHROUTE) {
99  myTransformToVehicleWithEmbeddedRoute->disable();
100  } else if (myVehicle->getTagProperty().getTag() == GNE_TAG_FLOW_ROUTE) {
101  myTransformToRouteFlow->disable();
102  } else if (myVehicle->getTagProperty().getTag() == GNE_TAG_FLOW_WITHROUTE) {
103  myTransformToRouteFlowWithEmbeddedRoute->disable();
104  } else if (myVehicle->getTagProperty().getTag() == SUMO_TAG_TRIP) {
105  myTransformToTrip->disable();
106  } else if (myVehicle->getTagProperty().getTag() == SUMO_TAG_FLOW) {
107  myTransformToFlow->disable();
108  }
109  }
110 }
111 
112 
114 
115 
116 long
117 GNEVehicle::GNESingleVehiclePopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
118  if (obj == myTransformToVehicle) {
119  GNERouteHandler::transformToVehicle(myVehicle, false);
120  } else if (obj == myTransformToVehicleWithEmbeddedRoute) {
121  GNERouteHandler::transformToVehicle(myVehicle, true);
122  } else if (obj == myTransformToRouteFlow) {
123  GNERouteHandler::transformToRouteFlow(myVehicle, false);
124  } else if (obj == myTransformToRouteFlowWithEmbeddedRoute) {
125  GNERouteHandler::transformToRouteFlow(myVehicle, true);
126  } else if (obj == myTransformToTrip) {
128  } else if (obj == myTransformToFlow) {
130  }
131  return 1;
132 }
133 
134 // ===========================================================================
135 // GNEVehicle::GNESelectedVehiclesPopupMenu
136 // ===========================================================================
137 
138 GNEVehicle::GNESelectedVehiclesPopupMenu::GNESelectedVehiclesPopupMenu(GNEVehicle* vehicle, const std::vector<GNEVehicle*>& selectedVehicle, GUIMainWindow& app, GUISUMOAbstractView& parent) :
139  GUIGLObjectPopupMenu(app, parent, *vehicle),
140  mySelectedVehicles(selectedVehicle),
141  myVehicleTag(vehicle->getTagProperty().getTag()),
142  myTransformToVehicle(nullptr),
143  myTransformToVehicleWithEmbeddedRoute(nullptr),
144  myTransformToRouteFlow(nullptr),
145  myTransformToRouteFlowWithEmbeddedRoute(nullptr),
146  myTransformToTrip(nullptr),
147  myTransformToFlow(nullptr),
148  myTransformAllVehiclesToVehicle(nullptr),
149  myTransformAllVehiclesToVehicleWithEmbeddedRoute(nullptr),
150  myTransformAllVehiclesToRouteFlow(nullptr),
151  myTransformAllVehiclesToRouteFlowWithEmbeddedRoute(nullptr),
152  myTransformAllVehiclesToTrip(nullptr),
153  myTransformAllVehiclesToFlow(nullptr) {
154  // build header
155  vehicle->buildPopupHeader(this, app);
156  // build menu command for center button and copy cursor position to clipboard
157  vehicle->buildCenterPopupEntry(this);
158  vehicle->buildPositionCopyEntry(this, false);
159  // buld menu commands for names
160  GUIDesigns::buildFXMenuCommand(this, ("Copy " + vehicle->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
161  GUIDesigns::buildFXMenuCommand(this, ("Copy " + vehicle->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
162  new FXMenuSeparator(this);
163  // build selection and show parameters menu
164  vehicle->getNet()->getViewNet()->buildSelectionACPopupEntry(this, vehicle);
165  vehicle->buildShowParamsPopupEntry(this);
166  // add transform functions only in demand mode
167  if (vehicle->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
168  // Get icons
169  FXIcon* vehicleIcon = GUIIconSubSys::getIcon(GUIIcon::VEHICLE);
170  FXIcon* tripIcon = GUIIconSubSys::getIcon(GUIIcon::TRIP);
171  FXIcon* routeFlowIcon = GUIIconSubSys::getIcon(GUIIcon::ROUTEFLOW);
172  FXIcon* flowIcon = GUIIconSubSys::getIcon(GUIIcon::FLOW);
173  // create menu pane for transform operations
174  FXMenuPane* transformOperation = new FXMenuPane(this);
175  this->insertMenuPaneChild(transformOperation);
176  new FXMenuCascade(this, "transform to", nullptr, transformOperation);
177  // Create menu comands for all transform
179  "Vehicles (Only " + vehicle->getTagStr() + ")", vehicleIcon, this, MID_GNE_VEHICLE_TRANSFORM);
181  "Vehicles (embedded route, only " + vehicle->getTagStr() + ")", vehicleIcon, this, MID_GNE_VEHICLE_TRANSFORM);
183  "RouteFlows (Only " + vehicle->getTagStr() + ")", routeFlowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
185  "RouteFlows (embedded route, only " + vehicle->getTagStr() + ")", routeFlowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
187  "Trips (Only " + vehicle->getTagStr() + ")", tripIcon, this, MID_GNE_VEHICLE_TRANSFORM);
189  "Flows (Only " + vehicle->getTagStr() + ")", flowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
190  // create separator
191  new FXMenuSeparator(transformOperation);
192  // Create menu comands for all transform all vehicles
193  myTransformAllVehiclesToVehicle = GUIDesigns::buildFXMenuCommand(transformOperation, "Vehicles", vehicleIcon, this, MID_GNE_VEHICLE_TRANSFORM);
194  myTransformAllVehiclesToVehicleWithEmbeddedRoute = GUIDesigns::buildFXMenuCommand(transformOperation, "Vehicles (embedded route)", vehicleIcon, this, MID_GNE_VEHICLE_TRANSFORM);
195  myTransformAllVehiclesToRouteFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "RouteFlows", routeFlowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
196  myTransformAllVehiclesToRouteFlowWithEmbeddedRoute = GUIDesigns::buildFXMenuCommand(transformOperation, "RouteFlows (embedded route)", routeFlowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
197  myTransformAllVehiclesToTrip = GUIDesigns::buildFXMenuCommand(transformOperation, "Trips", tripIcon, this, MID_GNE_VEHICLE_TRANSFORM);
198  myTransformAllVehiclesToFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "Flows", flowIcon, this, MID_GNE_VEHICLE_TRANSFORM);
199  }
200 }
201 
202 
204 
205 
206 long
208  // iterate over all selected vehicles
209  for (const auto& i : mySelectedVehicles) {
210  if ((obj == myTransformToVehicle) &&
211  (i->getTagProperty().getTag() == myVehicleTag)) {
213  } else if ((obj == myTransformToVehicleWithEmbeddedRoute) &&
214  (i->getTagProperty().getTag() == myVehicleTag)) {
216  } else if ((obj == myTransformToRouteFlow) &&
217  (i->getTagProperty().getTag() == myVehicleTag)) {
219  } else if ((obj == myTransformToRouteFlowWithEmbeddedRoute) &&
220  (i->getTagProperty().getTag() == myVehicleTag)) {
222  } else if ((obj == myTransformToTrip) &&
223  (i->getTagProperty().getTag() == myVehicleTag)) {
225  } else if ((obj == myTransformToFlow) &&
226  (i->getTagProperty().getTag() == myVehicleTag)) {
228  } else if (obj == myTransformAllVehiclesToVehicle) {
230  } else if (obj == myTransformAllVehiclesToVehicleWithEmbeddedRoute) {
232  } else if (obj == myTransformAllVehiclesToRouteFlow) {
234  } else if (obj == myTransformAllVehiclesToRouteFlowWithEmbeddedRoute) {
236  } else if (obj == myTransformAllVehiclesToTrip) {
238  } else if (obj == myTransformAllVehiclesToFlow) {
240  }
241  }
242  return 1;
243 }
244 
245 // ===========================================================================
246 // member method definitions
247 // ===========================================================================
248 
249 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType, GNEDemandElement* route) :
251 {}, {}, {}, {}, {}, {}, {vehicleType, route}, {}),
253  // SUMOVehicleParameter ID has to be set manually
254  id = vehicleID;
255  // set manually vtypeID (needed for saving)
256  vtypeid = vehicleType->getID();
257 }
258 
259 
260 GNEVehicle::GNEVehicle(GNENet* net, GNEDemandElement* vehicleType, GNEDemandElement* route, const SUMOVehicleParameter& vehicleParameters) :
261  GNEDemandElement(vehicleParameters.id, net, (vehicleParameters.tag == GNE_TAG_FLOW_ROUTE) ? GLO_ROUTEFLOW : GLO_VEHICLE, vehicleParameters.tag,
262 {}, {}, {}, {}, {}, {}, {vehicleType, route}, {}),
263 SUMOVehicleParameter(vehicleParameters) {
264  // SUMOVehicleParameter ID has to be set manually
265  id = vehicleParameters.id;
266  // set manually vtypeID (needed for saving)
267  vtypeid = vehicleType->getID();
268 }
269 
270 
271 GNEVehicle::GNEVehicle(GNENet* net, GNEDemandElement* vehicleType, const SUMOVehicleParameter& vehicleParameters) :
272  GNEDemandElement(vehicleParameters.id, net, (vehicleParameters.tag == GNE_TAG_VEHICLE_WITHROUTE) ? GLO_VEHICLE : GLO_ROUTEFLOW, vehicleParameters.tag,
273 {}, {}, {}, {}, {}, {}, {vehicleType}, {}),
274 SUMOVehicleParameter(vehicleParameters) {
275  // SUMOVehicleParameter ID has to be set manually
276  id = vehicleParameters.id;
277  // reset routeid
278  routeid.clear();
279  // set manually vtypeID (needed for saving)
280  vtypeid = vehicleType->getID();
281 }
282 
283 
284 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge,
285  const std::vector<GNEEdge*>& via) :
286  GNEDemandElement(vehicleID, net, (tag == SUMO_TAG_FLOW) ? GLO_FLOW : GLO_TRIP, tag,
287 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {vehicleType}, {}),
289  // set via parameter without updating references
291  // compute vehicle
292  computePath();
293 }
294 
295 
296 GNEVehicle::GNEVehicle(GNENet* net, GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge, const std::vector<GNEEdge*>& via,
297  const SUMOVehicleParameter& vehicleParameters) :
298  GNEDemandElement(vehicleParameters.id, net, (vehicleParameters.tag == SUMO_TAG_FLOW) ? GLO_FLOW : GLO_TRIP, vehicleParameters.tag,
299 {}, {fromEdge, toEdge}, {}, {}, {}, {}, {vehicleType}, {}),
300 SUMOVehicleParameter(vehicleParameters) {
301  // set via parameter without updating references
303  // compute vehicle
304  computePath();
305 }
306 
307 
309 
310 
311 std::string
313  // obtain depart
314  std::string departStr = time2string(depart);
315  // we need to handle depart as a tuple of 20 numbers (format: 000000...00<departTime>)
316  departStr.reserve(20 - departStr.size());
317  // add 0s at the beginning of departStr until we have 20 numbers
318  for (int i = (int)departStr.size(); i < 20; i++) {
319  departStr.insert(departStr.begin(), '0');
320  }
321  return departStr;
322 }
323 
324 
325 void
327  // obtain tag depending if tagProperty has a synonym
329  // attribute VType musn't be written if is DEFAULT_VTYPE_ID
330  if (getParentDemandElements().at(0)->getID() == DEFAULT_VTYPE_ID) {
331  // unset VType parameter
333  // write vehicle attributes (VType will not be written)
334  write(device, OptionsCont::getOptions(), synonymTag);
335  // set VType parameter again
337  } else {
338  // write vehicle attributes, including VType
339  write(device, OptionsCont::getOptions(), synonymTag, getParentDemandElements().at(0)->getID());
340  }
341  // write specific attribute depeding of tag property
343  // write route
345  }
346  // write from, to and edge vias
348  // write manually from/to edges (it correspond to fron and back parent edges)
349  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
350  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
351  // only write via if there isn't empty
352  if (via.size() > 0) {
353  device.writeAttr(SUMO_ATTR_VIA, via);
354  }
355  }
356  // write specific routeFlow/flow attributes
358  // write routeFlow values depending if it was set
361  }
364  }
367  }
370  }
373  }
374  }
375  // write parameters
376  writeParams(device);
377  // write child demand elements associated to this vehicle
378  for (const auto& i : getChildDemandElements()) {
379  i->writeDemandElement(device);
380  }
381  // close vehicle tag
382  device.closeTag();
383 }
384 
385 
386 bool
388  // only trips or flows can have problems
390  // check if from and to are the same edges
391  if ((getParentEdges().size() == 2) && (getParentEdges().at(0) == getParentEdges().at(1))) {
392  return true;
393  } else if (getPath().size() > 0) {
394  // if path edges isn't empty, then there is a valid route
395  return true;
396  } else {
397  return false;
398  }
399  } else if (getParentDemandElements().size() == 2) {
400  // check if exist a valid path using route parent edges
402  return true;
403  } else {
404  return false;
405  }
406  } else if (getChildDemandElements().size() > 0 && (getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_ROUTE_EMBEDDED)) {
407  // check if exist a valid path using embebbed route edges
409  return true;
410  } else {
411  return false;
412  }
413  } else {
414  return false;
415  }
416 }
417 
418 
419 std::string
421  // only trips or flows can have problems
423  // check if exist at least a connection between every edge
424  for (int i = 1; i < (int)getParentEdges().size(); i++) {
425  if (myNet->getPathCalculator()->consecutiveEdgesConnected(getParentDemandElements().at(0)->getVClass(), getParentEdges().at((int)i - 1), getParentEdges().at(i)) == false) {
426  return ("There is no valid path between edges '" + getParentEdges().at((int)i - 1)->getID() + "' and '" + getParentEdges().at(i)->getID() + "'");
427  }
428  }
429  // there is connections bewteen all edges, then all ok
430  return "";
431  } else if (getParentDemandElements().size() == 2) {
432  // get route parent edges
433  const std::vector<GNEEdge*>& routeEdges = getParentDemandElements().at(1)->getParentEdges();
434  // check if exist at least a connection between every edge
435  for (int i = 1; i < (int)routeEdges.size(); i++) {
436  if (myNet->getPathCalculator()->consecutiveEdgesConnected(getParentDemandElements().at(0)->getVClass(), routeEdges.at((int)i - 1), routeEdges.at(i)) == false) {
437  return ("There is no valid path between route edges '" + routeEdges.at((int)i - 1)->getID() + "' and '" + routeEdges.at(i)->getID() + "'");
438  }
439  }
440  // there is connections bewteen all edges, then all ok
441  return "";
442  } else if (getChildDemandElements().size() > 0 && (getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_ROUTE_EMBEDDED)) {
443  // get embebbed route edges
444  const std::vector<GNEEdge*>& routeEdges = getChildDemandElements().front()->getParentEdges();
445  // check if exist at least a connection between every edge
446  for (int i = 1; i < (int)routeEdges.size(); i++) {
447  if (myNet->getPathCalculator()->consecutiveEdgesConnected(getParentDemandElements().at(0)->getVClass(), routeEdges.at((int)i - 1), routeEdges.at(i)) == false) {
448  return ("There is no valid path between embebbed route edges '" + routeEdges.at((int)i - 1)->getID() + "' and '" + routeEdges.at(i)->getID() + "'");
449  }
450  }
451  // there is connections bewteen all edges, then all ok
452  return "";
453  } else {
454  return "";
455  }
456 }
457 
458 
459 void
461 
462 }
463 
464 
467  return getParentDemandElements().front()->getVClass();
468 }
469 
470 
471 const RGBColor&
473  return color;
474 }
475 
476 
477 void
479  // Vehicles cannot be moved
480 }
481 
482 
483 void
485  // Vehicles cannot be moved
486 }
487 
488 
489 void
491  // Vehicles cannot be moved
492 }
493 
494 
495 void
497  // Vehicles cannot be moved
498 }
499 
500 
501 void
503  // declare extreme geometry
504  GNEGeometry::ExtremeGeometry extremeGeometry;
505  // check if depart and arrival pos lanes are defined
507  extremeGeometry.laneStartPosition = departPos;
508  }
510  extremeGeometry.laneEndPosition = arrivalPos;
511  }
512  // get first allowed lane
513  GNELane* firstLane = getFirstAllowedVehicleLane();
514  // check if first lane wasn't sucesfully obtained
515  if (!firstLane) {
517  // use route edges
518  firstLane = getParentDemandElements().at(1)->getParentEdges().front()->getLanes().front();
520  // use embebbed route
521  if (getChildDemandElements().size() > 0) {
522  firstLane = getChildDemandElements().front()->getParentEdges().front()->getLanes().front();
523  } else {
524  firstLane = nullptr;
525  }
526  } else if ((getPath().size() > 0) && getPath().front().getLane()) {
527  // use path edges
528  firstLane = getPath().front().getLane();
529  } else if (getParentEdges().size() > 0) {
530  // use first
531  firstLane = getParentEdges().front()->getLanes().front();
532  } else {
533  firstLane = nullptr;
534  }
535  }
536  // continue only if lane was sucesfully found
537  if (firstLane) {
538  // check if depart pos has to be adjusted
539  if ((departPosProcedure == DepartPosDefinition::GIVEN) && (extremeGeometry.laneStartPosition < 0)) {
540  extremeGeometry.laneStartPosition += firstLane->getLaneShape().length();
541  }
542  // continue depending of tag
544  // calculate edge geometry path using path
547  // calculate edge geometry path using route edges
550  // calculate edge geometry path using embedded route edges
552  }
553  // update start pos geometry
554  myDemandElementGeometry.updateGeometry(firstLane, extremeGeometry.laneStartPosition);
555  firstLane->getParentEdge()->updateVehicleStackLabels();
556  }
557  // update child demand elementss
558  for (const auto& i : getChildDemandElements()) {
559  i->updateGeometry();
560  }
561 }
562 
563 
564 void
566  // calculate path (only for flows and trips)
571  getViaEdges());
572  }
573  // update geometry
574  updateGeometry();
575 }
576 
577 
578 void
580  // reset path (only for flows and trips)
582  resetPathLanes(getVClass(), true,
585  getViaEdges());
586  }
587  // update geometry
588  updateGeometry();
589 }
590 
591 
592 Position
594  return myDemandElementGeometry.getShape().front();
595 }
596 
597 
601  // obtain all selected vehicles
602  std::vector<GNEDemandElement*> selectedDemandElements = myNet->retrieveDemandElements(true);
603  std::vector<GNEVehicle*> selectedVehicles;
604  selectedVehicles.reserve(selectedDemandElements.size());
605  for (const auto& i : selectedDemandElements) {
606  if (i->getTagProperty().isVehicle()) {
607  selectedVehicles.push_back(dynamic_cast<GNEVehicle*>(i));
608  }
609  }
610  // return a GNESelectedVehiclesPopupMenu
611  return new GNESelectedVehiclesPopupMenu(this, selectedVehicles, app, parent);
612  } else {
613  // return a GNESingleVehiclePopupMenu
614  return new GNESingleVehiclePopupMenu(this, app, parent);
615  }
616 }
617 
618 
619 std::string
622  return getParentDemandElements().at(1)->getID();
623  } else if ((myTagProperty.getTag() == SUMO_TAG_TRIP) || (myTagProperty.getTag() == SUMO_TAG_FLOW)) {
624  return getParentEdges().front()->getID();
625  } else {
626  throw ProcessError("Invalid vehicle tag");
627  }
628 }
629 
630 
631 Boundary
633  Boundary vehicleBoundary;
634  vehicleBoundary.add(myDemandElementGeometry.getShape().front());
635  vehicleBoundary.grow(20);
636  return vehicleBoundary;
637 }
638 
639 
640 void
641 GNEVehicle::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
642  // geometry of this element cannot be splitted
643 }
644 
645 
646 void
648  // only drawn in super mode demand
652  // declare common attributes
654  const double exaggeration = s.vehicleSize.getExaggeration(s, this);
655  const double width = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_WIDTH);
656  const double length = getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_LENGTH);
657  const double vehicleSizeSquared = (width * width) * (length * length) * (exaggeration * exaggeration);
658  // obtain Position an rotation (depending of draw spread vehicles)
659  if (drawSpreadVehicles && mySpreadGeometry.getShape().size() == 0) {
660  return;
661  }
662  const Position vehiclePosition = drawSpreadVehicles ? mySpreadGeometry.getShape().front() : myDemandElementGeometry.getShape().front();
663  const double vehicleRotation = drawSpreadVehicles ? mySpreadGeometry.getShapeRotations().front() : myDemandElementGeometry.getShapeRotations().front();
664  // check that position is valid
665  if (vehiclePosition != Position::INVALID) {
666  // first push name
667  glPushName(getGlID());
668  // first check if if mouse is enought near to this vehicle to draw it
669  if (s.drawForRectangleSelection && (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(vehiclePosition) >= (vehicleSizeSquared + 2))) {
670  // push draw matrix
671  glPushMatrix();
672  // Start with the drawing of the area traslating matrix to origin
674  // translate to drawing position
675  glTranslated(vehiclePosition.x(), vehiclePosition.y(), 0);
676  glRotated(vehicleRotation, 0, 0, -1);
677  // extra translation needed to draw vehicle over edge (to avoid selecting problems)
678  glTranslated(0, (-1) * length * exaggeration, 0);
679  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
680  // Pop last matrix
681  glPopMatrix();
682  } else {
684  // push draw matrix
685  glPushMatrix();
686  // Start with the drawing of the area traslating matrix to origin
688  // translate to drawing position
689  glTranslated(vehiclePosition.x(), vehiclePosition.y(), 0);
690  glRotated(vehicleRotation, 0, 0, -1);
691  // extra translation needed to draw vehicle over edge (to avoid selecting problems)
692  glTranslated(0, (-1) * length * exaggeration, 0);
693  // set lane color
694  setColor(s);
695  double upscaleLength = exaggeration;
696  if ((exaggeration > 1) && (length > 5)) {
697  // reduce the length/width ratio because this is not usefull at high zoom
698  upscaleLength = MAX2(1.0, upscaleLength * (5 + sqrt(length - 5)) / length);
699  }
700  glScaled(exaggeration, upscaleLength, 1);
701  // check if we're drawing in selecting mode
703  // draw vehicle as a box and don't draw the rest of details
705  } else {
706  // draw the vehicle depending of detail level
707  if (s.drawDetail(s.detailSettings.vehicleShapes, exaggeration)) {
709  } else if (s.drawDetail(s.detailSettings.vehicleBoxes, exaggeration)) {
711  } else if (s.drawDetail(s.detailSettings.vehicleTriangles, exaggeration)) {
713  }
714 
715  /*
716  switch (s.vehicleQuality) {
717  case 0:
718  GUIBaseVehicleHelper::drawAction_drawVehicleAsTrianglePlus(width, length);
719  break;
720  case 1:
721  GUIBaseVehicleHelper::drawAction_drawVehicleAsBoxPlus(width, length);
722  break;
723  default:
724  GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly(s, shape, width, length);
725  break;
726  }
727  */
728  // check if min gap has to be drawn
729  if (s.drawMinGap) {
730  const double minGap = -1 * getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_MINGAP);
731  glColor3d(0., 1., 0.);
732  glBegin(GL_LINES);
733  glVertex2d(0., 0);
734  glVertex2d(0., minGap);
735  glVertex2d(-.5, minGap);
736  glVertex2d(.5, minGap);
737  glEnd();
738  }
739  // drawing name at GLO_MAX fails unless translating z
740  glTranslated(0, MIN2(length / 2, double(5)), -getType());
741  glScaled(1 / exaggeration, 1 / upscaleLength, 1);
742  glRotated(vehicleRotation, 0, 0, -1);
744  // draw line
745  if (s.vehicleName.show && line != "") {
746  glTranslated(0, 0.6 * s.vehicleName.scaledSize(s.scale), 0);
747  GLHelper::drawTextSettings(s.vehicleName, "line:" + line, Position(0, 0), s.scale, s.angle);
748  }
749  }
750  // pop draw matrix
751  glPopMatrix();
752  // draw stack label
753  if ((myStackedLabelNumber > 0) && !drawSpreadVehicles) {
754  drawStackLabel(vehiclePosition, vehicleRotation, width, length, exaggeration);
755  }
756  // draw flow label
758  drawFlowLabel(vehiclePosition, vehicleRotation, width, length, exaggeration);
759  }
760  // check if dotted contours has to be drawn
762  // draw using drawDottedContourClosedShape
763  GNEGeometry::drawDottedSquaredShape(GNEGeometry::DottedContourType::INSPECT, s, vehiclePosition, length * 0.5, width * 0.5, length * -0.5, 0, vehicleRotation, exaggeration);
764  }
765  if (s.drawDottedContour() || myNet->getViewNet()->getFrontAttributeCarrier() == this) {
766  // draw using drawDottedContourClosedShape
767  GNEGeometry::drawDottedSquaredShape(GNEGeometry::DottedContourType::FRONT, s, vehiclePosition, length * 0.5, width * 0.5, length * -0.5, 0, vehicleRotation, exaggeration);
768  }
769  }
770  // pop name
771  glPopName();
772  }
773  }
774 }
775 
776 
777 void
778 GNEVehicle::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const {
780  // declare flag to draw spread vehicles
782  // calculate width
783  const double width = s.vehicleSize.getExaggeration(s, lane) * s.widthSettings.trip;
784  // Start drawing adding an gl identificator
785  glPushName(getGlID());
786  // Add a draw matrix
787  glPushMatrix();
788  // Start with the drawing of the area traslating matrix to origin
789  glTranslated(0, 0, getType() + offsetFront);
790  // Set color of the base
791  if (drawUsingSelectColor()) {
793  } else {
795  }
796  // iterate over segments
797  if (drawSpreadVehicles) {
798  for (const auto& segment : myDemandElementSegmentGeometry) {
799  // draw partial segment
800  if (segment.isLaneSegment() && (segment.getLane() == lane)) {
802  }
803  }
804  } else {
805  for (const auto& segment : myDemandElementSegmentGeometry) {
806  // draw partial segment
807  if (segment.isLaneSegment() && (segment.getLane() == lane)) {
809  }
810  }
811  }
812  // Pop last matrix
813  glPopMatrix();
814  // Draw name if isn't being drawn for selecting
815  if (!s.drawForRectangleSelection) {
816  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
817  }
818  // check if shape dotted contour has to be drawn
820  // get first and last allowed lanes
821  const GNELane* firstLane = getFirstAllowedVehicleLane();
822  const GNELane* lastLane = getLastAllowedVehicleLane();
823  // iterate over segments
824  for (const auto& segment : myDemandElementSegmentGeometry) {
825  if (segment.isLaneSegment() && (segment.getLane() == lane)) {
826  // draw partial segment
827  if (firstLane == lane) {
828  // draw front dotted contour
830  } else if (lastLane == lane) {
831  // draw back dotted contour
833  } else {
834  // draw dotted contour
836  }
837  }
838  }
839  }
840  // Pop name
841  glPopName();
842  }
843 }
844 
845 
846 void
847 GNEVehicle::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const {
848  if (!s.drawForRectangleSelection && fromLane->getLane2laneConnections().exist(toLane) &&
850  // Start drawing adding an gl identificator
851  glPushName(getGlID());
852  // obtain lane2lane geometry
853  const GNEGeometry::Geometry& lane2laneGeometry = fromLane->getLane2laneConnections().getLane2laneGeometry(toLane);
854  // calculate width
855  const double width = s.vehicleSize.getExaggeration(s, fromLane) * s.widthSettings.trip;
856  // Add a draw matrix
857  glPushMatrix();
858  // Start with the drawing of the area traslating matrix to origin
859  glTranslated(0, 0, getType() + offsetFront);
860  // Set color of the base
861  if (drawUsingSelectColor()) {
863  } else {
865  }
866  // draw lane2lane
867  GNEGeometry::drawGeometry(myNet->getViewNet(), lane2laneGeometry, width);
868  // Pop last matrix
869  glPopMatrix();
870  // check if shape dotted contour has to be drawn
872  // draw lane2lane dotted geometry
873  if (fromLane->getLane2laneConnections().exist(toLane)) {
875  }
876  }
877  // Pop name
878  glPopName();
879  }
880 }
881 
882 
883 std::string
885  switch (key) {
886  case SUMO_ATTR_ID:
887  return getID();
888  case SUMO_ATTR_TYPE:
889  return getParentDemandElements().at(0)->getID();
890  case SUMO_ATTR_COLOR:
891  if (wasSet(VEHPARS_COLOR_SET)) {
892  return toString(color);
893  } else {
895  }
898  return getDepartLane();
899  } else {
901  }
902  case SUMO_ATTR_DEPARTPOS:
904  return getDepartPos();
905  } else {
907  }
910  return getDepartSpeed();
911  } else {
913  }
916  return getArrivalLane();
917  } else {
919  }
922  return getArrivalPos();
923  } else {
925  }
928  return getArrivalSpeed();
929  } else {
931  }
932  case SUMO_ATTR_LINE:
933  if (wasSet(VEHPARS_LINE_SET)) {
934  return line;
935  } else {
937  }
940  return toString(personNumber);
941  } else {
943  }
946  return toString(containerNumber);
947  } else {
949  }
950  case SUMO_ATTR_REROUTE:
952  return "true";
953  } else {
954  return "false";
955  }
958  return getDepartPosLat();
959  } else {
961  }
964  return getArrivalPosLat();
965  } else {
967  }
968  // Specific of vehicles
969  case SUMO_ATTR_DEPART:
970  return time2string(depart);
971  case SUMO_ATTR_ROUTE:
972  if (getParentDemandElements().size() == 2) {
973  return getParentDemandElements().at(1)->getID();
974  } else {
975  return "";
976  }
977  // Specific of Trips
978  case SUMO_ATTR_FROM:
979  return getParentEdges().front()->getID();
980  case SUMO_ATTR_TO:
981  return getParentEdges().back()->getID();
982  case SUMO_ATTR_VIA:
983  return toString(via);
984  // Specific of routeFlows
985  case SUMO_ATTR_BEGIN:
986  return time2string(depart);
987  case SUMO_ATTR_END:
988  return time2string(repetitionEnd);
990  return toString(3600 / STEPS2TIME(repetitionOffset));
991  case SUMO_ATTR_PERIOD:
993  case SUMO_ATTR_PROB:
995  case SUMO_ATTR_NUMBER:
996  return toString(repetitionNumber);
997  //
998  case GNE_ATTR_SELECTED:
1000  case GNE_ATTR_PARAMETERS:
1001  return getParametersStr();
1002  default:
1003  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1004  }
1005 }
1006 
1007 
1008 double
1010  switch (key) {
1011  case SUMO_ATTR_DEPART:
1012  case SUMO_ATTR_BEGIN:
1013  return STEPS2TIME(depart);
1014  case SUMO_ATTR_DEPARTPOS:
1015  // only return departPos it if is given
1017  return departPos;
1018  } else {
1019  return 0;
1020  }
1021  case SUMO_ATTR_ARRIVALPOS:
1022  // only return departPos it if is given
1024  return arrivalPos;
1025  } else {
1026  return -1;
1027  }
1028  case SUMO_ATTR_WIDTH:
1029  case SUMO_ATTR_LENGTH:
1030  case SUMO_ATTR_MINGAP:
1031  return getParentDemandElements().at(0)->getAttributeDouble(key);
1032  default:
1033  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
1034  }
1035 }
1036 
1037 
1038 void
1039 GNEVehicle::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
1040  if (value == getAttribute(key)) {
1041  return; //avoid needless changes, later logic relies on the fact that attributes have changed
1042  }
1043  switch (key) {
1044  case SUMO_ATTR_ID:
1045  case SUMO_ATTR_TYPE:
1046  case SUMO_ATTR_COLOR:
1047  case SUMO_ATTR_DEPARTLANE:
1048  case SUMO_ATTR_DEPARTPOS:
1049  case SUMO_ATTR_DEPARTSPEED:
1050  case SUMO_ATTR_ARRIVALLANE:
1051  case SUMO_ATTR_ARRIVALPOS:
1053  case SUMO_ATTR_LINE:
1056  case SUMO_ATTR_REROUTE:
1059  // Specific of vehicles
1060  case SUMO_ATTR_DEPART:
1061  case SUMO_ATTR_ROUTE:
1062  // Specific of Trips
1063  case SUMO_ATTR_FROM:
1064  case SUMO_ATTR_TO:
1065  case SUMO_ATTR_VIA:
1066  //
1067  // Specific of routeFlows
1068  case SUMO_ATTR_BEGIN:
1069  case SUMO_ATTR_END:
1070  case SUMO_ATTR_NUMBER:
1071  case SUMO_ATTR_VEHSPERHOUR:
1072  case SUMO_ATTR_PERIOD:
1073  case SUMO_ATTR_PROB:
1074  //
1075  case GNE_ATTR_PARAMETERS:
1076  case GNE_ATTR_SELECTED:
1077  undoList->p_add(new GNEChange_Attribute(this, key, value));
1078  break;
1079  default:
1080  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1081  }
1082 }
1083 
1084 
1085 bool
1086 GNEVehicle::isValid(SumoXMLAttr key, const std::string& value) {
1087  // declare string error
1088  std::string error;
1089  switch (key) {
1090  case SUMO_ATTR_ID:
1091  // Vehicles, Trips and Flows share namespace
1093  (myNet->retrieveDemandElement(SUMO_TAG_VEHICLE, value, false) == nullptr) &&
1094  (myNet->retrieveDemandElement(SUMO_TAG_TRIP, value, false) == nullptr) &&
1095  (myNet->retrieveDemandElement(GNE_TAG_FLOW_ROUTE, value, false) == nullptr) &&
1096  (myNet->retrieveDemandElement(SUMO_TAG_FLOW, value, false) == nullptr)) {
1097  return true;
1098  } else {
1099  return false;
1100  }
1101  case SUMO_ATTR_TYPE:
1102  return SUMOXMLDefinitions::isValidTypeID(value) && (myNet->retrieveDemandElement(SUMO_TAG_VTYPE, value, false) != nullptr);
1103  case SUMO_ATTR_COLOR:
1104  return canParse<RGBColor>(value);
1105  case SUMO_ATTR_DEPARTLANE: {
1106  int dummyDepartLane;
1107  DepartLaneDefinition dummyDepartLaneProcedure;
1108  parseDepartLane(value, toString(SUMO_TAG_VEHICLE), id, dummyDepartLane, dummyDepartLaneProcedure, error);
1109  // if error is empty, check if depart lane is correct
1110  if (error.empty()) {
1111  const GNELane* lane = getFirstAllowedVehicleLane();
1112  if (lane == nullptr) {
1113  return false;
1114  } else if (dummyDepartLaneProcedure != DepartLaneDefinition::GIVEN) {
1115  return true;
1116  } else {
1117  return dummyDepartLane < (int)lane->getParentEdge()->getLanes().size();
1118  }
1119  } else {
1120  return false;
1121  }
1122  }
1123  case SUMO_ATTR_DEPARTPOS: {
1124  double dummyDepartPos;
1125  DepartPosDefinition dummyDepartPosProcedure;
1126  parseDepartPos(value, toString(SUMO_TAG_VEHICLE), id, dummyDepartPos, dummyDepartPosProcedure, error);
1127  // if error is empty, given value is valid
1128  return error.empty();
1129  }
1130  case SUMO_ATTR_DEPARTSPEED: {
1131  double dummyDepartSpeed;
1132  DepartSpeedDefinition dummyDepartSpeedProcedure;
1133  parseDepartSpeed(value, toString(SUMO_TAG_VEHICLE), id, dummyDepartSpeed, dummyDepartSpeedProcedure, error);
1134  // if error is empty, check if depart speed is correct
1135  if (error.empty()) {
1136  if (dummyDepartSpeedProcedure != DepartSpeedDefinition::GIVEN) {
1137  return true;
1138  } else {
1139  return (dummyDepartSpeed <= getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_MAXSPEED));
1140  }
1141  } else {
1142  return false;
1143  }
1144  }
1145  case SUMO_ATTR_ARRIVALLANE: {
1146  int dummyArrivalLane;
1147  ArrivalLaneDefinition dummyArrivalLaneProcedure;
1148  parseArrivalLane(value, toString(SUMO_TAG_VEHICLE), id, dummyArrivalLane, dummyArrivalLaneProcedure, error);
1149  // if error is empty, given value is valid
1150  return error.empty();
1151  }
1152  case SUMO_ATTR_ARRIVALPOS: {
1153  double dummyArrivalPos;
1154  ArrivalPosDefinition dummyArrivalPosProcedure;
1155  parseArrivalPos(value, toString(SUMO_TAG_VEHICLE), id, dummyArrivalPos, dummyArrivalPosProcedure, error);
1156  // if error is empty, given value is valid
1157  return error.empty();
1158  }
1159  case SUMO_ATTR_ARRIVALSPEED: {
1160  double dummyArrivalSpeed;
1161  ArrivalSpeedDefinition dummyArrivalSpeedProcedure;
1162  parseArrivalSpeed(value, toString(SUMO_TAG_VEHICLE), id, dummyArrivalSpeed, dummyArrivalSpeedProcedure, error);
1163  // if error is empty, given value is valid
1164  return error.empty();
1165  }
1166  case SUMO_ATTR_LINE:
1167  return true;
1169  return canParse<int>(value) && parse<int>(value) >= 0;
1171  return canParse<int>(value) && parse<int>(value) >= 0;
1172  case SUMO_ATTR_REROUTE:
1173  return true; // check
1174  case SUMO_ATTR_DEPARTPOS_LAT: {
1175  double dummyDepartPosLat;
1176  DepartPosLatDefinition dummyDepartPosLatProcedure;
1177  parseDepartPosLat(value, toString(SUMO_TAG_VEHICLE), id, dummyDepartPosLat, dummyDepartPosLatProcedure, error);
1178  // if error is empty, given value is valid
1179  return error.empty();
1180  }
1181  case SUMO_ATTR_ARRIVALPOS_LAT: {
1182  double dummyArrivalPosLat;
1183  ArrivalPosLatDefinition dummyArrivalPosLatProcedure;
1184  parseArrivalPosLat(value, toString(SUMO_TAG_VEHICLE), id, dummyArrivalPosLat, dummyArrivalPosLatProcedure, error);
1185  // if error is empty, given value is valid
1186  return error.empty();
1187  }
1188  // Specific of vehicles
1189  case SUMO_ATTR_DEPART: {
1190  SUMOTime dummyDepart;
1191  DepartDefinition dummyDepartProcedure;
1192  parseDepart(value, toString(SUMO_TAG_VEHICLE), id, dummyDepart, dummyDepartProcedure, error);
1193  // if error is empty, given value is valid
1194  return error.empty();
1195  }
1196  case SUMO_ATTR_ROUTE:
1197  if (getParentDemandElements().size() == 2) {
1198  return SUMOXMLDefinitions::isValidVehicleID(value) && (myNet->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
1199  } else {
1200  return true;
1201  }
1202  // Specific of Trips
1203  case SUMO_ATTR_FROM:
1204  case SUMO_ATTR_TO:
1205  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrieveEdge(value, false) != nullptr);
1206  case SUMO_ATTR_VIA:
1207  if (value.empty()) {
1208  return true;
1209  } else {
1210  return canParse<std::vector<GNEEdge*> >(myNet, value, false);
1211  }
1212  // Specific of routeFlows
1213  case SUMO_ATTR_BEGIN:
1214  if (canParse<double>(value)) {
1215  return (parse<double>(value) >= 0);
1216  } else {
1217  return false;
1218  }
1219  case SUMO_ATTR_END:
1220  if (value.empty()) {
1221  return true;
1222  } else if (canParse<double>(value)) {
1223  return (parse<double>(value) >= 0);
1224  } else {
1225  return false;
1226  }
1227  case SUMO_ATTR_VEHSPERHOUR:
1228  if (value.empty()) {
1229  return true;
1230  } else if (canParse<double>(value)) {
1231  return (parse<double>(value) > 0);
1232  } else {
1233  return false;
1234  }
1235  case SUMO_ATTR_PERIOD:
1236  if (value.empty()) {
1237  return true;
1238  } else if (canParse<double>(value)) {
1239  return (parse<double>(value) > 0);
1240  } else {
1241  return false;
1242  }
1243  case SUMO_ATTR_PROB:
1244  if (value.empty()) {
1245  return true;
1246  } else if (canParse<double>(value)) {
1247  return (parse<double>(value) >= 0);
1248  } else {
1249  return false;
1250  }
1251  case SUMO_ATTR_NUMBER:
1252  if (canParse<int>(value)) {
1253  return (parse<int>(value) >= 0);
1254  } else {
1255  return false;
1256  }
1257  //
1258  case GNE_ATTR_SELECTED:
1259  return canParse<bool>(value);
1260  case GNE_ATTR_PARAMETERS:
1261  return Parameterised::areParametersValid(value);
1262  default:
1263  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1264  }
1265 }
1266 
1267 
1268 void
1270  // obtain a copy of parameter sets
1271  int newParametersSet = parametersSet;
1272  // modify newParametersSet
1273  GNERouteHandler::setFlowParameters(key, newParametersSet);
1274  // add GNEChange_EnableAttribute
1275  undoList->add(new GNEChange_EnableAttribute(this, parametersSet, newParametersSet), true);
1276 }
1277 
1278 
1279 void
1281  // nothing to disable
1282 }
1283 
1284 
1285 bool
1287  switch (key) {
1288  case SUMO_ATTR_END:
1289  return (parametersSet & VEHPARS_END_SET) != 0;
1290  case SUMO_ATTR_NUMBER:
1291  return (parametersSet & VEHPARS_NUMBER_SET) != 0;
1292  case SUMO_ATTR_VEHSPERHOUR:
1293  return (parametersSet & VEHPARS_VPH_SET) != 0;
1294  case SUMO_ATTR_PERIOD:
1295  return (parametersSet & VEHPARS_PERIOD_SET) != 0;
1296  case SUMO_ATTR_PROB:
1297  return (parametersSet & VEHPARS_PROB_SET) != 0;
1298  default:
1299  return true;
1300  }
1301 }
1302 
1303 
1304 std::string
1306  return getTagStr();
1307 }
1308 
1309 
1310 std::string
1312  // special case for Trips and flow
1314  // check if we're inspecting a Edge
1315  if (!myNet->getViewNet()->getInspectedAttributeCarriers().empty() &&
1316  myNet->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1317  // check if edge correspond to a "from", "to" or "via" edge
1319  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (from)";
1320  } else if (myNet->getViewNet()->isAttributeCarrierInspected(getParentEdges().front())) {
1321  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (to)";
1322  } else {
1323  // iterate over via
1324  for (const auto& i : via) {
1325  if (i == myNet->getViewNet()->getInspectedAttributeCarriers().front()->getID()) {
1326  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (via)";
1327  }
1328  }
1329  }
1330  }
1331  }
1332  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
1333 }
1334 
1335 
1336 const std::map<std::string, std::string>&
1338  return getParametersMap();
1339 }
1340 
1341 // ===========================================================================
1342 // protected
1343 // ===========================================================================
1344 
1345 void
1347  // change color
1348  if (drawUsingSelectColor()) {
1350  } else {
1351  // obtain vehicle color
1352  const GUIColorer& c = s.vehicleColorer;
1353  // set color depending of vehicle color active
1354  switch (c.getActive()) {
1355  case 0: {
1356  // test for emergency vehicle
1357  if (getParentDemandElements().at(0)->getAttribute(SUMO_ATTR_GUISHAPE) == "emergency") {
1359  break;
1360  }
1361  // test for firebrigade
1362  if (getParentDemandElements().at(0)->getAttribute(SUMO_ATTR_GUISHAPE) == "firebrigade") {
1364  break;
1365  }
1366  // test for police car
1367  if (getParentDemandElements().at(0)->getAttribute(SUMO_ATTR_GUISHAPE) == "police") {
1369  break;
1370  }
1371  // check if color was set
1372  if (wasSet(VEHPARS_COLOR_SET)) {
1374  break;
1375  } else {
1376  // take their parent's color)
1378  break;
1379  }
1380  break;
1381  }
1382  case 2: {
1383  if (wasSet(VEHPARS_COLOR_SET)) {
1385  } else {
1387  }
1388  break;
1389  }
1390  case 3: {
1393  } else {
1395  }
1396  break;
1397  }
1398  case 4: {
1401  } else {
1403  }
1404  break;
1405  }
1406  case 5: {
1407  Position p = getParentDemandElements().at(1)->getParentEdges().at(0)->getLanes().at(0)->getLaneShape()[0];
1408  const Boundary& b = myNet->getBoundary();
1409  Position center = b.getCenter();
1410  double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / M_PI;
1411  double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
1412  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1413  break;
1414  }
1415  case 6: {
1416  Position p = getParentDemandElements().at(1)->getParentEdges().back()->getLanes().at(0)->getLaneShape()[-1];
1417  const Boundary& b = myNet->getBoundary();
1418  Position center = b.getCenter();
1419  double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / M_PI;
1420  double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
1421  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1422  break;
1423  }
1424  case 7: {
1425  Position pb = getParentDemandElements().at(1)->getParentEdges().at(0)->getLanes().at(0)->getLaneShape()[0];
1426  Position pe = getParentDemandElements().at(1)->getParentEdges().back()->getLanes().at(0)->getLaneShape()[-1];
1427  const Boundary& b = myNet->getBoundary();
1428  double hue = 180. + atan2(pb.x() - pe.x(), pb.y() - pe.y()) * 180. / M_PI;
1429  Position minp(b.xmin(), b.ymin());
1430  Position maxp(b.xmax(), b.ymax());
1431  double sat = pb.distanceTo(pe) / minp.distanceTo(maxp);
1432  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1433  break;
1434  }
1435  case 29: { // color randomly (by pointer hash)
1436  std::hash<const GNEVehicle*> ptr_hash;
1437  const double hue = (double)(ptr_hash(this) % 360); // [0-360]
1438  const double sat = ((ptr_hash(this) / 360) % 67) / 100.0 + 0.33; // [0.33-1]
1439  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1440  break;
1441  }
1442  default: {
1444  }
1445  }
1446  }
1447 }
1448 
1449 // ===========================================================================
1450 // private
1451 // ===========================================================================
1452 
1453 void
1454 GNEVehicle::setAttribute(SumoXMLAttr key, const std::string& value) {
1455  // declare string error
1456  std::string error;
1457  // flag to upate stack label
1458  bool updateSpreadStackGeometry = false;
1459  switch (key) {
1460  case SUMO_ATTR_ID:
1461  myNet->getAttributeCarriers()->updateID(this, value);
1462  // set manually vehicle ID (needed for saving)
1463  id = value;
1464  // Change IDs of all person plans children (stops, embedded routes...)
1465  for (const auto& childDemandElement : getChildDemandElements()) {
1466  childDemandElement->setMicrosimID(getID());
1467  }
1468  break;
1469  case SUMO_ATTR_TYPE:
1471  // set manually vtypeID (needed for saving)
1472  vtypeid = value;
1473  break;
1474  case SUMO_ATTR_COLOR:
1475  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1476  color = parse<RGBColor>(value);
1477  // mark parameter as set
1479  } else {
1480  // set default value
1481  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
1482  // unset parameter
1484  }
1485  break;
1486  case SUMO_ATTR_DEPARTLANE:
1487  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1489  // mark parameter as set
1491  } else {
1492  // set default value
1494  // unset parameter
1496  }
1497  break;
1498  case SUMO_ATTR_DEPARTPOS:
1499  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1501  // mark parameter as set
1503  } else {
1504  // set default value
1506  // unset parameter
1508  }
1509  updateGeometry();
1510  updateSpreadStackGeometry = true;
1511  break;
1512  case SUMO_ATTR_DEPARTSPEED:
1513  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1515  // mark parameter as set
1517  } else {
1518  // set default value
1520  // unset parameter
1522  }
1523  break;
1524  case SUMO_ATTR_ARRIVALLANE:
1525  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1527  // mark parameter as set
1529  } else {
1530  // set default value
1532  // unset parameter
1534  }
1535  break;
1536  case SUMO_ATTR_ARRIVALPOS:
1537  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1539  // mark parameter as set
1541  } else {
1542  // set default value
1544  // unset parameter
1546  }
1547  updateGeometry();
1548  updateSpreadStackGeometry = true;
1549  break;
1551  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1553  // mark parameter as set
1555  } else {
1556  // set default value
1558  // unset parameter
1560  }
1561  break;
1562  case SUMO_ATTR_LINE:
1563  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1564  line = value;
1565  // mark parameter as set
1567  } else {
1568  // set default value
1570  // unset parameter
1572  }
1573  break;
1575  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1576  personNumber = parse<int>(value);
1577  // mark parameter as set
1579  } else {
1580  // set default value
1581  personNumber = parse<int>(myTagProperty.getDefaultValue(key));
1582  // unset parameter
1584  }
1585  break;
1587  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1588  containerNumber = parse<int>(value);
1589  // mark parameter as set
1591  } else {
1592  // set default value
1593  containerNumber = parse<int>(myTagProperty.getDefaultValue(key));
1594  // unset parameter
1596  }
1597  break;
1598  case SUMO_ATTR_REROUTE:
1599  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1600  // mark parameter as set
1602  } else {
1603  // unset parameter
1605  }
1606  break;
1608  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1610  // mark parameter as set
1612  } else {
1613  // set default value
1615  // unset parameter
1617  }
1618  break;
1620  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1622  // mark parameter as set
1624  } else {
1625  // set default value
1627  // unset parameter
1629  }
1631  break;
1632  // Specific of vehicles
1633  case SUMO_ATTR_DEPART: {
1635  break;
1636  }
1637  case SUMO_ATTR_ROUTE:
1638  if (getParentDemandElements().size() == 2) {
1640  }
1641  updateGeometry();
1642  updateSpreadStackGeometry = true;
1643  break;
1644  // Specific of Trips and flow
1645  case SUMO_ATTR_FROM: {
1646  // change first edge
1647  replaceFirstParentEdge(value);
1648  // compute vehicle
1649  computePath();
1650  updateSpreadStackGeometry = true;
1651  break;
1652  }
1653  case SUMO_ATTR_TO: {
1654  // change last edge
1655  replaceLastParentEdge(value);
1656  // compute vehicle
1657  computePath();
1658  updateSpreadStackGeometry = true;
1659  break;
1660  }
1661  case SUMO_ATTR_VIA: {
1662  if (!value.empty()) {
1663  // set new via edges
1664  via = parse< std::vector<std::string> >(value);
1665  // mark parameter as set
1667  } else {
1668  // clear via
1669  via.clear();
1670  // unset parameter
1672  }
1673  // update via
1674  replaceMiddleParentEdges(value, true);
1675  // compute vehicle
1676  computePath();
1677  updateSpreadStackGeometry = true;
1678  break;
1679  }
1680  // Specific of routeFlows
1681  case SUMO_ATTR_BEGIN: {
1682  depart = string2time(value);
1683  break;
1684  }
1685  case SUMO_ATTR_END:
1686  repetitionEnd = string2time(value);
1687  break;
1688  case SUMO_ATTR_VEHSPERHOUR:
1689  repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
1690  break;
1691  case SUMO_ATTR_PERIOD:
1692  repetitionOffset = string2time(value);
1693  break;
1694  case SUMO_ATTR_PROB:
1695  repetitionProbability = parse<double>(value);
1696  break;
1697  case SUMO_ATTR_NUMBER:
1698  repetitionNumber = parse<int>(value);
1699  break;
1700  //
1701  case GNE_ATTR_SELECTED:
1702  if (parse<bool>(value)) {
1704  } else {
1706  }
1707  break;
1708  case GNE_ATTR_PARAMETERS:
1709  setParametersStr(value);
1710  break;
1711  default:
1712  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1713  }
1714  // check if stack label has to be updated
1715  if (updateSpreadStackGeometry) {
1717  getParentEdges().front()->updateVehicleStackLabels();
1718  getParentEdges().front()->updateVehicleSpreadGeometries();
1719  } else if (getParentDemandElements().size() == 2) {
1720  getParentDemandElements().at(1)->getParentEdges().front()->updateVehicleStackLabels();
1721  getParentDemandElements().at(1)->getParentEdges().front()->updateVehicleSpreadGeometries();
1722  } else if (getChildDemandElements().size() > 0) {
1723  getChildDemandElements().front()->getParentEdges().front()->updateVehicleStackLabels();
1724  getChildDemandElements().front()->getParentEdges().front()->updateVehicleSpreadGeometries();
1725  }
1726  }
1727 }
1728 
1729 
1730 void
1731 GNEVehicle::setEnabledAttribute(const int enabledAttributes) {
1732  parametersSet = enabledAttributes;
1733 }
1734 
1735 
1736 void
1737 GNEVehicle::drawStackLabel(const Position& vehiclePosition, const double vehicleRotation, const double width, const double length, const double exaggeration) const {
1738  // declare contour width
1739  const double contourWidth = (0.05 * exaggeration);
1740  // Push matrix
1741  glPushMatrix();
1742  // Traslate to vehicle top
1743  glTranslated(vehiclePosition.x(), vehiclePosition.y(), GLO_ROUTE + getType() + 0.1 + GLO_PERSONFLOW);
1744  glRotated(vehicleRotation, 0, 0, -1);
1745  glTranslated((width * exaggeration * 0.5) + (0.35 * exaggeration), 0, 0);
1746  // draw external box
1748  GLHelper::drawBoxLine(Position(), 0, (length * exaggeration), 0.3 * exaggeration);
1749  // draw internal box
1750  glTranslated(0, 0, 0.1);
1751  GLHelper::setColor(RGBColor(0, 128, 0));
1752  GLHelper::drawBoxLine(Position(0, -contourWidth), Position(0, -contourWidth), 0, (length * exaggeration) - (contourWidth * 2), (0.3 * exaggeration) - contourWidth);
1753  // draw stack label
1754  GLHelper::drawText("vehicles stacked: " + toString(myStackedLabelNumber), Position(0, length * exaggeration * -0.5), (.1 * exaggeration), (0.6 * exaggeration), RGBColor::WHITE, 90, 0, -1);
1755  // pop draw matrix
1756  glPopMatrix();
1757 }
1758 
1759 
1760 void
1761 GNEVehicle::drawFlowLabel(const Position& vehiclePosition, const double vehicleRotation, const double width, const double length, const double exaggeration) const {
1762  // declare contour width
1763  const double contourWidth = (0.05 * exaggeration);
1764  // Push matrix
1765  glPushMatrix();
1766  // Traslate to vehicle bot
1767  glTranslated(vehiclePosition.x(), vehiclePosition.y(), GLO_ROUTE + getType() + 0.1 + GLO_PERSONFLOW);
1768  glRotated(vehicleRotation, 0, 0, -1);
1769  glTranslated(-1 * ((width * 0.5 * exaggeration) + (0.35 * exaggeration)), 0, 0);
1770  // draw external box
1772  GLHelper::drawBoxLine(Position(), Position(), 0, (length * exaggeration), 0.3 * exaggeration);
1773  // draw internal box
1774  glTranslated(0, 0, 0.1);
1776  GLHelper::drawBoxLine(Position(0, -contourWidth), Position(0, -contourWidth), 0, (length * exaggeration) - (contourWidth * 2), (0.3 * exaggeration) - contourWidth);
1777  // draw stack label
1778  GLHelper::drawText("Flow", Position(0, length * exaggeration * -0.5), (.1 * exaggeration), (0.6 * exaggeration), RGBColor::BLACK, 90, 0, -1);
1779  // pop draw matrix
1780  glPopMatrix();
1781 }
1782 
1783 
1784 /****************************************************************************/
FXDEFMAP(GNEVehicle::GNESingleVehiclePopupMenu) GNESingleVehiclePopupMenuMap[]
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:403
@ MID_GNE_VEHICLE_TRANSFORM
transform vehicle to another vehicle type (ej: flow to trip)
Definition: GUIAppEnum.h:1083
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:401
@ GLO_TRIP
a trip
@ GLO_ROUTEFLOW
a routeFlow
@ GLO_ROUTE
a route
@ GLO_FLOW
a flow
@ GLO_VEHICLE
a vehicle
@ GLO_PERSONFLOW
a person flow
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
long long int SUMOTime
Definition: SUMOTime.h:31
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
const std::string DEFAULT_VTYPE_ID
const int VEHPARS_PROB_SET
const int VEHPARS_VPH_SET
const int VEHPARS_END_SET
const int VEHPARS_ROUTE_SET
const int VEHPARS_COLOR_SET
DepartLaneDefinition
Possible ways to choose a lane on depart.
@ GIVEN
The lane is given.
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
DepartPosLatDefinition
DepartPosDefinition
Possible ways to choose the departure position.
@ GIVEN
The position is given.
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_CONTAINER_NUMBER_SET
const int VEHPARS_ARRIVALLANE_SET
DepartSpeedDefinition
Possible ways to choose the departure speed.
@ GIVEN
The speed is given.
const int VEHPARS_DEPARTLANE_SET
const int VEHPARS_ARRIVALPOSLAT_SET
const int VEHPARS_NUMBER_SET
const int VEHPARS_ARRIVALSPEED_SET
ArrivalPosDefinition
Possible ways to choose the arrival position.
@ GIVEN
The arrival position is given.
const int VEHPARS_LINE_SET
const int VEHPARS_PERSON_NUMBER_SET
const int VEHPARS_DEPARTSPEED_SET
const int VEHPARS_PERIOD_SET
ArrivalPosLatDefinition
Possible ways to choose the departure position.
const int VEHPARS_VTYPE_SET
const int VEHPARS_ARRIVALPOS_SET
DepartDefinition
Possible ways to depart.
const int VEHPARS_VIA_SET
const int VEHPARS_DEPARTPOSLAT_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VTYPE
description of a vehicle type
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ GNE_TAG_VEHICLE_WITHROUTE
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_NUMBER
@ SUMO_ATTR_ARRIVALSPEED
@ SUMO_ATTR_ARRIVALLANE
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_VIA
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_MINGAP
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_CONTAINER_NUMBER
@ SUMO_ATTR_LINE
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_GUISHAPE
@ SUMO_ATTR_REROUTE
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_DEPARTSPEED
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_DEPARTLANE
@ SUMO_ATTR_PROB
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_ROUTE
@ SUMO_ATTR_PERSON_NUMBER
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_MAXSPEED
@ SUMO_ATTR_ID
@ SUMO_ATTR_ARRIVALPOS_LAT
@ SUMO_ATTR_WIDTH
T MIN2(T a, T b)
Definition: StdDefs.h:73
T MAX2(T a, T b)
Definition: StdDefs.h:79
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
Position getCenter() const
Returns the center of the boundary.
Definition: Boundary.cpp:111
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:129
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:117
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:135
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:123
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:446
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:135
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, const int align=0, double width=-1)
Definition: GLHelper.cpp:498
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition: GLHelper.cpp:529
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_EnableAttribute
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
An Element which don't belongs to GNENet but has influency in the simulation.
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry (also called "stacked geometry")
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
GNEGeometry::Geometry mySpreadGeometry
demand element spread geometry (Only used by vehicles and pedestrians)
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
int myStackedLabelNumber
stacked label number
GNEGeometry::Geometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
void replaceMiddleParentEdges(const std::string &value, const bool updateChildReferences)
replace middle (via) parent edges
std::vector< GNEEdge * > getViaEdges() const
get middle (via) parent edges
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
void updateVehicleStackLabels()
Definition: GNEEdge.cpp:1097
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:723
class for pack all variables related with DottedGeometry
Definition: GNEGeometry.h:187
class for NETEDIT geometries over lanes
Definition: GNEGeometry.h:76
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
Definition: GNEGeometry.cpp:81
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GNEGeometry::Geometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
const GNEGeometry::DottedGeometry & getLane2laneDottedGeometry(const GNELane *toLane) const
get lane2lane dotted geometry
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
const PositionVector & getLaneShape() const
Definition: GNELane.cpp:117
const GNEGeometry::DottedGeometry & getDottedLaneGeometry() const
get dotted lane geometry
Definition: GNELane.cpp:135
const GNEGeometry::Lane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:774
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:111
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
std::vector< GNEEdge * > calculatePath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra path between a list of partial edges
bool consecutiveEdgesConnected(const SUMOVehicleClass vClass, const GNEEdge *from, const GNEEdge *to) const
check if exist a path between the two given consecutives edges for the given VClass
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
Definition: GNENet.cpp:1141
const Boundary & getBoundary() const
returns the bounder of the network
Definition: GNENet.cpp:142
std::vector< GNEDemandElement * > retrieveDemandElements(bool onlySelected=false) const
return all demand elements
Definition: GNENet.cpp:2447
GNENetHelper::PathCalculator * getPathCalculator()
obtain instance of PathCalculator
Definition: GNENet.cpp:136
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2435
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
void calculatePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
calculate path lanes (Dijkstra)
const std::vector< GNEPathElements::PathElement > & getPath() const
get path edges
void resetPathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
reset path lanes
static void transformToRouteFlow(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform routeFlow over an existent route
static void transformToFlow(GNEVehicle *originalVehicle)
transform to flow
static void setFlowParameters(const SumoXMLAttr attribute, int &parameters)
configure flow parameters
static void transformToTrip(GNEVehicle *originalVehicle)
transform to trip
static void transformToVehicle(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform vehicle functions
bool hasTagSynonym() const
return true if tag correspond to an element that will be written in XML with another tag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
SumoXMLTag getTagSynonym() const
get tag synonym
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition: GNEVehicle.h:81
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current vehicle to another vehicle type.
Definition: GNEVehicle.cpp:207
GNESelectedVehiclesPopupMenu(GNEVehicle *vehicle, const std::vector< GNEVehicle * > &selectedVehicle, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEVehicle.cpp:138
FXMenuCommand * myTransformToRouteFlowWithEmbeddedRoute
menu command for transform to route flow with an embedded route
Definition: GNEVehicle.h:120
FXMenuCommand * myTransformToVehicle
menu command for transform to vehicle
Definition: GNEVehicle.h:111
FXMenuCommand * myTransformToVehicleWithEmbeddedRoute
menu command for transform to vehicle with an embedded route
Definition: GNEVehicle.h:114
FXMenuCommand * myTransformAllVehiclesToVehicleWithEmbeddedRoute
menu command for transform all selected vehicles to vehicle with an embedded route
Definition: GNEVehicle.h:132
FXMenuCommand * myTransformAllVehiclesToRouteFlow
menu command for transform all selected vehicles to route flow
Definition: GNEVehicle.h:135
FXMenuCommand * myTransformToTrip
menu command for transform to trip
Definition: GNEVehicle.h:123
FXMenuCommand * myTransformAllVehiclesToTrip
menu command for transform all selected vehicles to trip
Definition: GNEVehicle.h:141
FXMenuCommand * myTransformToFlow
menu command for transform to flow
Definition: GNEVehicle.h:126
FXMenuCommand * myTransformAllVehiclesToVehicle
menu command for transform all selected vehicles to vehicle
Definition: GNEVehicle.h:129
FXMenuCommand * myTransformAllVehiclesToFlow
menu command for transform all selected vehicles to flow
Definition: GNEVehicle.h:144
FXMenuCommand * myTransformAllVehiclesToRouteFlowWithEmbeddedRoute
menu command for transform all selected vehicles to route flow with an embedded route
Definition: GNEVehicle.h:138
FXMenuCommand * myTransformToRouteFlow
menu command for transform to route flow
Definition: GNEVehicle.h:117
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition: GNEVehicle.h:36
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current vehicle to another vehicle type.
Definition: GNEVehicle.cpp:117
void drawFlowLabel(const Position &vehiclePosition, const double vehicleRotation, const double width, const double length, const double exaggeration) const
draw flow label
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEVehicle.cpp:460
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEVehicle.cpp:632
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEVehicle.cpp:884
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEVehicle.cpp:620
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
~GNEVehicle()
destructor
Definition: GNEVehicle.cpp:308
double getAttributeDouble(SumoXMLAttr key) const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEVehicle.cpp:647
bool isAttributeEnabled(SumoXMLAttr key) const
const RGBColor & getColor() const
get color
Definition: GNEVehicle.cpp:472
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEVehicle.cpp:641
void computePath()
compute path
Definition: GNEVehicle.cpp:565
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEVehicle.cpp:490
void startGeometryMoving()
Definition: GNEVehicle.cpp:478
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEVehicle.cpp:599
void updateGeometry()
update pre-computed geometry information
Definition: GNEVehicle.cpp:502
std::string getBegin() const
get begin time of demand element
Definition: GNEVehicle.cpp:312
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEVehicle.cpp:387
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEVehicle.cpp:420
void drawStackLabel(const Position &vehiclePosition, const double vehicleRotation, const double width, const double length, const double exaggeration) const
draw stack label
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEVehicle.cpp:593
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEVehicle.cpp:496
void invalidatePath()
invalidate path
Definition: GNEVehicle.cpp:579
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
Definition: GNEVehicle.cpp:778
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEVehicle.cpp:326
SUMOVehicleClass getVClass() const
Definition: GNEVehicle.cpp:466
GNEVehicle(SumoXMLTag tag, GNENet *net, const std::string &vehicleID, GNEDemandElement *vehicleType, GNEDemandElement *route)
default constructor for vehicles and routeFlows without embedded routes
Definition: GNEVehicle.cpp:249
void endGeometryMoving()
end geometry movement
Definition: GNEVehicle.cpp:484
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:491
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:467
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:479
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:485
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length)
draw vehicle as a triangle
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length)
draw vehicle as a Box
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const T getColor(const double value) const
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationTextSettings vehicleName
GUIVisualizationSizeSettings vehicleSize
GUIColorer vehicleColorer
The vehicle colorer.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
GUIVisualizationWidthSettings widthSettings
width settings
bool drawDottedContour() const
check if dotted contour can be drawn
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
bool drawMinGap
Information whether the minimum gap shall be drawn.
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:246
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:282
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:231
double x() const
Returns the x-position.
Definition: Position.h:54
double y() const
Returns the y-position.
Definition: Position.h:59
double length() const
Returns the length.
static const RGBColor WHITE
Definition: RGBColor.h:187
static const RGBColor BLUE
Definition: RGBColor.h:182
static const RGBColor GREY
Definition: RGBColor.h:189
static const RGBColor CYAN
Definition: RGBColor.h:184
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:300
static const RGBColor BLACK
Definition: RGBColor.h:188
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
Definition: RGBColor.h:194
static const RGBColor RED
named colors
Definition: RGBColor.h:180
Structure representing possible vehicle parameter.
double departPosLat
(optional) The lateral position the vehicle shall depart from
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
double repetitionProbability
The probability for emitting a vehicle per second.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
SumoXMLTag tag
The vehicle tag.
std::string vtypeid
The vehicle's type id.
std::string getDepartLane() const
obtain depart lane parameter in string format
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
std::string getDepartSpeed() const
obtain depart speed parameter in string format
std::string getArrivalPos() const
obtain arrival pos parameter in string format
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
RGBColor color
The vehicle's color, TraCI may change this.
double arrivalPos
(optional) The position the vehicle shall arrive on
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
std::string routeid
The vehicle's route id.
std::string id
The vehicle's id.
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
bool wasSet(int what) const
Returns whether the given parameter was set.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
std::string getDepartPos() const
obtain depart pos parameter in string format
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport)
int containerNumber
The static number of containers in the vehicle when it departs.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
#define M_PI
Definition: odrSpiral.cpp:40
struct for variables used in Geometry extremes
Definition: GNEGeometry.h:58
double laneEndPosition
arrival position over lane
Definition: GNEGeometry.h:66
double laneStartPosition
depart position over lane
Definition: GNEGeometry.h:63
static void drawDottedContourLane(const DottedContourType type, const GUIVisualizationSettings &s, const DottedGeometry &dottedGeometry, const double width, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given dottedGeometry (used by lanes, routes, etc.)
static void calculateLaneGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEPathElements::PathElement > &path, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between lanes
static void drawSegmentGeometry(const GNEViewNet *viewNet, const SegmentGeometry::Segment &segment, const double width)
draw geometry segment
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool drawSpreadVehicles() const
check if vehicles must be drawn spread
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool drawSpreadVehicles() const
check if vehicles must be drawn spread
bool showDemandElements() const
check if show demand elements checkbox is enabled
static const RGBColor vehicleTrips
color for vehicle trips
RGBColor selectedVehicleColor
vehicle selection color
static const double vehicleTriangles
details for draw person as triangles
static const double vehicleShapes
details for draw person as shapes
static const double vehicleBoxes
details for draw person as boxes
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double scaledSize(double scale, double constFactor=0.1) const
get scale size
static const double trip
width for trips