SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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-2016 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 "GNEAdditionalSet.h"
54 #include "GNEConnection.h"
55 
56 
57 #ifdef CHECK_MEMORY_LEAKS
58 #include <foreign/nvwa/debug_new.h>
59 #endif // CHECK_MEMORY_LEAKS
60 
61 
62 
63 // ===========================================================================
64 // static
65 // ===========================================================================
67 
68 // ===========================================================================
69 // members methods
70 // ===========================================================================
71 GNEEdge::GNEEdge(NBEdge& nbe, GNENet* net, bool wasSplit, bool loaded):
72  GNENetElement(net, nbe.getID(), GLO_EDGE, SUMO_TAG_EDGE),
73  myNBEdge(nbe) ,
74  myOrigShape(nbe.getInnerGeometry()),
75  myLanes(0),
76  myAmResponsible(false),
77  myWasSplit(wasSplit),
78  myConnectionStatus(loaded ? LOADED : GUESSED) {
79  // Create lanes
80  int numLanes = myNBEdge.getNumLanes();
81  myLanes.reserve(numLanes);
82  for (int i = 0; i < numLanes; i++) {
83  myLanes.push_back(new GNELane(*this, i));
84  myLanes.back()->incRef("GNEEdge::GNEEdge");
85  }
86 }
87 
88 
90  // Delete edges
91  for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
92  (*i)->decRef("GNEEdge::~GNEEdge");
93  if ((*i)->unreferenced()) {
94  delete *i;
95  }
96  }
97  // delete connections
98  for (ConnectionVector::const_iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); ++i) {
99  (*i)->decRef("GNEEdge::~GNEEdge");
100  if ((*i)->unreferenced()) {
101  delete(*i);
102  }
103  }
104  if (myAmResponsible) {
105  delete &myNBEdge;
106  }
107 }
108 
109 
110 void
112  // Update geometry of lanes
113  for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
114  (*i)->updateGeometry();
115  }
116  // Update geometry of additionals vinculated to this edge
117  for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); ++i) {
118  (*i)->updateGeometry();
119  }
120  // Update geometry of additionalSets vinculated to this edge
121  for (AdditionalSetVector::iterator i = myAdditionalSets.begin(); i != myAdditionalSets.end(); ++i) {
122  (*i)->updateGeometry();
123  }
124 }
125 
126 
127 Boundary
129  Boundary ret;
130  for (LaneVector::const_iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
131  ret.add((*i)->getBoundary());
132  }
133  ret.grow(10); // !!! magic value
134  return ret;
135 }
136 
137 
138 Boundary
140  Boundary b = getBoundary();
141  b.grow(20);
142  return b;
143 }
144 
145 
148  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
149  buildPopupHeader(ret, app);
153  buildPositionCopyEntry(ret, false);
154  return ret;
155 }
156 
157 
160  return myNet->retrieveJunction(myNBEdge.getFromNode()->getID(), false);
161 }
162 
163 
166  return myNet->retrieveJunction(myNBEdge.getToNode()->getID(), false);
167 }
168 
169 void
171  /* do something different for connectors?
172  if (myNBEdge.isMacroscopicConnector()) {
173  }
174  */
175 
176  // draw the lanes
177  for (LaneVector::const_iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
178  (*i)->drawGL(s);
179  }
180 
181  // draw the connections
182  if (s.scale >= 2) {
183  for (ConnectionVector::const_iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); ++i) {
184  (*i)->drawGL(s);
185  }
186  }
187 
188  // draw geometry hints
189  if (s.scale * SNAP_RADIUS > 1.) { // check whether it is not too small
190  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
191  if (gSelected.isSelected(getType(), getGlID()) && s.laneColorer.getActive() != 1) {
192  // override with special colors (unless the color scheme is based on selection)
193  GLHelper::setColor(GNENet::selectionColor.changedBrightness(-20));
194  }
195  // recognize full transparency and simply don't draw
196  GLfloat color[4];
197  glGetFloatv(GL_CURRENT_COLOR, color);
198  if (color[3] > 0) {
199  glPushName(getGlID());
201  for (int i = 1; i < (int)geom.size() - 1; i++) {
202  Position pos = geom[i];
203  glPushMatrix();
204  glTranslated(pos.x(), pos.y(), GLO_JUNCTION - 0.01);
206  glPopMatrix();
207  }
208  glPopName();
209  }
210  }
211 
212  // (optionally) draw the name and/or the street name
213  const bool drawStreetName = s.streetName.show && myNBEdge.getStreetName() != "";
214  if (s.edgeName.show || drawStreetName) {
215  glPushName(getGlID());
216  GNELane* lane1 = myLanes[0];
217  GNELane* lane2 = myLanes[myLanes.size() - 1];
218  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
219  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.));
220  p.mul(.5);
221  SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
222  angle += 90;
223  if (angle > 90 && angle < 270) {
224  angle -= 180;
225  }
226  if (s.edgeName.show) {
227  drawName(p, s.scale, s.edgeName, angle);
228  }
229  if (drawStreetName) {
231  s.streetName.size / s.scale, s.streetName.color, angle);
232  }
233  glPopName();
234  }
235 }
236 
237 
241  GUIParameterTableWindow* ret = 0;
242  UNUSED_PARAMETER(&app);
243  return ret;
244 }
245 
246 
247 void
249  Position delta = junction->getNBNode()->getPosition() - origPos;
251  // geometry endpoint need not equal junction position hence we modify it with delta
252  if (junction == getGNEJunctionSource()) {
253  geom[0].add(delta);
254  } else {
255  geom[-1].add(delta);
256  }
257  setGeometry(geom, false);
258 }
259 
260 NBEdge*
262  return &myNBEdge;
263 }
264 
265 
266 Position
267 GNEEdge::getSplitPos(const Position& clickPos) {
268  const PositionVector& geom = myNBEdge.getGeometry();
269  int index = geom.indexOfClosest(clickPos);
270  if (geom[index].distanceTo(clickPos) < SNAP_RADIUS) {
271  // split at existing geometry point
272  return geom[index];
273  } else {
274  // split straight between the next two points
275  return geom.positionAtOffset(geom.nearest_offset_to_point2D(clickPos));
276  }
277 }
278 
279 
280 Position
281 GNEEdge::moveGeometry(const Position& oldPos, const Position& newPos, bool relative) {
283  bool changed = changeGeometry(geom, getMicrosimID(), oldPos, newPos, relative);
284  if (changed) {
285  setGeometry(geom, false);
286  return newPos;
287  } else {
288  return oldPos;
289  }
290 }
291 
292 
293 bool
294 GNEEdge::changeGeometry(PositionVector& geom, const std::string& id, const Position& oldPos, const Position& newPos, bool relative, bool moveEndPoints) {
295  if (geom.size() < 2) {
296  throw ProcessError("Invalid geometry size in edge " + id);
297  } else {
298  int index = geom.indexOfClosest(oldPos);
299  const SUMOReal nearestOffset = geom.nearest_offset_to_point2D(oldPos, true);
300  if (nearestOffset != GeomHelper::INVALID_OFFSET
301  && (moveEndPoints || (nearestOffset >= SNAP_RADIUS
302  && nearestOffset <= geom.length2D() - SNAP_RADIUS))) {
303  const Position nearest = geom.positionAtOffset2D(nearestOffset);
304  const SUMOReal distance = geom[index].distanceTo2D(nearest);
305  if (distance < SNAP_RADIUS) { //move existing
306  if (moveEndPoints || (index != 0 && index != (int)geom.size() - 1)) {
307  const bool closed = geom.isClosed();
308  if (relative) {
309  geom[index] = geom[index] + newPos;
310  } else {
311  geom[index] = newPos;
312  }
313  if (closed && moveEndPoints && (index == 0 || index == (int)geom.size() - 1)) {
314  const int otherIndex = (int)geom.size() - 1 - index;
315  geom[otherIndex] = geom[index];
316  }
317  return true;
318  }
319  } else {
320  if (relative) {
321  int index = geom.insertAtClosest(nearest);
322  geom[index] = geom[index] + newPos;
323  return true;
324  } else {
325  geom.insertAtClosest(newPos); // insert new
326  return true;
327  }
328  }
329  }
330  return false;
331  }
332 }
333 
334 
335 void
338  if (geom.size() == 0) {
339  return;
340  }
341  geom.add(delta.x(), delta.y(), delta.z());
342  setGeometry(geom, true);
343 }
344 
345 
346 bool
349  if (geom.size() == 0) {
350  return false;
351  }
352  int index = geom.indexOfClosest(pos);
353  if (geom[index].distanceTo(pos) < SNAP_RADIUS) {
354  geom.erase(geom.begin() + index);
355  setAttribute(SUMO_ATTR_SHAPE, toString(geom), undoList);
356  return true;
357  } else {
358  return false;
359  }
360 }
361 
362 
363 void
365  undoList->p_begin("set endpoint");
367  int index = geom.indexOfClosest(pos);
368  if (geom[index].distanceTo(pos) < SNAP_RADIUS) { // snap to existing geometry
369  pos = geom[index];
370  }
373  if (pos.distanceTo2D(destPos) < pos.distanceTo2D(sourcePos)) {
374  setAttribute(GNE_ATTR_SHAPE_END, toString(pos), undoList);
376  } else {
377  setAttribute(GNE_ATTR_SHAPE_START, toString(pos), undoList);
379  }
380  // possibly existing inner point is no longer needed
381  deleteGeometry(pos, undoList);
382  undoList->p_end();
383 }
384 
385 
386 void
390  if (pos.distanceTo2D(destPos) < pos.distanceTo2D(sourcePos)) {
391  setAttribute(GNE_ATTR_SHAPE_END, toString(destPos), undoList);
393  } else {
394  setAttribute(GNE_ATTR_SHAPE_START, toString(sourcePos), undoList);
396  }
397 }
398 
399 
400 void
402  myNBEdge.setGeometry(geom, inner);
403  updateGeometry();
406  myNet->refreshElement(this);
407 }
408 
409 void
412  assert(from);
413  std::vector<GNEEdge*> incomingEdges = from->getGNEIncomingEdges();
414  for (std::vector<GNEEdge*>::iterator i = incomingEdges.begin(); i != incomingEdges.end(); i++) {
415  (*i)->remakeGNEConnections();
416  }
417 }
418 
419 void
421  // @note: this method may only be called once the whole network is initialized
422  // Create connections (but reuse existing objects)
423  std::vector<NBEdge::Connection>& myConnections = myNBEdge.getConnections();
424  ConnectionVector newCons;
425  for (std::vector<NBEdge::Connection>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
426  const NBEdge::Connection& con = *i;
427  newCons.push_back(retrieveConnection(con.fromLane, con.toEdge, con.toLane));
428  newCons.back()->incRef("GNEEdge::GNEEdge");
429  newCons.back()->updateLinkState();
430  //std::cout << " remakeGNEConnection " << newCons.back()->getNBConnection() << "\n";
431  }
433  myGNEConnections = newCons;
434 }
435 
436 
437 void
439  // Drop all existents connections that aren't referenced anymore
440  for (ConnectionVector::iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); i++) {
441  // Dec reference of connection
442  (*i)->decRef("GNEEdge::clearGNEConnections");
443  // Delete GNEConnectionToErase if is unreferenced
444  if ((*i)->unreferenced()) {
445  delete(*i);
446  }
447  }
448  myGNEConnections.clear();
449 }
450 
451 
452 void
454  undoList->p_begin("copy template");
462  // copy lane attributes as well
463  for (int i = 0; i < (int)myLanes.size(); i++) {
464  myLanes[i]->setAttribute(SUMO_ATTR_ALLOW, tpl->myLanes[i]->getAttribute(SUMO_ATTR_ALLOW), undoList);
465  myLanes[i]->setAttribute(SUMO_ATTR_DISALLOW, tpl->myLanes[i]->getAttribute(SUMO_ATTR_DISALLOW), undoList);
466  myLanes[i]->setAttribute(SUMO_ATTR_SPEED, tpl->myLanes[i]->getAttribute(SUMO_ATTR_SPEED), undoList);
467  myLanes[i]->setAttribute(SUMO_ATTR_WIDTH, tpl->myLanes[i]->getAttribute(SUMO_ATTR_WIDTH), undoList);
468  myLanes[i]->setAttribute(SUMO_ATTR_ENDOFFSET, tpl->myLanes[i]->getAttribute(SUMO_ATTR_ENDOFFSET), undoList);
469  }
470  undoList->p_end();
471 }
472 
473 
474 std::set<GUIGlID>
476  std::set<GUIGlID> result;
477  for (size_t i = 0; i < myLanes.size(); i++) {
478  result.insert(myLanes[i]->getGlID());
479  }
480  return result;
481 }
482 
483 
484 const std::vector<GNELane*>&
486  return myLanes;
487 }
488 
489 
490 const std::vector<GNEConnection*>&
492  return myGNEConnections;
493 }
494 
495 
496 bool
498  return myWasSplit;
499 }
500 
501 
502 std::string
504  switch (key) {
505  case SUMO_ATTR_ID:
506  return getMicrosimID();
507  case SUMO_ATTR_FROM:
509  case SUMO_ATTR_TO:
510  return getGNEJunctionDest()->getMicrosimID();
511  case SUMO_ATTR_NUMLANES:
512  return toString(myNBEdge.getNumLanes());
513  case SUMO_ATTR_PRIORITY:
514  return toString(myNBEdge.getPriority());
515  case SUMO_ATTR_LENGTH:
516  return toString(myNBEdge.getFinalLength());
517  case SUMO_ATTR_TYPE:
518  return myNBEdge.getTypeID();
519  case SUMO_ATTR_SHAPE:
523  case SUMO_ATTR_NAME:
524  return myNBEdge.getStreetName();
525  case SUMO_ATTR_ALLOW:
526  // return all allowed classes (may differ from the written attributes)
528  (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : ""));
529  case SUMO_ATTR_DISALLOW: {
530  // return classes disallowed on at least one lane (may differ from the written attributes)
531  SVCPermissions combinedDissallowed = 0;
532  for (int i = 0; i < (int)myNBEdge.getNumLanes(); ++i) {
533  combinedDissallowed |= ~myNBEdge.getPermissions(i);
534  }
535  return (getVehicleClassNames(combinedDissallowed) +
536  (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : ""));
537  }
538  case SUMO_ATTR_SPEED:
540  return "lane specific";
541  } else {
542  return toString(myNBEdge.getSpeed());
543  }
544  case SUMO_ATTR_WIDTH:
546  return "lane specific";
547  } else {
548  return toString(myNBEdge.getLaneWidth());
549  }
550  case SUMO_ATTR_ENDOFFSET:
552  return "lane specific";
553  } else {
554  return toString(myNBEdge.getEndOffset());
555  }
557  return myConnectionStatus;
559  return toString(myNBEdge.getGeometry()[0]);
560  case GNE_ATTR_SHAPE_END:
561  return toString(myNBEdge.getGeometry()[-1]);
562  default:
563  throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed");
564  }
565 }
566 
567 
568 void
569 GNEEdge::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
570  switch (key) {
571  case SUMO_ATTR_WIDTH:
572  case SUMO_ATTR_ENDOFFSET:
573  case SUMO_ATTR_SPEED:
574  case SUMO_ATTR_ALLOW:
575  case SUMO_ATTR_DISALLOW: {
576  undoList->p_begin("change edge attribute");
577  const std::string origValue = getAttribute(key); // will have intermediate value of "lane specific"
578  // lane specific attributes need to be changed via lanes to allow undo
579  for (LaneVector::iterator it = myLanes.begin(); it != myLanes.end(); it++) {
580  (*it)->setAttribute(key, value, undoList);
581  }
582  // ensure that the edge value is also changed. Actually this sets the lane attributes again but it does not matter
583  undoList->p_add(new GNEChange_Attribute(this, key, value, true, origValue));
584  undoList->p_end();
585  break;
586  }
587  case SUMO_ATTR_FROM: {
588  undoList->p_begin("change edge attribute");
589  undoList->p_add(new GNEChange_Attribute(this, key, value));
590  getGNEJunctionSource()->setLogicValid(false, undoList);
591  myNet->retrieveJunction(value)->setLogicValid(false, undoList);
592  setAttribute(GNE_ATTR_SHAPE_START, toString(getGNEJunctionSource()->getNBNode()->getPosition()), undoList);
594  undoList->p_end();
595  break;
596  }
597  case SUMO_ATTR_TO: {
598  undoList->p_begin("change edge attribute");
599  undoList->p_add(new GNEChange_Attribute(this, key, value));
600  getGNEJunctionDest()->setLogicValid(false, undoList);
601  myNet->retrieveJunction(value)->setLogicValid(false, undoList);
602  setAttribute(GNE_ATTR_SHAPE_END, toString(getGNEJunctionDest()->getNBNode()->getPosition()), undoList);
604  undoList->p_end();
605  break;
606  }
607  case SUMO_ATTR_ID:
608  case SUMO_ATTR_PRIORITY:
609  case SUMO_ATTR_LENGTH:
610  case SUMO_ATTR_TYPE:
614  case GNE_ATTR_SHAPE_END:
615  undoList->p_add(new GNEChange_Attribute(this, key, value));
616  break;
617  case SUMO_ATTR_NAME:
618  // user cares about street names. Make sure they appear in the output
620  OptionsCont::getOptions().set("output.street-names", "true");
621  undoList->p_add(new GNEChange_Attribute(this, key, value));
622  break;
623  case SUMO_ATTR_NUMLANES:
624  if (value != getAttribute(key)) {
625  setNumLanes(parse<int>(value), undoList);
626  }
627  break;
628  case SUMO_ATTR_SHAPE:
629  // @note: assumes value of inner geometry!
630  // actually the geometry is already updated (incrementally
631  // during mouse movement). We set the restore point to the end
632  // of the last change-set
634  undoList->p_add(new GNEChange_Attribute(this, key, value));
635  break;
636  default:
637  throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed");
638  }
639 }
640 
641 
642 bool
643 GNEEdge::isValid(SumoXMLAttr key, const std::string& value) {
644  switch (key) {
645  case SUMO_ATTR_ID:
646  return isValidID(value) && myNet->retrieveEdge(value, false) == 0;
647  break;
648  case SUMO_ATTR_FROM:
649  return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != getGNEJunctionDest()->getMicrosimID();
650  break;
651  case SUMO_ATTR_TO:
652  return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != getGNEJunctionSource()->getMicrosimID();
653  break;
654  case SUMO_ATTR_SPEED:
655  return isPositive<SUMOReal>(value);
656  break;
657  case SUMO_ATTR_NUMLANES:
658  return isPositive<int>(value);
659  break;
660  case SUMO_ATTR_PRIORITY:
661  return canParse<int>(value);
662  break;
663  case SUMO_ATTR_LENGTH:
664  return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) == NBEdge::UNSPECIFIED_LOADED_LENGTH);
665  break;
666  case SUMO_ATTR_ALLOW:
667  case SUMO_ATTR_DISALLOW:
668  return canParseVehicleClasses(value);
669  break;
670  case SUMO_ATTR_TYPE:
671  return true;
672  break;
673  case SUMO_ATTR_SHAPE: {
674  bool ok = true;
676  value, "user-supplied position", 0, ok, true);
677  return ok;
678  break;
679  }
682  break;
683  case SUMO_ATTR_NAME:
684  return true;
685  break;
686  case SUMO_ATTR_WIDTH:
687  return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) == NBEdge::UNSPECIFIED_WIDTH);
688  break;
689  case SUMO_ATTR_ENDOFFSET:
690  return canParse<SUMOReal>(value);
691  break;
692  default:
693  throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed");
694  }
695 }
696 
697 
698 void
700  myAmResponsible = newVal;
701 }
702 
703 // ===========================================================================
704 // private
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  break;
715  case SUMO_ATTR_TO:
717  break;
718  case SUMO_ATTR_NUMLANES:
719  throw InvalidArgument("GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen");
720  break;
721  case SUMO_ATTR_PRIORITY:
722  myNBEdge.myPriority = parse<int>(value);
723  break;
724  case SUMO_ATTR_LENGTH:
725  myNBEdge.setLoadedLength(parse<SUMOReal>(value));
726  break;
727  case SUMO_ATTR_TYPE:
728  myNBEdge.myType = value;
729  break;
730  case SUMO_ATTR_SHAPE:
731  bool ok;
732  myOrigShape = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, true);
733  setGeometry(myOrigShape, true);
734  break;
737  break;
738  case SUMO_ATTR_NAME:
739  myNBEdge.setStreetName(value);
740  break;
741  case SUMO_ATTR_SPEED:
742  myNBEdge.setSpeed(-1, parse<SUMOReal>(value));
743  break;
744  case SUMO_ATTR_WIDTH:
745  myNBEdge.setLaneWidth(-1, parse<SUMOReal>(value));
746  break;
747  case SUMO_ATTR_ENDOFFSET:
748  myNBEdge.setEndOffset(-1, parse<SUMOReal>(value));
749  break;
750  case SUMO_ATTR_ALLOW:
751  break; // no edge value
752  case SUMO_ATTR_DISALLOW:
753  break; // no edge value
755  myConnectionStatus = value;
756  if (value == GUESSED) {
758  } else if (value != GUESSED) {
760  }
761  break;
762  case GNE_ATTR_SHAPE_START: {
764  geom[0] = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0];
765  setGeometry(geom, false);
766  break;
767  }
768  case GNE_ATTR_SHAPE_END: {
770  geom[-1] = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0];
771  setGeometry(geom, false);
772  break;
773  }
774  default:
775  throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed");
776  }
777 }
778 
779 
780 void
781 GNEEdge::setNumLanes(int numLanes, GNEUndoList* undoList) {
782  undoList->p_begin("change number of lanes");
783  getGNEJunctionSource()->setLogicValid(false, undoList);
784  getGNEJunctionDest()->setLogicValid(false, undoList);
785 
786  const int oldNumLanes = (int)myLanes.size();
787  for (int i = oldNumLanes; i < numLanes; i++) {
788  // since the GNELane does not exist yet, it cannot have yet been referenced so we only pass a zero-pointer
789  undoList->add(new GNEChange_Lane(this, 0,
790  myNBEdge.getLaneStruct(oldNumLanes - 1), true), true);
791  }
792  for (int i = oldNumLanes - 1; i > numLanes - 1; i--) {
793  // delete leftmost lane
794  undoList->add(new GNEChange_Lane(this, myLanes[i], myNBEdge.getLaneStruct(i), false), true);
795  }
796  undoList->p_end();
797 }
798 
799 
800 void
801 GNEEdge::addLane(GNELane* lane, const NBEdge::Lane& laneAttrs) {
802  const int index = lane ? lane->getIndex() : myNBEdge.getNumLanes();
803  // the laneStruct must be created first to ensure we have some geometry
804  myNBEdge.addLane(index);
805  if (lane) {
806  // restore a previously deleted lane
807  myLanes.insert(myLanes.begin() + index, lane);
808 
809  } else {
810  // create a new lane by copying leftmost lane
811  lane = new GNELane(*this, index);
812  myLanes.push_back(lane);
813  }
814  lane->incRef("GNEEdge::addLane");
815  // we copy all attributes except shape since this is recomputed from edge shape
816  myNBEdge.setSpeed(lane->getIndex(), laneAttrs.speed);
817  myNBEdge.setPermissions(laneAttrs.permissions, lane->getIndex());
819  myNBEdge.setEndOffset(lane->getIndex(), laneAttrs.endOffset);
820  myNBEdge.setLaneWidth(lane->getIndex(), laneAttrs.width);
821  // udate indices
822  for (int i = 0; i < (int)myLanes.size(); ++i) {
823  myLanes[i]->setIndex(i);
824  }
825  /* while technically correct, this looks ugly
826  getGNEJunctionSource()->invalidateShape();
827  getGNEJunctionDest()->invalidateShape();
828  */
829  // Remake connections for this edge and all edges that target this lane
832  // Update element
833  myNet->refreshElement(this);
834  updateGeometry();
835 }
836 
837 
838 void
840  if (myLanes.size() == 0) {
841  throw ProcessError("Should not remove the last lane from an edge\n");
842  }
843  if (lane == 0) {
844  lane = myLanes.back();
845  }
846  // Delete lane of edge's container
847  myNBEdge.deleteLane(lane->getIndex());
848  lane->decRef("GNEEdge::removeLane");
849  myLanes.erase(myLanes.begin() + lane->getIndex());
850  // Delete lane if is unreferenced
851  if (lane->unreferenced()) {
852  delete lane;
853  }
854  // udate indices
855  for (int i = 0; i < (int)myLanes.size(); ++i) {
856  myLanes[i]->setIndex(i);
857  }
858  /* while technically correct, this looks ugly
859  getGNEJunctionSource()->invalidateShape();
860  getGNEJunctionDest()->invalidateShape();
861  */
862  // Remake connections for this edge and all edges that target this lane
865 
866  // Update element
867  myNet->refreshElement(this);
868  updateGeometry();
869 }
870 
871 void
873  // If a new connection was sucesfully created
874  if (myNBEdge.setConnection(nbCon.fromLane, nbCon.toEdge, nbCon.toLane, NBEdge::L2L_USER, true, nbCon.mayDefinitelyPass, nbCon.keepClear, nbCon.contPos, nbCon.visibility)) {
875  // Create GNEConection
876  con->updateGeometry();
877  myGNEConnections.push_back(con);
878  // Add reference
879  myGNEConnections.back()->incRef("GNEEdge::addConnection");
880  }
881  myNet->refreshElement(this); // actually we only do this to force a redraw
882 }
883 
884 
885 void
887 
888  if (nbCon.toEdge == myNBEdge.getTurnDestination()) {
890  }
891  // Get connection to remove
892  GNEConnection* con = retrieveConnection(nbCon.fromLane, nbCon.toEdge, nbCon.toLane);
894  if (!con->unreferenced()) {
895  con->decRef("GNEEdge::removeConnection");
896  myGNEConnections.erase(std::find(myGNEConnections.begin(), myGNEConnections.end(), con));
897  myNet->refreshElement(this); // actually we only do this to force a redraw
898  }
899 }
900 
901 
903 GNEEdge::retrieveConnection(int fromLane, NBEdge* to, int toLane) {
904  for (ConnectionVector::iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); ++i) {
905  if ((*i)->getFromLaneIndex() == fromLane
906  && (*i)->getEdgeTo()->getNBEdge() == to
907  && (*i)->getToLaneIndex() == toLane) {
908  return *i;
909  }
910  }
911  return new GNEConnection(myLanes[fromLane], myNet->retrieveEdge(to->getID())->getLanes()[toLane]);
912 }
913 
914 
915 
916 void
917 GNEEdge::setMicrosimID(const std::string& newID) {
919  for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); ++i) {
920  (*i)->setMicrosimID(getNBEdge()->getLaneID((*i)->getIndex()));
921  }
922 }
923 
924 
925 void
927  // First check that additional wasn't already inserted
928  for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) {
929  if (*i == additional) {
930  throw ProcessError("additional element with ID='" + additional->getID() + "' was already inserted in edge with ID='" + getID() + "'");
931  }
932  }
933  myAdditionals.push_back(additional);
934 }
935 
936 
937 void
939  // Declare iterator
940  AdditionalVector::iterator i = myAdditionals.begin();
941  // Find additional
942  while ((*i != additional) && (i != myAdditionals.end())) {
943  i++;
944  }
945  // If additional was found, remove it
946  if (i == myAdditionals.end()) {
947  throw ProcessError("additional element with ID='" + additional->getID() + "' doesn't exist in edge with ID='" + getID() + "'");
948  } else {
949  myAdditionals.erase(i);
950  }
951 }
952 
953 
954 const std::vector<GNEAdditional*>&
956  return myAdditionals;
957 }
958 
959 
960 bool
962  // Check if additionalSet already exists before insertion
963  for (AdditionalSetVector::iterator i = myAdditionalSets.begin(); i != myAdditionalSets.end(); i++) {
964  if ((*i) == additionalSet) {
965  return false;
966  }
967  }
968  // Insert it and retur true
969  myAdditionalSets.push_back(additionalSet);
970  return true;
971 }
972 
973 
974 bool
976  // search additionalSet and remove it
977  for (AdditionalSetVector::iterator i = myAdditionalSets.begin(); i != myAdditionalSets.end(); i++) {
978  if ((*i) == additionalSet) {
979  myAdditionalSets.erase(i);
980  return true;
981  }
982  }
983  // If additionalSet wasn't found, return false
984  return false;
985 }
986 
987 
988 const std::vector<GNEAdditionalSet*>&
990  return myAdditionalSets;
991 }
992 
993 
994 bool
996  for (std::vector<GNELane*>::const_iterator i = myLanes.begin(); i != myLanes.end(); i++) {
997  if ((*i)->isRestricted(vclass)) {
998  return true;
999  }
1000  }
1001  return false;
1002 }
1003 
1004 /****************************************************************************/
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:801
void copyTemplate(GNEEdge *tpl, GNEUndoList *undolist)
copy edge attributes from tpl
Definition: GNEEdge.cpp:453
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
Definition: NBEdge.cpp:1111
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:420
void addConnection(NBEdge::Connection nbCon, GNEConnection *con)
adds a connection
Definition: GNEEdge.cpp:872
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:934
SUMOReal endOffset
This lane'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 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:781
int toLane
The lane the connections yields in.
Definition: NBEdge.h:178
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:702
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:237
GUIVisualizationTextSettings streetName
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:159
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:270
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void invalidateShape()
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:175
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:276
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:119
void refreshElement(GUIGlObject *o)
refreshes boundary information for o and update
Definition: GNENet.cpp:776
bool hasString(const std::string &str) const
PositionVector myOrigShape
restore point for undo
Definition: GNEEdge.h:261
void setMicrosimID(const std::string &newID)
override to also set lane ids
Definition: GNEEdge.cpp:917
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1642
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2627
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
Definition: GNEEdge.cpp:475
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2682
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:1129
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:281
const std::vector< T > & getSchemes() const
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:995
NBNode * getNBNode() const
Return net build node.
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:523
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:503
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:505
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:2698
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:55
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:187
void clearGNEConnections()
clear current connections
Definition: GNEEdge.cpp:438
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const std::vector< GNEConnection * > & getGNEConnections()
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:491
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return list of additionals associated with this edge
Definition: GNEEdge.cpp:955
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:1117
An Element wich group additionalSet elements.
bool isClosed() const
check if PositionVector is closed
bool myWasSplit
whether this edge was created from a split
Definition: GNEEdge.h:273
~GNEEdge()
Destructor.
Definition: GNEEdge.cpp:89
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's geometry
Definition: NBEdge.cpp:493
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:663
GUIGlID getGlID() const
Returns the numerical id of the object.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
bool removeAdditionalGeometrySet(GNEAdditionalSet *additionalSet)
remove GNEAdditionalSet from this edge
Definition: GNEEdge.cpp:975
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
SUMOReal scale
information about a lane's width (temporary, used for a single view)
const std::vector< GNEAdditionalSet * > & getAdditionalSets()
return list of additionalSets associated with this edge
Definition: GNEEdge.cpp:989
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEEdge.cpp:239
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEEdge.cpp:170
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.
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:190
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:2519
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:474
void addAdditionalChild(GNEAdditional *additional)
add additional child to this edge
Definition: GNEEdge.cpp:926
const Position & getPosition() const
Returns the position of this node.
Definition: NBNode.h:228
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:1620
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:402
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:172
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:2554
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:689
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:1606
friend class GNEChange_Attribute
declare friend class
AdditionalVector myAdditionals
list with the additonals vinculated with this edge
Definition: GNEEdge.h:279
Boundary getBoundary() const
Returns the street's geometry.
Definition: GNEEdge.cpp:128
GNEJunction * getGNEJunctionDest() const
returns the destination-junction
Definition: GNEEdge.cpp:165
SUMOReal z() const
Returns the z-position.
Definition: Position.h:73
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:395
SUMOReal contPos
custom position for internal junction on this connection
Definition: NBEdge.h:193
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:1326
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEEdge.cpp:139
GUIColorer junctionColorer
The junction colorer.
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:2741
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
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:1063
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
void removeLane(GNELane *lane)
the number of lanes by one. argument is only used to increase robustness (assertions) ...
Definition: GNEEdge.cpp:839
SUMOReal getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:530
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEEdge.cpp:147
void decRef(const std::string &debugMsg="")
void setGeometry(PositionVector geom, bool inner)
update edge geometry and inform the lanes
Definition: GNEEdge.cpp:401
GNEEdge(NBEdge &nbe, GNENet *net, bool wasSplit=false, bool loaded=false)
Constructor.
Definition: GNEEdge.cpp:71
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:55
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2726
ConnectionVector myGNEConnections
vector with the connections of this edge
Definition: GNEEdge.h:267
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:699
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:232
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:416
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:485
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:347
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:252
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:63
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
Definition: NBEdge.cpp:2712
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:577
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:248
void updateGeometry()
update pre-computed geometry information
Definition: GNEEdge.cpp:111
The popup menu of a globject.
an edge
static const SUMOReal SNAP_RADIUS
Definition: GNEEdge.h:252
void mul(SUMOReal val)
Multiplies both positions with the given value.
Definition: Position.h:99
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:1310
void renameEdge(GNEEdge *edge, const std::string &newID)
updates the map and reserves new id
Definition: GNENet.cpp:1063
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNEEdge.cpp:643
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
Definition: NBEdge.h:646
void removeExplicitTurnaround(std::string id)
remove edge id from the list of explicit turnarounds
Definition: GNENet.cpp:1109
LaneVector myLanes
vectgor with the lanes of this edge
Definition: GNEEdge.h:264
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:232
void removeConnection(NBEdge::Connection nbCon)
removes a connection
Definition: GNEEdge.cpp:886
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1631
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2666
#define SUMOReal
Definition: config.h:214
static const std::string GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
bool addAdditionalSet(GNEAdditionalSet *additionalSet)
add GNEAdditionalSet to this edge
Definition: GNEEdge.cpp:961
void setEndpoint(Position pos, GNEUndoList *undoList)
makes pos the new geometry endpoint at the appropriate end
Definition: GNEEdge.cpp:364
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:938
GNEConnection * retrieveConnection(int fromLane, NBEdge *to, int toLane)
get connection
Definition: GNEEdge.cpp:903
AdditionalSetVector myAdditionalSets
list with the additonalSets vinculated with this edge
Definition: GNEEdge.h:282
NBEdge & myNBEdge
the underlying NBEdge
Definition: GNEEdge.h:258
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:489
SUMOReal getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:2961
std::vector< GNEEdge * > getGNEIncomingEdges() const
Return incoming GNEEdges.
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:261
const SUMOReal SUMO_const_halfLaneWidth
Definition: StdDefs.h:50
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:665
std::vector< GNEConnection * > ConnectionVector
Definition of the connection's vector.
Definition: GNEEdge.h:66
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEEdge.cpp:569
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:518
GUISelectedStorage gSelected
A global holder of selected objects.
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:803
void resetEndpoint(const Position &pos, GNEUndoList *undoList)
restores the endpoint to the junction position at the appropriate end
Definition: GNEEdge.cpp:387
A window containing a gl-object's parameter.
void changeEdgeEndpoints(GNEEdge *edge, const std::string &newSourceID, const std::string &newDestID)
modifies endpoins of the given edge
Definition: GNENet.cpp:1072
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:2490
bool wasSplit()
whether this edge was created from a split
Definition: GNEEdge.cpp:497
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:843
Position getSplitPos(const Position &clickPos)
Definition: GNEEdge.cpp:267
friend class GNEChange_Lane
Friend class.
Definition: GNEEdge.h:58
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:294
SUMOReal width
This lane'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:410
SUMOReal visibility
custom foe visiblity for connection
Definition: NBEdge.h:196
a junction
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:409