SUMO - Simulation of Urban MObility
GNEEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A road/street connecting two junctions (netedit-version, adapted from GUIEdge)
8 // Basically a container for an NBEdge with drawing and editing capabilities
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <vector>
33 #include <cmath>
34 #include <string>
35 #include <algorithm>
39 #include <utils/geom/GeomHelper.h>
42 #include <utils/gui/div/GLHelper.h>
44 #include "GNEEdge.h"
45 #include "GNENet.h"
46 #include "GNEViewNet.h"
47 #include "GNEUndoList.h"
48 #include "GNEChange_Attribute.h"
49 #include "GNEChange_Lane.h"
50 #include "GNEJunction.h"
51 #include "GNELane.h"
52 #include "GNEAdditional.h"
53 #include "GNEConnection.h"
54 
55 
56 #ifdef CHECK_MEMORY_LEAKS
57 #include <foreign/nvwa/debug_new.h>
58 #endif // CHECK_MEMORY_LEAKS
59 
60 
61 
62 // ===========================================================================
63 // static
64 // ===========================================================================
66 
67 // ===========================================================================
68 // members methods
69 // ===========================================================================
70 GNEEdge::GNEEdge(NBEdge& nbe, GNENet* net, bool wasSplit, bool loaded):
71  GNENetElement(net, nbe.getID(), GLO_EDGE, SUMO_TAG_EDGE, ICON_EDGE),
72  myNBEdge(nbe) ,
73  myGNEJunctionSource(myNet->retrieveJunction(myNBEdge.getFromNode()->getID())),
74  myGNEJunctionDestiny(myNet->retrieveJunction(myNBEdge.getToNode()->getID())),
75  myOrigShape(nbe.getInnerGeometry()),
76  myLanes(0),
77  myAmResponsible(false),
78  myWasSplit(wasSplit),
79  myConnectionStatus(loaded ? LOADED : GUESSED) {
80  // Create lanes
81  int numLanes = myNBEdge.getNumLanes();
82  myLanes.reserve(numLanes);
83  for (int i = 0; i < numLanes; i++) {
84  myLanes.push_back(new GNELane(*this, i));
85  myLanes.back()->incRef("GNEEdge::GNEEdge");
86  }
87 }
88 
89 
91  // Delete edges
92  for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
93  (*i)->decRef("GNEEdge::~GNEEdge");
94  if ((*i)->unreferenced()) {
95  delete *i;
96  }
97  }
98  // delete connections
99  for (ConnectionVector::const_iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); ++i) {
100  (*i)->decRef("GNEEdge::~GNEEdge");
101  if ((*i)->unreferenced()) {
102  delete(*i);
103  }
104  }
105  if (myAmResponsible) {
106  delete &myNBEdge;
107  }
108 }
109 
110 
111 void
113  // Update geometry of lanes
114  for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
115  (*i)->updateGeometry();
116  }
117  // Update geometry of additionals vinculated to this edge
118  for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); ++i) {
119  (*i)->updateGeometry();
120  }
121 }
122 
123 
124 Boundary
126  Boundary ret;
127  for (LaneVector::const_iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
128  ret.add((*i)->getBoundary());
129  }
130  ret.grow(10); // !!! magic value
131  return ret;
132 }
133 
134 
135 Boundary
137  Boundary b = getBoundary();
138  b.grow(20);
139  return b;
140 }
141 
142 
145  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
146  buildPopupHeader(ret, app);
150  buildPositionCopyEntry(ret, false);
151  return ret;
152 }
153 
154 
157  return myGNEJunctionSource;
158 }
159 
160 
163  return myGNEJunctionDestiny;
164 }
165 
166 void
168  /* do something different for connectors?
169  if (myNBEdge.isMacroscopicConnector()) {
170  }
171  */
172 
173  // draw the lanes
174  for (LaneVector::const_iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
175  (*i)->drawGL(s);
176  }
177 
178  // draw the connections
179  if (s.scale >= 2) {
180  for (ConnectionVector::const_iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); ++i) {
181  (*i)->drawGL(s);
182  }
183  }
184 
185  // draw geometry hints
186  if (s.scale * SNAP_RADIUS > 1.) { // check whether it is not too small
187  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
188  if (gSelected.isSelected(getType(), getGlID()) && s.laneColorer.getActive() != 1) {
189  // override with special colors (unless the color scheme is based on selection)
190  GLHelper::setColor(GNENet::selectionColor.changedBrightness(-20));
191  }
192  // recognize full transparency and simply don't draw
193  GLfloat color[4];
194  glGetFloatv(GL_CURRENT_COLOR, color);
195  if (color[3] > 0) {
196  glPushName(getGlID());
198  for (int i = 1; i < (int)geom.size() - 1; i++) {
199  Position pos = geom[i];
200  glPushMatrix();
201  glTranslated(pos.x(), pos.y(), GLO_JUNCTION - 0.01);
203  glPopMatrix();
204  }
205  glPopName();
206  }
207  }
208 
209  // (optionally) draw the name and/or the street name
210  const bool drawStreetName = s.streetName.show && myNBEdge.getStreetName() != "";
211  if (s.edgeName.show || drawStreetName) {
212  glPushName(getGlID());
213  GNELane* lane1 = myLanes[0];
214  GNELane* lane2 = myLanes[myLanes.size() - 1];
215  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
216  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.));
217  p.mul(.5);
218  SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
219  angle += 90;
220  if (angle > 90 && angle < 270) {
221  angle -= 180;
222  }
223  if (s.edgeName.show) {
224  drawName(p, s.scale, s.edgeName, angle);
225  }
226  if (drawStreetName) {
228  s.streetName.size / s.scale, s.streetName.color, angle);
229  }
230  glPopName();
231  }
232 }
233 
234 
238  GUIParameterTableWindow* ret = 0;
239  UNUSED_PARAMETER(&app);
240  return ret;
241 }
242 
243 
244 void
246  Position delta = junction->getNBNode()->getPosition() - origPos;
248  // geometry endpoint need not equal junction position hence we modify it with delta
249  if (junction == myGNEJunctionSource) {
250  geom[0].add(delta);
251  } else {
252  geom[-1].add(delta);
253  }
254  setGeometry(geom, false);
255 }
256 
257 NBEdge*
259  return &myNBEdge;
260 }
261 
262 
263 Position
264 GNEEdge::getSplitPos(const Position& clickPos) {
265  const PositionVector& geom = myNBEdge.getGeometry();
266  int index = geom.indexOfClosest(clickPos);
267  if (geom[index].distanceTo(clickPos) < SNAP_RADIUS) {
268  // split at existing geometry point
269  return geom[index];
270  } else {
271  // split straight between the next two points
272  return geom.positionAtOffset(geom.nearest_offset_to_point2D(clickPos));
273  }
274 }
275 
276 
277 Position
278 GNEEdge::moveGeometry(const Position& oldPos, const Position& newPos, bool relative) {
280  bool changed = changeGeometry(geom, getMicrosimID(), oldPos, newPos, relative);
281  if (changed) {
282  setGeometry(geom, false);
283  return newPos;
284  } else {
285  return oldPos;
286  }
287 }
288 
289 
290 bool
291 GNEEdge::changeGeometry(PositionVector& geom, const std::string& id, const Position& oldPos, const Position& newPos, bool relative, bool moveEndPoints) {
292  if (geom.size() < 2) {
293  throw ProcessError("Invalid geometry size in " + toString(SUMO_TAG_EDGE) + " with ID='" + id + "'");
294  } else {
295  int index = geom.indexOfClosest(oldPos);
296  const SUMOReal nearestOffset = geom.nearest_offset_to_point2D(oldPos, true);
297  if (nearestOffset != GeomHelper::INVALID_OFFSET
298  && (moveEndPoints || (nearestOffset >= SNAP_RADIUS
299  && nearestOffset <= geom.length2D() - SNAP_RADIUS))) {
300  const Position nearest = geom.positionAtOffset2D(nearestOffset);
301  const SUMOReal distance = geom[index].distanceTo2D(nearest);
302  if (distance < SNAP_RADIUS) { //move existing
303  if (moveEndPoints || (index != 0 && index != (int)geom.size() - 1)) {
304  const bool closed = geom.isClosed();
305  if (relative) {
306  geom[index] = geom[index] + newPos;
307  } else {
308  geom[index] = newPos;
309  }
310  if (closed && moveEndPoints && (index == 0 || index == (int)geom.size() - 1)) {
311  const int otherIndex = (int)geom.size() - 1 - index;
312  geom[otherIndex] = geom[index];
313  }
314  return true;
315  }
316  } else {
317  if (relative) {
318  int index = geom.insertAtClosest(nearest);
319  geom[index] = geom[index] + newPos;
320  return true;
321  } else {
322  geom.insertAtClosest(newPos); // insert new
323  return true;
324  }
325  }
326  }
327  return false;
328  }
329 }
330 
331 
332 void
335  if (geom.size() == 0) {
336  return;
337  }
338  geom.add(delta.x(), delta.y(), delta.z());
339  setGeometry(geom, true);
340 }
341 
342 
343 bool
346  if (geom.size() == 0) {
347  return false;
348  }
349  int index = geom.indexOfClosest(pos);
350  if (geom[index].distanceTo(pos) < SNAP_RADIUS) {
351  geom.erase(geom.begin() + index);
352  setAttribute(SUMO_ATTR_SHAPE, toString(geom), undoList);
353  return true;
354  } else {
355  return false;
356  }
357 }
358 
359 
360 void
362  undoList->p_begin("set endpoint");
364  int index = geom.indexOfClosest(pos);
365  if (geom[index].distanceTo(pos) < SNAP_RADIUS) { // snap to existing geometry
366  pos = geom[index];
367  }
370  if (pos.distanceTo2D(destPos) < pos.distanceTo2D(sourcePos)) {
371  setAttribute(GNE_ATTR_SHAPE_END, toString(pos), undoList);
373  } else {
374  setAttribute(GNE_ATTR_SHAPE_START, toString(pos), undoList);
376  }
377  // possibly existing inner point is no longer needed
378  deleteGeometry(pos, undoList);
379  undoList->p_end();
380 }
381 
382 
383 void
387  if (pos.distanceTo2D(destPos) < pos.distanceTo2D(sourcePos)) {
388  setAttribute(GNE_ATTR_SHAPE_END, toString(destPos), undoList);
390  } else {
391  setAttribute(GNE_ATTR_SHAPE_START, toString(sourcePos), undoList);
393  }
394 }
395 
396 
397 void
399  myNBEdge.setGeometry(geom, inner);
400  updateGeometry();
403  myNet->refreshElement(this);
404 }
405 
406 void
408  for (std::vector<GNEEdge*>::const_iterator i = myGNEJunctionSource->getGNEIncomingEdges().begin(); i != myGNEJunctionSource->getGNEIncomingEdges().end(); i++) {
409  (*i)->remakeGNEConnections();
410  }
411 }
412 
413 void
415  // @note: this method may only be called once the whole network is initialized
416  // Create connections (but reuse existing objects)
417  std::vector<NBEdge::Connection>& myConnections = myNBEdge.getConnections();
418  ConnectionVector newCons;
419  for (std::vector<NBEdge::Connection>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
420  const NBEdge::Connection& con = *i;
421  newCons.push_back(retrieveConnection(con.fromLane, con.toEdge, con.toLane));
422  newCons.back()->incRef("GNEEdge::GNEEdge");
423  newCons.back()->updateLinkState();
424  //std::cout << " remakeGNEConnection " << newCons.back()->getNBConnection() << "\n";
425  }
427  myGNEConnections = newCons;
428 }
429 
430 
431 void
433  // Drop all existents connections that aren't referenced anymore
434  for (ConnectionVector::iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); i++) {
435  // Dec reference of connection
436  (*i)->decRef("GNEEdge::clearGNEConnections");
437  // Delete GNEConnectionToErase if is unreferenced
438  if ((*i)->unreferenced()) {
439  delete(*i);
440  }
441  }
442  myGNEConnections.clear();
443 }
444 
445 
446 void
448  undoList->p_begin("copy template");
456  // copy lane attributes as well
457  for (int i = 0; i < (int)myLanes.size(); i++) {
458  myLanes[i]->setAttribute(SUMO_ATTR_ALLOW, tpl->myLanes[i]->getAttribute(SUMO_ATTR_ALLOW), undoList);
459  myLanes[i]->setAttribute(SUMO_ATTR_DISALLOW, tpl->myLanes[i]->getAttribute(SUMO_ATTR_DISALLOW), undoList);
460  myLanes[i]->setAttribute(SUMO_ATTR_SPEED, tpl->myLanes[i]->getAttribute(SUMO_ATTR_SPEED), undoList);
461  myLanes[i]->setAttribute(SUMO_ATTR_WIDTH, tpl->myLanes[i]->getAttribute(SUMO_ATTR_WIDTH), undoList);
462  myLanes[i]->setAttribute(SUMO_ATTR_ENDOFFSET, tpl->myLanes[i]->getAttribute(SUMO_ATTR_ENDOFFSET), undoList);
463  }
464  undoList->p_end();
465 }
466 
467 
468 std::set<GUIGlID>
470  std::set<GUIGlID> result;
471  for (size_t i = 0; i < myLanes.size(); i++) {
472  result.insert(myLanes[i]->getGlID());
473  }
474  return result;
475 }
476 
477 
478 const std::vector<GNELane*>&
480  return myLanes;
481 }
482 
483 
484 const std::vector<GNEConnection*>&
486  return myGNEConnections;
487 }
488 
489 
490 bool
492  return myWasSplit;
493 }
494 
495 
496 std::string
498  switch (key) {
499  case SUMO_ATTR_ID:
500  return getMicrosimID();
501  case SUMO_ATTR_FROM:
503  case SUMO_ATTR_TO:
505  case SUMO_ATTR_NUMLANES:
506  return toString(myNBEdge.getNumLanes());
507  case SUMO_ATTR_PRIORITY:
508  return toString(myNBEdge.getPriority());
509  case SUMO_ATTR_LENGTH:
510  return toString(myNBEdge.getFinalLength());
511  case SUMO_ATTR_TYPE:
512  return myNBEdge.getTypeID();
513  case SUMO_ATTR_SHAPE:
517  case SUMO_ATTR_NAME:
518  return myNBEdge.getStreetName();
519  case SUMO_ATTR_ALLOW:
520  // return all allowed classes (may differ from the written attributes)
522  (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : ""));
523  case SUMO_ATTR_DISALLOW: {
524  // return classes disallowed on at least one lane (may differ from the written attributes)
525  SVCPermissions combinedDissallowed = 0;
526  for (int i = 0; i < (int)myNBEdge.getNumLanes(); ++i) {
527  combinedDissallowed |= ~myNBEdge.getPermissions(i);
528  }
529  return (getVehicleClassNames(combinedDissallowed) +
530  (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : ""));
531  }
532  case SUMO_ATTR_SPEED:
534  return "lane specific";
535  } else {
536  return toString(myNBEdge.getSpeed());
537  }
538  case SUMO_ATTR_WIDTH:
540  return "lane specific";
542  return "default";
543  } else {
544  return toString(myNBEdge.getLaneWidth());
545  }
546  case SUMO_ATTR_ENDOFFSET:
548  return "lane specific";
549  } else {
550  return toString(myNBEdge.getEndOffset());
551  }
553  return myConnectionStatus;
555  return toString(myNBEdge.getGeometry()[0]);
556  case GNE_ATTR_SHAPE_END:
557  return toString(myNBEdge.getGeometry()[-1]);
558  default:
559  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
560  }
561 }
562 
563 
564 void
565 GNEEdge::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
566  switch (key) {
567  case SUMO_ATTR_WIDTH:
568  case SUMO_ATTR_ENDOFFSET:
569  case SUMO_ATTR_SPEED:
570  case SUMO_ATTR_ALLOW:
571  case SUMO_ATTR_DISALLOW: {
572  undoList->p_begin("change " + toString(getTag()) + " attribute");
573  const std::string origValue = getAttribute(key); // will have intermediate value of "lane specific"
574  // lane specific attributes need to be changed via lanes to allow undo
575  for (LaneVector::iterator it = myLanes.begin(); it != myLanes.end(); it++) {
576  (*it)->setAttribute(key, value, undoList);
577  }
578  // ensure that the edge value is also changed. Actually this sets the lane attributes again but it does not matter
579  undoList->p_add(new GNEChange_Attribute(this, key, value, true, origValue));
580  undoList->p_end();
581  break;
582  }
583  case SUMO_ATTR_FROM: {
584  undoList->p_begin("change " + toString(getTag()) + " attribute");
585  undoList->p_add(new GNEChange_Attribute(this, key, value));
586  myGNEJunctionSource->setLogicValid(false, undoList);
587  myNet->retrieveJunction(value)->setLogicValid(false, undoList);
590  undoList->p_end();
591  break;
592  }
593  case SUMO_ATTR_TO: {
594  undoList->p_begin("change " + toString(getTag()) + " attribute");
595  undoList->p_add(new GNEChange_Attribute(this, key, value));
596  myGNEJunctionDestiny->setLogicValid(false, undoList);
597  myNet->retrieveJunction(value)->setLogicValid(false, undoList);
600  undoList->p_end();
601  break;
602  }
603  case SUMO_ATTR_ID:
604  case SUMO_ATTR_PRIORITY:
605  case SUMO_ATTR_LENGTH:
606  case SUMO_ATTR_TYPE:
610  case GNE_ATTR_SHAPE_END:
611  undoList->p_add(new GNEChange_Attribute(this, key, value));
612  break;
613  case SUMO_ATTR_NAME:
614  // user cares about street names. Make sure they appear in the output
616  OptionsCont::getOptions().set("output.street-names", "true");
617  undoList->p_add(new GNEChange_Attribute(this, key, value));
618  break;
619  case SUMO_ATTR_NUMLANES:
620  if (value != getAttribute(key)) {
621  setNumLanes(parse<int>(value), undoList);
622  }
623  break;
624  case SUMO_ATTR_SHAPE:
625  // @note: assumes value of inner geometry!
626  // actually the geometry is already updated (incrementally
627  // during mouse movement). We set the restore point to the end
628  // of the last change-set
630  undoList->p_add(new GNEChange_Attribute(this, key, value));
631  break;
632  default:
633  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
634  }
635 }
636 
637 
638 bool
639 GNEEdge::isValid(SumoXMLAttr key, const std::string& value) {
640  switch (key) {
641  case SUMO_ATTR_ID:
642  return isValidID(value) && myNet->retrieveEdge(value, false) == 0;
643  break;
644  case SUMO_ATTR_FROM:
645  return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != myGNEJunctionDestiny->getMicrosimID();
646  break;
647  case SUMO_ATTR_TO:
648  return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != myGNEJunctionSource->getMicrosimID();
649  break;
650  case SUMO_ATTR_SPEED:
651  return isPositive<SUMOReal>(value);
652  break;
653  case SUMO_ATTR_NUMLANES:
654  return isPositive<int>(value);
655  break;
656  case SUMO_ATTR_PRIORITY:
657  return canParse<int>(value);
658  break;
659  case SUMO_ATTR_LENGTH:
660  return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) == NBEdge::UNSPECIFIED_LOADED_LENGTH);
661  break;
662  case SUMO_ATTR_ALLOW:
663  case SUMO_ATTR_DISALLOW:
664  return canParseVehicleClasses(value);
665  break;
666  case SUMO_ATTR_TYPE:
667  return true;
668  break;
669  case SUMO_ATTR_SHAPE: {
670  bool ok = true;
671  PositionVector shape = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, true);
672  return ok;
673  break;
674  }
677  break;
678  case SUMO_ATTR_NAME:
679  return true;
680  break;
681  case SUMO_ATTR_WIDTH:
682  if (value == "default") {
683  return true;
684  } else {
685  return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) == NBEdge::UNSPECIFIED_WIDTH);
686  }
687  break;
688  case SUMO_ATTR_ENDOFFSET:
689  return canParse<SUMOReal>(value);
690  break;
691  default:
692  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
693  }
694 }
695 
696 
697 void
699  myAmResponsible = newVal;
700 }
701 
702 // ===========================================================================
703 // private
704 // ===========================================================================
705 
706 void
707 GNEEdge::setAttribute(SumoXMLAttr key, const std::string& value) {
708  switch (key) {
709  case SUMO_ATTR_ID:
710  myNet->renameEdge(this, value);
711  break;
712  case SUMO_ATTR_FROM:
714  // update this edge of list of outgoings edges of the old GNEJunctionSource
716  // update GNEJunctionSource
718  // update this edge of list of outgoings edges of the new GNEJunctionSource
720  break;
721  case SUMO_ATTR_TO:
723  // update this edge of list of incomings edges of the old GNEJunctionDestiny
725  // update GNEJunctionDestiny
727  // update this edge of list of incomings edges of the new GNEJunctionDestiny
729  break;
730  case SUMO_ATTR_NUMLANES:
731  throw InvalidArgument("GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen");
732  break;
733  case SUMO_ATTR_PRIORITY:
734  myNBEdge.myPriority = parse<int>(value);
735  break;
736  case SUMO_ATTR_LENGTH:
737  myNBEdge.setLoadedLength(parse<SUMOReal>(value));
738  break;
739  case SUMO_ATTR_TYPE:
740  myNBEdge.myType = value;
741  break;
742  case SUMO_ATTR_SHAPE:
743  bool ok;
744  myOrigShape = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, true);
745  setGeometry(myOrigShape, true);
746  break;
749  break;
750  case SUMO_ATTR_NAME:
751  myNBEdge.setStreetName(value);
752  break;
753  case SUMO_ATTR_SPEED:
754  myNBEdge.setSpeed(-1, parse<SUMOReal>(value));
755  break;
756  case SUMO_ATTR_WIDTH:
757  if (value == "default") {
759  } else {
760  myNBEdge.setLaneWidth(-1, parse<SUMOReal>(value));
761  }
762  break;
763  case SUMO_ATTR_ENDOFFSET:
764  myNBEdge.setEndOffset(-1, parse<SUMOReal>(value));
765  break;
766  case SUMO_ATTR_ALLOW:
767  break; // no edge value
768  case SUMO_ATTR_DISALLOW:
769  break; // no edge value
771  myConnectionStatus = value;
772  if (value == GUESSED) {
775  } else if (value != GUESSED) {
777  }
778  break;
779  case GNE_ATTR_SHAPE_START: {
781  geom.erase(geom.begin());
782  geom.push_front_noDoublePos(GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]);
783  setGeometry(geom, false);
784  break;
785  }
786  case GNE_ATTR_SHAPE_END: {
788  geom.pop_back();
789  geom.push_back_noDoublePos(GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]);
790  setGeometry(geom, false);
791  break;
792  }
793  default:
794  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
795  }
796 }
797 
798 
799 void
800 GNEEdge::setNumLanes(int numLanes, GNEUndoList* undoList) {
801  undoList->p_begin("change number of " + toString(SUMO_TAG_LANE) + "s");
802  myGNEJunctionSource->setLogicValid(false, undoList);
803  myGNEJunctionDestiny->setLogicValid(false, undoList);
804 
805  const int oldNumLanes = (int)myLanes.size();
806  for (int i = oldNumLanes; i < numLanes; i++) {
807  // since the GNELane does not exist yet, it cannot have yet been referenced so we only pass a zero-pointer
808  undoList->add(new GNEChange_Lane(this, 0,
809  myNBEdge.getLaneStruct(oldNumLanes - 1), true), true);
810  }
811  for (int i = oldNumLanes - 1; i > numLanes - 1; i--) {
812  // delete leftmost lane
813  undoList->add(new GNEChange_Lane(this, myLanes[i], myNBEdge.getLaneStruct(i), false), true);
814  }
815  undoList->p_end();
816 }
817 
818 
819 void
820 GNEEdge::addLane(GNELane* lane, const NBEdge::Lane& laneAttrs) {
821  const int index = lane ? lane->getIndex() : myNBEdge.getNumLanes();
822  // the laneStruct must be created first to ensure we have some geometry
823  myNBEdge.addLane(index);
824  if (lane) {
825  // restore a previously deleted lane
826  myLanes.insert(myLanes.begin() + index, lane);
827 
828  } else {
829  // create a new lane by copying leftmost lane
830  lane = new GNELane(*this, index);
831  myLanes.push_back(lane);
832  }
833  lane->incRef("GNEEdge::addLane");
834  // we copy all attributes except shape since this is recomputed from edge shape
835  myNBEdge.setSpeed(lane->getIndex(), laneAttrs.speed);
836  myNBEdge.setPermissions(laneAttrs.permissions, lane->getIndex());
838  myNBEdge.setEndOffset(lane->getIndex(), laneAttrs.endOffset);
839  myNBEdge.setLaneWidth(lane->getIndex(), laneAttrs.width);
840  // udate indices
841  for (int i = 0; i < (int)myLanes.size(); ++i) {
842  myLanes[i]->setIndex(i);
843  }
844  /* while technically correct, this looks ugly
845  myGNEJunctionSource->invalidateShape();
846  myGNEJunctionDestiny->invalidateShape();
847  */
848  // Remake connections for this edge and all edges that target this lane
851  // Update element
852  myNet->refreshElement(this);
853  updateGeometry();
854 }
855 
856 
857 void
859  if (myLanes.size() == 0) {
860  throw ProcessError("Should not remove the last " + toString(SUMO_TAG_LANE) + " from an " + toString(getTag()));
861  }
862  if (lane == 0) {
863  lane = myLanes.back();
864  }
865  // Delete lane of edge's container
866  myNBEdge.deleteLane(lane->getIndex());
867  lane->decRef("GNEEdge::removeLane");
868  myLanes.erase(myLanes.begin() + lane->getIndex());
869  // Delete lane if is unreferenced
870  if (lane->unreferenced()) {
871  delete lane;
872  }
873  // udate indices
874  for (int i = 0; i < (int)myLanes.size(); ++i) {
875  myLanes[i]->setIndex(i);
876  }
877  /* while technically correct, this looks ugly
878  myGNEJunctionSource->invalidateShape();
879  myGNEJunctionDestiny->invalidateShape();
880  */
881  // Remake connections for this edge and all edges that target this lane
884 
885  // Update element
886  myNet->refreshElement(this);
887  updateGeometry();
888 }
889 
890 void
892  // If a new connection was sucesfully created
893  if (myNBEdge.setConnection(nbCon.fromLane, nbCon.toEdge, nbCon.toLane, NBEdge::L2L_USER, true, nbCon.mayDefinitelyPass, nbCon.keepClear, nbCon.contPos, nbCon.visibility)) {
894  // Create GNEConection
895  con->updateGeometry();
896  myGNEConnections.push_back(con);
897  // Add reference
898  myGNEConnections.back()->incRef("GNEEdge::addConnection");
899  }
900  myNet->refreshElement(this); // actually we only do this to force a redraw
901 }
902 
903 
904 void
906 
907  if (nbCon.toEdge == myNBEdge.getTurnDestination()) {
909  }
910  // Get connection to remove
911  GNEConnection* con = retrieveConnection(nbCon.fromLane, nbCon.toEdge, nbCon.toLane);
913  if (!con->unreferenced()) {
914  con->decRef("GNEEdge::removeConnection");
915  myGNEConnections.erase(std::find(myGNEConnections.begin(), myGNEConnections.end(), con));
916  myNet->refreshElement(this); // actually we only do this to force a redraw
917  }
918 }
919 
920 
922 GNEEdge::retrieveConnection(int fromLane, NBEdge* to, int toLane) {
923  for (ConnectionVector::iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); ++i) {
924  if ((*i)->getFromLaneIndex() == fromLane
925  && (*i)->getEdgeTo()->getNBEdge() == to
926  && (*i)->getToLaneIndex() == toLane) {
927  return *i;
928  }
929  }
930  return new GNEConnection(myLanes[fromLane], myNet->retrieveEdge(to->getID())->getLanes()[toLane]);
931 }
932 
933 
934 
935 void
936 GNEEdge::setMicrosimID(const std::string& newID) {
938  for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
939  (*i)->setMicrosimID(getNBEdge()->getLaneID((*i)->getIndex()));
940  }
941 }
942 
943 
944 void
946  // First check that additional wasn't already inserted
947  if (std::find(myAdditionals.begin(), myAdditionals.end(), additional) != myAdditionals.end()) {
948  throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' was already inserted in " + toString(getTag()) + " with ID='" + getID() + "'");
949  } else {
950  myAdditionals.push_back(additional);
951  }
952 }
953 
954 
955 void
957  // First check that additional was already inserted
958  AdditionalVector::iterator it = std::find(myAdditionals.begin(), myAdditionals.end(), additional);
959  if (it == myAdditionals.end()) {
960  throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' doesn't exist in " + toString(getTag()) + " with ID='" + getID() + "'");
961  } else {
962  myAdditionals.erase(it);
963  }
964 }
965 
966 
967 const std::vector<GNEAdditional*>&
969  return myAdditionals;
970 }
971 
972 
973 bool
975  for (std::vector<GNELane*>::const_iterator i = myLanes.begin(); i != myLanes.end(); i++) {
976  if ((*i)->isRestricted(vclass)) {
977  return true;
978  }
979  }
980  return false;
981 }
982 
983 /****************************************************************************/
void addLane(GNELane *lane, const NBEdge::Lane &laneAttrs)
increase number of lanes by one use the given attributes and restore the GNELane
Definition: GNEEdge.cpp:820
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
Definition: GNEEdge.cpp:447
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
Definition: NBEdge.cpp:1148
GNEJunction * myGNEJunctionSource
pointer to GNEJunction source
Definition: GNEEdge.h:248
The information about how to spread the lanes from the given position.
void updateGeometry()
update pre-computed geometry information
void remakeGNEConnections()
remake connections
Definition: GNEEdge.cpp:414
void addConnection(NBEdge::Connection nbCon, GNEConnection *con)
adds a connection
Definition: GNEEdge.cpp:891
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:946
SUMOReal endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:141
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:157
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
void setNumLanes(int numLanes, GNEUndoList *undoList)
changes the number of lanes. When reducing the number of lanes, higher-numbered lanes are removed fir...
Definition: GNEEdge.cpp:800
int toLane
The lane the connections yields in.
Definition: NBEdge.h:182
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:732
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:244
GUIVisualizationTextSettings streetName
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:156
void resetWritable()
Resets all options to be writeable.
GNENet * myNet
the net to inform about updates
bool myAmResponsible
whether we are responsible for deleting myNBNode
Definition: GNEEdge.h:263
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void invalidateShape()
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:179
begin/end of the description of a single lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
std::string myConnectionStatus
modification status of the connections
Definition: GNEEdge.h:269
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:133
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
Definition: GNENet.cpp:806
GNEJunction * myGNEJunctionDestiny
pointer to GNEJunction destiny
Definition: GNEEdge.h:251
bool hasString(const std::string &str) const
PositionVector myOrigShape
restore point for undo
Definition: GNEEdge.h:254
void setMicrosimID(const std::string &newID)
override to also set lane ids
Definition: GNEEdge.cpp:936
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1679
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2664
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
Definition: GNEEdge.cpp:469
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2719
GUIColorer laneColorer
The lane colorer.
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
Stores the information about how to visualize structures.
int SVCPermissions
The representation of a single edge during network building.
Definition: NBEdge.h:71
void declareConnectionsAsLoaded()
declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has ...
Definition: NBEdge.h:1137
Position moveGeometry(const Position &oldPos, const Position &newPos, bool relative=false)
change the edge geometry It is up to the Edge to decide whether an new geometry node should be genera...
Definition: GNEEdge.cpp:278
const std::vector< T > & getSchemes() const
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:974
NBNode * getNBNode() const
Return net build node.
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:530
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEEdge.cpp:497
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:512
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:87
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
Definition: NBEdge.cpp:2735
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
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:86
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:191
void clearGNEConnections()
clear current connections
Definition: GNEEdge.cpp:432
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const std::vector< GNEConnection * > & getGNEConnections()
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:485
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return list of additionals associated with this edge
Definition: GNEEdge.cpp:968
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:460
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1123
bool isClosed() const
check if PositionVector is closed
bool myWasSplit
whether this edge was created from a split
Definition: GNEEdge.h:266
~GNEEdge()
Destructor.
Definition: GNEEdge.cpp:90
first coordinate of edge shape
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
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.
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge&#39;s geometry
Definition: NBEdge.cpp:499
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:659
GUIGlID getGlID() const
Returns the numerical id of the object.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
whether a feature has been loaded,guessed,modified or approved
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEEdge.cpp:236
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEEdge.cpp:167
SUMOReal speed
The speed allowed on this lane.
Definition: NBEdge.h:132
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:194
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GUIVisualizationTextSettings edgeName
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:344
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:124
const std::string & getID() const
Returns the id.
Definition: Named.h:66
SUMOReal length2D() const
Returns the length.
static bool isValidID(const std::string &value)
true if value is a valid sumo ID
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
Definition: NBEdge.h:135
void addLane(int index, bool recompute=true)
add lane
Definition: NBEdge.cpp:2556
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:480
void push_front_noDoublePos(const Position &p)
insert in front a non double position
void addAdditionalChild(GNEAdditional *additional)
add additional child to this edge
Definition: GNEEdge.cpp:945
const Position & getPosition() const
Definition: NBNode.h:232
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:1657
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:409
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:443
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:138
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:176
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:93
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void deleteLane(int index, bool recompute=true)
delete lane
Definition: NBEdge.cpp:2591
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:719
A list of positions.
void add(SUMOReal xoff, SUMOReal yoff, SUMOReal zoff)
int indexOfClosest(const Position &p) const
index of the closest position to p
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
Definition: NBEdge.cpp:1643
friend class GNEChange_Attribute
declare friend class
AdditionalVector myAdditionals
list with the additonals vinculated with this edge
Definition: GNEEdge.h:272
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GNEEdge.cpp:125
SUMOReal z() const
Returns the z-position.
Definition: Position.h:73
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:402
SUMOReal contPos
custom position for internal junction on this connection
Definition: NBEdge.h:197
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
int myPriority
The priority of the edge.
Definition: NBEdge.h:1334
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEEdge.cpp:136
edge: the shape in xml-definition
GUIColorer junctionColorer
The junction colorer.
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
int insertAtClosest(const Position &p)
inserts p between the two closest positions and returns the insertion index
const std::string getID() const
function to support debugging
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
draw name of item
void setLoadedLength(SUMOReal val)
set loaded lenght
Definition: NBEdge.cpp:2778
void incRef(const std::string &debugMsg="")
The connection was given by the user.
Definition: NBEdge.h:115
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false)
Removes the specified connection(s)
Definition: NBEdge.cpp:1100
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
void removeLane(GNELane *lane)
the number of lanes by one. argument is only used to increase robustness (assertions) ...
Definition: GNEEdge.cpp:858
SUMOReal getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:537
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEEdge.cpp:144
void decRef(const std::string &debugMsg="")
begin/end of the description of an edge
void setGeometry(PositionVector geom, bool inner)
update edge geometry and inform the lanes
Definition: GNEEdge.cpp:398
GNEEdge(NBEdge &nbe, GNENet *net, bool wasSplit=false, bool loaded=false)
Constructor.
Definition: GNEEdge.cpp:70
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2763
ConnectionVector myGNEConnections
vector with the connections of this edge
Definition: GNEEdge.h:260
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
Definition: GNEEdge.cpp:698
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:238
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:423
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:583
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:479
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
bool deleteGeometry(const Position &pos, GNEUndoList *undoList)
deletes the closest geometry node within SNAP_RADIUS.
Definition: GNEEdge.cpp:344
void add(SUMOReal x, SUMOReal y, SUMOReal z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:90
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
static const SUMOReal UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:259
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
Definition: NBEdge.cpp:2749
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:584
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
void updateJunctionPosition(GNEJunction *junction, const Position &origPos)
update edge geometry after junction move
Definition: GNEEdge.cpp:245
void updateGeometry()
update pre-computed geometry information
Definition: GNEEdge.cpp:112
The popup menu of a globject.
an edge
static const SUMOReal SNAP_RADIUS
Definition: GNEEdge.h:239
void mul(SUMOReal val)
Multiplies both positions with the given value.
Definition: Position.h:113
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
std::string myType
The type of the edge.
Definition: NBEdge.h:1318
void renameEdge(GNEEdge *edge, const std::string &newID)
updates the map and reserves new id
Definition: GNENet.cpp:1095
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNEEdge.cpp:639
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:653
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
Definition: GNENet.cpp:1141
LaneVector myLanes
vectgor with the lanes of this edge
Definition: GNEEdge.h:257
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:250
SumoXMLTag getTag() const
get XML Tag assigned to this object
void removeConnection(NBEdge::Connection nbCon)
removes a connection
Definition: GNEEdge.cpp:905
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1668
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2703
#define SUMOReal
Definition: config.h:208
static const std::string GUESSED
feature has been reguessed (may still be unchanged be we can&#39;t tell (yet)
last coordinate of edge shape
void setEndpoint(Position pos, GNEUndoList *undoList)
makes pos the new geometry endpoint at the appropriate end
Definition: GNEEdge.cpp:361
void push_back_noDoublePos(const Position &p)
insert in back a non double position
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
static const RGBColor selectionColor
color of selection
Definition: GNENet.h:96
empty max
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this edge
Definition: GNEEdge.cpp:956
GNEConnection * retrieveConnection(int fromLane, NBEdge *to, int toLane)
get connection
Definition: GNEEdge.cpp:922
NBEdge & myNBEdge
the underlying NBEdge
Definition: GNEEdge.h:245
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:496
SUMOReal getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:2978
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:258
const SUMOReal SUMO_const_halfLaneWidth
Definition: StdDefs.h:49
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:689
std::vector< GNEConnection * > ConnectionVector
Definition of the connection&#39;s vector.
Definition: GNEEdge.h:65
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEEdge.cpp:565
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:525
GUISelectedStorage gSelected
A global holder of selected objects.
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:810
void resetEndpoint(const Position &pos, GNEUndoList *undoList)
restores the endpoint to the junction position at the appropriate end
Definition: GNEEdge.cpp:384
A window containing a gl-object&#39;s parameter.
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
Definition: GNENet.cpp:1104
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:2527
bool wasSplit()
whether this edge was created from a split
Definition: GNEEdge.cpp:491
bool setConnection(int lane, NBEdge *destEdge, int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, SUMOReal contPos=UNSPECIFIED_CONTPOS, SUMOReal visibility=UNSPECIFIED_VISIBILITY_DISTANCE)
Adds a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:867
Position getSplitPos(const Position &clickPos)
Definition: GNEEdge.cpp:264
friend class GNEChange_Lane
Friend class.
Definition: GNEEdge.h:57
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occured errors.
static bool changeGeometry(PositionVector &geom, const std::string &id, const Position &oldPos, const Position &newPos, bool relative=false, bool moveEndPoints=false)
Definition: GNEEdge.cpp:291
SUMOReal width
This lane&#39;s width.
Definition: NBEdge.h:144
static const SUMOReal INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
Definition: GeomHelper.h:59
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void remakeIncomingGNEConnections()
remake connections of all incoming edges
Definition: GNEEdge.cpp:407
SUMOReal visibility
custom foe visiblity for connection
Definition: NBEdge.h:200
a junction
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:162
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:416