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 {}, {}, {}, {}, {}, {}, {}, {}, {}, {}),
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 /****************************************************************************/
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
static bool isRouteValid(const std::vector< GNEEdge *> &edges, bool report)
check if a route is valid
Copy object name - popup entry.
Definition: GUIAppEnum.h:369
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNERoute.cpp:378
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNERoute.cpp:459
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNERoute.cpp:434
void addedLockedObject(const GUIGlObjectType type)
set object selected
Position getPositionInView() const
Returns position of additional in view.
Definition: GNERoute.cpp:350
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
struct for saving route parameters
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNERoute.cpp:147
Stores the information about how to visualize structures.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
const RGBColor & getColor() const
get color
Definition: GNERoute.cpp:229
The representation of a single edge during network building.
Definition: NBEdge.h:86
bool geometryDeprecated
mark geometry as deprecated (used to avoid multiple updates)
void startGeometryMoving()
Definition: GNERoute.cpp:241
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
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...
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
FXIcon * getIcon() const
get FXIcon associated to this AC
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:3116
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
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:644
GUISUMOAbstractView * myParent
The parent window.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[]
void changeDemandElementID(const std::string &newID)
change ID of demand element
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool hasNext()
returns the information whether further substrings exist
long onCmdApplyDistance(FXObject *, FXSelector, void *)
Called to modify edge distance values along the route.
Definition: GNERoute.cpp:62
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute) ...
Definition: GNERoute.cpp:591
generic attribute
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
begin/end of the description of a route
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNERoute.cpp:259
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNERoute.cpp:217
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNERoute.cpp:501
double area() const
Returns the area (0 for non-closed)
void endGeometryMoving()
end geometry movement
Definition: GNERoute.cpp:247
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNERoute.cpp:415
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:933
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:465
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
DemandElementSegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry
A list of positions.
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeLockedObject(const GUIGlObjectType type)
set object unselected
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNERoute.cpp:399
friend class GNEChange_Attribute
declare friend class
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
void calculatePartialShapeRotationsAndLengths()
calculate partial shape, rotations and lengths
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
const std::string & getDemandElementID() const
returns DemandElement ID
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children) ...
Definition: GNERoute.cpp:205
~GNERoute()
destructor
Definition: GNERoute.cpp:116
~GNERoutePopupMenu()
Destructor.
Definition: GNERoute.cpp:58
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void insertEdgeSegment(const GNEDemandElement *element, const GNEEdge *edge, const Position pos, const bool visible, const bool valid)
insert edge segment
void clearDemandElementSegmentGeometry()
clear demand element geometry
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
Definition: GNERoute.h:253
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3441
vehicle is a passenger car (a "normal" car)
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
bool areEdgesConsecutives(SUMOVehicleClass vClass, GNEEdge *from, GNEEdge *to) const
check if exist a route between the two given consecutives edges
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:2143
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNEEdge * getFromEdge() const
Definition: GNERoute.cpp:211
static const RGBColor YELLOW
Definition: RGBColor.h:193
void deselect(GUIGlID id)
Deselects the object with the given id.
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
a embedded route
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNERoute.cpp:120
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
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNERoute.cpp:533
const std::string & getTagStr() const
get tag assigned to this object in string format
element is selected
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
The popup menu of a globject.
class used in GUIGLObjectPopupMenu for routes
Definition: GNERoute.h:47
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNERoute.cpp:522
void updateGeometry()
update pre-computed geometry information
Definition: GNERoute.cpp:265
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:379
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNERoute.cpp:223
Parameterised()
Constructor.
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
begin/end of the description of a embedded route (used in NETEDIT)
GUIGlID getGlID() const
Returns the numerical id of the object.
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1127
GNERoute(GNEViewNet *viewNet)
default constructor
Definition: GNERoute.cpp:80
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNERoute.cpp:489
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNERoute.cpp:362
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:79
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERoute.cpp:483
RGBColor myColor
route color
Definition: GNERoute.h:250
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
GUIGlObject * myObject
The object that belongs to this popup-menu.
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNERoute.cpp:495
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
void compute()
compute demand element
Definition: GNERoute.cpp:235
GUISelectedStorage gSelected
A global holder of selected objects.
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:371
A color information.
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc.)
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNERoute.cpp:384
void insertJunctionSegment(const GNEDemandElement *element, const GNEJunction *junction, const Position pos, const bool visible, const bool valid)
insert junction segment
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNERoute.cpp:507
std::string getParentName() const
Returns the name of the parent object.
Definition: GNERoute.cpp:356
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNERoute.cpp:253
void clearParameter()
Clears the parameter map.