Eclipse SUMO - Simulation of Urban MObility
GNERoute.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing routes in Netedit
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <netbuild/NBNode.h>
25 #include <netedit/GNENet.h>
26 #include <netedit/GNEUndoList.h>
27 #include <netedit/GNEViewNet.h>
28 #include <netedit/GNEViewParent.h>
36 
37 #include "GNERoute.h"
38 
39 // ===========================================================================
40 // FOX callback mapping
41 // ===========================================================================
42 FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[] = {
44 };
45 
46 // Object implementation
47 FXIMPLEMENT(GNERoute::GNERoutePopupMenu, GUIGLObjectPopupMenu, GNERoutePopupMenuMap, ARRAYNUMBER(GNERoutePopupMenuMap))
48 
49 // ===========================================================================
50 // GNERoute::GNERoutePopupMenu - methods
51 // ===========================================================================
52 
54  GUIGLObjectPopupMenu(app, parent, o) {
55 }
56 
57 
59 
60 
61 long
62 GNERoute::GNERoutePopupMenu::onCmdApplyDistance(FXObject*, FXSelector, void*) {
63  GNERoute* route = static_cast<GNERoute*>(myObject);
64  GNEViewNet* viewNet = static_cast<GNEViewNet*>(myParent);
65  GNEUndoList* undoList = route->myViewNet->getUndoList();
66  undoList->p_begin("apply distance along route");
67  double dist = (route->getEdgeParents().size() > 0) ? route->getEdgeParents().front()->getNBEdge()->getDistance() : 0;
68  for (GNEEdge* edge : route->getEdgeParents()) {
69  undoList->p_add(new GNEChange_Attribute(edge, viewNet->getNet(), SUMO_ATTR_DISTANCE, toString(dist), true, edge->getAttribute(SUMO_ATTR_DISTANCE)));
70  dist += edge->getNBEdge()->getFinalLength();
71  }
72  undoList->p_end();
73  return 1;
74 }
75 
76 // ===========================================================================
77 // GNERoute - methods
78 // ===========================================================================
79 
81  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_ROUTE), viewNet, GLO_ROUTE, SUMO_TAG_ROUTE,
82 {}, {}, {}, {}, {}, {}, {}, {}, {}, {}),
84 myColor(RGBColor::YELLOW),
85 myVClass(SVC_PASSENGER) {
86 }
87 
88 
90  GNEDemandElement(routeParameters.routeID, viewNet, GLO_ROUTE, SUMO_TAG_ROUTE,
91  routeParameters.edges, {}, {}, {}, {}, {}, {}, {}, {}, {}),
92 Parameterised(routeParameters.genericParameters),
93 myColor(routeParameters.color),
94 myVClass(routeParameters.VClass) {
95 }
96 
97 
98 GNERoute::GNERoute(GNEViewNet* viewNet, GNEDemandElement* vehicleParent, const GNERouteHandler::RouteParameter& routeParameters) :
99  GNEDemandElement(viewNet->getNet()->generateDemandElementID("", SUMO_TAG_EMBEDDEDROUTE), viewNet, GLO_EMBEDDEDROUTE, SUMO_TAG_EMBEDDEDROUTE,
100  routeParameters.edges, {}, {}, {}, {vehicleParent}, {}, {}, {}, {}, {}),
101 Parameterised(routeParameters.genericParameters),
102 myColor(routeParameters.color),
103 myVClass(routeParameters.VClass) {
104 }
105 
106 
108  GNEDemandElement(route->getViewNet()->getNet()->generateDemandElementID("", SUMO_TAG_ROUTE), route->getViewNet(), GLO_ROUTE, SUMO_TAG_ROUTE,
109  route->getEdgeParents(), {}, {}, {}, {}, {}, {}, {}, {}, {}),
110 Parameterised(),
111 myColor(route->getColor()),
112 myVClass(route->getVClass()) {
113 }
114 
115 
117 
118 
121  GUIGLObjectPopupMenu* ret = new GNERoutePopupMenu(app, parent, *this);
122  // build header
123  buildPopupHeader(ret, app);
124  // build menu command for center button and copy cursor position to clipboard
126  buildPositionCopyEntry(ret, false);
127  // buld menu commands for names
128  new FXMenuCommand(ret, ("Copy " + getTagStr() + " name to clipboard").c_str(), nullptr, ret, MID_COPY_NAME);
129  new FXMenuCommand(ret, ("Copy " + getTagStr() + " typed name to clipboard").c_str(), nullptr, ret, MID_COPY_TYPED_NAME);
130  new FXMenuSeparator(ret);
131  // build selection and show parameters menu
134  // show option to open demand element dialog
135  if (myTagProperty.hasDialog()) {
136  new FXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
137  new FXMenuSeparator(ret);
138  }
139  new FXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
140  new FXMenuSeparator(ret);
141  new FXMenuCommand(ret, "Apply distance along route", nullptr, ret, MID_GNE_ROUTE_APPLY_DISTANCE);
142  return ret;
143 }
144 
145 
146 void
148  device.openTag(SUMO_TAG_ROUTE);
151  // write extra attributes depending if is an embedded route
154  // write stops associated to this route
155  for (const auto& i : getDemandElementChildren()) {
156  if (i->getTagProperty().isStop()) {
157  i->writeDemandElement(device);
158  }
159  }
160  }
161  // write generic parameters
162  writeParams(device);
163  // close tag
164  device.closeTag();
165 }
166 
167 
168 bool
170  if (getEdgeParents().size() == 0) {
171  return false;
172  } else if (getEdgeParents().size() == 1) {
173  return true;
174  } else {
175  // check if exist at least a connection between every edge
176  for (int i = 1; i < (int)getEdgeParents().size(); i++) {
177  if (getRouteCalculatorInstance()->areEdgesConsecutives(myVClass, getEdgeParents().at((int)i - 1), getEdgeParents().at(i)) == false) {
178  return false;
179  }
180  }
181  // there is connections bewteen all edges, then return true
182  return true;
183  }
184 }
185 
186 
187 std::string
189  if (getEdgeParents().size() == 0) {
190  return ("A route need at least one edge");
191  } else {
192  // check if exist at least a connection between every edge
193  for (int i = 1; i < (int)getEdgeParents().size(); i++) {
194  if (getRouteCalculatorInstance()->areEdgesConsecutives(myVClass, getEdgeParents().at((int)i - 1), getEdgeParents().at(i)) == false) {
195  return ("Edge '" + getEdgeParents().at((int)i - 1)->getID() + "' and edge '" + getEdgeParents().at(i)->getID() + "' aren't consecutives");
196  }
197  }
198  // there is connections bewteen all edges, then all ok
199  return "";
200  }
201 }
202 
203 
204 void
206  // currently the only solution is removing Route
207 }
208 
209 
210 GNEEdge*
212  return getEdgeParents().front();
213 }
214 
215 
216 GNEEdge*
218  return getEdgeParents().back();
219 }
220 
221 
224  return myVClass;
225 }
226 
227 
228 const RGBColor&
230  return myColor;
231 }
232 
233 
234 void
236  // Nothing to compute
237 }
238 
239 
240 void
242  // Routes cannot be moved
243 }
244 
245 
246 void
248  // Routes cannot be moved
249 }
250 
251 
252 void
254  // Routes cannot be moved
255 }
256 
257 
258 void
260  // Routes cannot be moved
261 }
262 
263 
264 void
266  // first check if geometry is deprecated
268  // first clear geometry
270  // declare vector for saving a reference to lane geometry and connection shapes
271  std::vector<std::pair<GNEEdge*, GNENetElement::NetElementGeometry> > laneGeometries;
272  std::vector<PositionVector> connectionShapes;
273  // obtain all lane shapes
274  for (const auto& i : getEdgeParents()) {
275  laneGeometries.push_back(std::make_pair(i, i->getLaneByVClass(myVClass)->getGeometry()));
276  }
277  // resize connectionShapes
278  connectionShapes.resize(laneGeometries.size());
279  // iterate over edge parents
280  for (int i = 0; i < ((int)getEdgeParents().size() - 1); i++) {
281  // obtain NBEdges from both edges
282  NBEdge* nbFrom = getEdgeParents().at(i)->getNBEdge();
283  NBEdge* nbTo = getEdgeParents().at(i + 1)->getNBEdge();
284  // declare a flags
285  bool connectionFound = false;
286  // iterate over all connections of NBFrom
287  for (NBEdge::Connection c : nbFrom->getConnectionsFromLane(-1, nbTo, -1)) {
288  //check if given VClass is allowed for from and to lanes
289  if (!connectionFound && ((nbFrom->getPermissions(c.fromLane) & nbTo->getPermissions(c.toLane) & myVClass) == myVClass)) {
290  // save shape
291  if (c.customShape.size() != 0) {
292  connectionShapes.at(i) = c.customShape;
293  } else if (nbFrom->getToNode()->getShape().area() > 4) {
294  if (c.shape.size() != 0) {
295  connectionShapes.at(i) = c.shape;
296  // only append via shape if it exists
297  if (c.haveVia) {
298  connectionShapes.at(i).append(c.viaShape);
299  }
300  } else {
301  // manually calculate smooth shape
302  PositionVector laneShapeFrom = nbFrom->getLanes().at(c.fromLane).shape;
303  PositionVector laneShapeTo = c.toEdge->getLanes().at(c.toLane).shape;
304  // Calculate shape so something can be drawn immidiately
305  connectionShapes.at(i) = nbFrom->getToNode()->computeSmoothShape(
306  laneShapeFrom,
307  laneShapeTo,
308  5, nbFrom->getTurnDestination() == c.toEdge,
309  (double) 5. * (double) nbFrom->getNumLanes(),
310  (double) 5. * (double) c.toEdge->getNumLanes());
311  }
312  }
313  // change flag
314  connectionFound = true;
315  }
316  }
317  }
318  // fill shapeSegments
319  for (int i = 0; i < (int)laneGeometries.size(); i++) {
320  // set lane shapes
321  for (int j = 0; j < (int)laneGeometries.at(i).second.shape.size(); j++) {
322  // save position and rotations (to avoid useless calculations)
323  if (j < (int)laneGeometries.at(i).second.shape.size() - 1) {
324  myDemandElementSegmentGeometry.insertEdgeLengthRotSegment(this, laneGeometries.at(i).first,
325  laneGeometries.at(i).second.shape[j], laneGeometries.at(i).second.shapeLengths[j],
326  laneGeometries.at(i).second.shapeRotations[j], true, true);
327  } else {
328  myDemandElementSegmentGeometry.insertEdgeSegment(this, laneGeometries.at(i).first,
329  laneGeometries.at(i).second.shape[j], true, true);
330  }
331  }
332  // set connection shapes
333  for (const auto& connectionShapePos : connectionShapes.at(i)) {
334  myDemandElementSegmentGeometry.insertJunctionSegment(this, laneGeometries.at(i).first->getGNEJunctionDestiny(), connectionShapePos, true, true);
335  }
336  }
337  // calculate entire shape, rotations and lengths
339  // update demand element childrens
340  for (const auto& i : getDemandElementChildren()) {
341  i->updateGeometry();
342  }
343  // set geometry as non-deprecated
345  }
346 }
347 
348 
349 Position
351  return Position();
352 }
353 
354 
355 std::string
357  return myViewNet->getNet()->getMicrosimID();
358 }
359 
360 
361 Boundary
363  Boundary routeBoundary;
364  // return the combination of all edge parents's boundaries
365  for (const auto& i : getEdgeParents()) {
366  routeBoundary.add(i->getCenteringBoundary());
367  }
368  // check if is valid
369  if (routeBoundary.isInitialised()) {
370  return routeBoundary;
371  } else {
372  return Boundary(-0.1, -0.1, 0.1, 0.1);
373  }
374 }
375 
376 
377 void
379  // Routes are drawn in GNEEdges
380 }
381 
382 
383 void
385  if (!myViewNet) {
386  throw ProcessError("ViewNet cannot be nullptr");
387  } else {
389  // add object of list into selected objects
391  if (changeFlag) {
392  mySelected = true;
393  }
394  }
395 }
396 
397 
398 void
400  if (!myViewNet) {
401  throw ProcessError("ViewNet cannot be nullptr");
402  } else {
404  // remove object of list of selected objects
406  if (changeFlag) {
407  mySelected = false;
408 
409  }
410  }
411 }
412 
413 
414 std::string
416  switch (key) {
417  case SUMO_ATTR_ID:
418  return getDemandElementID();
419  case SUMO_ATTR_EDGES:
420  return parseIDs(getEdgeParents());
421  case SUMO_ATTR_COLOR:
422  return toString(myColor);
423  case GNE_ATTR_SELECTED:
425  case GNE_ATTR_GENERIC:
426  return getGenericParametersStr();
427  default:
428  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
429  }
430 }
431 
432 
433 double
435  return 0;
436 }
437 
438 
439 void
440 GNERoute::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
441  if (value == getAttribute(key)) {
442  return; //avoid needless changes, later logic relies on the fact that attributes have changed
443  }
444  switch (key) {
445  case SUMO_ATTR_ID:
446  case SUMO_ATTR_EDGES:
447  case SUMO_ATTR_COLOR:
448  case GNE_ATTR_SELECTED:
449  case GNE_ATTR_GENERIC:
450  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
451  break;
452  default:
453  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
454  }
455 }
456 
457 
458 bool
459 GNERoute::isValid(SumoXMLAttr key, const std::string& value) {
460  switch (key) {
461  case SUMO_ATTR_ID:
462  return isValidDemandElementID(value);
463  case SUMO_ATTR_EDGES:
464  if (canParse<std::vector<GNEEdge*> >(myViewNet->getNet(), value, false)) {
465  // all edges exist, then check if compounds a valid route
466  return GNEDemandElement::isRouteValid(parse<std::vector<GNEEdge*> >(myViewNet->getNet(), value), false);
467  } else {
468  return false;
469  }
470  case SUMO_ATTR_COLOR:
471  return canParse<RGBColor>(value);
472  case GNE_ATTR_SELECTED:
473  return canParse<bool>(value);
474  case GNE_ATTR_GENERIC:
475  return isGenericParametersValid(value);
476  default:
477  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
478  }
479 }
480 
481 
482 void
484  //
485 }
486 
487 
488 bool
490  return true;
491 }
492 
493 
494 std::string
496  return getTagStr();
497 }
498 
499 
500 std::string
502  return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) ;
503 }
504 
505 
506 std::string
508  std::string result;
509  // Generate an string using the following structure: "key1=value1|key2=value2|...
510  for (auto i : getParametersMap()) {
511  result += i.first + "=" + i.second + "|";
512  }
513  // remove the last "|"
514  if (!result.empty()) {
515  result.pop_back();
516  }
517  return result;
518 }
519 
520 
521 std::vector<std::pair<std::string, std::string> >
523  std::vector<std::pair<std::string, std::string> > result;
524  // iterate over parameters map and fill result
525  for (auto i : getParametersMap()) {
526  result.push_back(std::make_pair(i.first, i.second));
527  }
528  return result;
529 }
530 
531 
532 void
533 GNERoute::setGenericParametersStr(const std::string& value) {
534  // clear parameters
535  clearParameter();
536  // separate value in a vector of string using | as separator
537  std::vector<std::string> parsedValues;
538  StringTokenizer stValues(value, "|", true);
539  while (stValues.hasNext()) {
540  parsedValues.push_back(stValues.next());
541  }
542  // check that parsed values (A=B)can be parsed in generic parameters
543  for (auto i : parsedValues) {
544  std::vector<std::string> parsedParameters;
545  StringTokenizer stParam(i, "=", true);
546  while (stParam.hasNext()) {
547  parsedParameters.push_back(stParam.next());
548  }
549  // Check that parsed parameters are exactly two and contains valid chracters
550  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
551  setParameter(parsedParameters.front(), parsedParameters.back());
552  }
553  }
554 }
555 
556 // ===========================================================================
557 // private
558 // ===========================================================================
559 
560 void
561 GNERoute::setAttribute(SumoXMLAttr key, const std::string& value) {
562  switch (key) {
563  case SUMO_ATTR_ID:
564  changeDemandElementID(value);
565  break;
566  case SUMO_ATTR_EDGES:
567  changeEdgeParents(this, value);
568  // change flag for geometry deprecating
570  break;
571  case SUMO_ATTR_COLOR:
572  myColor = parse<RGBColor>(value);
573  break;
574  case GNE_ATTR_SELECTED:
575  if (parse<bool>(value)) {
577  } else {
579  }
580  break;
581  case GNE_ATTR_GENERIC:
583  break;
584  default:
585  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
586  }
587 }
588 
589 
590 void
591 GNERoute::setEnabledAttribute(const int /*enabledAttributes*/) {
592  //
593 }
594 
595 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:181
GNEViewParent::getSelectorFrame
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Definition: GNEViewParent.cpp:185
GNEDemandElement::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
Definition: GNEDemandElement.h:469
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNEAttributeCarrier::getIcon
FXIcon * getIcon() const
get FXIcon associated to this AC
Definition: GNEAttributeCarrier.cpp:1177
GNERoute::compute
void compute()
compute demand element
Definition: GNERoute.cpp:235
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNERoute::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNERoute.cpp:265
GNERoute::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNERoute.cpp:591
GNEAttributeCarrier::mySelected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
Definition: GNEAttributeCarrier.h:795
GNERoute::GNERoutePopupMenu::~GNERoutePopupMenu
~GNERoutePopupMenu()
Destructor.
Definition: GNERoute.cpp:58
GNEDemandElement::isValidDemandElementID
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
Definition: GNEDemandElement.cpp:530
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GNEDemandElement::getRouteCalculatorInstance
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
Definition: GNEDemandElement.cpp:435
GNEDemandElement::DemandElementSegmentGeometry::calculatePartialShapeRotationsAndLengths
void calculatePartialShapeRotationsAndLengths()
calculate partial shape, rotations and lengths
Definition: GNEDemandElement.cpp:161
GNERoute::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNERoute.cpp:362
GNERoute::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNERoute.cpp:259
GNERoute::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNERoute.cpp:384
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
FXDEFMAP
FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[]
GNERoute::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNERoute.cpp:247
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:80
GNEAttributeCarrier::parseIDs
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
GNEDemandElement::DemandElementSegmentGeometry::insertEdgeSegment
void insertEdgeSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, const bool visible, const bool valid)
insert edge segment
Definition: GNEDemandElement.cpp:133
GNERoute::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNERoute.cpp:253
StringTokenizer::hasNext
bool hasNext()
returns the information whether further substrings exist
Definition: StringTokenizer.cpp:95
GNEDemandElement::DemandElementSegmentGeometry::clearDemandElementSegmentGeometry
void clearDemandElementSegmentGeometry()
clear demand element geometry
Definition: GNEDemandElement.cpp:154
GNERoute::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNERoute.cpp:501
RGBColor::YELLOW
static const RGBColor YELLOW
Definition: RGBColor.h:193
GUIGlobalSelection.h
NBNode::computeSmoothShape
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, NBNode *recordError=0, int shapeFlag=0) const
Compute a smooth curve between the given geometries.
Definition: NBNode.cpp:504
NBEdge::getConnectionsFromLane
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1127
GNEAttributeCarrier::isGenericParametersValid
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
Definition: GNEAttributeCarrier.cpp:1354
GNERoute
Definition: GNERoute.h:42
GNERoute::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNERoute.cpp:459
GNERoute::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNERoute.cpp:434
SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:701
StringTokenizer::next
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
Definition: StringTokenizer.cpp:100
GNEViewNet
Definition: GNEViewNet.h:43
GNEHierarchicalElementParents::getEdgeParents
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
Definition: GNEHierarchicalElementParents.cpp:150
MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:379
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:379
MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:369
NBEdge::getPermissions
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3441
PositionVector
A list of positions.
Definition: PositionVector.h:46
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:521
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:111
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:86
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:254
GUIAppEnum.h
GNERoute::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNERoute.cpp:350
GNERoute::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNERoute.cpp:205
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:132
GNEDemandElement::changeDemandElementID
void changeDemandElementID(const std::string &newID)
change ID of demand element
Definition: GNEDemandElement.cpp:540
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
GNERoute::myVClass
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
Definition: GNERoute.h:253
GNERoute.h
GNERoute::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNERoute.cpp:147
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
GNERouteHandler::RouteParameter
struct for saving route parameters
Definition: GNERouteHandler.h:54
RGBColor
Definition: RGBColor.h:40
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:105
GNERoute::startGeometryMoving
void startGeometryMoving()
Definition: GNERoute.cpp:241
NBEdge::getToNode
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486
GNEDemandElement::DemandElementSegmentGeometry::insertJunctionSegment
void insertJunctionSegment(const GNEDemandElement *element, const GNEJunction *junction, const Position pos, const bool visible, const bool valid)
insert junction segment
Definition: GNEDemandElement.cpp:147
GNERoute::GNERoutePopupMenu::onCmdApplyDistance
long onCmdApplyDistance(FXObject *, FXSelector, void *)
Called to modify edge distance values along the route.
Definition: GNERoute.cpp:62
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:114
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
StringTokenizer
Definition: StringTokenizer.h:62
GNEViewNet.h
SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
Definition: SUMOVehicleClass.h:160
GNERoute::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNERoute.cpp:211
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:428
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
NBEdge::getNumLanes
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:465
ProcessError
Definition: UtilExceptions.h:40
GNERoute::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNERoute.cpp:217
GNERoute::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNERoute.cpp:169
GLO_ROUTE
Definition: GUIGlObjectTypes.h:116
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:79
GNEEdge.h
GNEAttributeCarrier::myTagProperty
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
Definition: GNEAttributeCarrier.h:792
SUMOXMLDefinitions::isValidGenericParameterKey
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1034
GNEViewNet::getUndoList
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:933
GNEDemandElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEDemandElement.cpp:555
GNERoute::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNERoute.cpp:415
GUIGlObject
Definition: GUIGlObject.h:66
SUMO_ATTR_DISTANCE
Definition: SUMOXMLDefinitions.h:396
GNERoute::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNERoute.cpp:399
GNELane.h
GNEAttributeCarrier::canParse
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
Definition: GNEAttributeCarrier.h:645
SUMOXMLDefinitions::isValidGenericParameterValue
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
Definition: SUMOXMLDefinitions.cpp:1041
NBEdge::getLanes
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:644
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:208
GNEAttributeCarrier::parse
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
GNEDemandElement::DemandElementSegmentGeometry::geometryDeprecated
bool geometryDeprecated
mark geometry as deprecated (used to avoid multiple updates)
Definition: GNEDemandElement.h:147
GNERoute::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNERoute.cpp:188
GNEViewParent.h
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:240
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
GNE_ATTR_GENERIC
generic attribute
Definition: SUMOXMLDefinitions.h:986
NBNode::getShape
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:2143
GNERoute::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNERoute.cpp:489
GNEDemandElement::DemandElementSegmentGeometry::insertEdgeLengthRotSegment
void insertEdgeLengthRotSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, double length, double rotation, const bool visible, const bool valid)
insert edge segment with length and rotation (used to avoid unnecessary calculation in calculateParti...
Definition: GNEDemandElement.cpp:140
GNEDemandElement::RouteCalculator::areEdgesConsecutives
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
Definition: GNEDemandElement.cpp:282
GNESelectorFrame.h
GNEDemandElement::myDemandElementSegmentGeometry
DemandElementSegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
Definition: GNEDemandElement.h:475
GUIMainWindow
Definition: GUIMainWindow.h:47
GNERoute::myColor
RGBColor myColor
route color
Definition: GNERoute.h:250
InvalidArgument
Definition: UtilExceptions.h:57
GNERoute::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNERoute.cpp:507
GNERoute::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNERoute.cpp:356
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:249
GNERoute::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNERoute.cpp:440
GNERoute::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNERoute.cpp:495
GNERoute::~GNERoute
~GNERoute()
destructor
Definition: GNERoute.cpp:116
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:34
GNEDemandElement::getDemandElementID
const std::string & getDemandElementID() const
returns DemandElement ID
Definition: GNEDemandElement.cpp:524
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:217
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:267
GNEDemandElement::isRouteValid
static bool isRouteValid(const std::vector< GNEEdge * > &edges, bool report)
check if a route is valid
Definition: GNEDemandElement.cpp:489
GNEAttributeCarrier::TagProperties::hasDialog
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
Definition: GNEAttributeCarrier.cpp:844
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:45
GNERoute::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERoute.cpp:483
SUMO_TAG_ROUTE
begin/end of the description of a route
Definition: SUMOXMLDefinitions.h:126
Parameterised::clearParameter
void clearParameter()
Clears the parameter map.
Definition: Parameterised.cpp:99
config.h
GNERoute::GNERoutePopupMenu
class used in GUIGLObjectPopupMenu for routes
Definition: GNERoute.h:47
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:968
StringTokenizer.h
GNERoute::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNERoute.cpp:378
MID_GNE_ROUTE_APPLY_DISTANCE
apply distance
Definition: GUIAppEnum.h:933
GNESelectorFrame::LockGLObjectTypes::removeLockedObject
void removeLockedObject(const GUIGlObjectType type)
set object unselected
Definition: GNESelectorFrame.cpp:574
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1165
GNEUndoList
Definition: GNEUndoList.h:49
MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:371
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEHierarchicalElementParents::changeEdgeParents
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
Definition: GNEHierarchicalElementParents.cpp:340
GNERoute::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNERoute.cpp:533
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
GNEHierarchicalElementChildren::getDemandElementChildren
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementChildren.cpp:297
GNEUndoList::p_begin
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:73
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
SUMO_TAG_EMBEDDEDROUTE
begin/end of the description of a embedded route (used in NETEDIT)
Definition: SUMOXMLDefinitions.h:128
NBNode.h
PositionVector::area
double area() const
Returns the area (0 for non-closed)
Definition: PositionVector.cpp:502
GNERoute::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNERoute.cpp:120
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:164
GNERoute::GNERoute
GNERoute(GNEViewNet *viewNet)
default constructor
Definition: GNERoute.cpp:80
GNERoute::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNERoute.cpp:522
GNEChange_Attribute.h
GNERoute::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNERoute.cpp:223
GNENet.h
GUISelectedStorage::deselect
void deselect(GUIGlID id)
Deselects the object with the given id.
Definition: GUISelectedStorage.cpp:131
GNEViewNet::getViewParent
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
GLO_EMBEDDEDROUTE
a embedded route
Definition: GUIGlObjectTypes.h:118
GNESelectorFrame::getLockGLObjectTypes
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition: GNESelectorFrame.cpp:460
GNERoute::getColor
const RGBColor & getColor() const
get color
Definition: GNERoute.cpp:229
GNEUndoList.h
NBEdge::getTurnDestination
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:3116
GNESelectorFrame::LockGLObjectTypes::addedLockedObject
void addedLockedObject(const GUIGlObjectType type)
set object selected
Definition: GNESelectorFrame.cpp:568