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.dev/sumo
3 // Copyright (C) 2001-2024 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 /****************************************************************************/
21 #include <netedit/GNENet.h>
22 #include <netedit/GNEUndoList.h>
23 #include <netedit/GNEViewNet.h>
24 #include <netedit/GNEViewParent.h>
29 #include <utils/gui/div/GLHelper.h>
33 #include <utils/xml/NamespaceIDs.h>
34 
35 #include "GNEVehicle.h"
36 #include "GNERoute.h"
37 
38 // ===========================================================================
39 // FOX callback mapping
40 // ===========================================================================
41 FXDEFMAP(GNEVehicle::GNESingleVehiclePopupMenu) GNESingleVehiclePopupMenuMap[] = {
43 };
44 
45 FXDEFMAP(GNEVehicle::GNESelectedVehiclesPopupMenu) GNESelectedVehiclesPopupMenuMap[] = {
47 };
48 
49 // Object implementation
50 FXIMPLEMENT(GNEVehicle::GNESingleVehiclePopupMenu, GUIGLObjectPopupMenu, GNESingleVehiclePopupMenuMap, ARRAYNUMBER(GNESingleVehiclePopupMenuMap))
51 FXIMPLEMENT(GNEVehicle::GNESelectedVehiclesPopupMenu, GUIGLObjectPopupMenu, GNESelectedVehiclesPopupMenuMap, ARRAYNUMBER(GNESelectedVehiclesPopupMenuMap))
52 
53 // ===========================================================================
54 // static definitions
55 // ===========================================================================
57 
58 // ===========================================================================
59 // GNEVehicle::GNESingleVehiclePopupMenu
60 // ===========================================================================
61 
63  GUIGLObjectPopupMenu(app, parent, *vehicle),
64  myVehicle(vehicle) {
65  // build header
66  myVehicle->buildPopupHeader(this, app);
67  // build menu command for center button and copy cursor position to clipboard
70  // build 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
77  // route length
78  vehicle->buildMenuCommandRouteLength(this);
79  // add transform functions only in demand mode
81  // add reverse
82  vehicle->buildMenuAddReverse(this);
83  // continue depending of type
85  // create menu pane for transform operations
86  FXMenuPane* transformOperation = new FXMenuPane(this);
87  this->insertMenuPaneChild(transformOperation);
88  new FXMenuCascade(this, TL("transform to"), nullptr, transformOperation);
89  // Create menu commands for all transform
90  GUIDesigns::buildFXMenuCommand(transformOperation,
91  TL("Trip (over junctions)"),
94  GUIDesigns::buildFXMenuCommand(transformOperation,
95  TL("Flow (over junctions)"),
98  } else if (myVehicle->getTagProperty().vehicleTAZs()) {
99  // create menu pane for transform operations
100  FXMenuPane* transformOperation = new FXMenuPane(this);
101  this->insertMenuPaneChild(transformOperation);
102  new FXMenuCascade(this, TL("transform to"), nullptr, transformOperation);
103  // Create menu commands for all transform
104  GUIDesigns::buildFXMenuCommand(transformOperation,
105  TL("Trip (over TAZs)"),
108  GUIDesigns::buildFXMenuCommand(transformOperation,
109  TL("Flow (over TAZs)"),
112  } else {
113  // create menu pane for transform operations
114  FXMenuPane* transformOperation = new FXMenuPane(this);
115  this->insertMenuPaneChild(transformOperation);
116  new FXMenuCascade(this, TL("transform to"), nullptr, transformOperation);
117  // Create menu commands for all transform
118  GUIDesigns::buildFXMenuCommand(transformOperation,
119  TL("Vehicle"),
122  GUIDesigns::buildFXMenuCommand(transformOperation,
123  TL("Vehicle (embedded route)"),
126  GUIDesigns::buildFXMenuCommand(transformOperation,
127  TL("RouteFlow"),
130  GUIDesigns::buildFXMenuCommand(transformOperation,
131  TL("RouteFlow (embedded route)"),
134  GUIDesigns::buildFXMenuCommand(transformOperation,
135  TL("Trip"),
138  GUIDesigns::buildFXMenuCommand(transformOperation,
139  TL("Flow"),
142  }
143  }
144 }
145 
146 
148 
149 
150 long
151 GNEVehicle::GNESingleVehiclePopupMenu::onCmdTransform(FXObject*, FXSelector sel, void*) {
152  switch (FXSELID(sel)) {
155  break;
158  break;
160  GNERouteHandler::transformToVehicle(myVehicle, false);
161  break;
163  GNERouteHandler::transformToRouteFlow(myVehicle, false);
164  break;
166  GNERouteHandler::transformToVehicle(myVehicle, true);
167  break;
169  GNERouteHandler::transformToRouteFlow(myVehicle, true);
170  break;
173  break;
176  break;
179  break;
182  break;
183  default:
184  break;
185  }
186  return 1;
187 }
188 
189 // ===========================================================================
190 // GNEVehicle::GNESelectedVehiclesPopupMenu
191 // ===========================================================================
192 
193 GNEVehicle::GNESelectedVehiclesPopupMenu::GNESelectedVehiclesPopupMenu(GNEVehicle* vehicle, const std::vector<GNEVehicle*>& selectedVehicle, GUIMainWindow& app, GUISUMOAbstractView& parent) :
194  GUIGLObjectPopupMenu(app, parent, *vehicle),
195  mySelectedVehicles(selectedVehicle),
196  myVehicleTag(vehicle->getTagProperty().getTag()) {
197  // build header
198  vehicle->buildPopupHeader(this, app);
199  // build menu command for center button and copy cursor position to clipboard
200  vehicle->buildCenterPopupEntry(this);
201  vehicle->buildPositionCopyEntry(this, app);
202  // build menu commands for names
203  GUIDesigns::buildFXMenuCommand(this, ("Copy " + vehicle->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
204  GUIDesigns::buildFXMenuCommand(this, ("Copy " + vehicle->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
205  new FXMenuSeparator(this);
206  // build selection and show parameters menu
207  vehicle->getNet()->getViewNet()->buildSelectionACPopupEntry(this, vehicle);
208  vehicle->buildShowParamsPopupEntry(this);
209  // route length
210  vehicle->buildMenuCommandRouteLength(this);
211  // add transform functions only in demand mode
212  if (vehicle->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
213  // add reverse
214  vehicle->buildMenuAddReverse(this);
215  // continue depending of type
216  if (vehicle->getTagProperty().vehicleJunctions()) {
217  // create menu pane for transform operations
218  FXMenuPane* transformOperation = new FXMenuPane(this);
219  this->insertMenuPaneChild(transformOperation);
220  new FXMenuCascade(this, TL("transform selected to"), nullptr, transformOperation);
221  // Create menu commands for restricted transforms
223  TLF("Trips (over junctions) (only %)", toString(GNE_TAG_TRIP_JUNCTIONS)),
226  TLF("Flows (over junctions) (only %)", toString(GNE_TAG_FLOW_JUNCTIONS)),
228  // create separator
229  new FXMenuSeparator(transformOperation);
230  // Create menu commands for all transform
231  GUIDesigns::buildFXMenuCommand(transformOperation,
232  TL("Trips (over junctions)"),
234  GUIDesigns::buildFXMenuCommand(transformOperation,
235  TL("Flows (over junctions)"),
237  } else if (vehicle->getTagProperty().vehicleTAZs()) {
238  // create menu pane for transform operations
239  FXMenuPane* transformOperation = new FXMenuPane(this);
240  this->insertMenuPaneChild(transformOperation);
241  new FXMenuCascade(this, TL("transform selected to"), nullptr, transformOperation);
242  // Create menu commands for all transform
244  TLF("Trips (over TAZs) (only %)", toString(GNE_TAG_TRIP_TAZS)),
247  TLF("Flows (over TAZs) (only %)", toString(GNE_TAG_FLOW_TAZS)),
249  // create separator
250  new FXMenuSeparator(transformOperation);
251  // Create menu commands for all transform
252  GUIDesigns::buildFXMenuCommand(transformOperation,
253  TL("Trips (over TAZs)"),
255  GUIDesigns::buildFXMenuCommand(transformOperation,
256  TL("Flows (over TAZs)"),
258  } else {
259  // create menu pane for transform operations
260  FXMenuPane* transformOperation = new FXMenuPane(this);
261  this->insertMenuPaneChild(transformOperation);
262  new FXMenuCascade(this, TL("transform selected to"), nullptr, transformOperation);
263  // Create menu commands for all transform
265  TLF("Vehicles (only %)", toString(SUMO_TAG_VEHICLE)),
268  TLF("Vehicles (embedded route) (only %)", toString(GNE_TAG_VEHICLE_WITHROUTE)),
271  TLF("RouteFlows (only %)", toString(GNE_TAG_FLOW_ROUTE)),
274  TLF("RouteFlows (embedded route) (only %)", toString(GNE_TAG_FLOW_WITHROUTE)),
277  TLF("Trips (only %)", toString(SUMO_TAG_TRIP)),
280  TLF("Flows (only %)", toString(SUMO_TAG_FLOW)),
282  // create separator
283  new FXMenuSeparator(transformOperation);
284  // Create menu commands for all transform
285  GUIDesigns::buildFXMenuCommand(transformOperation,
286  TL("Vehicles"),
288  GUIDesigns::buildFXMenuCommand(transformOperation,
289  TL("Vehicles (embedded route)"),
291  GUIDesigns::buildFXMenuCommand(transformOperation,
292  TL("RouteFlows"),
294  GUIDesigns::buildFXMenuCommand(transformOperation,
295  TL("RouteFlows (embedded route)"),
297  GUIDesigns::buildFXMenuCommand(transformOperation,
298  TL("Trips"),
300  GUIDesigns::buildFXMenuCommand(transformOperation,
301  TL("Flows"),
303  }
304  }
305 }
306 
307 
309 
310 
311 long
312 GNEVehicle::GNESelectedVehiclesPopupMenu::onCmdTransform(FXObject* obj, FXSelector sel, void*) {
313  // iterate over all selected vehicles
314  for (const auto& vehicle : mySelectedVehicles) {
315  switch (FXSELID(sel)) {
317  if (!vehicle->getTagProperty().vehicleJunctions() && !vehicle->getTagProperty().vehicleTAZs()) {
318  if (myRestrictedMenuCommands.count(obj) > 0) {
319  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
321  }
322  } else {
324  }
325  }
326  break;
328  if (!vehicle->getTagProperty().vehicleJunctions() && !vehicle->getTagProperty().vehicleTAZs()) {
329  if (myRestrictedMenuCommands.count(obj) > 0) {
330  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
332  }
333  } else {
335  }
336  }
337  break;
339  if (!vehicle->getTagProperty().vehicleJunctions() && !vehicle->getTagProperty().vehicleTAZs()) {
340  if (myRestrictedMenuCommands.count(obj) > 0) {
341  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
342  GNERouteHandler::transformToVehicle(vehicle, false);
343  }
344  } else {
345  GNERouteHandler::transformToVehicle(vehicle, false);
346  }
347  }
348  break;
350  if (!vehicle->getTagProperty().vehicleJunctions() && !vehicle->getTagProperty().vehicleTAZs()) {
351  if (myRestrictedMenuCommands.count(obj) > 0) {
352  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
354  }
355  } else {
357  }
358  }
359  break;
361  if (!vehicle->getTagProperty().vehicleJunctions() && !vehicle->getTagProperty().vehicleTAZs()) {
362  if (myRestrictedMenuCommands.count(obj) > 0) {
363  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
365  }
366  } else {
368  }
369  }
370  break;
372  if (!vehicle->getTagProperty().vehicleJunctions() && !vehicle->getTagProperty().vehicleTAZs()) {
373  if (myRestrictedMenuCommands.count(obj) > 0) {
374  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
376  }
377  } else {
379  }
380  }
381  break;
383  if (vehicle->getTagProperty().vehicleJunctions()) {
384  if (myRestrictedMenuCommands.count(obj) > 0) {
385  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
387  }
388  } else {
390  }
391  }
392  break;
394  if (vehicle->getTagProperty().vehicleJunctions()) {
395  if (myRestrictedMenuCommands.count(obj) > 0) {
396  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
398  }
399  } else {
401  }
402  }
403  break;
405  if (vehicle->getTagProperty().vehicleTAZs()) {
406  if (myRestrictedMenuCommands.count(obj) > 0) {
407  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
409  }
410  } else {
412  }
413  }
414  break;
416  if (vehicle->getTagProperty().vehicleTAZs()) {
417  if (myRestrictedMenuCommands.count(obj) > 0) {
418  if (vehicle->getTagProperty().getTag() == myRestrictedMenuCommands.at(obj)) {
420  }
421  } else {
423  }
424  }
425  break;
426  default:
427  break;
428  }
429  }
430  return 1;
431 }
432 
433 // ===========================================================================
434 // member method definitions
435 // ===========================================================================
436 
439  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
440 GNEDemandElementFlow(this) {
441  // reset default values
443  // set end and vehPerHours as default flow values
446 }
447 
448 
449 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType, GNEDemandElement* route) :
450  GNEDemandElement(vehicleID, net, (tag == GNE_TAG_FLOW_ROUTE) ? GLO_ROUTEFLOW : GLO_VEHICLE, tag,
452  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {vehicleType, route}, {}),
453 GNEDemandElementFlow(this) {
454  // SUMOVehicleParameter ID has to be set manually
455  id = vehicleID;
456  // set manually vtypeID (needed for saving)
457  vtypeid = vehicleType->getID();
458 }
459 
460 
461 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEDemandElement* route, const SUMOVehicleParameter& vehicleParameters) :
462  GNEDemandElement(vehicleParameters.id, net, (tag == GNE_TAG_FLOW_ROUTE) ? GLO_ROUTEFLOW : GLO_VEHICLE, tag,
464  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {vehicleType, route}, {}),
465 GNEDemandElementFlow(this, vehicleParameters) {
466  // SUMOVehicleParameter ID has to be set manually
467  id = vehicleParameters.id;
468  // set manually vtypeID (needed for saving)
469  vtypeid = vehicleType->getID();
470 }
471 
472 
473 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, const SUMOVehicleParameter& vehicleParameters) :
474  GNEDemandElement(vehicleParameters.id, net, (tag == GNE_TAG_VEHICLE_WITHROUTE) ? GLO_VEHICLE : GLO_ROUTEFLOW, tag,
476  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {vehicleType}, {}),
477 GNEDemandElementFlow(this, vehicleParameters) {
478  // SUMOVehicleParameter ID has to be set manually
479  id = vehicleParameters.id;
480  // reset routeid
481  routeid.clear();
482  // set manually vtypeID (needed for saving)
483  vtypeid = vehicleType->getID();
484 }
485 
486 
487 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType,
488  GNEEdge* fromEdge, GNEEdge* toEdge) :
489  GNEDemandElement(vehicleID, net, (tag == SUMO_TAG_FLOW) ? GLO_FLOW : GLO_TRIP, tag,
490  (tag == SUMO_TAG_FLOW) ? GUIIconSubSys::getIcon(GUIIcon::FLOW) : GUIIconSubSys::getIcon(GUIIcon::TRIP),
491  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge, toEdge}, {}, {}, {vehicleType}, {}),
492 GNEDemandElementFlow(this) {
493 }
494 
495 
496 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge,
497  const SUMOVehicleParameter& vehicleParameters) :
498  GNEDemandElement(vehicleParameters.id, net, (tag == SUMO_TAG_FLOW) ? GLO_FLOW : GLO_TRIP, tag,
499  (tag == SUMO_TAG_FLOW) ? GUIIconSubSys::getIcon(GUIIcon::FLOW) : GUIIconSubSys::getIcon(GUIIcon::TRIP),
500  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge, toEdge}, {}, {}, {vehicleType}, {}),
501 GNEDemandElementFlow(this, vehicleParameters) {
502 }
503 
504 
505 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType, GNEJunction* fromJunction, GNEJunction* toJunction) :
506  GNEDemandElement(vehicleID, net, (tag == GNE_TAG_FLOW_JUNCTIONS) ? GLO_FLOW : GLO_TRIP, tag,
508  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {
509  fromJunction, toJunction
510 }, {}, {}, {}, {vehicleType}, {}),
511 GNEDemandElementFlow(this) {
512 }
513 
514 
515 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEJunction* fromJunction, GNEJunction* toJunction, const SUMOVehicleParameter& vehicleParameters) :
516  GNEDemandElement(vehicleParameters.id, net, (tag == GNE_TAG_FLOW_JUNCTIONS) ? GLO_FLOW : GLO_TRIP, tag,
518  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {
519  fromJunction, toJunction
520 }, {}, {}, {}, {vehicleType}, {}),
521 GNEDemandElementFlow(this, vehicleParameters) {
522 }
523 
524 
525 GNEVehicle::GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEAdditional* fromTAZ, GNEAdditional* toTAZ, const SUMOVehicleParameter& vehicleParameters) :
526  GNEDemandElement(vehicleParameters.id, net, (tag == GNE_TAG_FLOW_TAZS) ? GLO_FLOW : GLO_TRIP, tag,
528  GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {fromTAZ, toTAZ}, {vehicleType}, {}),
529 GNEDemandElementFlow(this, vehicleParameters) {
530  // mark taz parameters as set
533  fromTaz = fromTAZ->getID();
534  toTaz = toTAZ->getID();
535 }
536 
537 
539 
540 
543  // get first and last lanes
544  const GNELane* firstLane = getFirstPathLane();
545  const GNELane* lastLane = getLastPathLane();
546  // check both lanes
547  if (firstLane && lastLane) {
548  // get depart and arrival positions (doubles)
549  const double departPosDouble = getAttributeDouble(SUMO_ATTR_DEPARTPOS);
550  const double arrivalPosDouble = (getAttributeDouble(SUMO_ATTR_ARRIVALPOS) < 0) ? lastLane->getLaneShape().length2D() : getAttributeDouble(SUMO_ATTR_ARRIVALPOS);
551  // obtain diameter
553  // return move operation depending if we're editing departPos or arrivalPos
555  return new GNEMoveOperation(this, firstLane, departPosDouble, lastLane, INVALID_DOUBLE,
559  return new GNEMoveOperation(this, firstLane, INVALID_DOUBLE, lastLane, arrivalPosDouble,
562  }
563  }
564  // nothing to move
565  return nullptr;
566 }
567 
568 
569 void
571  // attribute VType must not be written if is DEFAULT_VTYPE_ID
572  if (getTypeParent()->getID() == DEFAULT_VTYPE_ID) {
573  // unset VType parameter
575  // write vehicle attributes (VType will not be written)
577  // set VType parameter again
579  } else {
580  // write vehicle attributes, including type/distribution
582  }
583  // write specific attribute depending of tag property
584  if (myTagProperty.vehicleRoute()) {
585  // write route
587  }
588  // write from, to and edge vias
589  if (myTagProperty.vehicleEdges()) {
590  // write manually from/to edges (it correspond to front and back parent edges)
591  device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
592  device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
593  // only write via if there isn't empty
594  if (via.size() > 0) {
595  device.writeAttr(SUMO_ATTR_VIA, via);
596  }
597  }
598  // write from and to junctions
600  // write manually from/to junctions (it correspond to front and back parent junctions)
603  }
604  // write flow attributes
605  writeFlowAttributes(this, device);
606  // write parameters
607  writeParams(device);
608  // write route elements associated to this vehicle (except for calibrator FLows)
609  if ((getChildDemandElements().size() > 0) && !myTagProperty.isCalibrator()) {
610  if (getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_ROUTE_EMBEDDED) {
611  // write embedded route
612  getChildDemandElements().front()->writeDemandElement(device);
613  // write stops
614  for (const auto& demandElement : getChildDemandElements()) {
615  if (demandElement->getTagProperty().isVehicleStop()) {
616  demandElement->writeDemandElement(device);
617  }
618  }
619  } else {
620  for (const auto& route : getChildDemandElements()) {
621  route->writeDemandElement(device);
622  }
623  }
624  }
625  // close vehicle tag
626  device.closeTag();
627 }
628 
629 
632  // check conditions
633  if (myTagProperty.vehicleTAZs()) {
634  // vehicles and flows over tazs are always valid
635  return Problem::OK;
636  } else if (myTagProperty.vehicleEdges()) {
637  // check vehicles and flows paths
638  if (getParentEdges().front() == getParentEdges().back()) {
639  return Problem::OK;
640  } else if (myNet->getPathManager()->isPathValid(this)) {
641  return Problem::OK;
642  } else {
643  return Problem::INVALID_PATH;
644  }
645  } else if (myTagProperty.vehicleJunctions()) {
646  // check vehicles and flows paths
647  if (getParentJunctions().front() == getParentJunctions().back()) {
648  return Problem::OK;
649  } else if (myNet->getPathManager()->isPathValid(this)) {
650  return Problem::OK;
651  } else {
652  return Problem::INVALID_PATH;
653  }
654  } else if (myTagProperty.vehicleRoute()) {
655  // check if exist a valid path using route parent edges
657  return Problem::OK;
658  } else {
659  return Problem::INVALID_PATH;
660  }
661  } else if (myTagProperty.vehicleRouteEmbedded()) {
662  // check if exist a valid path using route child edges
664  return Problem::OK;
665  } else {
666  return Problem::INVALID_PATH;
667  }
668  } else {
670  }
671 }
672 
673 
674 std::string
676  // only trips or flows can have problems
677  if (myTagProperty.vehicleEdges()) {
678  // check if exist at least a connection between every edge
679  for (int i = 1; i < (int)getParentEdges().size(); i++) {
681  return ("There is no valid path between edges '" + getParentEdges().at((int)i - 1)->getID() + "' and '" + getParentEdges().at(i)->getID() + "'");
682  }
683  }
684  // if there are connections between all edges, then all is ok
685  return "";
686  } else if (myTagProperty.vehicleJunctions()) {
687  return ("No path between junction '" + getParentJunctions().front()->getID() + "' and '" + getParentJunctions().back()->getID() + "'");
688  } else if (myTagProperty.vehicleRoute()) {
689  // get route parent edges
690  const std::vector<GNEEdge*>& routeEdges = getRouteParent()->getParentEdges();
691  // check if exist at least a connection between every edge
692  for (int i = 1; i < (int)routeEdges.size(); i++) {
693  if (myNet->getPathManager()->getPathCalculator()->consecutiveEdgesConnected(getTypeParent()->getVClass(), routeEdges.at((int)i - 1), routeEdges.at(i)) == false) {
694  return ("There is no valid path between route edges '" + routeEdges.at((int)i - 1)->getID() + "' and '" + routeEdges.at(i)->getID() + "'");
695  }
696  }
697  // if there are connections between all edges, then all is ok
698  return "";
699  } else if (myTagProperty.vehicleRouteEmbedded()) {
700  // get route parent edges
701  const std::vector<GNEEdge*>& routeEdges = getChildDemandElements().at(0)->getParentEdges();
702  // check if exist at least a connection between every edge
703  for (int i = 1; i < (int)routeEdges.size(); i++) {
704  if (myNet->getPathManager()->getPathCalculator()->consecutiveEdgesConnected(getTypeParent()->getVClass(), routeEdges.at((int)i - 1), routeEdges.at(i)) == false) {
705  return ("There is no valid path between embedded route edges '" + routeEdges.at((int)i - 1)->getID() + "' and '" + routeEdges.at(i)->getID() + "'");
706  }
707  }
708  // if there are connections between all edges, then all is ok
709  return "";
710  } else {
711  return "";
712  }
713 }
714 
715 
716 void
718  //
719 }
720 
721 
724  return getParentDemandElements().front()->getVClass();
725 }
726 
727 
728 const RGBColor&
730  return color;
731 }
732 
733 
734 void
736  if (getParentJunctions().size() > 0) {
737  // calculate rotation between both junctions
738  const Position posA = getParentJunctions().front()->getPositionInView();
739  const Position posB = getParentJunctions().back()->getPositionInView();
740  const double rot = ((double)atan2((posB.x() - posA.x()), (posA.y() - posB.y())) * (double) -180.0 / (double)M_PI);
741  // update Geometry
742  myDemandElementGeometry.updateSinglePosGeometry(getParentJunctions().front()->getPositionInView(), rot);
743  } else if (getParentAdditionals().size() > 0) {
744  // calculate rotation between both TAZs
745  const Position posA = getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty() ?
746  getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID) :
747  getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
748  const Position posB = getParentAdditionals().back()->getAttribute(SUMO_ATTR_CENTER).empty() ?
749  getParentAdditionals().back()->getAttributePosition(GNE_ATTR_TAZ_CENTROID) :
750  getParentAdditionals().back()->getAttributePosition(SUMO_ATTR_CENTER);
751  const double rot = ((double)atan2((posB.x() - posA.x()), (posA.y() - posB.y())) * (double) -180.0 / (double)M_PI);
752  // update Geometry
754  } else {
755  // get first path lane
756  const GNELane* firstPathLane = getFirstPathLane();
757  // check path lane
758  if (firstPathLane) {
759  // declare departPos
760  double posOverLane = 0;
762  posOverLane = departPos;
763  }
764  // update Geometry
766  // compute route embedded associated with this vehicle
767  for (const auto& demandElement : getChildDemandElements()) {
768  if (demandElement->getTagProperty().getTag() == GNE_TAG_ROUTE_EMBEDDED) {
769  demandElement->computePathElement();
770  }
771  demandElement->updateGeometry();
772  }
773  }
774  }
775 }
776 
777 
778 Position
780  return myDemandElementGeometry.getShape().front();
781 }
782 
783 
784 bool
786  // get edit modes
787  const auto& editModes = myNet->getViewNet()->getEditModes();
788  // check if we're editing a type
789  if (editModes.isCurrentSupermodeDemand() && (editModes.demandEditMode == DemandEditMode::DEMAND_TYPE) &&
791  return true;
792  } else {
793  return false;
794  }
795 }
796 
797 
801  // obtain all selected vehicles
802  const auto selectedDemandElements = myNet->getAttributeCarriers()->getSelectedDemandElements();
803  std::vector<GNEVehicle*> selectedVehicles;
804  selectedVehicles.reserve(selectedDemandElements.size());
805  for (const auto& selectedDemandElement : selectedDemandElements) {
806  if (selectedDemandElement->getTagProperty().isVehicle()) {
807  selectedVehicles.push_back(dynamic_cast<GNEVehicle*>(selectedDemandElement));
808  }
809  }
810  // return a GNESelectedVehiclesPopupMenu
811  return new GNESelectedVehiclesPopupMenu(this, selectedVehicles, app, parent);
812  } else {
813  // return a GNESingleVehiclePopupMenu
814  return new GNESingleVehiclePopupMenu(this, app, parent);
815  }
816 }
817 
818 
819 std::string
821  if (myTagProperty.vehicleRoute()) {
822  return getRouteParent()->getID();
823  } else if (myTagProperty.vehicleEdges()) {
824  return getParentEdges().front()->getID();
825  } else if (myTagProperty.vehicleJunctions()) {
826  return getParentJunctions().front()->getID();
827  } else if (myTagProperty.vehicleTAZs()) {
828  return getParentAdditionals().front()->getID();
829  } else {
830  throw ProcessError(TL("Invalid vehicle tag"));
831  }
832 }
833 
834 
835 double
837  return s.vehicleSize.getExaggeration(s, this);
838 }
839 
840 
841 Boundary
843  Boundary vehicleBoundary;
844  vehicleBoundary.add(myDemandElementGeometry.getShape().front());
845  vehicleBoundary.grow(20);
846  return vehicleBoundary;
847 }
848 
849 
850 void
851 GNEVehicle::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
852  // geometry of this element cannot be splitted
853 }
854 
855 
856 void
858  // only drawn in super mode demand
862  // declare common attributes
864  const double exaggeration = getExaggeration(s);
865  const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
866  const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
867  const double vehicleSizeSquared = (width * width) * (length * length) * (exaggeration * exaggeration);
868  // obtain Position an rotation (depending of draw spread vehicles)
869  if ((!drawSpreadVehicles || (mySpreadGeometry.getShape().size() > 0)) && (myDemandElementGeometry.getShape().size() > 0)) {
870  const Position vehiclePosition = drawSpreadVehicles ? mySpreadGeometry.getShape().front() : myDemandElementGeometry.getShape().front();
871  const double vehicleRotation = drawSpreadVehicles ? mySpreadGeometry.getShapeRotations().front() : myDemandElementGeometry.getShapeRotations().front();
872  // check that position is valid
873  if (vehiclePosition == Position::INVALID) {
874  return;
875  }
876  // get detail level
877  const auto d = s.getDetailLevel(exaggeration);
878  // draw geometry only if we'rent in drawForObjectUnderCursor mode
880  // first check if if mouse is enough near to this vehicle to draw it
881  if (s.drawForRectangleSelection && (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(vehiclePosition) >= (vehicleSizeSquared + 2))) {
882  // push draw matrix
884  // Start with the drawing of the area translating matrix to origin
886  // translate to drawing position
887  glTranslated(vehiclePosition.x(), vehiclePosition.y(), 0);
888  glRotated(vehicleRotation, 0, 0, -1);
889  // extra translation needed to draw vehicle over edge (to avoid selecting problems)
890  glTranslated(0, (-1) * length * exaggeration, 0);
891  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
892  // Pop last matrix
894  } else {
896  // push draw matrix
898  // Start with the drawing of the area translating matrix to origin
900  // translate to drawing position
901  glTranslated(vehiclePosition.x(), vehiclePosition.y(), 0);
902  glRotated(vehicleRotation, 0, 0, -1);
903  // extra translation needed to draw vehicle over edge (to avoid selecting problems)
904  glTranslated(0, (-1) * length * exaggeration, 0);
905  // set lane color
907  double upscaleLength = exaggeration;
908  if ((exaggeration > 1) && (length > 5)) {
909  // reduce the length/width ratio because this is not useful at high zoom
910  upscaleLength = MAX2(1.0, upscaleLength * (5 + sqrt(length - 5)) / length);
911  }
912  glScaled(exaggeration, upscaleLength, 1);
913  // check if we're drawing in selecting mode
915  // draw vehicle as a box and don't draw the rest of details
917  } else {
918  // draw the vehicle depending of detail level
925  }
926  // check if min gap has to be drawn
927  if (s.drawMinGap) {
928  const double minGap = -1 * getTypeParent()->getAttributeDouble(SUMO_ATTR_MINGAP);
929  glColor3d(0., 1., 0.);
930  glBegin(GL_LINES);
931  glVertex2d(0., 0);
932  glVertex2d(0., minGap);
933  glVertex2d(-.5, minGap);
934  glVertex2d(.5, minGap);
935  glEnd();
936  }
937  // drawing name at GLO_MAX fails unless translating z
938  glTranslated(0, MIN2(length / 2, double(5)), -getType());
939  glScaled(1 / exaggeration, 1 / upscaleLength, 1);
940  glRotated(vehicleRotation, 0, 0, -1);
942  // draw line
943  if (s.vehicleName.show(this) && line != "") {
944  glTranslated(0, 0.6 * s.vehicleName.scaledSize(s.scale), 0);
945  GLHelper::drawTextSettings(s.vehicleName, "line:" + line, Position(0, 0), s.scale, s.angle);
946  }
947  }
948  // pop draw matrix
950  // draw line between junctions if path isn't valid
951  if ((getParentJunctions().size() > 0) && !myNet->getPathManager()->isPathValid(this)) {
952  drawJunctionLine(this);
953  }
954  // draw stack label
955  if ((myStackedLabelNumber > 0) && !drawSpreadVehicles) {
956  drawStackLabel(myStackedLabelNumber, "Vehicle", vehiclePosition, vehicleRotation, width, length, exaggeration);
957  }
958  // draw flow label
959  if (myTagProperty.isFlow()) {
960  drawFlowLabel(vehiclePosition, vehicleRotation, width, length, exaggeration);
961  }
962  }
963  // draw lock icon
964  GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), vehiclePosition, exaggeration);
965  // draw dotted contour
967  }
968  // draw squared shape
969  myVehicleContour.calculateContourRectangleShape(s, d, this, vehiclePosition, length * 0.5, width * 0.5, length * -0.5, 0, vehicleRotation, exaggeration);
970  }
971  }
972 }
973 
974 
975 void
977  // calculate path (only for flows and trips)
979  // calculate path
981  } else if (myTagProperty.vehicleEdges()) {
982  // save edges in wich this vehicle has to stop
983  std::vector<GNEEdge*> edgeStops;
984  // iterate over child demand elements
985  for (const auto& demandElement : getChildDemandElements()) {
986  // extract lanes
987  if (demandElement->getTagProperty().isVehicleStop()) {
988  GNEEdge* edgeStop = nullptr;
989  if (demandElement->getParentAdditionals().size() > 0) {
990  edgeStop = demandElement->getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
991  } else {
992  edgeStop = demandElement->getParentLanes().front()->getParentEdge();
993  }
994  if (edgeStop) {
995  // avoid double edge stops
996  if (stops.empty()) {
997  edgeStops.push_back(edgeStop);
998  } else if (edgeStops.back() != edgeStop) {
999  edgeStops.push_back(edgeStop);
1000  }
1001  }
1002  }
1003  }
1004  // declare edge vector
1005  std::vector<GNEEdge*> edgePath;
1006  // get first and last lanes
1007  const auto firstLane = getFirstPathLane();
1008  const auto lastLane = getLastPathLane();
1009  // check first and last lanes
1010  if (firstLane && lastLane) {
1011  // add first lane
1012  edgePath.push_back(firstLane->getParentEdge());
1013  // give more priority to stops instead via
1014  if (edgeStops.size() > 0) {
1015  // add stops only if they're accesibles
1016  for (const auto& edgeStop : edgeStops) {
1017  // check if exist a valid path that includes the last edge
1018  auto edgePathStop = edgePath;
1019  edgePathStop.push_back(edgeStop);
1020  edgePathStop.push_back(lastLane->getParentEdge());
1021  auto path = myNet->getPathManager()->getPathCalculator()->calculateDijkstraPath(getVClass(), edgePathStop);
1022  if (path.size() > 0) {
1023  edgePath.push_back(edgeStop);
1024  }
1025  }
1026  } else {
1027  // add via lanes
1028  for (const auto& edgeViaID : via) {
1029  const auto edgeVia = myNet->getAttributeCarriers()->retrieveEdge(edgeViaID, false);
1030  if (edgeVia) {
1031  // check if exist a valid path that includes the last edge
1032  auto edgePathStop = edgePath;
1033  edgePathStop.push_back(edgeVia);
1034  edgePathStop.push_back(lastLane->getParentEdge());
1035  if (myNet->getPathManager()->getPathCalculator()->calculateDijkstraPath(getVClass(), edgePathStop).size() > 0) {
1036  edgePath.push_back(edgeVia);
1037  }
1038  }
1039  }
1040  }
1041  // add last lane
1042  edgePath.push_back(lastLane->getParentEdge());
1043  // calculate path
1044  myNet->getPathManager()->calculatePath(this, getVClass(), edgePath);
1045  }
1046  }
1047  // update geometry
1048  updateGeometry();
1049 }
1050 
1051 
1052 void
1053 GNEVehicle::drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const {
1054  // conditions for draw always in network mode
1055  const bool drawInNetworkMode = myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
1058  // conditions for draw always in demand mode
1059  const bool drawInDemandMode = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
1061  // conditions for draw if is selected
1062  const bool isSelected = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
1064  // conditions for draw if is inspected
1065  const bool isInspected = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
1067  // check drawing conditions
1068  if (segment->getLane() && !s.drawForRectangleSelection && (drawInNetworkMode || drawInDemandMode || isSelected || isInspected) &&
1070  // get detail level
1071  const auto d = s.getDetailLevel(1);
1072  // calculate width
1073  const double width = s.vehicleSize.getExaggeration(s, segment->getLane()) * s.widthSettings.tripWidth;
1074  // calculate startPos
1075  const double geometryDepartPos = (getParentJunctions().size() > 0) ? 0 : getAttributeDouble(SUMO_ATTR_DEPARTPOS) + getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
1076  // get endPos
1077  const double geometryEndPos = (getParentJunctions().size() > 0) ? segment->getLane()->getLaneGeometry().getShape().length2D() : getAttributeDouble(SUMO_ATTR_ARRIVALPOS);
1078  // declare path geometry
1079  GUIGeometry vehicleGeometry;
1080  // update pathGeometry depending of first and last segment
1081  if (segment->isFirstSegment() && segment->isLastSegment()) {
1082  vehicleGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
1083  geometryDepartPos,
1085  geometryEndPos,
1087  } else if (segment->isFirstSegment()) {
1088  vehicleGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
1089  geometryDepartPos,
1091  -1,
1093  } else if (segment->isLastSegment()) {
1094  vehicleGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
1095  -1,
1097  geometryEndPos,
1099  } else {
1100  vehicleGeometry = segment->getLane()->getLaneGeometry();
1101  }
1102  // draw geometry only if we'rent in drawForObjectUnderCursor mode
1104  // obtain color
1106  // Add a draw matrix
1108  // Start with the drawing of the area translating matrix to origin
1109  glTranslated(0, 0, getType() + offsetFront);
1110  // Set color
1111  GLHelper::setColor(pathColor);
1112  // draw geometry
1113  GUIGeometry::drawGeometry(d, vehicleGeometry, width);
1114  // Pop last matrix
1116  // check if we have to draw a red line to the next segment (if next segment isnt' a junction
1117  if (segment->getNextLane()) {
1118  // push draw matrix
1120  // Start with the drawing of the area translating matrix to origin
1122  // Set red color
1124  // get firstPosition (last position of current lane shape)
1125  const Position& firstPosition = segment->getLane()->getLaneShape().back();
1126  // get lastPosition (first position of next lane shape)
1127  const Position& arrivalPosition = segment->getNextLane()->getLaneShape().front();
1128  // draw box line
1129  GLHelper::drawBoxLine(arrivalPosition,
1130  RAD2DEG(firstPosition.angleTo2D(arrivalPosition)) - 90,
1131  firstPosition.distanceTo2D(arrivalPosition), .05);
1132  // pop draw matrix
1134  }
1135  // check if this is the last segment
1136  if (segment->isLastSegment() && (getParentJunctions().size() == 0)) {
1137  // get geometryEndPos
1138  const Position geometryEndPosition = getAttributePosition(GNE_ATTR_PLAN_GEOMETRY_ENDPOS);
1139  // check if endPos can be drawn
1141  // push draw matrix
1143  // Start with the drawing of the area translating matrix to origin
1145  // translate to geometryEndPos
1146  glTranslated(geometryEndPosition.x(), geometryEndPosition.y(), 0);
1147  // Set person plan color
1148  GLHelper::setColor(pathColor);
1149  // resolution of drawn circle depending of the zoom (To improve smoothness)
1151  // pop draw matrix
1153  }
1154  }
1155  // Draw name if isn't being drawn for selecting
1156  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
1157  // draw dotted contour
1158  segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
1159  }
1160  // calculate contour and draw dotted geometry
1161  if (segment->isFirstSegment() || segment->isLastSegment()) {
1162  segment->getContour()->calculateContourExtrudedShape(s, d, this, vehicleGeometry.getShape(), width, 1, segment->isFirstSegment(), segment->isLastSegment(), 0);
1163  } else {
1164  segment->getContour()->calculateContourExtrudedShape(s, d, this, segment->getLane()->getLaneShape(), width, 1, segment->isFirstSegment(), segment->isLastSegment(), 0);
1165  }
1166  }
1167 }
1168 
1169 
1170 void
1171 GNEVehicle::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const {
1172  // conditions for draw always in network mode
1173  const bool drawInNetworkMode = myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
1176  // conditions for draw always in demand mode
1177  const bool drawInDemandMode = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
1179  // conditions for draw if is selected
1180  const bool isSelected = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
1182  // conditions for draw if is inspected
1183  const bool isInspected = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
1185  // check drawing conditions
1186  if (segment->getJunction() && !s.drawForRectangleSelection && (drawInNetworkMode || drawInDemandMode || isSelected || isInspected) &&
1188  // get detail level
1189  const auto d = s.getDetailLevel(1);
1190  // calculate width
1191  const double width = s.vehicleSize.getExaggeration(s, segment->getPreviousLane()) * s.widthSettings.tripWidth;
1192  // draw geometry only if we'rent in drawForObjectUnderCursor mode
1194  // Add a draw matrix
1196  // Start with the drawing of the area translating matrix to origin
1197  glTranslated(0, 0, getType() + offsetFront);
1198  // Set color of the base
1199  if (drawUsingSelectColor()) {
1201  } else {
1203  }
1204  // continue depending if we're in the middle of two lanes or in the begin/end of a junction route
1205  if (segment->getPreviousLane() && segment->getNextLane()) {
1206  // draw lane2lane
1208  } else if (segment->getPreviousLane() && myTagProperty.vehicleJunctions()) {
1209  // draw line between center of junction and last lane shape
1210  GLHelper::drawBoxLines({segment->getPreviousLane()->getLaneShape().back(), getParentJunctions().back()->getPositionInView()}, width);
1211  } else if (segment->getNextLane() && myTagProperty.vehicleJunctions()) {
1212  // draw line between center of junction and first lane shape
1213  GLHelper::drawBoxLines({getParentJunctions().front()->getPositionInView(), segment->getNextLane()->getLaneShape().front()}, width);
1214  }
1215  // Pop last matrix
1217  // draw dotted contour
1218  segment->getContour()->drawDottedContours(s, d, this, s.dottedContourSettings.segmentWidth, true);
1219  }
1220  // continue depending if we're in the middle of two lanes or in the begin/end of a junction route
1221  if (segment->getPreviousLane() && segment->getNextLane()) {
1222  // calculate contour and draw dotted geometry
1224  width, 1, false, false);
1225  } else if (segment->getPreviousLane() && myTagProperty.vehicleJunctions()) {
1226  segment->getContour()->calculateContourExtrudedShape(s, d, this, {segment->getPreviousLane()->getLaneShape().back(), getParentJunctions().back()->getPositionInView()}, 0,
1227  width, 1, true, true);
1228  } else if (segment->getNextLane() && myTagProperty.vehicleJunctions()) {
1229  segment->getContour()->calculateContourExtrudedShape(s, d, this, {getParentJunctions().front()->getPositionInView(), segment->getNextLane()->getLaneShape().front()}, 0,
1230  width, 1, true, true);
1231  }
1232  }
1233 }
1234 
1235 
1236 GNELane*
1238  // declare first edge
1239  GNEEdge* firstEdge = nullptr;
1240  // continue depending of tags
1241  if (myTagProperty.vehicleRoute()) {
1242  // check departEdge
1243  if ((departEdge > 0) && (departEdge < (int)getRouteParent()->getParentEdges().size())) {
1244  // use departEdge
1245  firstEdge = getRouteParent()->getParentEdges().at(departEdge);
1246  } else {
1247  // use first route edge
1248  firstEdge = getRouteParent()->getParentEdges().front();
1249  }
1250  } else if (myTagProperty.vehicleRouteEmbedded()) {
1251  // check if embedded route exist (due during loading embedded route doesn't exist)
1252  if (getChildDemandElements().empty()) {
1253  return nullptr;
1254  }
1255  // check departEdge
1256  if ((departEdge > 0) && (departEdge < (int)getChildDemandElements().front()->getParentEdges().size())) {
1257  // use depart edge
1258  firstEdge = getChildDemandElements().front()->getParentEdges().at(departEdge);
1259  } else if (getChildDemandElements().front()->getParentEdges().size() > 0) {
1260  firstEdge = getChildDemandElements().front()->getParentEdges().front();
1261  } else if (getChildDemandElements().front()->getParentLanes().size() > 0) {
1262  firstEdge = getChildDemandElements().front()->getParentLanes().front()->getParentEdge();
1263  } else {
1264  return nullptr;
1265  }
1266  } else if (getParentEdges().size() > 0) {
1267  // use first parent edge
1268  firstEdge = getParentEdges().front();
1269  } else {
1270  // defined over junctions
1271  return nullptr;
1272  }
1273  // get departLane index
1274  const int departLaneIndex = (int)getAttributeDouble(SUMO_ATTR_DEPARTLANE);
1275  // check departLane index
1276  if ((departLaneIndex >= 0) && (departLaneIndex < (int)firstEdge->getLanes().size())) {
1277  return firstEdge->getLanes().at(departLaneIndex);
1278  } else {
1279  // get first allowed VClass
1280  return firstEdge->getLaneByAllowedVClass(getVClass());
1281  }
1282 }
1283 
1284 
1285 GNELane*
1287  // declare last edge
1288  GNEEdge* lastEdge = nullptr;
1289  // continue depending of tags
1290  if (myTagProperty.vehicleRoute()) {
1291  // check arrivalEdge
1292  if ((arrivalEdge > 0) && (arrivalEdge < (int)getRouteParent()->getParentEdges().size())) {
1293  // use arrival edge
1294  lastEdge = getRouteParent()->getParentEdges().at(arrivalEdge);
1295  } else {
1296  // use last route edge
1297  lastEdge = getRouteParent()->getParentEdges().back();
1298  }
1299  } else if (myTagProperty.vehicleRouteEmbedded()) {
1300  // check if embedded route exist (due during loading embedded route doesn't exist)
1301  if (getChildDemandElements().empty()) {
1302  return nullptr;
1303  }
1304  // check arrivalEdge
1305  if ((arrivalEdge > 0) && (arrivalEdge < (int)getChildDemandElements().front()->getParentEdges().size())) {
1306  // use arrival edge
1307  lastEdge = getChildDemandElements().front()->getParentEdges().at(arrivalEdge);
1308  } else if (getChildDemandElements().front()->getParentEdges().size() > 0) {
1309  // use last route edge
1310  lastEdge = getChildDemandElements().front()->getParentEdges().back();
1311  } else if (getChildDemandElements().front()->getParentLanes().size() > 0) {
1312  // use lane
1313  lastEdge = getChildDemandElements().front()->getParentLanes().back()->getParentEdge();
1314  } else {
1315  return nullptr;
1316  }
1317  } else if (getParentEdges().size() > 0) {
1318  // use last parent edge
1319  lastEdge = getParentEdges().back();
1320  } else {
1321  // defined over junctions
1322  return nullptr;
1323  }
1324  // get arrivalLane index
1325  const int arrivalLaneIndex = (int)getAttributeDouble(SUMO_ATTR_ARRIVALLANE);
1326  // check arrivalLane index
1327  if ((arrivalLaneIndex >= 0) && (arrivalLaneIndex < (int)lastEdge->getLanes().size())) {
1328  return lastEdge->getLanes().at(arrivalLaneIndex);
1329  } else {
1330  // get last allowed VClass
1331  return lastEdge->getLaneByAllowedVClass(getVClass());
1332  }
1333 }
1334 
1335 
1336 std::string
1338  switch (key) {
1339  case SUMO_ATTR_ID:
1340  return getMicrosimID();
1341  case SUMO_ATTR_TYPE:
1342  return vtypeid;
1343  case SUMO_ATTR_COLOR:
1344  if (wasSet(VEHPARS_COLOR_SET)) {
1345  return toString(color);
1346  } else {
1348  }
1349  case SUMO_ATTR_DEPARTLANE:
1351  return getDepartLane();
1352  } else {
1354  }
1355  case SUMO_ATTR_DEPARTPOS:
1357  return getDepartPos();
1358  } else {
1360  }
1361  case SUMO_ATTR_DEPARTSPEED:
1363  return getDepartSpeed();
1364  } else {
1366  }
1367  case SUMO_ATTR_ARRIVALLANE:
1369  return getArrivalLane();
1370  } else {
1372  }
1373  case SUMO_ATTR_ARRIVALPOS:
1375  return getArrivalPos();
1376  } else {
1378  }
1381  return getArrivalSpeed();
1382  } else {
1384  }
1385  case SUMO_ATTR_LINE:
1386  if (wasSet(VEHPARS_LINE_SET)) {
1387  return line;
1388  } else {
1390  }
1393  return toString(personNumber);
1394  } else {
1396  }
1399  return toString(containerNumber);
1400  } else {
1402  }
1403  case SUMO_ATTR_REROUTE:
1405  return "true";
1406  } else {
1407  return "false";
1408  }
1411  return getDepartPosLat();
1412  } else {
1414  }
1417  return getArrivalPosLat();
1418  } else {
1420  }
1422  return getInsertionChecks();
1423  // Specific of vehicles over routes
1424  case SUMO_ATTR_ROUTE:
1425  if (getParentDemandElements().size() == 2) {
1426  return getRouteParent()->getID();
1427  } else {
1428  return "";
1429  }
1430  // Specific of from-to edge
1431  case SUMO_ATTR_FROM:
1432  return getParentEdges().front()->getID();
1433  case SUMO_ATTR_TO:
1434  return getParentEdges().back()->getID();
1435  case SUMO_ATTR_VIA:
1436  return toString(via);
1437  case SUMO_ATTR_DEPARTEDGE:
1438  if (departEdge == -1) {
1439  return "";
1440  } else {
1441  return toString(departEdge);
1442  }
1443  case SUMO_ATTR_ARRIVALEDGE:
1444  if (arrivalEdge == -1) {
1445  return "";
1446  } else {
1447  return toString(arrivalEdge);
1448  }
1449  // Specific of from-to junctions
1451  return getParentJunctions().front()->getID();
1452  case SUMO_ATTR_TO_JUNCTION:
1453  return getParentJunctions().back()->getID();
1454  // Specific of from-to tazs
1455  case SUMO_ATTR_FROM_TAZ:
1456  return getParentAdditionals().front()->getID();
1457  case SUMO_ATTR_TO_TAZ:
1458  return getParentAdditionals().back()->getID();
1459  // other
1460  case GNE_ATTR_SELECTED:
1462  case GNE_ATTR_PARAMETERS:
1463  return getParametersStr();
1465  return toString(parametersSet);
1466  default:
1467  return getFlowAttribute(key);
1468  }
1469 }
1470 
1471 
1472 double
1474  switch (key) {
1475  case SUMO_ATTR_DEPARTLANE:
1477  return departLane;
1478  } else {
1479  return -1;
1480  }
1481  case SUMO_ATTR_DEPARTPOS:
1482  // only return departPos it if is given
1484  return departPos;
1485  } else {
1486  return 0;
1487  }
1488  case SUMO_ATTR_ARRIVALLANE:
1490  return arrivalLane;
1491  } else {
1492  return -1;
1493  }
1494  case SUMO_ATTR_ARRIVALPOS:
1495  // only return departPos it if is given
1497  return arrivalPos;
1498  } else {
1499  return -1;
1500  }
1501  case SUMO_ATTR_WIDTH:
1502  case SUMO_ATTR_LENGTH:
1503  case SUMO_ATTR_MINGAP:
1504  return getTypeParent()->getAttributeDouble(key);
1505  default:
1506  return getFlowAttributeDouble(key);
1507  }
1508 }
1509 
1510 
1511 Position
1513  switch (key) {
1515  // check if this vehicle was defined over junctions
1516  if (getParentJunctions().size() > 0) {
1517  return getParentJunctions().front()->getPositionInView();
1518  } else {
1519  // get first path lane shape
1520  const PositionVector& laneShape = getFirstPathLane()->getLaneShape();
1521  // check arrivalPosProcedure
1523  if (departPos < 0) {
1524  return laneShape.front();
1525  } else if (departPos > laneShape.length2D()) {
1526  return laneShape.back();
1527  } else {
1528  return laneShape.positionAtOffset2D(departPos);
1529  }
1530  } else {
1531  return laneShape.front();
1532  }
1533  }
1534  }
1536  // check if this vehicle was defined over junctions
1537  if (getParentJunctions().size() > 0) {
1538  return getParentJunctions().back()->getPositionInView();
1539  } else {
1540  // get last path lane shape
1541  const PositionVector& laneShape = getLastPathLane()->getLaneShape();
1542  // check arrivalPosProcedure
1544  if (arrivalPos < 0) {
1545  return laneShape.front();
1546  } else if (arrivalPos > laneShape.length2D()) {
1547  return laneShape.back();
1548  } else {
1549  return laneShape.positionAtOffset2D(arrivalPos);
1550  }
1551  } else {
1552  return laneShape.back();
1553  }
1554  }
1555  }
1556  default:
1557  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
1558  }
1559 }
1560 
1561 
1562 void
1563 GNEVehicle::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
1564  if (value == getAttribute(key)) {
1565  return; //avoid needless changes, later logic relies on the fact that attributes have changed
1566  }
1567  switch (key) {
1568  case SUMO_ATTR_ID:
1569  case SUMO_ATTR_TYPE:
1570  case SUMO_ATTR_COLOR:
1571  case SUMO_ATTR_DEPARTLANE:
1572  case SUMO_ATTR_DEPARTPOS:
1573  case SUMO_ATTR_DEPARTSPEED:
1574  case SUMO_ATTR_ARRIVALLANE:
1575  case SUMO_ATTR_ARRIVALPOS:
1577  case SUMO_ATTR_LINE:
1580  case SUMO_ATTR_REROUTE:
1584  // Specific of vehicles over routes
1585  case SUMO_ATTR_ROUTE:
1586  // Specific of from-to edges
1587  case SUMO_ATTR_FROM:
1588  case SUMO_ATTR_TO:
1589  case SUMO_ATTR_VIA:
1590  case SUMO_ATTR_DEPARTEDGE:
1591  case SUMO_ATTR_ARRIVALEDGE:
1592  // Specific of from-to junctions
1594  case SUMO_ATTR_TO_JUNCTION:
1595  // Specific of from-to taz
1596  case SUMO_ATTR_FROM_TAZ:
1597  case SUMO_ATTR_TO_TAZ:
1598  // other
1599  case GNE_ATTR_PARAMETERS:
1600  case GNE_ATTR_SELECTED:
1601  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
1602  break;
1603  default:
1604  setFlowAttribute(this, key, value, undoList);
1605  break;
1606  }
1607 }
1608 
1609 
1610 bool
1611 GNEVehicle::isValid(SumoXMLAttr key, const std::string& value) {
1612  // get ACs
1613  const auto ACs = myNet->getAttributeCarriers();
1614  // declare string error
1615  std::string error;
1616  switch (key) {
1617  case SUMO_ATTR_ID:
1619  case SUMO_ATTR_TYPE:
1620  return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) != nullptr);
1621  case SUMO_ATTR_COLOR:
1622  return canParse<RGBColor>(value);
1623  case SUMO_ATTR_DEPARTLANE: {
1624  int dummyDepartLane;
1625  DepartLaneDefinition dummyDepartLaneProcedure;
1626  parseDepartLane(value, myTagProperty.getTagStr(), id, dummyDepartLane, dummyDepartLaneProcedure, error);
1627  // if error is empty, check if depart lane is correct
1628  if (error.empty()) {
1629  if (dummyDepartLaneProcedure != DepartLaneDefinition::GIVEN) {
1630  return true;
1631  } else if (isTemplate()) {
1632  return true;
1633  } else if (getParentJunctions().size() > 0) {
1634  return (dummyDepartLane == 0);
1635  } else if (getParentAdditionals().size() > 0) {
1636  return (dummyDepartLane == 0);
1637  } else {
1638  return dummyDepartLane < (int)getFirstPathLane()->getParentEdge()->getLanes().size();
1639  }
1640  } else {
1641  return false;
1642  }
1643  }
1644  case SUMO_ATTR_DEPARTPOS: {
1645  double dummyDepartPos;
1646  DepartPosDefinition dummyDepartPosProcedure;
1647  parseDepartPos(value, myTagProperty.getTagStr(), id, dummyDepartPos, dummyDepartPosProcedure, error);
1648  // if error is empty, given value is valid
1649  return error.empty();
1650  }
1651  case SUMO_ATTR_DEPARTSPEED: {
1652  double dummyDepartSpeed;
1653  DepartSpeedDefinition dummyDepartSpeedProcedure;
1654  parseDepartSpeed(value, myTagProperty.getTagStr(), id, dummyDepartSpeed, dummyDepartSpeedProcedure, error);
1655  // if error is empty, check if depart speed is correct
1656  if (error.empty()) {
1657  if (dummyDepartSpeedProcedure != DepartSpeedDefinition::GIVEN) {
1658  return true;
1659  } else if (isTemplate()) {
1660  return true;
1661  } else {
1662  return (dummyDepartSpeed <= getTypeParent()->getAttributeDouble(SUMO_ATTR_MAXSPEED));
1663  }
1664  } else {
1665  return false;
1666  }
1667  }
1668  case SUMO_ATTR_ARRIVALLANE: {
1669  int dummyArrivalLane;
1670  ArrivalLaneDefinition dummyArrivalLaneProcedure;
1671  parseArrivalLane(value, myTagProperty.getTagStr(), id, dummyArrivalLane, dummyArrivalLaneProcedure, error);
1672  // if error is empty, given value is valid
1673  if (error.empty()) {
1674  if (dummyArrivalLaneProcedure != ArrivalLaneDefinition::GIVEN) {
1675  return true;
1676  } else if (isTemplate()) {
1677  return true;
1678  } else if (getParentJunctions().size() > 0) {
1679  return (dummyArrivalLane == 0);
1680  } else if (getParentAdditionals().size() > 0) {
1681  return (dummyArrivalLane == 0);
1682  } else {
1683  return dummyArrivalLane < (int)getLastPathLane()->getParentEdge()->getLanes().size();
1684  }
1685  } else {
1686  return false;
1687  }
1688  }
1689  case SUMO_ATTR_ARRIVALPOS: {
1690  double dummyArrivalPos;
1691  ArrivalPosDefinition dummyArrivalPosProcedure;
1692  parseArrivalPos(value, myTagProperty.getTagStr(), id, dummyArrivalPos, dummyArrivalPosProcedure, error);
1693  // if error is empty, given value is valid
1694  return error.empty();
1695  }
1696  case SUMO_ATTR_ARRIVALSPEED: {
1697  double dummyArrivalSpeed;
1698  ArrivalSpeedDefinition dummyArrivalSpeedProcedure;
1699  parseArrivalSpeed(value, myTagProperty.getTagStr(), id, dummyArrivalSpeed, dummyArrivalSpeedProcedure, error);
1700  // if error is empty, given value is valid
1701  return error.empty();
1702  }
1703  case SUMO_ATTR_LINE:
1704  return true;
1706  return canParse<int>(value) && parse<int>(value) >= 0;
1708  return canParse<int>(value) && parse<int>(value) >= 0;
1709  case SUMO_ATTR_REROUTE:
1710  return true; // check
1711  case SUMO_ATTR_DEPARTPOS_LAT: {
1712  double dummyDepartPosLat;
1713  DepartPosLatDefinition dummyDepartPosLatProcedure;
1714  parseDepartPosLat(value, myTagProperty.getTagStr(), id, dummyDepartPosLat, dummyDepartPosLatProcedure, error);
1715  // if error is empty, given value is valid
1716  return error.empty();
1717  }
1718  case SUMO_ATTR_ARRIVALPOS_LAT: {
1719  double dummyArrivalPosLat;
1720  ArrivalPosLatDefinition dummyArrivalPosLatProcedure;
1721  parseArrivalPosLat(value, myTagProperty.getTagStr(), id, dummyArrivalPosLat, dummyArrivalPosLatProcedure, error);
1722  // if error is empty, given value is valid
1723  return error.empty();
1724  }
1726  return areInsertionChecksValid(value);
1727  // Specific of vehicles over routes
1728  case SUMO_ATTR_ROUTE:
1729  if (getParentDemandElements().size() == 2) {
1730  return SUMOXMLDefinitions::isValidVehicleID(value) && (ACs->retrieveDemandElement(SUMO_TAG_ROUTE, value, false) != nullptr);
1731  } else {
1732  return true;
1733  }
1734  // Specific of from-to edges
1735  case SUMO_ATTR_FROM:
1736  case SUMO_ATTR_TO:
1737  return (ACs->retrieveEdge(value, false) != nullptr);
1738  case SUMO_ATTR_DEPARTEDGE:
1739  case SUMO_ATTR_ARRIVALEDGE: {
1740  if (value.empty()) {
1741  return true;
1742  } else if (canParse<int>(value)) {
1743  // get index
1744  const int index = parse<int>(value);
1745  // check conditions
1746  if (index < 0) {
1747  return false;
1748  } else if (myTagProperty.vehicleRoute()) {
1749  // check parent route
1750  return (index < (int)getRouteParent()->getParentEdges().size());
1751  } else {
1752  // check embedded route
1753  return (index < (int)getChildDemandElements().front()->getParentEdges().size());
1754  }
1755  } else {
1756  return false;
1757  }
1758  }
1759  case SUMO_ATTR_VIA:
1760  if (value.empty()) {
1761  return true;
1762  } else {
1763  return canParse<std::vector<GNEEdge*> >(myNet, value, false);
1764  }
1765  // Specific of from-to junctions
1767  case SUMO_ATTR_TO_JUNCTION:
1768  return (ACs->retrieveJunction(value, false) != nullptr);
1769  // Specific of from-to taz
1770  case SUMO_ATTR_FROM_TAZ:
1771  case SUMO_ATTR_TO_TAZ:
1772  return (ACs->retrieveAdditional(SUMO_TAG_TAZ, value, false) != nullptr);
1773  // other
1774  case GNE_ATTR_SELECTED:
1775  return canParse<bool>(value);
1776  case GNE_ATTR_PARAMETERS:
1777  return Parameterised::areParametersValid(value);
1778  default:
1779  return isValidFlowAttribute(this, key, value);
1780  }
1781 }
1782 
1783 
1784 void
1786  enableFlowAttribute(this, key, undoList);
1787 }
1788 
1789 
1790 void
1792  disableFlowAttribute(this, key, undoList);
1793 }
1794 
1795 
1796 bool
1798  return isFlowAttributeEnabled(key);
1799 }
1800 
1801 
1802 std::string
1804  return getTagStr();
1805 }
1806 
1807 
1808 std::string
1810  // special case for Trips and flow
1811  if (myTagProperty.vehicleEdges()) {
1812  // check if we're inspecting a Edge
1813  if (!myNet->getViewNet()->getInspectedAttributeCarriers().empty() &&
1814  myNet->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1815  // check if edge correspond to a "from", "to" or "via" edge
1817  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (from)";
1818  } else if (myNet->getViewNet()->isAttributeCarrierInspected(getParentEdges().front())) {
1819  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (to)";
1820  } else {
1821  // iterate over via
1822  for (const auto& i : via) {
1823  if (i == myNet->getViewNet()->getInspectedAttributeCarriers().front()->getID()) {
1824  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (via)";
1825  }
1826  }
1827  }
1828  }
1829  }
1830  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
1831 }
1832 
1833 
1834 const Parameterised::Map&
1836  return getParametersMap();
1837 }
1838 
1839 
1841 GNEVehicle::copyVehicle(const GNEVehicle* originalVehicle) {
1842  // get net and undoList
1843  const auto net = originalVehicle->getNet();
1844  auto undoList = net->getViewNet()->getUndoList();
1845  // declare new route, vehicle and embedded route
1846  GNERoute* newRoute = nullptr;
1847  GNEVehicle* newVehicle = nullptr;
1848  GNERoute* newEmbeddedRoute = nullptr;
1849  // generate new vehicle ID
1850  const std::string newRouteID = net->getAttributeCarriers()->generateDemandElementID(SUMO_TAG_ROUTE);
1851  const std::string newVehicleID = net->getAttributeCarriers()->generateDemandElementID(originalVehicle->getTagProperty().getTag());
1852  // create vehicle using vehicleParameters
1853  if (originalVehicle->getTagProperty().vehicleRoute()) {
1854  newRoute = new GNERoute(net, newRouteID, originalVehicle->getParentDemandElements().at(1));
1855  newVehicle = new GNEVehicle(originalVehicle->getTagProperty().getTag(), net,
1856  originalVehicle->getParentDemandElements().at(0), newRoute,
1857  originalVehicle->getSUMOVehicleParameter());
1858  } else if (originalVehicle->getTagProperty().vehicleRouteEmbedded()) {
1859  newVehicle = new GNEVehicle(originalVehicle->getTagProperty().getTag(), net,
1860  originalVehicle->getParentDemandElements().at(0),
1861  originalVehicle->getSUMOVehicleParameter());
1862  newEmbeddedRoute = new GNERoute(net, newVehicle, originalVehicle->getChildDemandElements().front());
1863  } else if (originalVehicle->getTagProperty().vehicleEdges()) {
1864  newVehicle = new GNEVehicle(originalVehicle->getTagProperty().getTag(), net,
1865  originalVehicle->getParentDemandElements().at(0),
1866  originalVehicle->getParentEdges().front(),
1867  originalVehicle->getParentEdges().back(),
1868  originalVehicle->getSUMOVehicleParameter());
1869  } else if (originalVehicle->getTagProperty().vehicleJunctions()) {
1870  newVehicle = new GNEVehicle(originalVehicle->getTagProperty().getTag(), net,
1871  originalVehicle->getParentDemandElements().at(0),
1872  originalVehicle->getParentJunctions().front(),
1873  originalVehicle->getParentJunctions().back(),
1874  originalVehicle->getSUMOVehicleParameter());
1875  } else if (originalVehicle->getTagProperty().vehicleTAZs()) {
1876  newVehicle = new GNEVehicle(originalVehicle->getTagProperty().getTag(), net,
1877  originalVehicle->getParentDemandElements().at(0),
1878  originalVehicle->getParentAdditionals().front(),
1879  originalVehicle->getParentAdditionals().back(),
1880  originalVehicle->getSUMOVehicleParameter());
1881  }
1882  // set new ID
1883  newVehicle->setAttribute(SUMO_ATTR_ID, newVehicleID);
1884  // add new vehicle
1885  undoList->begin(originalVehicle, TLF("copy % '%'", newVehicle->getTagStr(), newVehicleID));
1886  if (newRoute) {
1887  net->getViewNet()->getUndoList()->add(new GNEChange_DemandElement(newRoute, true), true);
1888  }
1889  undoList->add(new GNEChange_DemandElement(newVehicle, true), true);
1890  if (newEmbeddedRoute) {
1891  net->getViewNet()->getUndoList()->add(new GNEChange_DemandElement(newEmbeddedRoute, true), true);
1892  }
1893  undoList->end();
1894  return newVehicle;
1895 }
1896 
1897 // ===========================================================================
1898 // protected
1899 // ===========================================================================
1900 
1901 RGBColor
1903  // change color
1904  if (drawUsingSelectColor()) {
1906  } else {
1907  return getColorByScheme(s.vehicleColorer, this);
1908  }
1909 }
1910 
1911 
1912 const SUMOVehicleParameter&
1914  return *this;
1915 }
1916 
1917 // ===========================================================================
1918 // private
1919 // ===========================================================================
1920 
1921 void
1922 GNEVehicle::setAttribute(SumoXMLAttr key, const std::string& value) {
1923  // declare string error
1924  std::string error;
1925  // flag to upate stack label
1926  bool updateSpreadStackGeometry = false;
1927  switch (key) {
1928  case SUMO_ATTR_ID:
1929  // update microsimID
1930  setDemandElementID(value);
1931  // set manually vehicle ID (needed for saving)
1932  id = value;
1933  break;
1934  case SUMO_ATTR_TYPE:
1935  if (getID().size() > 0) {
1936  if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, value, false) != nullptr) {
1938  } else {
1940  }
1941  // set manually vtypeID (needed for saving)
1942  vtypeid = value;
1943  }
1944  break;
1945  case SUMO_ATTR_COLOR:
1946  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1947  color = parse<RGBColor>(value);
1948  // mark parameter as set
1950  } else {
1951  // set default value
1952  color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
1953  // unset parameter
1955  }
1956  break;
1957  case SUMO_ATTR_DEPARTLANE:
1958  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1960  // mark parameter as set
1962  } else {
1963  // set default value
1965  // unset parameter
1967  }
1968  break;
1969  case SUMO_ATTR_DEPARTPOS:
1970  if (value == toString(INVALID_DOUBLE)) {
1972  // mark parameter as set
1974  } else if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1976  // mark parameter as set
1978  } else {
1979  // set default value
1981  // unset parameter
1983  }
1984  if (getID().size() > 0) {
1985  updateGeometry();
1986  updateSpreadStackGeometry = true;
1987  }
1988  break;
1989  case SUMO_ATTR_DEPARTSPEED:
1990  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
1992  // mark parameter as set
1994  } else {
1995  // set default value
1997  // unset parameter
1999  }
2000  break;
2001  case SUMO_ATTR_ARRIVALLANE:
2002  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2004  // mark parameter as set
2006  } else {
2007  // set default value
2009  // unset parameter
2011  }
2012  break;
2013  case SUMO_ATTR_ARRIVALPOS:
2014  if (value == toString(INVALID_DOUBLE)) {
2016  // mark parameter as set
2018  } else if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2020  // mark parameter as set
2022  } else {
2023  // set default value
2025  // unset parameter
2027  }
2028  if (getID().size() > 0) {
2029  updateGeometry();
2030  updateSpreadStackGeometry = true;
2031  }
2032  break;
2034  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2036  // mark parameter as set
2038  } else {
2039  // set default value
2041  // unset parameter
2043  }
2044  break;
2045  case SUMO_ATTR_LINE:
2046  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2047  line = value;
2048  // mark parameter as set
2050  } else {
2051  // set default value
2053  // unset parameter
2055  }
2056  break;
2058  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2059  personNumber = parse<int>(value);
2060  // mark parameter as set
2062  } else {
2063  // set default value
2064  personNumber = parse<int>(myTagProperty.getDefaultValue(key));
2065  // unset parameter
2067  }
2068  break;
2070  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2071  containerNumber = parse<int>(value);
2072  // mark parameter as set
2074  } else {
2075  // set default value
2076  containerNumber = parse<int>(myTagProperty.getDefaultValue(key));
2077  // unset parameter
2079  }
2080  break;
2081  case SUMO_ATTR_REROUTE:
2082  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2083  // mark parameter as set
2085  } else {
2086  // unset parameter
2088  }
2089  break;
2091  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2093  // mark parameter as set
2095  } else {
2096  // set default value
2098  // unset parameter
2100  }
2101  break;
2103  if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
2105  // mark parameter as set
2107  } else {
2108  // set default value
2110  // unset parameter
2112  }
2114  break;
2116  parseInsertionChecks(value);
2117  break;
2118  // Specific of vehicles over routes
2119  case SUMO_ATTR_ROUTE:
2120  if (getParentDemandElements().size() == 2) {
2122  }
2123  updateGeometry();
2124  updateSpreadStackGeometry = true;
2125  break;
2126  // Specific of from-to edges
2127  case SUMO_ATTR_FROM: {
2128  // change first edge
2129  replaceFirstParentEdge(value);
2130  // compute vehicle
2132  updateSpreadStackGeometry = true;
2133  break;
2134  }
2135  case SUMO_ATTR_TO: {
2136  // change last edge
2137  replaceLastParentEdge(value);
2138  // compute vehicle
2140  updateSpreadStackGeometry = true;
2141  break;
2142  }
2143  case SUMO_ATTR_VIA: {
2144  if (!value.empty()) {
2145  // set new via edges
2146  via = parse< std::vector<std::string> >(value);
2147  // mark parameter as set
2149  } else {
2150  // clear via
2151  via.clear();
2152  // unset parameter
2154  }
2155  // compute vehicle
2157  updateSpreadStackGeometry = true;
2158  break;
2159  }
2160  case SUMO_ATTR_DEPARTEDGE: {
2161  // update depart edge
2162  if (value.empty()) {
2163  // unset parameter
2165  departEdge = -1;
2167  } else {
2168  // mark parameter as set
2170  departEdge = parse<int>(value);
2172  }
2173  // compute vehicle
2174  if (getID().size() > 0) {
2176  updateSpreadStackGeometry = true;
2177  }
2178  break;
2179  }
2180  case SUMO_ATTR_ARRIVALEDGE: {
2181  // update arrival edge
2182  if (value.empty()) {
2183  // unset parameter
2185  arrivalEdge = -1;
2187  } else {
2188  // mark parameter as set
2190  arrivalEdge = parse<int>(value);
2192  }
2193  if (getID().size() > 0) {
2194  // compute vehicle
2196  updateSpreadStackGeometry = true;
2197  }
2198  break;
2199  }
2200  // Specific of from-to junctions
2201  case SUMO_ATTR_FROM_JUNCTION: {
2202  // change first junction
2204  // compute vehicle
2206  updateSpreadStackGeometry = true;
2207  break;
2208  }
2209  case SUMO_ATTR_TO_JUNCTION: {
2210  // change last junction
2212  // compute vehicle
2214  updateSpreadStackGeometry = true;
2215  break;
2216  }
2217  // Specific of from-to TAZs
2218  case SUMO_ATTR_FROM_TAZ: {
2219  // change first additional
2221  // set taz manually
2222  fromTaz = value;
2223  // compute vehicle
2225  updateSpreadStackGeometry = true;
2226  break;
2227  }
2228  case SUMO_ATTR_TO_TAZ: {
2229  // change last additional
2231  // set taz manually
2232  toTaz = value;
2233  // compute vehicle
2235  updateSpreadStackGeometry = true;
2236  break;
2237  }
2238  // other
2239  case GNE_ATTR_SELECTED:
2240  if (parse<bool>(value)) {
2242  } else {
2244  }
2245  break;
2246  case GNE_ATTR_PARAMETERS:
2247  setParametersStr(value);
2248  break;
2249  default:
2250  setFlowAttribute(this, key, value);
2251  break;
2252  }
2253  // check if stack label has to be updated
2254  if (updateSpreadStackGeometry) {
2255  if (myTagProperty.vehicleEdges()) {
2256  getParentEdges().front()->updateVehicleStackLabels();
2257  getParentEdges().front()->updateVehicleSpreadGeometries();
2258  } else if (myTagProperty.vehicleRoute()) {
2259  getRouteParent()->getParentEdges().front()->updateVehicleStackLabels();
2260  getRouteParent()->getParentEdges().front()->updateVehicleSpreadGeometries();
2261  } else if (myTagProperty.vehicleRouteEmbedded()) {
2262  getChildDemandElements().front()->getParentEdges().front()->updateVehicleStackLabels();
2263  getChildDemandElements().front()->getParentEdges().front()->updateVehicleSpreadGeometries();
2264  }
2265  }
2266 }
2267 
2268 
2269 void
2271  // toggle flow attributes
2272  toggleFlowAttribute(key, value);
2273 }
2274 
2275 
2276 void
2278  if ((moveResult.newFirstPos != INVALID_DOUBLE) &&
2280  // change depart
2283  departPos = moveResult.newFirstPos;
2284  }
2287  // change arrival
2290  arrivalPos = moveResult.newFirstPos;
2291  }
2292  // set lateral offset
2294  // update geometry
2295  updateGeometry();
2296 }
2297 
2298 
2299 void
2301  // reset lateral offset
2303  // check value
2304  if (moveResult.newFirstPos != INVALID_DOUBLE) {
2305  // continue depending if we're moving first or last position
2307  // begin change attribute
2308  undoList->begin(this, TLF("departPos of %", getTagStr()));
2309  // now set departPos
2310  setAttribute(SUMO_ATTR_DEPARTPOS, toString(moveResult.newFirstPos), undoList);
2311  // check if depart lane has to be changed
2312  if (moveResult.newFirstLane) {
2313  // set new depart lane
2314  setAttribute(SUMO_ATTR_DEPARTLANE, toString(moveResult.newFirstLane->getIndex()), undoList);
2315  }
2316  } else {
2317  // begin change attribute
2318  undoList->begin(this, TLF("arrivalPos of %", getTagStr()));
2319  // now set arrivalPos
2320  setAttribute(SUMO_ATTR_ARRIVALPOS, toString(moveResult.newFirstPos), undoList);
2321  // check if arrival lane has to be changed
2322  if (moveResult.newFirstLane) {
2323  // set new arrival lane
2325  }
2326  }
2327  }
2328  // end change attribute
2329  undoList->end();
2330 }
2331 
2332 /****************************************************************************/
FXDEFMAP(GNEVehicle::GNESingleVehiclePopupMenu) GNESingleVehiclePopupMenuMap[]
@ DEMAND_TYPE
Mode for editing types.
@ MID_GNE_VEHICLE_TRANSFORM_FLOW_EMBEDDED
transform vehicle to flow over junctions
Definition: GUIAppEnum.h:1396
@ MID_GNE_VEHICLE_TRANSFORM_FLOW_TAZS
transform vehicle to flow over TAZs
Definition: GUIAppEnum.h:1404
@ MID_GNE_VEHICLE_TRANSFORM_VEHICLE_EMBEDDED
transform vehicle to vehicle over junctions
Definition: GUIAppEnum.h:1394
@ MID_GNE_VEHICLE_TRANSFORM_ROUTEFLOW
transform vehicle to flow over route
Definition: GUIAppEnum.h:1392
@ MID_GNE_VEHICLE_TRANSFORM_TRIP_JUNCTIONS
transform vehicle to trip over junctions
Definition: GUIAppEnum.h:1398
@ MID_GNE_VEHICLE_TRANSFORM_TRIP_TAZS
transform vehicle to trip over TAZs
Definition: GUIAppEnum.h:1402
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:455
@ MID_GNE_VEHICLE_TRANSFORM_TRIP
transform vehicle to trip
Definition: GUIAppEnum.h:1386
@ MID_GNE_VEHICLE_TRANSFORM_FLOW
transform vehicle to flow
Definition: GUIAppEnum.h:1388
@ MID_GNE_VEHICLE_TRANSFORM_VEHICLE
transform vehicle to vehicle over route
Definition: GUIAppEnum.h:1390
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:453
@ MID_GNE_VEHICLE_TRANSFORM_FLOW_JUNCTIONS
transform vehicle to flow over jucntions
Definition: GUIAppEnum.h:1400
@ GLO_TRIP
a trip
@ GLO_ROUTEFLOW
a routeFlow
@ GLO_FLOW
a flow
@ GLO_VEHICLE
a vehicle
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ TRIP_JUNCTIONS
@ FLOW_JUNCTIONS
#define RAD2DEG(x)
Definition: GeomHelper.h:36
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearances.
const std::string DEFAULT_VTYPE_ID
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
const int VEHPARS_DEPARTEDGE_SET
const int VEHPARS_ARRIVALEDGE_SET
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const int VEHPARS_ROUTE_SET
const int VEHPARS_COLOR_SET
DepartLaneDefinition
Possible ways to choose a lane on depart.
@ GIVEN
The lane is given.
const int VEHPARS_TO_TAZ_SET
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
DepartPosLatDefinition
Possible ways to choose the lateral departure position.
DepartPosDefinition
Possible ways to choose the departure position.
@ GIVEN
The position is given.
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
@ GIVEN
The arrival lane is given.
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_FROM_TAZ_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
ArrivalPosLatDefinition
Possible ways to choose the lateral arrival position.
const int VEHPARS_VTYPE_SET
const int VEHPARS_ARRIVALPOS_SET
const int VEHPARS_VIA_SET
const int VEHPARS_DEPARTPOSLAT_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_TRIP_JUNCTIONS
a trip between junctions
@ GNE_TAG_TRIP_TAZS
a single trip definition that uses TAZs
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_VTYPE
description of a vehicle/person/container 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
@ GNE_TAG_FLOW_JUNCTIONS
a flow between junctions
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ GNE_TAG_FLOW_TAZS
a flow between TAZs
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ GNE_TAG_VEHICLE_WITHROUTE
description of a vehicle with an embedded route
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
@ 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_ARRIVALSPEED
@ SUMO_ATTR_ARRIVALLANE
@ GNE_ATTR_PLAN_GEOMETRY_STARTPOS
person/container geometry start position
@ SUMO_ATTR_DEPARTEDGE
@ SUMO_ATTR_FROM_JUNCTION
@ SUMO_ATTR_VEHSPERHOUR
@ SUMO_ATTR_ARRIVALEDGE
@ SUMO_ATTR_VIA
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_TO_JUNCTION
@ GNE_ATTR_FLOWPARAMETERS
flow parameters (integer for mask end, number, etc...)
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_TAZ_CENTROID
TAZ Center (uses to return the TAZ centroid if center is not defined)
@ 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_TO_TAZ
@ SUMO_ATTR_CENTER
@ SUMO_ATTR_DEPARTSPEED
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_FROM_TAZ
@ SUMO_ATTR_DEPARTLANE
@ GNE_ATTR_PLAN_GEOMETRY_ENDPOS
person/container geometry end position
@ 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_INSERTIONCHECKS
@ SUMO_ATTR_WIDTH
const double INVALID_DOUBLE
invalid double
Definition: StdDefs.h:64
T MIN2(T a, T b)
Definition: StdDefs.h:76
T MAX2(T a, T b)
Definition: StdDefs.h:82
const double SUMO_const_halfLaneWidth
Definition: StdDefs.h:49
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:319
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:347
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:295
static void drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition: GLHelper.cpp:539
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
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:787
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void resetDefaultValues()
reset attribute carrier to their default values
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
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
Definition: GNEContour.cpp:88
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double scale) const
calculate contour (for rectangled elements)
Definition: GNEContour.cpp:103
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
void toggleFlowAttribute(const SumoXMLAttr attribute, const bool value)
toggle flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers
void drawFlowLabel(const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw flow label
void disableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
bool isFlowAttributeEnabled(SumoXMLAttr key) const
double getFlowAttributeDouble(SumoXMLAttr key) const
bool isValidFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value)
void writeFlowAttributes(const GNEDemandElement *flowElement, OutputDevice &device) const
write flow attributes
void enableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
std::string getFlowAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier and adapted to GNEDemandElementFlow
void setFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void buildMenuCommandRouteLength(GUIGLObjectPopupMenu *ret) const
build menu command route length
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void drawStackLabel(const int number, const std::string &element, const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw stack label
GUIGeometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
virtual double getAttributeDouble(SumoXMLAttr key) const =0
bool isValidDemandElementID(const std::string &value) const
check if a new demand element ID is valid
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
void drawJunctionLine(const GNEDemandElement *element) const
draw line between junctions
void replaceFirstParentAdditional(SumoXMLTag tag, const std::string &value)
replace the first parent additional
GNEDemandElement * getRouteParent() const
get route parent (always the second parent demand element)
void setDemandElementID(const std::string &newID)
set demand element id
GUIGeometry mySpreadGeometry
demand element spread geometry (Only used by vehicles and pedestrians)
void buildMenuAddReverse(GUIGLObjectPopupMenu *ret) const
build menu command route length
void replaceFirstParentJunction(const std::string &value)
replace the first parent junction
GNEDemandElement * getTypeParent() const
get type parent (needed because first parent can be either type or typeDistribution)
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
int myStackedLabelNumber
stacked label number
RGBColor getColorByScheme(const GUIColorer &c, const SUMOVehicleParameter *parameters) const
get color by scheme (used by vehicles, persons and containers)
Problem
enum class for demandElement problems
void replaceLastParentAdditional(SumoXMLTag tag, const std::string &value)
replace the last parent additional
void replaceLastParentJunction(const std::string &value)
replace the last parent junction
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:1090
GNELane * getLaneByAllowedVClass(const SUMOVehicleClass vClass) const
return the first lane that allow a vehicle of type vClass (or the first lane, if none was found)
Definition: GNEEdge.cpp:1510
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:214
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:657
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:615
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition: GNELane.cpp:208
GNEEdge * getParentEdge() const
get parent edge
Definition: GNELane.cpp:196
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
bool getAllowChangeLane() const
allow change lane
CommonModeOptions * getCommonModeOptions() const
get common mode options
move operation
move result
const GNELane * newFirstLane
new first Lane
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
double firstLaneOffset
lane offset
std::vector< GNEDemandElement * > getSelectedDemandElements() const
get selected demand elements
GNEDemandElement * retrieveDemandElements(const std::vector< SumoXMLTag > types, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:123
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:135
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2136
std::vector< GNEEdge * > calculateDijkstraPath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &edges) const
calculate Dijkstra path between a list of edges (for example, from-via-to edges)
bool consecutiveEdgesConnected(const SUMOVehicleClass vClass, const GNEEdge *from, const GNEEdge *to) const
check if exist a path between the two given consecutive edges for the given VClass
bool checkDrawPathGeometry(const GUIVisualizationSettings &s, const GNELane *lane, SumoXMLTag tag)
check if path element geometry must be drawn in the given lane
PathElement()=delete
invalidate default constructor
const GNELane * getPreviousLane() const
get previous lane
GNEContour * getContour() const
getcontour associated with segment
const GNEJunction * getJunction() const
get junction associated with this segment
const GNELane * getNextLane() const
get next lane
const GNELane * getLane() const
get lane associated with this segment
bool isLastSegment() const
check if segment is the last path's segment
bool isFirstSegment() const
check if segment is the first path's segment
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
PathDraw * getPathDraw()
obtain instance of PathDraw
bool isPathValid(const PathElement *pathElement) const
check if path element is valid
void calculatePath(PathElement *pathElement, SUMOVehicleClass vClass, GNELane *fromLane, GNELane *toLane)
calculate path between from-to edges (using dijkstra, require path calculator updated)
static void transformToRouteFlow(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform routeFlow over an existent route
static void transformToFlow(GNEVehicle *originalVehicle)
transform to flow
static void transformToTrip(GNEVehicle *originalVehicle)
transform to trip
static void transformToFlowJunctions(GNEVehicle *originalVehicle)
transform to flow over junctions
static void transformToTripJunctions(GNEVehicle *originalVehicle)
transform to trip over junctions
static void transformToFlowTAZs(GNEVehicle *originalVehicle)
transform to flow over TAZs
static void transformToVehicle(GNEVehicle *originalVehicle, bool createEmbeddedRoute)
transform vehicle functions
static void transformToTripTAZs(GNEVehicle *originalVehicle)
transform to trip over TAZs
bool isFlow() const
return true if tag correspond to a flow element
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool vehicleJunctions() const
return true if tag correspond to a vehicle placed over from-to junctions
bool isCalibrator() const
return true if tag correspond to a calibrator (Only used to group all detectors in the XML)
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool vehicleRouteEmbedded() const
return true if tag correspond to a vehicle placed over an embedded route
bool vehicleEdges() const
return true if tag correspond to a vehicle placed over from-to edges
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
SumoXMLTag getXMLTag() const
get XML tag
bool vehicleTAZs() const
return true if tag correspond to a vehicle placed over from-to TAZs
bool vehicleRoute() const
plan parents
GNEDemandElement * getCurrentType() const
get current Vehicle Type
TypeSelector * getTypeSelector() const
get vehicle type selector
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition: GNEVehicle.h:62
GNESelectedVehiclesPopupMenu(GNEVehicle *vehicle, const std::vector< GNEVehicle * > &selectedVehicle, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEVehicle.cpp:193
long onCmdTransform(FXObject *obj, FXSelector sel, void *)
Called to transform the current vehicle to another vehicle type.
Definition: GNEVehicle.cpp:312
std::map< FXObject *, SumoXMLTag > myRestrictedMenuCommands
selected menu commands
Definition: GNEVehicle.h:89
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition: GNEVehicle.h:35
long onCmdTransform(FXObject *, FXSelector sel, void *)
Called to transform the current vehicle to another vehicle type.
Definition: GNEVehicle.cpp:151
GNESingleVehiclePopupMenu(GNEVehicle *vehicle, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEVehicle.cpp:62
GNEVehicle * myVehicle
current vehicle
Definition: GNEVehicle.h:58
const Parameterised::Map & getACParametersMap() const
get parameters map
GNELane * getLastPathLane() const
get last path lane
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEVehicle.cpp:836
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEVehicle.cpp:717
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEVehicle.cpp:842
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEVehicle.cpp:542
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEVehicle.cpp:820
void computePathElement()
compute pathElement
Definition: GNEVehicle.cpp:976
GNEContour myVehicleContour
variable used for draw vehicle contours
Definition: GNEVehicle.h:302
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
~GNEVehicle()
destructor
Definition: GNEVehicle.cpp:538
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
double getAttributeDouble(SumoXMLAttr key) const
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEVehicle.cpp:857
bool isAttributeEnabled(SumoXMLAttr key) const
const RGBColor & getColor() const
get color
Definition: GNEVehicle.cpp:729
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNELane * getFirstPathLane() const
get first path lane
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition: GNEVehicle.cpp:631
static const double myArrivalPositionDiameter
vehicle arrival position radius
Definition: GNEVehicle.h:312
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEVehicle.cpp:851
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
Definition: GNEVehicle.cpp:785
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:799
const SUMOVehicleParameter & getSUMOVehicleParameter() const
@brier get sumo vehicle parameter
void updateGeometry()
update pre-computed geometry information
Definition: GNEVehicle.cpp:735
Position getAttributePosition(SumoXMLAttr key) const
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEVehicle.cpp:675
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEVehicle.cpp:779
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 toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEVehicle.cpp:570
GNEVehicle(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEVehicle.cpp:437
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEVehicle.cpp:723
static GNEDemandElement * copyVehicle(const GNEVehicle *originalVehicle)
create a copy of the given vehicle
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:747
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:723
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:735
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
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:553
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:741
GNEMoveFrame * getMoveFrame() const
get frame for move elements
GNETypeFrame * getTypeFrame() const
get frame for DEMAND_TYPE
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length, bool amReversed=false)
draw vehicle as a triangle
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1, bool isStopped=false, bool amReversed=false)
draw vehicle as a polygon
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length, bool amReversed=false)
draw vehicle as a Box
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
Definition: GUIDesigns.cpp:42
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
void updateSinglePosGeometry(const Position &position, const double rotation)
update position and rotation
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:59
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.
Definition: GUIGlObject.h:156
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:143
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
virtual 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
GUIVisualizationWidthSettings widthSettings
width settings
bool checkDrawVehicle(Detail d, const bool selected) const
check if draw vehicle
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
bool drawMinGap
Information whether the minimum gap shall be drawn.
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static const std::vector< SumoXMLTag > types
type namespace
Definition: NamespaceIDs.h:53
static const std::vector< SumoXMLTag > vehicles
vehicles namespace
Definition: NamespaceIDs.h:59
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:60
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
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, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
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"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
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".
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:281
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:322
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:276
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
Definition: Position.h:271
double x() const
Returns the x-position.
Definition: Position.h:55
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
Definition: Position.h:286
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor RED
named colors
Definition: RGBColor.h:185
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
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
void parseInsertionChecks(const std::string &value)
parses insertion checks
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.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
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.
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.
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
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.
bool areInsertionChecksValid(const std::string &value) const
check if given insertion checks are valid
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 getInsertionChecks() const
get insertion checks in string format
std::string routeid
The vehicle's route id.
std::string id
The vehicle's id.
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
int departEdge
(optional) The initial edge within the route of the vehicle
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
std::string toTaz
The vehicle's destination zone (district)
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
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.
int arrivalEdge
(optional) The final edge within the route of the vehicle
std::string fromTaz
The vehicle's origin zone (district)
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.
RouteIndexDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
#define M_PI
Definition: odrSpiral.cpp:45
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 showAllTrips() const
check if trips has to be drawn
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool drawSpreadVehicles() const
check if vehicles must be drawn spread
bool showDemandElements() const
check if show demand elements checkbox is enabled
RGBColor vehicleTripColor
color for vehicle trips
RGBColor selectedVehicleColor
vehicle selection color
static const double segmentWidth
width of dotted contour segments
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size