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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing routes in Netedit
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEUndoList.h>
24 #include <netedit/GNEViewNet.h>
27 #include <utils/gui/div/GLHelper.h>
30 
31 #include "GNERoute.h"
32 
33 // ===========================================================================
34 // FOX callback mapping
35 // ===========================================================================
36 FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[] = {
38 };
39 
40 // Object implementation
41 FXIMPLEMENT(GNERoute::GNERoutePopupMenu, GUIGLObjectPopupMenu, GNERoutePopupMenuMap, ARRAYNUMBER(GNERoutePopupMenuMap))
42 
43 // ===========================================================================
44 // GNERoute::GNERoutePopupMenu - methods
45 // ===========================================================================
46 
48  GUIGLObjectPopupMenu(app, parent, o) {
49 }
50 
51 
53 
54 
55 long
56 GNERoute::GNERoutePopupMenu::onCmdApplyDistance(FXObject*, FXSelector, void*) {
57  GNERoute* route = static_cast<GNERoute*>(myObject);
58  GNEUndoList* undoList = route->myNet->getViewNet()->getUndoList();
59  undoList->p_begin("apply distance along route");
60  double dist = (route->getParentEdges().size() > 0) ? route->getParentEdges().front()->getNBEdge()->getDistance() : 0;
61  for (GNEEdge* edge : route->getParentEdges()) {
62  undoList->p_add(new GNEChange_Attribute(edge, SUMO_ATTR_DISTANCE, toString(dist), edge->getAttribute(SUMO_ATTR_DISTANCE)));
63  dist += edge->getNBEdge()->getFinalLength();
64  }
65  undoList->p_end();
66  return 1;
67 }
68 
69 // ===========================================================================
70 // GNERoute - methods
71 // ===========================================================================
72 
74  GNEDemandElement(net->generateDemandElementID(SUMO_TAG_ROUTE), net, GLO_ROUTE, SUMO_TAG_ROUTE,
75 {}, {}, {}, {}, {}, {}, {}, {}),
77 myColor(RGBColor::YELLOW),
78 myVClass(SVC_PASSENGER) {
79  // compute route
80  computePath();
81 }
82 
83 
85  GNEDemandElement(routeParameters.routeID, net, GLO_ROUTE, SUMO_TAG_ROUTE,
86 {}, routeParameters.edges, {}, {}, {}, {}, {}, {}),
87 Parameterised(routeParameters.parameters),
88 myColor(routeParameters.color),
89 myVClass(routeParameters.vClass) {
90  // compute route
91  computePath();
92 }
93 
94 
95 GNERoute::GNERoute(GNENet* net, GNEDemandElement* vehicleParent, const GNERouteHandler::RouteParameter& routeParameters) :
97 {}, routeParameters.edges, {}, {}, {}, {}, {vehicleParent}, {}),
98 Parameterised(routeParameters.parameters),
99 myColor(routeParameters.color),
100 myVClass(routeParameters.vClass) {
101  // compute route
102  computePath();
103 }
104 
105 
107  GNEDemandElement(route, route->getNet(), GLO_ROUTE, SUMO_TAG_ROUTE,
108 {}, route->getParentEdges(), {}, {}, {}, {}, {}, {}),
109 Parameterised(),
110 myColor(route->getColor()),
111 myVClass(route->getVClass()) {
112  // compute route
113  computePath();
114 }
115 
116 
118 
119 
122  GUIGLObjectPopupMenu* ret = new GNERoutePopupMenu(app, parent, *this);
123  // build header
124  buildPopupHeader(ret, app);
125  // build menu command for center button and copy cursor position to clipboard
127  buildPositionCopyEntry(ret, false);
128  // buld menu commands for names
129  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
130  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
131  new FXMenuSeparator(ret);
132  // build selection and show parameters menu
135  // show option to open demand element dialog
136  if (myTagProperty.hasDialog()) {
137  GUIDesigns::buildFXMenuCommand(ret, "Open " + getTagStr() + " Dialog", getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
138  new FXMenuSeparator(ret);
139  }
140  GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
141  new FXMenuSeparator(ret);
142  GUIDesigns::buildFXMenuCommand(ret, "Apply distance along route", nullptr, ret, MID_GNE_ROUTE_APPLY_DISTANCE);
143  return ret;
144 }
145 
146 
147 void
149  device.openTag(SUMO_TAG_ROUTE);
152  // write extra attributes depending if is an embedded route
154  device.writeAttr(SUMO_ATTR_ID, getID());
155  // write stops associated to this route
156  for (const auto& stop : getChildDemandElements()) {
157  if (stop->getTagProperty().isStop()) {
158  stop->writeDemandElement(device);
159  }
160  }
161  }
162  // write parameters
163  writeParams(device);
164  // close tag
165  device.closeTag();
166 }
167 
168 
169 bool
171  if ((getParentEdges().size() == 2) && (getParentEdges().at(0) == getParentEdges().at(1))) {
172  // from and to are the same edges, then return true
173  return true;
174  } else if (getParentEdges().size() > 0) {
175  // check that exist a connection between every edge
176  return isRouteValid(getParentEdges()).empty();
177  } else {
178  return false;
179  }
180 }
181 
182 
183 std::string
185  // return string with the problem obtained from isRouteValid
186  return isRouteValid(getParentEdges());
187 }
188 
189 
190 void
192  // currently the only solution is removing Route
193 }
194 
195 
198  return myVClass;
199 }
200 
201 
202 const RGBColor&
204  return myColor;
205 }
206 
207 
208 void
210  // Routes cannot be moved
211 }
212 
213 
214 void
216  // Routes cannot be moved
217 }
218 
219 
220 void
222  // Routes cannot be moved
223 }
224 
225 
226 void
228  // Routes cannot be moved
229 }
230 
231 
232 void
234  // declare extreme geometry
235  GNEGeometry::ExtremeGeometry extremeGeometry;
236  // calculate edge geometry path using path
238  // update child demand elementss
239  for (const auto& i : getChildDemandElements()) {
240  if (!i->getTagProperty().isPersonStop() && !i->getTagProperty().isStop()) {
241  i->updateGeometry();
242  }
243  }
244 }
245 
246 
247 void
249  // calculate consecutive path using parent edges
251  // update geometry
252  updateGeometry();
253 }
254 
255 
256 void
258  // due routes don't need to calculate a dijkstra path, just calculate consecutive path lanes again
260  // update geometry
261  updateGeometry();
262 }
263 
264 
265 Position
267  return Position();
268 }
269 
270 
271 std::string
273  return getParentEdges().front()->getID();
274 }
275 
276 
277 Boundary
279  Boundary routeBoundary;
280  // return the combination of all parent edges's boundaries
281  for (const auto& i : getParentEdges()) {
282  routeBoundary.add(i->getCenteringBoundary());
283  }
284  // check if is valid
285  if (routeBoundary.isInitialised()) {
286  return routeBoundary;
287  } else {
288  return Boundary(-0.1, -0.1, 0.1, 0.1);
289  }
290 }
291 
292 
293 void
294 GNERoute::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
295  // obtain new list of route edges
296  std::string newRouteEdges = getNewListOfParents(originalElement, newElement);
297  // update route edges
298  if (newRouteEdges.size() > 0) {
299  setAttribute(SUMO_ATTR_EDGES, newRouteEdges, undoList);
300  }
301 }
302 
303 
304 void
306  // Routes are drawn in drawPartialGL
307 }
308 
309 
310 void
311 GNERoute::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const {
312  // check if route can be drawn
316  // get route width
317  const double routeWidth = s.vehicleSize.getExaggeration(s, this) * s.widthSettings.route;
318  // obtain color
320  // Start drawing adding an gl identificator
321  glPushName(getGlID());
322  // Add a draw matrix
323  glPushMatrix();
324  // Start with the drawing of the area traslating matrix to origin
326  // iterate over segments
327  for (const auto& segment : myDemandElementSegmentGeometry) {
328  // draw partial segment
329  if (segment.isLaneSegment() && (segment.getLane() == lane)) {
330  // Set route color (needed due drawShapeDottedContour)
331  GLHelper::setColor(routeColor);
332  // draw box lines
333  GNEGeometry::drawSegmentGeometry(myNet->getViewNet(), segment, routeWidth);
334  }
335  }
336  // Pop last matrix
337  glPopMatrix();
338  // Draw name if isn't being drawn for selecting
339  if (!s.drawForRectangleSelection) {
340  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
341  }
342  // Pop name
343  glPopName();
344  // check if shape dotted contour has to be drawn
346  // get first and last allowed lanes
347  const GNELane* firstLane = getFirstAllowedVehicleLane();
348  const GNELane* lastLane = getLastAllowedVehicleLane();
349  // iterate over segments
350  for (const auto& segment : myDemandElementSegmentGeometry) {
351  if (segment.isLaneSegment() && (segment.getLane() == lane)) {
352  // draw partial segment
353  if (firstLane == lane) {
354  // draw front dotted contour
355  GNEGeometry::drawDottedContourLane(GNEGeometry::DottedContourType::INSPECT, s, GNEGeometry::DottedGeometry(s, segment.getShape(), false), routeWidth, true, false);
356  } else if (lastLane == lane) {
357  // draw back dotted contour
358  GNEGeometry::drawDottedContourLane(GNEGeometry::DottedContourType::INSPECT, s, GNEGeometry::DottedGeometry(s, segment.getShape(), false), routeWidth, false, true);
359  } else {
360  // draw dotted contour
362  }
363  }
364  }
365  }
366  }
367 }
368 
369 
370 void
371 GNERoute::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const {
372  // only drawn in super mode demand
375  // calculate width
376  const double width = s.vehicleSize.getExaggeration(s, this) * s.widthSettings.route;
377  // obtain lane2lane geometry
378  const GNEGeometry::Geometry& lane2laneGeometry = fromLane->getLane2laneConnections().getLane2laneGeometry(toLane);
379  // Start drawing adding an gl identificator
380  glPushName(getGlID());
381  // Add a draw matrix
382  glPushMatrix();
383  // Start with the drawing of the area traslating matrix to origin
384  glTranslated(0, 0, getType() + offsetFront);
385  // Set color of the base
386  if (drawUsingSelectColor()) {
388  } else {
390  }
391  // draw lane2lane
392  GNEGeometry::drawGeometry(myNet->getViewNet(), lane2laneGeometry, width);
393  // Pop last matrix
394  glPopMatrix();
395  // Pop name
396  glPopName();
397  // check if shape dotted contour has to be drawn
399  // draw lane2lane dotted geometry
400  if (fromLane->getLane2laneConnections().exist(toLane)) {
402  }
403  }
404  }
405 }
406 
407 
408 std::string
410  switch (key) {
411  case SUMO_ATTR_ID:
412  return getID();
413  case SUMO_ATTR_EDGES:
414  return parseIDs(getParentEdges());
415  case SUMO_ATTR_COLOR:
416  return toString(myColor);
417  case GNE_ATTR_SELECTED:
419  case GNE_ATTR_PARAMETERS:
420  return getParametersStr();
421  default:
422  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
423  }
424 }
425 
426 
427 double
429  return 0;
430 }
431 
432 
433 void
434 GNERoute::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
435  if (value == getAttribute(key)) {
436  return; //avoid needless changes, later logic relies on the fact that attributes have changed
437  }
438  switch (key) {
439  case SUMO_ATTR_ID:
440  case SUMO_ATTR_EDGES:
441  case SUMO_ATTR_COLOR:
442  case GNE_ATTR_SELECTED:
443  case GNE_ATTR_PARAMETERS:
444  undoList->p_add(new GNEChange_Attribute(this, key, value));
445  break;
446  default:
447  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
448  }
449 }
450 
451 
452 bool
453 GNERoute::isValid(SumoXMLAttr key, const std::string& value) {
454  switch (key) {
455  case SUMO_ATTR_ID:
456  return isValidDemandElementID(value);
457  case SUMO_ATTR_EDGES:
458  if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
459  // all edges exist, then check if compounds a valid route
460  return isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
461  } else {
462  return false;
463  }
464  case SUMO_ATTR_COLOR:
465  return canParse<RGBColor>(value);
466  case GNE_ATTR_SELECTED:
467  return canParse<bool>(value);
468  case GNE_ATTR_PARAMETERS:
469  return Parameterised::areParametersValid(value);
470  default:
471  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
472  }
473 }
474 
475 
476 void
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 const std::map<std::string, std::string>&
508  return getParametersMap();
509 }
510 
511 
512 std::string
513 GNERoute::isRouteValid(const std::vector<GNEEdge*>& edges) {
514  if (edges.size() == 0) {
515  // routes cannot be empty
516  return ("list of route edges cannot be empty");
517  } else if (edges.size() == 1) {
518  // routes with a single edge are valid, then return an empty string
519  return ("");
520  } else {
521  // iterate over edges to check that compounds a chain
522  auto it = edges.begin();
523  while (it != edges.end() - 1) {
524  const GNEEdge* currentEdge = *it;
525  const GNEEdge* nextEdge = *(it + 1);
526  // same consecutive edges aren't allowed
527  if (currentEdge->getID() == nextEdge->getID()) {
528  return ("consecutive duplicated edges (" + currentEdge->getID() + ") aren't allowed in a route");
529  }
530  // obtain outgoing edges of currentEdge
531  const std::vector<GNEEdge*>& outgoingEdges = currentEdge->getParentJunctions().back()->getGNEOutgoingEdges();
532  // check if nextEdge is in outgoingEdges
533  if (std::find(outgoingEdges.begin(), outgoingEdges.end(), nextEdge) == outgoingEdges.end()) {
534  return ("Edges '" + currentEdge->getID() + "' and '" + nextEdge->getID() + "' aren't consecutives");
535  }
536  it++;
537  }
538  // all edges consecutives, then return an empty string
539  return ("");
540  }
541 }
542 
543 // ===========================================================================
544 // private
545 // ===========================================================================
546 
547 void
548 GNERoute::setAttribute(SumoXMLAttr key, const std::string& value) {
549  switch (key) {
550  case SUMO_ATTR_ID:
551  myNet->getAttributeCarriers()->updateID(this, value);
552  break;
553  case SUMO_ATTR_EDGES:
555  // compute route
556  updateGeometry();
557  break;
558  case SUMO_ATTR_COLOR:
559  myColor = parse<RGBColor>(value);
560  break;
561  case GNE_ATTR_SELECTED:
562  if (parse<bool>(value)) {
564  } else {
566  }
567  break;
568  case GNE_ATTR_PARAMETERS:
569  setParametersStr(value);
570  break;
571  default:
572  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
573  }
574 }
575 
576 
577 void
578 GNERoute::setEnabledAttribute(const int /*enabledAttributes*/) {
579  //
580 }
581 
582 
583 /****************************************************************************/
FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[]
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:403
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:411
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:401
@ MID_GNE_ROUTE_APPLY_DISTANCE
apply distance
Definition: GUIAppEnum.h:1081
@ GLO_ROUTE
a route
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_DISTANCE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:215
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:446
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
FXIcon * getIcon() const
get FXIcon associated to this AC
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
An Element which don't belongs to GNENet but has influency in the simulation.
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry (also called "stacked geometry")
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
class for pack all variables related with DottedGeometry
Definition: GNEGeometry.h:187
class for NETEDIT geometries over lanes
Definition: GNEGeometry.h:76
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GNEGeometry::Geometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
const GNEGeometry::DottedGeometry & getLane2laneDottedGeometry(const GNELane *toLane) const
get lane2lane dotted geometry
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
const GNEGeometry::DottedGeometry & getDottedLaneGeometry() const
get dotted lane geometry
Definition: GNELane.cpp:135
const GNEGeometry::Lane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:774
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
const std::string & getID() const
get ID
void calculateConsecutivePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, const std::vector< GNEEdge * > &edges)
calculate consecutive path lanes (used by routes)
const std::vector< GNEPathElements::PathElement > & getPath() const
get path edges
class used in GUIGLObjectPopupMenu for routes
Definition: GNERoute.h:43
~GNERoutePopupMenu()
Destructor.
Definition: GNERoute.cpp:52
long onCmdApplyDistance(FXObject *, FXSelector, void *)
Called to modify edge distance values along the route.
Definition: GNERoute.cpp:56
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNERoute.cpp:501
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNERoute.cpp:578
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNERoute.cpp:191
void endGeometryMoving()
end geometry movement
Definition: GNERoute.cpp:215
void computePath()
compute path
Definition: GNERoute.cpp:248
Position getPositionInView() const
Returns position of additional in view.
Definition: GNERoute.cpp:266
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
Definition: GNERoute.h:261
std::string getParentName() const
Returns the name of the parent object.
Definition: GNERoute.cpp:272
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNERoute.cpp:495
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNERoute.cpp:409
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNERoute.cpp:221
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
Definition: GNERoute.cpp:311
void invalidatePath()
invalidate path
Definition: GNERoute.cpp:257
void updateGeometry()
update pre-computed geometry information
Definition: GNERoute.cpp:233
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNERoute.cpp:170
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNERoute.cpp:121
void startGeometryMoving()
Definition: GNERoute.cpp:209
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNERoute.cpp:507
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNERoute.cpp:294
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERoute.cpp:477
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNERoute.cpp:428
SUMOVehicleClass getVClass() const
Definition: GNERoute.cpp:197
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNERoute.cpp:483
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNERoute.cpp:278
GNERoute(GNENet *net)
default constructor
Definition: GNERoute.cpp:73
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNERoute.cpp:453
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNERoute.cpp:305
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition: GNERoute.cpp:513
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:434
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNERoute.cpp:184
RGBColor myColor
route color
Definition: GNERoute.h:258
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNERoute.cpp:148
~GNERoute()
destructor
Definition: GNERoute.cpp:117
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNERoute.cpp:489
const RGBColor & getColor() const
get color
Definition: GNERoute.cpp:203
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNERoute.cpp:227
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
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:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:491
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:479
GNEUndoList * getUndoList() const
get the undoList object
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:485
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationSizeSettings vehicleSize
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationWidthSettings widthSettings
width settings
bool drawDottedContour() const
check if dotted contour can be drawn
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
Definition: Parameterised.h:39
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
static const RGBColor YELLOW
Definition: RGBColor.h:183
struct for variables used in Geometry extremes
Definition: GNEGeometry.h:58
static void drawDottedContourLane(const DottedContourType type, const GUIVisualizationSettings &s, const DottedGeometry &dottedGeometry, const double width, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given dottedGeometry (used by lanes, routes, etc.)
static void calculateLaneGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const std::vector< GNEPathElements::PathElement > &path, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between lanes
static void drawSegmentGeometry(const GNEViewNet *viewNet, const SegmentGeometry::Segment &segment, const double width)
draw geometry segment
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
struct for saving route parameters
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
bool showDemandElements() const
check if show demand elements checkbox is enabled
RGBColor selectedRouteColor
route selection color (used for routes and vehicle stops)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
static const double route
width for routes