Eclipse SUMO - Simulation of Urban MObility
GNEJunction.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // A class for visualizing and editing junctions in netedit (adapted from
15 // GUIJunctionWrapper)
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <netbuild/NBAlgorithms.h>
26 #include <netbuild/NBNetBuilder.h>
27 #include <netbuild/NBOwnTLDef.h>
28 #include <netedit/GNENet.h>
29 #include <netedit/GNEUndoList.h>
30 #include <netedit/GNEViewNet.h>
37 #include <utils/gui/div/GLHelper.h>
43 
44 #include "GNEEdge.h"
45 #include "GNELane.h"
46 #include "GNEConnection.h"
47 #include "GNEJunction.h"
48 #include "GNECrossing.h"
49 
50 
51 // ===========================================================================
52 // static members
53 // ===========================================================================
54 
55 const double GNEJunction::BUBBLE_RADIUS(4);
56 
57 // ===========================================================================
58 // method definitions
59 // ===========================================================================
60 
61 GNEJunction::GNEJunction(GNENet* net, NBNode* nbn, bool loaded) :
62  GNENetElement(net, nbn->getID(), GLO_JUNCTION, SUMO_TAG_JUNCTION),
63  myNBNode(nbn),
64  myMaxSize(1),
65  myAmCreateEdgeSource(false),
66  myLogicStatus(loaded ? FEATURE_LOADED : FEATURE_GUESSED),
67  myAmResponsible(false),
68  myHasValidLogic(loaded),
69  myAmTLSSelected(false) {
70 }
71 
72 
74  // delete all GNECrossing
75  for (const auto& crossing : myGNECrossings) {
76  crossing->decRef();
77  if (crossing->unreferenced()) {
78  // show extra information for tests
79  WRITE_DEBUG("Deleting unreferenced " + crossing->getTagStr() + " '" + crossing->getID() + "' in GNEJunction destructor");
80  delete crossing;
81  }
82  }
83 
84  if (myAmResponsible) {
85  // show extra information for tests
86  WRITE_DEBUG("Deleting NBNode of '" + getID() + "' in GNEJunction destructor");
87  delete myNBNode;
88  }
89 }
90 
91 
92 std::string
94  int counter = 0;
95  while (myNet->retrieveJunction(getID() + toString(childTag) + toString(counter), false) != nullptr) {
96  counter++;
97  }
98  return (getID() + toString(childTag) + toString(counter));
99 }
100 
101 
102 const PositionVector&
104  return myNBNode->getShape();
105 }
106 
107 
108 void
111 }
112 
113 
114 void
115 GNEJunction::updateGeometryAfterNetbuild(bool rebuildNBNodeCrossings) {
116  myMaxSize = MAX2(getCenteringBoundary().getWidth(), getCenteringBoundary().getHeight());
117  rebuildGNECrossings(rebuildNBNodeCrossings);
118 }
119 
120 
121 Position
123  return myNBNode->getPosition();
124 }
125 
126 
127 void
128 GNEJunction::rebuildGNECrossings(bool rebuildNBNodeCrossings) {
129  // rebuild GNECrossings only if create crossings and walkingAreas in net is enabled
131  if (rebuildNBNodeCrossings) {
132  // build new NBNode::Crossings and walking areas
133  mirrorXLeftHand();
135  mirrorXLeftHand();
136  }
137  // create a vector to keep retrieved and created crossings
138  std::vector<GNECrossing*> retrievedCrossings;
139  // iterate over NBNode::Crossings of GNEJunction
140  for (const auto& NBNodeConnection : myNBNode->getCrossingsIncludingInvalid()) {
141  // retrieve existent GNECrossing, or create it
142  GNECrossing* retrievedGNECrossing = retrieveGNECrossing(NBNodeConnection);
143  retrievedCrossings.push_back(retrievedGNECrossing);
144  // check if previously this GNECrossings exists, and if true, remove it from myGNECrossings and insert in tree again
145  std::vector<GNECrossing*>::iterator retrievedExists = std::find(myGNECrossings.begin(), myGNECrossings.end(), retrievedGNECrossing);
146  if (retrievedExists != myGNECrossings.end()) {
147  myGNECrossings.erase(retrievedExists);
148  // update geometry of retrieved crossing
149  retrievedGNECrossing->updateGeometry();
150  } else {
151  // include reference to created GNECrossing
152  retrievedGNECrossing->incRef();
153  }
154  }
155  // delete non retrieved GNECrossings (we don't need to extract if from Tree two times)
156  for (const auto& crossing : myGNECrossings) {
157  crossing->decRef();
158  // check if crossing is selected
159  if (crossing->isAttributeCarrierSelected()) {
160  crossing->unselectAttributeCarrier();
161  }
162  if (crossing->unreferenced()) {
163  // show extra information for tests
164  WRITE_DEBUG("Deleting unreferenced " + crossing->getTagStr() + " in rebuildGNECrossings()");
165  delete crossing;
166  }
167  }
168  // copy retrieved (existent and created) GNECrossigns to myGNECrossings
169  myGNECrossings = retrievedCrossings;
170  }
171 }
172 
173 void
175  if (OptionsCont::getOptions().getBool("lefthand")) {
176  myNBNode->mirrorX();
177  for (NBEdge* e : myNBNode->getEdges()) {
178  e->mirrorX();
179 
180  }
181  }
182 }
183 
184 
187  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
188  buildPopupHeader(ret, app);
191  // build selection and show parameters menu
194  buildPositionCopyEntry(ret, false);
195  // check if we're in supermode network
197  //if (parent.getVisualisationSettings()->editMode != GNE_MODE_CONNECT) {
198  // // XXX if joinable
199  // new FXMenuCommand(ret, "Join adjacent edges", 0, &parent, MID_GNE_JOIN_EDGES);
200  //}
201  const int numEndpoints = (int)myNBNode->getEndPoints().size();
202  // check if we're handling a selection
203  bool handlingSelection = isAttributeCarrierSelected() && (myNet->retrieveJunctions(true).size() > 1);
204  // check if menu commands has to be disabled
205  const bool wrongMode = (myNet->getViewNet()->getEditModes().networkEditMode == GNE_NMODE_CONNECT) ||
208  // create menu commands
209  FXMenuCommand* mcCustomShape = new FXMenuCommand(ret, "Set custom junction shape", nullptr, &parent, MID_GNE_JUNCTION_EDIT_SHAPE);
210  FXMenuCommand* mcResetCustomShape = new FXMenuCommand(ret, "Reset junction shape", nullptr, &parent, MID_GNE_JUNCTION_RESET_SHAPE);
211  FXMenuCommand* mcReplace = new FXMenuCommand(ret, "Replace junction by geometry point", nullptr, &parent, MID_GNE_JUNCTION_REPLACE);
212  FXMenuCommand* mcSplit = new FXMenuCommand(ret, ("Split junction (" + toString(numEndpoints) + " end points)").c_str(), nullptr, &parent, MID_GNE_JUNCTION_SPLIT);
213  FXMenuCommand* mcSplitReconnect = new FXMenuCommand(ret, "Split junction and reconnect", nullptr, &parent, MID_GNE_JUNCTION_SPLIT_RECONNECT);
214  FXMenuCommand* mcClearConnections = new FXMenuCommand(ret, "Clear connections", nullptr, &parent, MID_GNE_JUNCTION_CLEAR_CONNECTIONS);
215  FXMenuCommand* mcResetConnections = new FXMenuCommand(ret, "Reset connections", nullptr, &parent, MID_GNE_JUNCTION_RESET_CONNECTIONS);
216  // check if current mode is correct
217  if (wrongMode) {
218  mcCustomShape->disable();
219  mcClearConnections->disable();
220  mcResetConnections->disable();
221  }
222  // check if we're handling a selection
223  if (handlingSelection) {
224  mcResetCustomShape->setText("Reset junction shapes");
225  }
226  // disable mcClearConnections if juction hasn't connections
227  if (getGNEConnections().empty()) {
228  mcClearConnections->disable();
229  }
230  // disable mcResetCustomShape if junction doesn't have a custom shape
231  if (myNBNode->getShape().size() == 0) {
232  mcResetCustomShape->disable();
233  }
234  // checkIsRemovable requiers turnarounds to be computed. This is ugly
235  if ((myNBNode->getIncomingEdges().size() == 2) && (myNBNode->getOutgoingEdges().size() == 2)) {
237  }
238  std::string reason = "wrong edit mode";
239  if (wrongMode || !myNBNode->checkIsRemovableReporting(reason)) {
240  mcReplace->setText(mcReplace->getText() + " (" + reason.c_str() + ")");
241  mcReplace->disable();
242  }
243  if (numEndpoints == 1) {
244  mcSplit->disable();
245  mcSplitReconnect->disable();
246  }
247  }
248  return ret;
249 }
250 
251 
252 Boundary
254  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
257  } else if (myNBNode->getShape().size() > 0) {
259  b.grow(10);
260  return b;
261  } else {
262  // calculate boundary using EXTENT as size
263  const double EXTENT = 2;
264  Boundary b(myNBNode->getPosition().x() - EXTENT, myNBNode->getPosition().y() - EXTENT,
265  myNBNode->getPosition().x() + EXTENT, myNBNode->getPosition().y() + EXTENT);
266  b.grow(10);
267  return b;
268  }
269 }
270 
271 
272 void
274  // check if boundary has to be drawn
275  if (s.drawBoundaries) {
277  }
278  // declare variable for exaggeration
279  double junctionExaggeration = isAttributeCarrierSelected() ? s.selectionScale : 1;
280  junctionExaggeration *= s.junctionSize.getExaggeration(s, this, 4);
281  // only continue if exaggeration is greather than 0
282  if (junctionExaggeration > 0) {
283  // declare values for circles
284  const double circleWidth = BUBBLE_RADIUS * junctionExaggeration;
285  const double circleWidthSquared = circleWidth * circleWidth;
286  // declare variable for mouse position
287  const Position mousePosition = myNet->getViewNet()->getPositionInformation();
288  // push name
289  if (s.scale * junctionExaggeration * myMaxSize < 1.) {
290  // draw something simple so that selection still works
291  glPushName(getGlID());
293  glPopName();
294  } else {
295  // node shape has been computed and is valid for drawing
296  glPushName(getGlID());
297  // declare flag for drawing junction shape
298  const bool drawShape = (myNBNode->getShape().size() > 0) && s.drawJunctionShape;
299  // declare flag for drawing junction as bubbles
300  bool drawBubble = (!drawShape || (myNBNode->getShape().area() < 4)) && s.drawJunctionShape;
301  // check if show junctions as bubbles checkbox is enabled
303  drawBubble = true;
304  }
305  // in supermode demand Bubble musn't be drawn
307  drawBubble = false;
308  }
309  // check if shape has to be drawn
310  if (drawShape) {
311  // set shape color
312  RGBColor junctionShapeColor = setColor(s, false);
313  // recognize full transparency and simply don't draw
314  if (junctionShapeColor.alpha() != 0) {
315  glPushMatrix();
316  glTranslated(0, 0, getType());
317  // obtain junction Shape
318  PositionVector junctionShape = myNBNode->getShape();
319  // close junction shape
320  junctionShape.closePolygon();
321  // adjust shape to exaggeration
322  if (junctionExaggeration > 1) {
323  junctionShape.scaleRelative(junctionExaggeration);
324  }
325  // first check if inner junction polygon can be drawn
326  if (s.drawForPositionSelection) {
327  // only draw a point if mouse is around shape
328  if (junctionShape.around(mousePosition)) {
329  // push matrix
330  glPushMatrix();
331  glTranslated(mousePosition.x(), mousePosition.y(), GLO_JUNCTION);
333  glPopMatrix();
334  }
335  } else if ((s.scale * junctionExaggeration * myMaxSize) < 40.) {
336  GLHelper::drawFilledPoly(junctionShape, true);
337  } else {
338  GLHelper::drawFilledPolyTesselated(junctionShape, true);
339  }
340  // check if dotted contour has to be drawn
341  if ((myNet->getViewNet()->getDottedAC() == this) && !drawBubble) {
343  }
344  glPopMatrix();
345  }
346  }
347  // check if bubble has to be drawn
348  if (drawBubble) {
349  // set bubble color
350  RGBColor bubbleColor = setColor(s, true);
351  // recognize full transparency and simply don't draw
352  if (bubbleColor.alpha() != 0) {
353  glPushMatrix();
354  // move matrix to
355  glTranslated(myNBNode->getPosition().x(), myNBNode->getPosition().y(), getType() + 0.05);
356  // only draw filled circle if we aren't in draw for selecting mode, or if distance to center is enough)
357  if (!s.drawForPositionSelection || (mousePosition.distanceSquaredTo2D(myNBNode->getPosition()) <= (circleWidthSquared + 2))) {
358  std::vector<Position> vertices = GLHelper::drawFilledCircleReturnVertices(circleWidth, s.getCircleResolution());
359  // check if dotted contour has to be drawn
360  if (myNet->getViewNet()->getDottedAC() == this) {
362  }
363  }
364  glPopMatrix();
365  }
366  }
367  // draw TLS
368  drawTLSIcon(s);
369  // (optional) draw name @todo expose this setting if isn't drawed if isn't being drawn for selecting
370  if (!s.drawForRectangleSelection) {
372  }
373  // draw elevation
375  glPushMatrix();
376  // Translate to center of junction
377  glTranslated(myNBNode->getPosition().x(), myNBNode->getPosition().y(), getType() + 1);
378  // draw Z value
380  glPopMatrix();
381  }
382  // name must be removed from selection stack before drawing crossings
383  glPopName();
384  // draw crossings only if junction isn't being moved
386  for (const auto& i : myGNECrossings) {
387  i->drawGL(s);
388  }
389  }
390  // draw Junction childs
392  }
393  }
394 }
395 
396 
397 NBNode*
399  return myNBNode;
400 }
401 
402 
403 std::vector<GNEJunction*>
405  // use set to avoid duplicates junctions
406  std::set<GNEJunction*> junctions;
407  for (const auto& i : myGNEIncomingEdges) {
408  junctions.insert(i->getGNEJunctionSource());
409  }
410  for (const auto& i : myGNEOutgoingEdges) {
411  junctions.insert(i->getGNEJunctionDestiny());
412  }
413  return std::vector<GNEJunction*>(junctions.begin(), junctions.end());
414 }
415 
416 
417 void
419  // Check if incoming edge was already inserted
420  std::vector<GNEEdge*>::iterator i = std::find(myGNEIncomingEdges.begin(), myGNEIncomingEdges.end(), edge);
421  if (i != myGNEIncomingEdges.end()) {
422  throw InvalidArgument("Incoming " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' was already inserted into " + getTagStr() + " with ID " + getID() + "'");
423  } else {
424  // Add edge into containers
425  myGNEIncomingEdges.push_back(edge);
426  myGNEEdges.push_back(edge);
427  }
428 }
429 
430 
431 
432 void
434  // Check if outgoing edge was already inserted
435  std::vector<GNEEdge*>::iterator i = std::find(myGNEOutgoingEdges.begin(), myGNEOutgoingEdges.end(), edge);
436  if (i != myGNEOutgoingEdges.end()) {
437  throw InvalidArgument("Outgoing " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' was already inserted into " + getTagStr() + " with ID " + getID() + "'");
438  } else {
439  // Add edge into containers
440  myGNEOutgoingEdges.push_back(edge);
441  myGNEEdges.push_back(edge);
442  }
443 }
444 
445 
446 void
448  // Check if incoming edge was already inserted
449  std::vector<GNEEdge*>::iterator i = std::find(myGNEIncomingEdges.begin(), myGNEIncomingEdges.end(), edge);
450  if (i == myGNEIncomingEdges.end()) {
451  throw InvalidArgument("Incoming " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' doesn't found into " + getTagStr() + " with ID " + getID() + "'");
452  } else {
453  // remove edge from containers
454  myGNEIncomingEdges.erase(i);
455  myGNEEdges.erase(std::find(myGNEEdges.begin(), myGNEEdges.end(), edge));
456  }
457 }
458 
459 
460 void
462  // Check if outgoing edge was already inserted
463  std::vector<GNEEdge*>::iterator i = std::find(myGNEOutgoingEdges.begin(), myGNEOutgoingEdges.end(), edge);
464  if (i == myGNEOutgoingEdges.end()) {
465  throw InvalidArgument("Outgoing " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' doesn't found into " + getTagStr() + " with ID " + getID() + "'");
466  } else {
467  // remove edge from containers
468  myGNEOutgoingEdges.erase(i);
469  myGNEEdges.erase(std::find(myGNEEdges.begin(), myGNEEdges.end(), edge));
470  }
471 }
472 
473 
474 const std::vector<GNEEdge*>&
476  return myGNEEdges;
477 }
478 
479 
480 const std::vector<GNEEdge*>&
482  return myGNEIncomingEdges;
483 }
484 
485 
486 const std::vector<GNEEdge*>&
488  return myGNEOutgoingEdges;
489 }
490 
491 
492 const std::vector<GNECrossing*>&
494  return myGNECrossings;
495 }
496 
497 
498 std::vector<GNEConnection*>
500  std::vector<GNEConnection*> connections;
501  for (const auto& i : myGNEIncomingEdges) {
502  for (const auto& j : i->getGNEConnections()) {
503  connections.push_back(j);
504  }
505  }
506  return connections;
507 }
508 
509 
510 void
512  myAmCreateEdgeSource = true;
513 }
514 
515 
516 void
518  myAmCreateEdgeSource = false;
519 }
520 
521 
522 void
523 GNEJunction::selectTLS(bool selected) {
524  myAmTLSSelected = selected;
525 }
526 
527 
528 void
529 GNEJunction::startGeometryMoving(bool extendToNeighbors) {
530  // save current centering boundary
532  // First declare three sets with all affected GNEJunctions, GNEEdges and GNEConnections
533  std::set<GNEJunction*> affectedJunctions;
534  std::set<GNEEdge*> affectedEdges;
535  // Iterate over GNEEdges
536  for (const auto& edge : myGNEEdges) {
537  // Add source and destiny junctions
538  affectedJunctions.insert(edge->getGNEJunctionSource());
539  affectedJunctions.insert(edge->getGNEJunctionDestiny());
540  // Obtain neighbors of Junction source
541  for (const auto& junctionSourceEdge : edge->getGNEJunctionSource()->getGNEEdges()) {
542  affectedEdges.insert(junctionSourceEdge);
543  }
544  // Obtain neighbors of Junction destiny
545  for (const auto& junctionDestinyEdge : edge->getGNEJunctionDestiny()->getGNEEdges()) {
546  affectedEdges.insert(junctionDestinyEdge);
547  }
548  }
549  // Iterate over affected Junctions only if extendToNeighbors is enabled
550  if (extendToNeighbors) {
551  for (const auto& affectedJunction : affectedJunctions) {
552  // don't include this junction (to avoid start more than one times)
553  if (affectedJunction != this) {
554  // start geometry moving in edges
555  affectedJunction->startGeometryMoving(false);
556  }
557  }
558  }
559  // Iterate over affected Edges
560  for (const auto& edge : affectedEdges) {
561  // start geometry moving in edges
562  edge->startGeometryMoving();
563  }
564 }
565 
566 
567 void
568 GNEJunction::endGeometryMoving(bool extendToNeighbors) {
569  // check that endGeometryMoving was called only once
571  // Remove object from net
573  // reset myMovingGeometryBoundary
575  // First declare three sets with all affected GNEJunctions, GNEEdges and GNEConnections
576  std::set<GNEJunction*> affectedJunctions;
577  std::set<GNEEdge*> affectedEdges;
578  // Iterate over GNEEdges
579  for (const auto& edge : myGNEEdges) {
580  // Add source and destiny junctions
581  affectedJunctions.insert(edge->getGNEJunctionSource());
582  affectedJunctions.insert(edge->getGNEJunctionDestiny());
583  // Obtain neighbors of Junction source
584  for (const auto& junctionSourceEdge : edge->getGNEJunctionSource()->getGNEEdges()) {
585  affectedEdges.insert(junctionSourceEdge);
586  }
587  // Obtain neighbors of Junction destiny
588  for (const auto& junctionDestinyEdge : edge->getGNEJunctionDestiny()->getGNEEdges()) {
589  affectedEdges.insert(junctionDestinyEdge);
590  }
591  }
592  // Iterate over affected Junctions
593  if (extendToNeighbors) {
594  for (const auto& affectedJunction : affectedJunctions) {
595  // don't include this junction (to avoid end it more than one times)
596  if (affectedJunction != this) {
597  // end geometry moving in edges
598  affectedJunction->endGeometryMoving(false);
599  }
600  }
601  }
602  // Iterate over affected Edges
603  for (const auto& affectedEdge : affectedEdges) {
604  // end geometry moving in edges
605  affectedEdge->endGeometryMoving();
606  }
607  // add object into grid again (using the new centering boundary)
608  myNet->addGLObjectIntoGrid(this);
609  }
610 }
611 
612 
613 void
614 GNEJunction::moveGeometry(const Position& oldPos, const Position& offset) {
615  // calculate new position
616  Position newPosition = oldPos;
617  newPosition.add(offset);
618  // filtern position using snap to active grid
619  newPosition = myNet->getViewNet()->snapToActiveGrid(newPosition, offset.z() == 0);
620  // move junction geometry without updating grid
621  moveJunctionGeometry(newPosition);
622 }
623 
624 
625 void
627  // first end geometry point
630  undoList->p_begin("position of " + getTagStr());
631  undoList->p_add(new GNEChange_Attribute(this, myNet, SUMO_ATTR_POSITION, toString(myNBNode->getPosition()), true, toString(oldPos)));
632  undoList->p_end();
633  } else {
634  // tried to set an invalid position, revert back to the previous one
635  moveJunctionGeometry(oldPos);
636  }
637 }
638 
639 
640 void
642  if (!myNBNode->hasCustomShape()) {
643  if (myNBNode->myPoly.size() > 0) {
644  // write GL Debug
645  WRITE_GLDEBUG("<-- Invalidating shape of junction '" + getID() + "' -->");
646  // remove Juntion from grid
648  // clear poly
649  myNBNode->myPoly.clear();
650  // add Juntion into grid
651  myNet->addGLObjectIntoGrid(this);
652  }
654  }
655 }
656 
657 
658 void
659 GNEJunction::setLogicValid(bool valid, GNEUndoList* undoList, const std::string& status) {
660  myHasValidLogic = valid;
661  if (!valid) {
662  assert(undoList != 0);
663  assert(undoList->hasCommandGroup());
665  EdgeVector incoming = myNBNode->getIncomingEdges();
666  for (EdgeVector::iterator it = incoming.begin(); it != incoming.end(); it++) {
667  GNEEdge* srcEdge = myNet->retrieveEdge((*it)->getID());
668  removeConnectionsFrom(srcEdge, undoList, false); // false, because the whole tls will be invalidated at the end
669  undoList->add(new GNEChange_Attribute(srcEdge, myNet, GNE_ATTR_MODIFICATION_STATUS, status), true);
670  }
671  undoList->add(new GNEChange_Attribute(this, myNet, GNE_ATTR_MODIFICATION_STATUS, status), true);
672  invalidateTLS(undoList);
673  } else {
674  // logic valed, then rebuild GNECrossings to adapt it to the new logic
675  // (but don't rebuild the crossings in NBNode because they are already finished)
676  rebuildGNECrossings(false);
677  }
678 }
679 
680 
681 void
682 GNEJunction::removeConnectionsFrom(GNEEdge* edge, GNEUndoList* undoList, bool updateTLS, int lane) {
683  NBEdge* srcNBE = edge->getNBEdge();
684  NBEdge* turnEdge = srcNBE->getTurnDestination();
685  // Make a copy of connections
686  std::vector<NBEdge::Connection> connections = srcNBE->getConnections();
687  // delete in reverse so that undoing will add connections in the original order
688  for (std::vector<NBEdge::Connection>::reverse_iterator con_it = connections.rbegin(); con_it != connections.rend(); con_it++) {
689  if (lane >= 0 && (*con_it).fromLane != lane) {
690  continue;
691  }
692  bool hasTurn = con_it->toEdge == turnEdge;
693  undoList->add(new GNEChange_Connection(edge, *con_it, false, false), true);
694  // needs to come after GNEChange_Connection
695  // XXX bug: this code path will not be used on a redo!
696  if (hasTurn) {
697  myNet->addExplicitTurnaround(srcNBE->getID());
698  }
699  }
700  if (updateTLS) {
701  std::vector<NBConnection> removeConnections;
702  for (NBEdge::Connection con : connections) {
703  removeConnections.push_back(NBConnection(srcNBE, con.fromLane, con.toEdge, con.toLane));
704  }
705  removeTLSConnections(removeConnections, undoList);
706  }
707 }
708 
709 
710 void
711 GNEJunction::removeConnectionsTo(GNEEdge* edge, GNEUndoList* undoList, bool updateTLS, int lane) {
712  NBEdge* destNBE = edge->getNBEdge();
713  std::vector<NBConnection> removeConnections;
714  for (NBEdge* srcNBE : myNBNode->getIncomingEdges()) {
715  GNEEdge* srcEdge = myNet->retrieveEdge(srcNBE->getID());
716  std::vector<NBEdge::Connection> connections = srcNBE->getConnections();
717  for (std::vector<NBEdge::Connection>::reverse_iterator con_it = connections.rbegin(); con_it != connections.rend(); con_it++) {
718  if ((*con_it).toEdge == destNBE) {
719  if (lane >= 0 && (*con_it).toLane != lane) {
720  continue;
721  }
722  bool hasTurn = srcNBE->getTurnDestination() == destNBE;
723  undoList->add(new GNEChange_Connection(srcEdge, *con_it, false, false), true);
724  // needs to come after GNEChange_Connection
725  // XXX bug: this code path will not be used on a redo!
726  if (hasTurn) {
727  myNet->addExplicitTurnaround(srcNBE->getID());
728  }
729  removeConnections.push_back(NBConnection(srcNBE, (*con_it).fromLane, destNBE, (*con_it).toLane));
730  }
731  }
732  }
733  if (updateTLS) {
734  removeTLSConnections(removeConnections, undoList);
735  }
736 }
737 
738 
739 void
740 GNEJunction::removeTLSConnections(std::vector<NBConnection>& connections, GNEUndoList* undoList) {
741  if (connections.size() > 0) {
742  const std::set<NBTrafficLightDefinition*> coypOfTls = myNBNode->getControllingTLS(); // make a copy!
743  for (const auto& TLS : coypOfTls) {
744  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(TLS);
745  // guessed TLS (NBOwnTLDef) do not need to be updated
746  if (tlDef != nullptr) {
747  std::string newID = tlDef->getID();
748  // create replacement before deleting the original because deletion will mess up saving original nodes
749  NBLoadedSUMOTLDef* replacementDef = new NBLoadedSUMOTLDef(tlDef, tlDef->getLogic());
750  for (NBConnection& con : connections) {
751  replacementDef->removeConnection(con);
752  }
753  undoList->add(new GNEChange_TLS(this, tlDef, false), true);
754  undoList->add(new GNEChange_TLS(this, replacementDef, true, false, newID), true);
755  // the removed traffic light may have controlled more than one junction. These too have become invalid now
756  const std::vector<NBNode*> copyOfNodes = tlDef->getNodes(); // make a copy!
757  for (const auto& node : copyOfNodes) {
758  GNEJunction* sharing = myNet->retrieveJunction(node->getID());
759  undoList->add(new GNEChange_TLS(sharing, tlDef, false), true);
760  undoList->add(new GNEChange_TLS(sharing, replacementDef, true, false, newID), true);
761  }
762  }
763  }
764  }
765 }
766 
767 
768 void
770  // remap connections of the edge
771  assert(which->getLanes().size() == by->getLanes().size());
772  std::vector<NBEdge::Connection> connections = which->getNBEdge()->getConnections();
773  for (NBEdge::Connection& c : connections) {
774  undoList->add(new GNEChange_Connection(which, c, false, false), true);
775  undoList->add(new GNEChange_Connection(by, c, false, true), true);
776  }
777  // also remap tls connections
778  const std::set<NBTrafficLightDefinition*> coypOfTls = myNBNode->getControllingTLS(); // make a copy!
779  for (const auto& TLS : coypOfTls) {
780  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(TLS);
781  // guessed TLS (NBOwnTLDef) do not need to be updated
782  if (tlDef != nullptr) {
783  std::string newID = tlDef->getID();
784  // create replacement before deleting the original because deletion will mess up saving original nodes
785  NBLoadedSUMOTLDef* replacementDef = new NBLoadedSUMOTLDef(tlDef, tlDef->getLogic());
786  for (int i = 0; i < (int)which->getLanes().size(); ++i) {
787  replacementDef->replaceRemoved(which->getNBEdge(), i, by->getNBEdge(), i);
788  }
789  undoList->add(new GNEChange_TLS(this, tlDef, false), true);
790  undoList->add(new GNEChange_TLS(this, replacementDef, true, false, newID), true);
791  // the removed traffic light may have controlled more than one junction. These too have become invalid now
792  const std::vector<NBNode*> copyOfNodes = tlDef->getNodes(); // make a copy!
793  for (const auto& node : copyOfNodes) {
794  GNEJunction* sharing = myNet->retrieveJunction(node->getID());
795  undoList->add(new GNEChange_TLS(sharing, tlDef, false), true);
796  undoList->add(new GNEChange_TLS(sharing, replacementDef, true, false, newID), true);
797  }
798  }
799  }
800 }
801 
802 
803 void
805  EdgeVector incoming = myNBNode->getIncomingEdges();
806  for (EdgeVector::iterator it = incoming.begin(); it != incoming.end(); it++) {
807  NBEdge* srcNBE = *it;
808  GNEEdge* srcEdge = myNet->retrieveEdge(srcNBE->getID());
809  undoList->add(new GNEChange_Attribute(srcEdge, myNet, GNE_ATTR_MODIFICATION_STATUS, FEATURE_MODIFIED), true);
810  }
811 }
812 
813 
814 void
815 GNEJunction::invalidateTLS(GNEUndoList* undoList, const NBConnection& deletedConnection, const NBConnection& addedConnection) {
816  assert(undoList->hasCommandGroup());
817  // NBLoadedSUMOTLDef becomes invalid, replace with NBOwnTLDef which will be dynamically recomputed
818  const std::set<NBTrafficLightDefinition*> coypOfTls = myNBNode->getControllingTLS(); // make a copy!
819  for (const auto& TLS : coypOfTls) {
820  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(TLS);
821  if (tlDef != nullptr) {
822  NBTrafficLightDefinition* replacementDef = nullptr;
823  std::string newID = tlDef->getID(); // + "_reguessed"; // changes due to reguessing will be visible in diff
824  if (deletedConnection != NBConnection::InvalidConnection) {
825  // create replacement before deleting the original because deletion will mess up saving original nodes
826  NBLoadedSUMOTLDef* repl = new NBLoadedSUMOTLDef(tlDef, tlDef->getLogic());
827  repl->removeConnection(deletedConnection);
828  replacementDef = repl;
829  } else if (addedConnection != NBConnection::InvalidConnection) {
830  if (addedConnection.getTLIndex() == NBConnection::InvalidTlIndex) {
831  // custom tl indices of crossings might become invalid upon recomputation so we must save them
832  // however, the could remain valud so we register a change but keep them at their old value
833  for (GNECrossing* c : myGNECrossings) {
834  const std::string oldValue = c->getAttribute(SUMO_ATTR_TLLINKINDEX);
836  undoList->add(new GNEChange_Attribute(c, myNet, SUMO_ATTR_TLLINKINDEX, oldValue), true);
837  const std::string oldValue2 = c->getAttribute(SUMO_ATTR_TLLINKINDEX);
839  undoList->add(new GNEChange_Attribute(c, myNet, SUMO_ATTR_TLLINKINDEX2, oldValue2), true);
840  }
841  }
842  NBLoadedSUMOTLDef* repl = new NBLoadedSUMOTLDef(tlDef, tlDef->getLogic());
843  repl->addConnection(addedConnection.getFrom(), addedConnection.getTo(),
844  addedConnection.getFromLane(), addedConnection.getToLane(), addedConnection.getTLIndex(), addedConnection.getTLIndex2());
845  replacementDef = repl;
846  } else {
847  replacementDef = new NBOwnTLDef(newID, tlDef->getOffset(), tlDef->getType());
848  replacementDef->setProgramID(tlDef->getProgramID());
849  }
850  undoList->add(new GNEChange_TLS(this, tlDef, false), true);
851  undoList->add(new GNEChange_TLS(this, replacementDef, true, false, newID), true);
852  // the removed traffic light may have controlled more than one junction. These too have become invalid now
853  const std::vector<NBNode*> copyOfNodes = tlDef->getNodes(); // make a copy!
854  for (const auto& node : copyOfNodes) {
855  GNEJunction* sharing = myNet->retrieveJunction(node->getID());
856  undoList->add(new GNEChange_TLS(sharing, tlDef, false), true);
857  undoList->add(new GNEChange_TLS(sharing, replacementDef, true, false, newID), true);
858  }
859  }
860  }
861 }
862 
863 void
865  // obtain a copy of GNECrossing of junctions
866  auto copyOfGNECrossings = myGNECrossings;
867  // iterate over copy of GNECrossings
868  for (int i = 0; i < (int)myGNECrossings.size(); i++) {
869  auto c = myGNECrossings.at(i);
870  // obtain the set of edges vinculated with the crossing (due it works as ID)
871  EdgeSet edgeSet(c->getCrossingEdges().begin(), c->getCrossingEdges().end());
872  // If this edge is part of the set of edges of crossing
873  if (edgeSet.count(edge->getNBEdge()) == 1) {
874  // delete crossing if this is their last edge
875  if ((c->getCrossingEdges().size() == 1) && (c->getCrossingEdges().front() == edge->getNBEdge())) {
876  myNet->deleteCrossing(c, undoList);
877  i = 0;
878  } else {
879  // remove this edge of the edge's attribute of crossing (note: This can invalidate the crossing)
880  std::vector<std::string> edges = GNEAttributeCarrier::parse<std::vector<std::string>>(c->getAttribute(SUMO_ATTR_EDGES));
881  edges.erase(std::find(edges.begin(), edges.end(), edge->getID()));
882  c->setAttribute(SUMO_ATTR_EDGES, joinToString(edges, " "), undoList);
883  }
884  }
885  }
886 }
887 
888 
889 bool
891  return myHasValidLogic;
892 }
893 
894 
896 GNEJunction::retrieveGNECrossing(NBNode::Crossing* NBNodeCrossing, bool createIfNoExist) {
897  // iterate over all crossing
898  for (const auto& crossing : myGNECrossings) {
899  // if found, return it
900  if (crossing->getCrossingEdges() == NBNodeCrossing->edges) {
901  return crossing;
902  }
903  }
904  if (createIfNoExist) {
905  // create new GNECrossing
906  GNECrossing* createdGNECrossing = new GNECrossing(this, NBNodeCrossing->edges);
907  // show extra information for tests
908  WRITE_DEBUG("Created " + createdGNECrossing->getTagStr() + " '" + createdGNECrossing->getID() + "' in retrieveGNECrossing()");
909  // update geometry after creating
910  createdGNECrossing->updateGeometry();
911  return createdGNECrossing;
912  } else {
913  return nullptr;
914  }
915 }
916 
917 
918 void
919 GNEJunction::markConnectionsDeprecated(bool includingNeighbours) {
920  // only it's needed to mark the connections of incoming edges
921  for (const auto& i : myGNEIncomingEdges) {
922  for (const auto& j : i->getGNEConnections()) {
923  j->markConnectionGeometryDeprecated();
924  }
925  if (includingNeighbours) {
926  i->getGNEJunctionSource()->markConnectionsDeprecated(false);
927  }
928  }
929 }
930 
931 
932 std::string
934  switch (key) {
935  case SUMO_ATTR_ID:
936  return getMicrosimID();
937  case SUMO_ATTR_POSITION:
938  return toString(myNBNode->getPosition());
939  case SUMO_ATTR_TYPE:
940  return toString(myNBNode->getType());
942  return myLogicStatus;
943  case SUMO_ATTR_SHAPE:
944  return toString(myNBNode->getShape());
945  case SUMO_ATTR_RADIUS:
946  return toString(myNBNode->getRadius());
947  case SUMO_ATTR_TLTYPE:
949  // @todo this causes problems if the node were to have multiple programs of different type (plausible)
950  return toString((*myNBNode->getControllingTLS().begin())->getType());
951  } else {
952  return "No TLS";
953  }
954  case SUMO_ATTR_TLID:
956  return toString((*myNBNode->getControllingTLS().begin())->getID());
957  } else {
958  return "No TLS";
959  }
961  // keep clear is only used as a convenience feature in plain xml
962  // input. When saving to .net.xml the status is saved only for the connections
963  // to show the correct state we must check all connections
964  for (const auto& i : myGNEIncomingEdges) {
965  for (const auto& j : i->getGNEConnections()) {
966  if (j->getNBEdgeConnection().keepClear) {
967  return toString(true);
968  }
969  }
970  }
971  return toString(false);
974  case SUMO_ATTR_FRINGE:
976  case GNE_ATTR_SELECTED:
978  case GNE_ATTR_PARAMETERS:
979  return myNBNode->getParametersStr();
980  default:
981  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
982  }
983 }
984 
985 
986 void
987 GNEJunction::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
988  if (value == getAttribute(key)) {
989  return; //avoid needless changes, later logic relies on the fact that attributes have changed
990  }
991  switch (key) {
992  case SUMO_ATTR_ID:
993  case SUMO_ATTR_POSITION:
995  case SUMO_ATTR_SHAPE:
996  case SUMO_ATTR_RADIUS:
998  case SUMO_ATTR_FRINGE:
999  case GNE_ATTR_SELECTED:
1000  case GNE_ATTR_PARAMETERS:
1001  undoList->add(new GNEChange_Attribute(this, myNet, key, value), true);
1002  break;
1003  case SUMO_ATTR_KEEP_CLEAR:
1004  // change Keep Clear attribute in all connections
1005  undoList->p_begin("change keepClear for whole junction");
1006  for (const auto& i : myGNEIncomingEdges) {
1007  for (const auto& j : i->getGNEConnections()) {
1008  undoList->add(new GNEChange_Attribute(j, myNet, key, value), true);
1009  }
1010  }
1011  undoList->p_end();
1012  break;
1013  case SUMO_ATTR_TYPE: {
1014  undoList->p_begin("change " + getTagStr() + " type");
1016  if (getNBNode()->isTLControlled() &&
1017  // if switching changing from or to traffic_light_right_on_red we need to remove the old plan
1020  ) {
1021  // make a copy because we will modify the original
1022  const std::set<NBTrafficLightDefinition*> copyOfTls = myNBNode->getControllingTLS();
1023  for (const auto& TLS : copyOfTls) {
1024  undoList->add(new GNEChange_TLS(this, TLS, false), true);
1025  }
1026  }
1027  if (!getNBNode()->isTLControlled()) {
1028  // create new traffic light
1029  undoList->add(new GNEChange_TLS(this, nullptr, true), true);
1030  }
1031  } else if (getNBNode()->isTLControlled()) {
1032  // delete old traffic light
1033  // make a copy because we will modify the original
1034  const std::set<NBTrafficLightDefinition*> copyOfTls = myNBNode->getControllingTLS();
1035  for (const auto& TLS : copyOfTls) {
1036  undoList->add(new GNEChange_TLS(this, TLS, false, false), true);
1037  }
1038  }
1039  // must be the final step, otherwise we do not know which traffic lights to remove via GNEChange_TLS
1040  undoList->add(new GNEChange_Attribute(this, myNet, key, value), true);
1041  for (const auto& crossing : myGNECrossings) {
1042  undoList->add(new GNEChange_Attribute(crossing, myNet, SUMO_ATTR_TLLINKINDEX, "-1"), true);
1043  undoList->add(new GNEChange_Attribute(crossing, myNet, SUMO_ATTR_TLLINKINDEX2, "-1"), true);
1044  }
1045  undoList->p_end();
1046  break;
1047  }
1048  case SUMO_ATTR_TLTYPE: {
1049  undoList->p_begin("change " + getTagStr() + " tl-type");
1050  // make a copy because we will modify the original
1051  const std::set<NBTrafficLightDefinition*> copyOfTls = myNBNode->getControllingTLS();
1052  for (const auto& TLS : copyOfTls) {
1053  NBLoadedSUMOTLDef* oldLoaded = dynamic_cast<NBLoadedSUMOTLDef*>(TLS);
1054  if (oldLoaded != nullptr) {
1055  NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(oldLoaded, oldLoaded->getLogic());
1056  newDef->guessMinMaxDuration();
1057  std::vector<NBNode*> nodes = TLS->getNodes();
1058  for (const auto& node : nodes) {
1059  GNEJunction* junction = myNet->retrieveJunction(node->getID());
1060  undoList->add(new GNEChange_TLS(junction, TLS, false), true);
1061  undoList->add(new GNEChange_TLS(junction, TLS, true), true);
1062  }
1063  }
1064  }
1065  undoList->add(new GNEChange_Attribute(this, myNet, key, value), true);
1066  undoList->p_end();
1067  break;
1068  }
1069  case SUMO_ATTR_TLID: {
1070  undoList->p_begin("change " + toString(SUMO_TAG_TRAFFIC_LIGHT) + " id");
1071  const std::set<NBTrafficLightDefinition*> copyOfTls = myNBNode->getControllingTLS();
1072  assert(copyOfTls.size() > 0);
1073  NBTrafficLightDefinition* currentTLS = *copyOfTls.begin();
1074  NBTrafficLightDefinition* currentTLSCopy = nullptr;
1075  const bool currentIsSingle = currentTLS->getNodes().size() == 1;
1076  const bool currentIsLoaded = dynamic_cast<NBLoadedSUMOTLDef*>(currentTLS) != nullptr;
1077  if (currentIsLoaded) {
1078  currentTLSCopy = new NBLoadedSUMOTLDef(currentTLS,
1079  dynamic_cast<NBLoadedSUMOTLDef*>(currentTLS)->getLogic());
1080  }
1081  // remove from previous tls
1082  for (const auto& TLS : copyOfTls) {
1083  undoList->add(new GNEChange_TLS(this, TLS, false), true);
1084  }
1086  // programs to which the current node shall be added
1087  const std::map<std::string, NBTrafficLightDefinition*> programs = tlCont.getPrograms(value);
1088  if (programs.size() > 0) {
1089  for (const auto& TLSProgram : programs) {
1090  NBTrafficLightDefinition* oldTLS = TLSProgram.second;
1091  if (dynamic_cast<NBOwnTLDef*>(oldTLS) != nullptr) {
1092  undoList->add(new GNEChange_TLS(this, oldTLS, true), true);
1093  } else {
1094  // delete and re-create the definition because the loaded phases are now invalid
1095  if (dynamic_cast<NBLoadedSUMOTLDef*>(oldTLS) != nullptr &&
1096  dynamic_cast<NBLoadedSUMOTLDef*>(oldTLS)->usingSignalGroups()) {
1097  // keep the old program and add all-red state for the added links
1098  NBLoadedSUMOTLDef* newTLSJoined = new NBLoadedSUMOTLDef(oldTLS, dynamic_cast<NBLoadedSUMOTLDef*>(oldTLS)->getLogic());
1099  newTLSJoined->joinLogic(currentTLSCopy);
1100  undoList->add(new GNEChange_TLS(this, newTLSJoined, true, true), true);
1101  } else {
1102  undoList->add(new GNEChange_TLS(this, nullptr, true, false, value), true);
1103  }
1104  NBTrafficLightDefinition* newTLS = *myNBNode->getControllingTLS().begin();
1105  // switch from old to new definition
1106  std::vector<NBNode*> copyOfNodes = oldTLS->getNodes();
1107  for (const auto& node : copyOfNodes) {
1108  GNEJunction* oldJunction = myNet->retrieveJunction(node->getID());
1109  undoList->add(new GNEChange_TLS(oldJunction, oldTLS, false), true);
1110  undoList->add(new GNEChange_TLS(oldJunction, newTLS, true), true);
1111  }
1112  }
1113  }
1114  } else {
1115  if (currentIsSingle && currentIsLoaded) {
1116  // rename the traffic light but keep everything else
1117  NBTrafficLightLogic* renamedLogic = dynamic_cast<NBLoadedSUMOTLDef*>(currentTLSCopy)->getLogic();
1118  renamedLogic->setID(value);
1119  NBLoadedSUMOTLDef* renamedTLS = new NBLoadedSUMOTLDef(currentTLSCopy, renamedLogic);
1120  renamedTLS->setID(value);
1121  undoList->add(new GNEChange_TLS(this, renamedTLS, true, true), true);
1122  } else {
1123  // create new traffic light
1124  undoList->add(new GNEChange_TLS(this, nullptr, true, false, value), true);
1125  }
1126  }
1127  delete currentTLSCopy;
1128  undoList->p_end();
1129  break;
1130  }
1131  default:
1132  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1133  }
1134 }
1135 
1136 
1137 bool
1138 GNEJunction::isValid(SumoXMLAttr key, const std::string& value) {
1139  switch (key) {
1140  case SUMO_ATTR_ID:
1141  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrieveJunction(value, false) == nullptr);
1142  case SUMO_ATTR_TYPE:
1144  case SUMO_ATTR_POSITION:
1145  return canParse<Position>(value);
1146  case SUMO_ATTR_SHAPE:
1147  // empty shapes are allowed
1148  return canParse<PositionVector>(value);
1149  case SUMO_ATTR_RADIUS:
1150  return canParse<double>(value) && (parse<double>(value) >= -1);
1151  case SUMO_ATTR_TLTYPE:
1153  case SUMO_ATTR_TLID:
1154  return myNBNode->isTLControlled() && (value != "");
1155  case SUMO_ATTR_KEEP_CLEAR:
1156  return canParse<bool>(value);
1159  case SUMO_ATTR_FRINGE:
1161  case GNE_ATTR_SELECTED:
1162  return canParse<bool>(value);
1163  case GNE_ATTR_PARAMETERS:
1164  return Parameterised::areParametersValid(value);
1165  default:
1166  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1167  }
1168 }
1169 
1170 
1171 bool
1173  switch (key) {
1174  case SUMO_ATTR_TLTYPE:
1175  case SUMO_ATTR_TLID:
1176  return myNBNode->isTLControlled();
1177  case SUMO_ATTR_KEEP_CLEAR: {
1178  // check if at least there is an incoming connection
1179  for (const auto& i : myGNEIncomingEdges) {
1180  if (i->getGNEConnections().size() > 0) {
1181  return true;
1182  }
1183  }
1184  return false;
1185  }
1186  default:
1187  return true;
1188  }
1189 }
1190 
1191 
1192 void
1194  myAmResponsible = newVal;
1195 }
1196 
1197 // ===========================================================================
1198 // private
1199 // ===========================================================================
1200 
1201 void
1203  // draw TLS icon if isn't being drawn for selecting
1206  glPushMatrix();
1207  Position pos = myNBNode->getPosition();
1208  glTranslated(pos.x(), pos.y(), getType() + 0.1);
1209  glColor3d(1, 1, 1);
1210  const double halfWidth = 32 / s.scale;
1211  const double halfHeight = 64 / s.scale;
1212  GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_TLS), -halfWidth, -halfHeight, halfWidth, halfHeight);
1213  glPopMatrix();
1214  }
1215 }
1216 
1217 
1218 void
1220  // draw connections and route elements connections (Only for incoming edges)
1221  for (const auto& incomingEdge : myGNEIncomingEdges) {
1222  // first draw connections
1223  for (const auto& connection : incomingEdge->getGNEConnections()) {
1224  connection->drawGL(s);
1225  }
1226  // then draw E2 multilane detectors
1227  for (const auto& lane : incomingEdge->getLanes()) {
1228  for (const auto& additional : lane->getChildAdditionals()) {
1229  if (additional->getTagProperty().getTag() == SUMO_TAG_E2DETECTOR_MULTILANE) {
1230  lane->drawPartialE2DetectorPlan(s, additional, this);
1231  }
1232  }
1233  }
1234  // first check if Demand elements can be shown
1236  // certain demand elements children can contain loops (for example, routes) and it causes overlapping problems. It's needed to filter it before drawing
1237  for (const auto& route : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_ROUTE)) {
1238  // first check if route can be drawn
1240  // draw partial route
1241  incomingEdge->drawPartialRoute(s, route, this);
1242  }
1243  }
1244  for (const auto& embeddedRoute : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_EMBEDDEDROUTE)) {
1245  // first check if embedded route can be drawn
1247  // draw partial route
1248  incomingEdge->drawPartialRoute(s, embeddedRoute, this);
1249  }
1250  }
1251  for (const auto& trip : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_TRIP)) {
1252  // Start drawing adding an gl identificator
1253  glPushName(trip->getGlID());
1254  // draw partial trip only if is being inspected or selected
1255  if ((myNet->getViewNet()->getDottedAC() == trip) || trip->isAttributeCarrierSelected()) {
1256  incomingEdge->drawPartialTripFromTo(s, trip, this);
1257  }
1258  // only draw trip in the first edge
1259  if (trip->getAttribute(SUMO_ATTR_FROM) == getID()) {
1260  trip->drawGL(s);
1261  }
1262  // Pop name
1263  glPopName();
1264  }
1265  for (const auto& flow : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_FLOW)) {
1266  // Start drawing adding an gl identificator
1267  glPushName(flow->getGlID());
1268  // draw partial trip only if is being inspected or selected
1269  if ((myNet->getViewNet()->getDottedAC() == flow) || flow->isAttributeCarrierSelected()) {
1270  incomingEdge->drawPartialTripFromTo(s, flow, this);
1271  }
1272  // only draw flow in the first edge
1273  if (flow->getAttribute(SUMO_ATTR_FROM) == getID()) {
1274  flow->drawGL(s);
1275  }
1276  // Pop name
1277  glPopName();
1278  }
1279  // draw partial person plan elements
1280  for (const auto& personTripFromTo : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_PERSONTRIP_FROMTO)) {
1281  incomingEdge->drawPartialPersonPlan(s, personTripFromTo, this);
1282  }
1283  for (const auto& personTripBusStop : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_PERSONTRIP_BUSSTOP)) {
1284  incomingEdge->drawPartialPersonPlan(s, personTripBusStop, this);
1285  }
1286  for (const auto& walkEdges : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_WALK_EDGES)) {
1287  incomingEdge->drawPartialPersonPlan(s, walkEdges, this);
1288  }
1289  for (const auto& walkFromTo : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_WALK_FROMTO)) {
1290  incomingEdge->drawPartialPersonPlan(s, walkFromTo, this);
1291  }
1292  for (const auto& walkBusStop : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_WALK_BUSSTOP)) {
1293  incomingEdge->drawPartialPersonPlan(s, walkBusStop, this);
1294  }
1295  for (const auto& walkRoute : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_WALK_ROUTE)) {
1296  incomingEdge->drawPartialPersonPlan(s, walkRoute, this);
1297  }
1298  for (const auto& rideFromTo : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_RIDE_FROMTO)) {
1299  incomingEdge->drawPartialPersonPlan(s, rideFromTo, this);
1300  }
1301  for (const auto& rideBusStop : incomingEdge->getChildDemandElementsSortedByType(SUMO_TAG_RIDE_BUSSTOP)) {
1302  incomingEdge->drawPartialPersonPlan(s, rideBusStop, this);
1303  }
1304  }
1305  }
1306 }
1307 
1308 
1309 void
1310 GNEJunction::setAttribute(SumoXMLAttr key, const std::string& value) {
1311  switch (key) {
1312  case SUMO_ATTR_KEEP_CLEAR: {
1313  throw InvalidArgument(toString(key) + " cannot be edited");
1314  }
1315  case SUMO_ATTR_ID: {
1316  myNet->renameJunction(this, value);
1317  break;
1318  }
1319  case SUMO_ATTR_TYPE: {
1323  }
1324  myNBNode->reinit(myNBNode->getPosition(), type);
1325  break;
1326  }
1327  case SUMO_ATTR_POSITION: {
1328  // start geometry moving (because new position affect all junction children)
1330  // set new position in NBNode without updating grid
1331  moveJunctionGeometry(parse<Position>(value));
1332  // end geometry moving
1334  // mark this connections and all of the junction's Neighbours as deprecated
1336  break;
1337  }
1339  if (myLogicStatus == FEATURE_GUESSED && value != FEATURE_GUESSED) {
1340  // clear guessed connections. previous connections will be restored
1342  // Clear GNEConnections of incoming edges
1343  for (const auto& i : myGNEIncomingEdges) {
1344  i->clearGNEConnections();
1345  }
1346  }
1347  myLogicStatus = value;
1348  break;
1349  case SUMO_ATTR_SHAPE: {
1350  // start geometry moving (because new position affect all junction children)
1352  // set new shape (without updating grid)
1353  const PositionVector shape = parse<PositionVector>(value);
1354  myNBNode->setCustomShape(shape);
1355  // end geometry moving
1357  // mark this connections and all of the junction's Neighbours as deprecated
1359  break;
1360  }
1361  case SUMO_ATTR_RADIUS: {
1362  myNBNode->setRadius(parse<double>(value));
1363  break;
1364  }
1365  case SUMO_ATTR_TLTYPE: {
1366  // we need to make a copy of controlling TLS (because original will be updated)
1367  const std::set<NBTrafficLightDefinition*> copyOfTls = myNBNode->getControllingTLS();
1368  for (const auto& TLS : copyOfTls) {
1369  TLS->setType(SUMOXMLDefinitions::TrafficLightTypes.get(value));
1370  }
1371  break;
1372  }
1375  break;
1376  case SUMO_ATTR_FRINGE:
1378  break;
1379  case GNE_ATTR_SELECTED:
1380  if (parse<bool>(value)) {
1382  } else {
1384  }
1385  break;
1386  case GNE_ATTR_PARAMETERS:
1387  myNBNode->setParametersStr(value);
1388  break;
1389  default:
1390  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1391  }
1392 }
1393 
1394 
1395 double
1396 GNEJunction::getColorValue(const GUIVisualizationSettings& /* s */, int activeScheme) const {
1397  switch (activeScheme) {
1398  case 0:
1399  // ensure visibility of red connections
1401  return 1;
1402  } else {
1403  return 0;
1404  }
1405  case 1:
1406  return isAttributeCarrierSelected();
1407  case 2:
1408  switch (myNBNode->getType()) {
1410  return 0;
1412  return 1;
1413  case NODETYPE_PRIORITY:
1414  return 2;
1416  return 3;
1418  return 4;
1419  case NODETYPE_ALLWAY_STOP:
1420  return 5;
1421  case NODETYPE_DISTRICT:
1422  return 6;
1423  case NODETYPE_NOJUNCTION:
1424  return 7;
1425  case NODETYPE_DEAD_END:
1427  return 8;
1428  case NODETYPE_UNKNOWN:
1429  return 8; // may happen before first network computation
1430  case NODETYPE_INTERNAL:
1431  assert(false);
1432  return 8;
1433  case NODETYPE_RAIL_SIGNAL:
1434  return 9;
1435  case NODETYPE_ZIPPER:
1436  return 10;
1438  return 11;
1440  return 12;
1441  }
1442  case 3:
1443  return myNBNode->getPosition().z();
1444  default:
1445  assert(false);
1446  return 0;
1447  }
1448 }
1449 
1450 
1451 void
1453  // obtain NBNode position
1454  const Position orig = myNBNode->getPosition();
1455  // reinit NBNode
1456  myNBNode->reinit(pos, myNBNode->getType());
1457  // set new position of adjacent edges
1458  for (const auto& edge : getNBNode()->getEdges()) {
1459  myNet->retrieveEdge(edge->getID())->updateJunctionPosition(this, orig);
1460  }
1461  // declare three sets with all affected GNEJunctions, GNEEdges and GNEConnections
1462  std::set<GNEJunction*> affectedJunctions;
1463  std::set<GNEEdge*> affectedEdges;
1464  // Iterate over GNEEdges
1465  for (const auto& edge : myGNEEdges) {
1466  // Add source and destiny junctions
1467  affectedJunctions.insert(edge->getGNEJunctionSource());
1468  affectedJunctions.insert(edge->getGNEJunctionDestiny());
1469  // Obtain neighbors of Junction source
1470  for (const auto& junctionSourceEdge : edge->getGNEJunctionSource()->getGNEEdges()) {
1471  affectedEdges.insert(junctionSourceEdge);
1472  }
1473  // Obtain neighbors of Junction destiny
1474  for (const auto& junctionDestinyEdge : edge->getGNEJunctionDestiny()->getGNEEdges()) {
1475  affectedEdges.insert(junctionDestinyEdge);
1476  }
1477  }
1478  // Iterate over affected Edges
1479  for (const auto& affectedEdge : affectedEdges) {
1480  // Update edge geometry
1481  affectedEdge->updateGeometry();
1482  }
1483 }
1484 
1485 
1486 RGBColor
1487 GNEJunction::setColor(const GUIVisualizationSettings& s, bool bubble) const {
1488  const int scheme = s.junctionColorer.getActive();
1489  RGBColor color = s.junctionColorer.getScheme().getColor(getColorValue(s, scheme));
1490  if (!bubble && scheme == 0) {
1491  color = s.junctionColorer.getScheme().getColor(0.);
1492  }
1493  // override with special colors (unless the color scheme is based on selection)
1494  if (drawUsingSelectColor() && scheme != 1) {
1495  color = s.colorSettings.selectionColor;
1496  }
1497  if (myAmCreateEdgeSource) {
1498  color = RGBColor(0, 255, 0);
1499  }
1500  GLHelper::setColor(color);
1501  return color;
1502 }
1503 
1504 
1505 void
1508  tlCont.insert(tlDef, forceInsert); // may return false for tlDef which controls multiple junctions
1509  tlDef->addNode(myNBNode);
1510 }
1511 
1512 
1513 void
1516  if (tlDef->getNodes().size() == 1) {
1517  tlCont.extract(tlDef);
1518  }
1519  myNBNode->removeTrafficLight(tlDef);
1520 }
1521 
1522 /****************************************************************************/
RGBColor::alpha
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.h:82
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
GNEJunction::BUBBLE_RADIUS
static const double BUBBLE_RADIUS
constant values for drawing buubles
Definition: GNEJunction.h:55
SUMO_TAG_WALK_FROMTO
@ SUMO_TAG_WALK_FROMTO
Definition: SUMOXMLDefinitions.h:307
NBConnection::InvalidConnection
const static NBConnection InvalidConnection
Definition: NBConnection.h:126
SUMO_ATTR_TYPE
@ SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
NODETYPE_PRIORITY
@ NODETYPE_PRIORITY
Definition: SUMOXMLDefinitions.h:1061
GNEJunction::getPositionInView
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNEJunction.cpp:122
GUIVisualizationSettings::drawForPositionSelection
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
Definition: GUIVisualizationSettings.h:644
GLO_MAX
@ GLO_MAX
empty max
Definition: GUIGlObjectTypes.h:165
NODETYPE_TRAFFIC_LIGHT_RIGHT_ON_RED
@ NODETYPE_TRAFFIC_LIGHT_RIGHT_ON_RED
Definition: SUMOXMLDefinitions.h:1058
GNEJunction::markConnectionsDeprecated
void markConnectionsDeprecated(bool includingNeighbours)
mark connections as deprecated
Definition: GNEJunction.cpp:919
GNEJunction::unMarkAsCreateEdgeSource
void unMarkAsCreateEdgeSource()
removes mark as first junction in createEdge-mode
Definition: GNEJunction.cpp:517
GNENetElement::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNENetElement.cpp:99
GNEViewNet::showJunctionAsBubbles
bool showJunctionAsBubbles() const
return true if junction must be showed as bubbles
Definition: GNEViewNet.cpp:547
NODETYPE_ZIPPER
@ NODETYPE_ZIPPER
Definition: SUMOXMLDefinitions.h:1065
GNEJunction::isLogicValid
bool isLogicValid()
whether this junction has a valid logic
Definition: GNEJunction.cpp:890
GNEJunction::mirrorXLeftHand
void mirrorXLeftHand()
temporarily mirror coordinates in lefthand network to compute correct crossing geometries
Definition: GNEJunction.cpp:174
GNEJunction::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
determines color value
Definition: GNEJunction.cpp:1396
NBTrafficLightLogicCont::getPrograms
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
Definition: NBTrafficLightLogicCont.cpp:243
Parameterised::getParametersStr
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
Definition: Parameterised.cpp:112
GNEAdditional.h
GNEJunction::drawJunctionChilds
void drawJunctionChilds(const GUIVisualizationSettings &s) const
draw junction childs
Definition: GNEJunction.cpp:1219
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
NBConnection::getTLIndex
int getTLIndex() const
returns the index within the controlling tls or InvalidTLIndex if this link is unontrolled
Definition: NBConnection.h:93
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
NODETYPE_DEAD_END_DEPRECATED
@ NODETYPE_DEAD_END_DEPRECATED
Definition: SUMOXMLDefinitions.h:1070
NBNode::checkIsRemovableReporting
bool checkIsRemovableReporting(std::string &reason) const
check if node is removable and return reason if not
Definition: NBNode.cpp:2050
GUIVisualizationSettings::junctionSize
GUIVisualizationSizeSettings junctionSize
Definition: GUIVisualizationSettings.h:578
SUMO_ATTR_TLTYPE
@ SUMO_ATTR_TLTYPE
node: the type of traffic light
Definition: SUMOXMLDefinitions.h:684
GNEJunction::invalidateShape
void invalidateShape()
Definition: GNEJunction.cpp:641
NBTrafficLightLogicCont
A container for traffic light definitions and built programs.
Definition: NBTrafficLightLogicCont.h:57
WRITE_GLDEBUG
#define WRITE_GLDEBUG(msg)
Definition: MsgHandler.h:285
GNEJunction::myAmTLSSelected
bool myAmTLSSelected
whether this junction is selected in tls-mode
Definition: GNEJunction.h:282
GNEJunction::commitGeometryMoving
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
registers completed movement with the undoList
Definition: GNEJunction.cpp:626
GUIGlObject::drawName
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
Definition: GUIGlObject.cpp:354
NBNode::setRightOfWay
void setRightOfWay(RightOfWay rightOfWay)
set method for computing right-of-way
Definition: NBNode.h:516
StringBijection::getString
const std::string & getString(const T key) const
Definition: StringBijection.h:106
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:79
Position::z
double z() const
Returns the z-position.
Definition: Position.h:66
GUIVisualizationSettings::drawForRectangleSelection
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
Definition: GUIVisualizationSettings.h:647
GNEJunction::removeEdgeFromCrossings
void removeEdgeFromCrossings(GNEEdge *edge, GNEUndoList *undoList)
removes the given edge from all pedestrian crossings
Definition: GNEJunction.cpp:864
OptionsCont.h
GUIVisualizationSettings::drawBoundaries
bool drawBoundaries
enable or disable draw boundaries
Definition: GUIVisualizationSettings.h:638
NBLoadedSUMOTLDef::removeConnection
void removeConnection(const NBConnection &conn, bool reconstruct=true)
removes the given connection from the traffic light if recontruct=true, reconstructs the logic and in...
Definition: NBLoadedSUMOTLDef.cpp:201
GNENet::removeGLObjectFromGrid
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1328
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
GNEJunction::getJunctionNeighbours
std::vector< GNEJunction * > getJunctionNeighbours() const
return GNEJunction neighbours
Definition: GNEJunction.cpp:404
GNEJunction::myLogicStatus
std::string myLogicStatus
modification status of the junction logic (all connections across this junction)
Definition: GNEJunction.h:273
SUMO_TAG_WALK_ROUTE
@ SUMO_TAG_WALK_ROUTE
Definition: SUMOXMLDefinitions.h:309
GUIVisualizationTextSettings::color
RGBColor color
text color
Definition: GUIVisualizationSettings.h:74
EdgeVector
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
GUIGLObjectPopupMenu.h
NBConnection::getTLIndex2
int getTLIndex2() const
Definition: NBConnection.h:96
GNEJunction::updateGeometryAfterNetbuild
void updateGeometryAfterNetbuild(bool rebuildNBNodeCrossings=false)
update pre-computed geometry information without modifying netbuild structures
Definition: GNEJunction.cpp:115
NBNode::getOutgoingEdges
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
Definition: NBNode.h:260
GNEJunction::getGNEOutgoingEdges
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
Definition: GNEJunction.cpp:487
SUMOXMLDefinitions::RightOfWayValues
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
Definition: SUMOXMLDefinitions.h:1377
GNEJunction::getGNEConnections
std::vector< GNEConnection * > getGNEConnections() const
Returns all GNEConnections vinculated with this junction.
Definition: GNEJunction.cpp:499
NBConnection::getFrom
NBEdge * getFrom() const
returns the from-edge (start of the connection)
Definition: NBConnection.cpp:89
NBLoadedSUMOTLDef::guessMinMaxDuration
void guessMinMaxDuration()
heuristically add minDur and maxDur when switching from tlType fixed to actuated
Definition: NBLoadedSUMOTLDef.cpp:638
SUMO_ATTR_TLID
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
Definition: SUMOXMLDefinitions.h:682
GNEJunction::removeIncomingGNEEdge
void removeIncomingGNEEdge(GNEEdge *edge)
remove incoming GNEEdge
Definition: GNEJunction.cpp:447
PositionVector::scaleRelative
void scaleRelative(double factor)
enlarges/shrinks the polygon by a factor based at the centroid
Definition: PositionVector.cpp:456
GNEJunction::moveGeometry
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEJunction.cpp:614
NODETYPE_INTERNAL
@ NODETYPE_INTERNAL
Definition: SUMOXMLDefinitions.h:1068
NBConnection::InvalidTlIndex
const static int InvalidTlIndex
Definition: NBConnection.h:125
NBConnection::getTo
NBEdge * getTo() const
returns the to-edge (end of the connection)
Definition: NBConnection.cpp:95
GNEJunction::getGNECrossings
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
Definition: GNEJunction.cpp:493
NBOwnTLDef
A traffic light logics which must be computed (only nodes/edges are given)
Definition: NBOwnTLDef.h:46
NODETYPE_UNKNOWN
@ NODETYPE_UNKNOWN
Definition: SUMOXMLDefinitions.h:1055
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
NBNode::getType
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:272
GNEViewNetHelper::NetworkViewOptions::showDemandElements
bool showDemandElements() const
check if show demand elements checkbox is enabled
Definition: GNEViewNetHelper.cpp:1616
GNEJunction::markAsModified
void markAsModified(GNEUndoList *undoList)
prevent re-guessing connections at this junction
Definition: GNEJunction.cpp:804
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
GLHelper.h
NBTrafficLightDefinition::getOffset
SUMOTime getOffset()
Returns the offset.
Definition: NBTrafficLightDefinition.h:324
NBLoadedSUMOTLDef::getLogic
NBTrafficLightLogic * getLogic()
Returns the internal logic.
Definition: NBLoadedSUMOTLDef.h:122
GNE_NMODE_CREATE_EDGE
@ GNE_NMODE_CREATE_EDGE
mode for creating new edges
Definition: GNEViewNetHelper.h:64
GNE_NMODE_TLS
@ GNE_NMODE_TLS
mode for editing tls
Definition: GNEViewNetHelper.h:68
GNEJunction::myHasValidLogic
bool myHasValidLogic
whether this junctions logic is valid
Definition: GNEJunction.h:279
GNEJunction::myGNEEdges
std::vector< GNEEdge * > myGNEEdges
vector with the GNEEdges vinculated with this junction
Definition: GNEJunction.h:254
GNEJunction::setResponsible
void setResponsible(bool newVal)
set responsibility for deleting internal strctures
Definition: GNEJunction.cpp:1193
GNENetElement::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNENetElement.cpp:120
MID_GNE_JUNCTION_SPLIT_RECONNECT
@ MID_GNE_JUNCTION_SPLIT_RECONNECT
turn junction into multiple junctions and reconnect them heuristically
Definition: GUIAppEnum.h:870
GNENet::addExplicitTurnaround
void addExplicitTurnaround(std::string id)
add edge id to the list of explicit turnarounds
Definition: GNENet.cpp:2171
PositionVector
A list of positions.
Definition: PositionVector.h:45
MID_GNE_JUNCTION_EDIT_SHAPE
@ MID_GNE_JUNCTION_EDIT_SHAPE
edit junction shape
Definition: GUIAppEnum.h:872
GNEJunction::myMaxSize
double myMaxSize
The maximum size (in either x-, or y-dimension) for determining whether to draw or not.
Definition: GNEJunction.h:266
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
NBLoadedSUMOTLDef::addConnection
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, int linkIndex2, bool reconstruct=true)
Adds a connection and immediately informs the edges.
Definition: NBLoadedSUMOTLDef.cpp:95
GLHelper::drawFilledPoly
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:82
MID_GNE_JUNCTION_RESET_CONNECTIONS
@ MID_GNE_JUNCTION_RESET_CONNECTIONS
reset junction's connections
Definition: GUIAppEnum.h:864
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:621
PositionVector::getBoxBoundary
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Definition: PositionVector.cpp:390
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GUISUMOAbstractView::snapToActiveGrid
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
Definition: GUISUMOAbstractView.cpp:196
GNEJunction::myGNEIncomingEdges
std::vector< GNEEdge * > myGNEIncomingEdges
vector with the incomings GNEEdges vinculated with this junction
Definition: GNEJunction.h:257
MID_GNE_JUNCTION_REPLACE
@ MID_GNE_JUNCTION_REPLACE
turn junction into geometry node
Definition: GUIAppEnum.h:866
MID_GNE_JUNCTION_RESET_SHAPE
@ MID_GNE_JUNCTION_RESET_SHAPE
reset junction shape
Definition: GUIAppEnum.h:874
NBTrafficLightDefinition::setProgramID
void setProgramID(const std::string &programID)
Sets the programID.
Definition: NBTrafficLightDefinition.h:316
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:150
GUITexturesHelper::drawTexturedBox
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
Definition: GUITexturesHelper.cpp:72
GNEJunction::startGeometryMoving
void startGeometryMoving(bool extendToNeighbors=true)
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNEJunction.cpp:529
GNENet::deleteCrossing
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
Definition: GNENet.cpp:602
MID_GNE_JUNCTION_CLEAR_CONNECTIONS
@ MID_GNE_JUNCTION_CLEAR_CONNECTIONS
clear junction's connections
Definition: GUIAppEnum.h:862
GUIVisualizationTextSettings::scaledSize
double scaledSize(double scale, double constFactor=0.1) const
get scale size
Definition: GUIVisualizationSettings.cpp:195
GNEJunction::updateGeometry
void updateGeometry()
update pre-computed geometry information (including crossings)
Definition: GNEJunction.cpp:109
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
GUIVisualizationSettings::junctionName
GUIVisualizationTextSettings junctionName
Definition: GUIVisualizationSettings.h:569
GLHelper::drawBoundary
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:817
GNETEXTURE_TLS
@ GNETEXTURE_TLS
Definition: GUITextures.h:46
GUIAppEnum.h
GNEJunction.h
GUIVisualizationSettings::junctionColorer
GUIColorer junctionColorer
The junction colorer.
Definition: GUIVisualizationSettings.h:566
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:131
GLHelper::drawFilledCircle
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:348
NBNode::getPosition
const Position & getPosition() const
Definition: NBNode.h:247
GNEJunction::getNBNode
NBNode * getNBNode() const
Return net build node.
Definition: GNEJunction.cpp:398
SUMO_TAG_WALK_EDGES
@ SUMO_TAG_WALK_EDGES
Definition: SUMOXMLDefinitions.h:306
GLHelper::drawText
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
Definition: GLHelper.cpp:673
GNEAttributeCarrier::FEATURE_GUESSED
static const std::string FEATURE_GUESSED
feature has been reguessed (may still be unchanged be we can't tell (yet)
Definition: GNEAttributeCarrier.h:595
RGBColor
Definition: RGBColor.h:39
NBTurningDirectionsComputer::computeTurnDirectionsForNode
static void computeTurnDirectionsForNode(NBNode *node, bool warn)
Computes turnaround destinations for all incoming edges of the given nodes (if any)
Definition: NBAlgorithms.cpp:54
NODETYPE_ALLWAY_STOP
@ NODETYPE_ALLWAY_STOP
Definition: SUMOXMLDefinitions.h:1064
NODETYPE_RAIL_SIGNAL
@ NODETYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1059
GNENet::getNetBuilder
NBNetBuilder * getNetBuilder() const
get net builder
Definition: GNENet.cpp:1592
Boundary::reset
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
GNE_ATTR_MODIFICATION_STATUS
@ GNE_ATTR_MODIFICATION_STATUS
whether a feature has been loaded,guessed,modified or approved
Definition: SUMOXMLDefinitions.h:973
NBNode::isTLControlled
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:313
NBTrafficLightLogicCont::extract
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
Definition: NBTrafficLightLogicCont.cpp:133
GNEJunction::myNBNode
NBNode * myNBNode
A reference to the represented junction.
Definition: GNEJunction.h:251
NBTrafficLightDefinition::getType
TrafficLightType getType() const
get the algorithm type (static etc..)
Definition: NBTrafficLightDefinition.h:330
SUMO_TAG_FLOW
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
Definition: SUMOXMLDefinitions.h:149
GNECrossing
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:44
GNEJunction::invalidateTLS
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
Definition: GNEJunction.cpp:815
GNEJunction::markAsCreateEdgeSource
void markAsCreateEdgeSource()
marks as first junction in createEdge-mode
Definition: GNEJunction.cpp:511
GNEJunction::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEJunction.cpp:253
SUMO_ATTR_KEEP_CLEAR
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
Definition: SUMOXMLDefinitions.h:696
GNEJunction::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEJunction.cpp:933
NBNode::invalidateIncomingConnections
void invalidateIncomingConnections()
invalidate incoming connections
Definition: NBNode.cpp:1662
GNEJunction::drawTLSIcon
void drawTLSIcon(const GUIVisualizationSettings &s) const
draw TLS icon
Definition: GNEJunction.cpp:1202
GNEJunction::removeTrafficLight
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
removes a traffic light
Definition: GNEJunction.cpp:1514
NODETYPE_PRIORITY_STOP
@ NODETYPE_PRIORITY_STOP
Definition: SUMOXMLDefinitions.h:1062
NODETYPE_TRAFFIC_LIGHT_NOJUNCTION
@ NODETYPE_TRAFFIC_LIGHT_NOJUNCTION
Definition: SUMOXMLDefinitions.h:1057
GUIGlObject::buildNameCopyPopupEntry
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
Definition: GUIGlObject.cpp:225
GNEEdge::getNBEdge
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:631
GUIPropertySchemeStorage::getScheme
T & getScheme()
Definition: GUIPropertySchemeStorage.h:79
GNEJunction::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEJunction.cpp:987
PositionVector::around
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
Definition: PositionVector.cpp:74
GNEViewNet::buildSelectionACPopupEntry
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:338
SUMO_ATTR_TLLINKINDEX2
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
Definition: SUMOXMLDefinitions.h:688
GNEJunction::addIncomingGNEEdge
void addIncomingGNEEdge(GNEEdge *edge)
add incoming GNEEdge
Definition: GNEJunction.cpp:418
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1054
NBNode::getRadius
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:277
GNEJunction::GNEJunction
GNEJunction(GNENet *net, NBNode *nbn, bool loaded=false)
Constructor.
Definition: GNEJunction.cpp:61
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:97
NBNode::getEndPoints
std::vector< std::pair< Position, std::string > > getEndPoints() const
return list of unique endpoint coordinates of all edges at this node
Definition: NBNode.cpp:3355
GNEDemandElement.h
GNEViewNet::getNetworkViewOptions
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:452
NBNode::mirrorX
void mirrorX()
mirror coordinates along the x-axis
Definition: NBNode.cpp:342
EdgeSet
std::set< NBEdge * > EdgeSet
container for unique edges
Definition: NBCont.h:49
GNEChange_TLS.h
GLHelper::drawFilledCircleReturnVertices
static std::vector< Position > drawFilledCircleReturnVertices(double width, int steps=8)
Draws a filled circle around (0,0) returning circle vertex.
Definition: GLHelper.cpp:354
PositionVector::closePolygon
void closePolygon()
ensures that the last position equals the first
Definition: PositionVector.cpp:1231
GNEViewNet.h
NBNode::removeTrafficLight
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
Definition: NBNode.cpp:371
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:1026
SUMO_ATTR_EDGES
@ SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
NBConnection::getToLane
int getToLane() const
returns the to-lane
Definition: NBConnection.cpp:240
GLHelper::drawShapeDottedContourAroundClosedShape
static void drawShapeDottedContourAroundClosedShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape)
draw a dotted contour around the given closed shape with certain width
Definition: GLHelper.cpp:496
GNENet::renameJunction
void renameJunction(GNEJunction *junction, const std::string &newID)
updates the map and reserves new id
Definition: GNENet.cpp:2159
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
GNE_ATTR_PARAMETERS
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:989
GUITextureSubSys::getTexture
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
Definition: GUITextureSubSys.cpp:101
NBNetBuilder.h
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:632
GNE_SUPERMODE_NETWORK
@ GNE_SUPERMODE_NETWORK
Network mode (Edges, junctions, etc..)
Definition: GNEViewNetHelper.h:46
GNENet::retrieveJunction
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:1050
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:305
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
NBTrafficLightDefinition::getNodes
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
Definition: NBTrafficLightDefinition.h:172
GNE_NMODE_CONNECT
@ GNE_NMODE_CONNECT
mode for connecting lanes
Definition: GNEViewNetHelper.h:66
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
GNEEdge.h
GNEJunction::endGeometryMoving
void endGeometryMoving(bool extendToNeighbors=true)
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNEJunction.cpp:568
GLHelper::drawFilledPolyTesselated
static void drawFilledPolyTesselated(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:101
GUIVisualizationSettings::selectionScale
double selectionScale
the current selection scaling in NETEDIT (temporary)
Definition: GUIVisualizationSettings.h:641
GNEViewNet::getDemandViewOptions
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:458
GNENetElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNENetElement.cpp:114
GNEViewNetHelper::NetworkViewOptions::editingElevation
bool editingElevation() const
check if we're editing elevation
Definition: GNEViewNetHelper.cpp:1653
NBNode::getEdges
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
Definition: NBNode.h:265
SUMO_TAG_PERSONTRIP_BUSSTOP
@ SUMO_TAG_PERSONTRIP_BUSSTOP
Definition: SUMOXMLDefinitions.h:305
NBNode::setCustomShape
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:2146
GNENetElement
Definition: GNENetElement.h:43
GNEChange_Connection
Definition: GNEChange_Connection.h:44
GNEJunction::addOutgoingGNEEdge
void addOutgoingGNEEdge(GNEEdge *edge)
add outgoing GNEEdge
Definition: GNEJunction.cpp:433
NBConnection
Definition: NBConnection.h:43
GNEJunction::myAmCreateEdgeSource
bool myAmCreateEdgeSource
whether this junction is the first junction for a newly creatededge
Definition: GNEJunction.h:270
GNEJunction::rebuildGNECrossings
void rebuildGNECrossings(bool rebuildNBNodeCrossings=true)
rebuilds crossing objects for this junction
Definition: GNEJunction.cpp:128
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:190
GNECrossing.h
NBNode::setRadius
void setRadius(double radius)
set the turning radius
Definition: NBNode.h:506
GNEEdge::getLanes
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:874
GNEJunction::~GNEJunction
~GNEJunction()
Destructor.
Definition: GNEJunction.cpp:73
NBNode::getCrossingsIncludingInvalid
const std::vector< Crossing * > & getCrossingsIncludingInvalid() const
Definition: NBNode.h:669
GNELane.h
NODETYPE_RAIL_CROSSING
@ NODETYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1060
NODETYPE_RIGHT_BEFORE_LEFT
@ NODETYPE_RIGHT_BEFORE_LEFT
Definition: SUMOXMLDefinitions.h:1063
GNEJunction::removeConnectionsFrom
void removeConnectionsFrom(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections from the given edge
Definition: GNEJunction.cpp:682
SUMO_ATTR_POSITION
@ SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
NODETYPE_DEAD_END
@ NODETYPE_DEAD_END
Definition: SUMOXMLDefinitions.h:1069
GNEJunction::setLogicValid
void setLogicValid(bool valid, GNEUndoList *undoList, const std::string &status=FEATURE_GUESSED)
Definition: GNEJunction.cpp:659
NODETYPE_DISTRICT
@ NODETYPE_DISTRICT
Definition: SUMOXMLDefinitions.h:1066
GNENet::getViewNet
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2117
NBNode::hasCustomShape
bool hasCustomShape() const
return whether the shape was set by the user
Definition: NBNode.h:526
Position::distanceSquaredTo2D
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:248
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
SUMO_TAG_E2DETECTOR_MULTILANE
@ SUMO_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (used by Netedit)
Definition: SUMOXMLDefinitions.h:69
GUIVisualizationSettings::colorSettings
GUIVisualizationColorSettings colorSettings
color settings
Definition: GUIVisualizationSettings.h:677
SUMO_ATTR_FROM
@ SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
SUMO_ATTR_RADIUS
@ SUMO_ATTR_RADIUS
The turning radius at an intersection in m.
Definition: SUMOXMLDefinitions.h:694
GUIVisualizationColorSettings::selectionColor
RGBColor selectionColor
basic selection color
Definition: GUIVisualizationSettings.h:129
GUIVisualizationSettings::getCircleResolution
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
Definition: GUIVisualizationSettings.cpp:1679
GNEJunction::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEJunction.cpp:186
NBNetBuilder::haveNetworkCrossings
bool haveNetworkCrossings()
notify about style of loaded network (Without Crossings)
Definition: NBNetBuilder.h:195
GNEJunction::getGNEIncomingEdges
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
Definition: GNEJunction.cpp:481
GNEJunction::addTrafficLight
void addTrafficLight(NBTrafficLightDefinition *tlDef, bool forceInsert)
adds a traffic light
Definition: GNEJunction.cpp:1506
Parameterised::setParametersStr
void setParametersStr(const std::string &paramsString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
Definition: Parameterised.cpp:139
GNENet::retrieveJunctions
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1261
NBLoadedSUMOTLDef::replaceRemoved
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces a removed edge/lane.
Definition: NBLoadedSUMOTLDef.cpp:163
GNEViewNetHelper::DemandViewOptions::showNonInspectedDemandElements
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
Definition: GNEViewNetHelper.cpp:1741
GLIncludes.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNENet::addGLObjectIntoGrid
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1322
NBNode::getShape
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:2140
GNENet::getTLLogicCont
NBTrafficLightLogicCont & getTLLogicCont()
returns the tllcont of the underlying netbuilder
Definition: GNENet.cpp:2147
GNEJunction::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEJunction.cpp:93
GUIMainWindow
Definition: GUIMainWindow.h:46
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
SUMO_TAG_TRAFFIC_LIGHT
@ SUMO_TAG_TRAFFIC_LIGHT
a traffic light
Definition: SUMOXMLDefinitions.h:139
GNENet::requireRecompute
void requireRecompute()
inform the net about the need for recomputation
Definition: GNENet.cpp:1569
GNEJunction::moveJunctionGeometry
void moveJunctionGeometry(const Position &pos)
reposition the node at pos without updating GRID and informs the edges
Definition: GNEJunction.cpp:1452
GNEJunction::getGNEEdges
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
Definition: GNEJunction.cpp:475
GNEUndoList::hasCommandGroup
bool hasCommandGroup() const
Check if undoList has command group.
Definition: GNEUndoList.cpp:231
SUMO_ATTR_TLLINKINDEX
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
Definition: SUMOXMLDefinitions.h:686
Parameterised::areParametersValid
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
Definition: Parameterised.cpp:166
GNEEdge::updateJunctionPosition
void updateJunctionPosition(GNEJunction *junction, const Position &origPos)
update edge geometry after junction move
Definition: GNEEdge.cpp:434
GNE_SUPERMODE_DEMAND
@ GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
Definition: GNEViewNetHelper.h:48
NBNode::getControllingTLS
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
Definition: NBNode.h:318
GNEAttributeCarrier::FEATURE_MODIFIED
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
Definition: GNEAttributeCarrier.h:598
InvalidArgument
Definition: UtilExceptions.h:56
GLHelper::drawBoxLine
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
SUMOXMLDefinitions::isValidNetID
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
Definition: SUMOXMLDefinitions.cpp:967
NBNode::getFringeType
FringeType getFringeType() const
Returns fringe type.
Definition: NBNode.h:292
GNEJunction::setColor
RGBColor setColor(const GUIVisualizationSettings &s, bool bubble) const
sets junction color depending on circumstances
Definition: GNEJunction.cpp:1487
NBNode::getIncomingEdges
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
Definition: NBNode.h:255
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
GNEReferenceCounter::incRef
void incRef(const std::string &debugMsg="")
Increarse reference.
Definition: GNEReferenceCounter.h:67
SUMO_TAG_PERSONTRIP_FROMTO
@ SUMO_TAG_PERSONTRIP_FROMTO
Definition: SUMOXMLDefinitions.h:304
GNEJunction::myGNECrossings
std::vector< GNECrossing * > myGNECrossings
the built crossing objects
Definition: GNEJunction.h:263
NBTrafficLightDefinition::getProgramID
const std::string & getProgramID() const
Returns the ProgramID.
Definition: NBTrafficLightDefinition.h:308
SUMO_TAG_RIDE_BUSSTOP
@ SUMO_TAG_RIDE_BUSSTOP
Definition: SUMOXMLDefinitions.h:311
SUMO_ATTR_RIGHT_OF_WAY
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
Definition: SUMOXMLDefinitions.h:698
NBNode::isTrafficLight
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
Definition: NBNode.cpp:3250
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:246
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:266
NBTrafficLightDefinition::addNode
virtual void addNode(NBNode *node)
Adds a node to the traffic light logic.
Definition: NBTrafficLightDefinition.cpp:414
SUMOXMLDefinitions::TrafficLightTypes
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
Definition: SUMOXMLDefinitions.h:1392
SUMO_TAG_WALK_BUSSTOP
@ SUMO_TAG_WALK_BUSSTOP
Definition: SUMOXMLDefinitions.h:308
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1069
NBNode::Crossing::edges
EdgeVector edges
The edges being crossed.
Definition: NBNode.h:137
GNENetElement::myNet
GNENet * myNet
the net to inform about updates
Definition: GNENetElement.h:166
SUMO_TAG_ROUTE
@ SUMO_TAG_ROUTE
begin/end of the description of a route
Definition: SUMOXMLDefinitions.h:125
NBNode::setFringeType
void setFringeType(FringeType fringeType)
set method for computing right-of-way
Definition: NBNode.h:521
SUMOXMLDefinitions::FringeTypeValues
static StringBijection< FringeType > FringeTypeValues
fringe types
Definition: SUMOXMLDefinitions.h:1380
config.h
GNEJunction::selectTLS
void selectTLS(bool selected)
notify the junction of being selected in tls-mode. (used to control drawing)
Definition: GNEJunction.cpp:523
StringBijection::hasString
bool hasString(const std::string &str) const
Definition: StringBijection.h:116
Position::add
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:126
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:216
GLO_JUNCTION
@ GLO_JUNCTION
a junction
Definition: GUIGlObjectTypes.h:50
GNECrossing::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNECrossing.cpp:70
GNEJunction::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNEJunction.cpp:1138
GNE_ATTR_SELECTED
@ GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
GNEJunction::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEJunction.cpp:1172
StringTokenizer.h
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:434
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
MID_GNE_JUNCTION_SPLIT
@ MID_GNE_JUNCTION_SPLIT
turn junction into multiple junctions
Definition: GUIAppEnum.h:868
GNEJunction::GNEChange_TLS
friend class GNEChange_TLS
Declare friend class.
Definition: GNEJunction.h:50
NBNode::myPoly
PositionVector myPoly
the (outer) shape of the junction
Definition: NBNode.h:840
NBEdgeCont::removeRoundabout
void removeRoundabout(const NBNode *node)
remove roundabout that contains the given node
Definition: NBEdgeCont.cpp:1364
SUMO_ATTR_FRINGE
@ SUMO_ATTR_FRINGE
Fringe type of node.
Definition: SUMOXMLDefinitions.h:700
GNENetElement::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
Definition: GNENetElement.cpp:83
NBTrafficLightLogic
A SUMO-compliant built logic for a traffic light.
Definition: NBTrafficLightLogic.h:51
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
GUIVisualizationSettings::drawJunctionShape
bool drawJunctionShape
whether the shape of the junction should be drawn
Definition: GUIVisualizationSettings.h:574
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
GNEUndoList
Definition: GNEUndoList.h:48
NBOwnTLDef.h
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
NBLoadedSUMOTLDef.h
NBAlgorithms.h
GNEJunction
Definition: GNEJunction.h:47
GNEJunction::removeConnectionsTo
void removeConnectionsTo(GNEEdge *edge, GNEUndoList *undoList, bool updateTLS, int lane=-1)
remove all connections to the given edge
Definition: GNEJunction.cpp:711
NBNode::Crossing
A definition of a pedestrian crossing.
Definition: NBNode.h:131
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:189
GNEUndoList::p_begin
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:72
NBTrafficLightLogicCont::insert
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
Definition: NBTrafficLightLogicCont.cpp:73
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
SUMO_TAG_EMBEDDEDROUTE
@ SUMO_TAG_EMBEDDEDROUTE
begin/end of the description of a embedded route (used in NETEDIT)
Definition: SUMOXMLDefinitions.h:127
GNEJunction::removeTLSConnections
void removeTLSConnections(std::vector< NBConnection > &connections, GNEUndoList *undoList)
remove the given connections from all traffic light definitions of this junction
Definition: GNEJunction.cpp:740
GNEJunction::replaceIncomingConnections
void replaceIncomingConnections(GNEEdge *which, GNEEdge *by, GNEUndoList *undoList)
replace one edge by another in all tls connections
Definition: GNEJunction.cpp:769
PositionVector::area
double area() const
Returns the area (0 for non-closed)
Definition: PositionVector.cpp:510
SUMO_ATTR_SHAPE
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:690
NBNode::getRightOfWay
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
Definition: NBNode.h:287
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
GNEViewNetHelper::EditModes::networkEditMode
NetworkEditMode networkEditMode
the current Network edit mode
Definition: GNEViewNetHelper.h:308
GNEJunction::getJunctionShape
const PositionVector & getJunctionShape() const
Definition: GNEJunction.cpp:103
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
GUIPropertyScheme::getColor
const T getColor(const double value) const
Definition: GUIPropertyScheme.h:110
NBEdge::getConnections
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:934
NBConnection::getFromLane
int getFromLane() const
returns the from-lane
Definition: NBConnection.cpp:234
WRITE_DEBUG
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:284
GUITextureSubSys.h
NBNode::buildCrossingsAndWalkingAreas
void buildCrossingsAndWalkingAreas()
build crossings, and walkingareas. Also removes invalid loaded crossings if wished
Definition: NBNode.cpp:2415
SUMO_TAG_RIDE_FROMTO
@ SUMO_TAG_RIDE_FROMTO
Definition: SUMOXMLDefinitions.h:310
NBLoadedSUMOTLDef::joinLogic
void joinLogic(NBTrafficLightDefinition *def)
join nodes and states from the given logic (append red state)
Definition: NBLoadedSUMOTLDef.cpp:607
GNEChange_Attribute.h
GNENet.h
GNEJunction::myGNEOutgoingEdges
std::vector< GNEEdge * > myGNEOutgoingEdges
vector with the outgoings GNEEdges vinculated with this junction
Definition: GNEJunction.h:260
GUIPropertySchemeStorage::getActive
int getActive() const
Definition: GUIPropertySchemeStorage.h:75
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
SUMO_TAG_TRIP
@ SUMO_TAG_TRIP
a single trip definition (used by router)
Definition: SUMOXMLDefinitions.h:145
SUMOXMLDefinitions::NodeTypes
static StringBijection< SumoXMLNodeType > NodeTypes
node types
Definition: SUMOXMLDefinitions.h:1368
NBNode::reinit
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
Definition: NBNode.cpp:303
NBTrafficLightDefinition
The base class for traffic light logic definitions.
Definition: NBTrafficLightDefinition.h:67
GNEJunction::removeOutgoingGNEEdge
void removeOutgoingGNEEdge(GNEEdge *edge)
remove outgoing GNEEdge
Definition: GNEJunction.cpp:461
SUMO_TAG_JUNCTION
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
Definition: SUMOXMLDefinitions.h:59
GNEUndoList.h
Named::setID
void setID(const std::string &newID)
resets the id
Definition: Named.h:84
GNEJunction::retrieveGNECrossing
GNECrossing * retrieveGNECrossing(NBNode::Crossing *NBNodeCrossing, bool createIfNoExist=true)
get GNECrossing if exist, and if not create it if create is enabled
Definition: GNEJunction.cpp:896
GNEJunction::myAmResponsible
bool myAmResponsible
whether we are responsible for deleting myNBNode
Definition: GNEJunction.h:276
GNEChange_Connection.h
NODETYPE_NOJUNCTION
@ NODETYPE_NOJUNCTION
Definition: SUMOXMLDefinitions.h:1067
GNENetElement::myMovingGeometryBoundary
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNENetElement.h:169
NBEdge::getTurnDestination
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:3084
NBEdge::getID
const std::string & getID() const
Definition: NBEdge.h:1380
GNEConnection.h
GNEJunction::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEJunction.cpp:273
NODETYPE_TRAFFIC_LIGHT
@ NODETYPE_TRAFFIC_LIGHT
Definition: SUMOXMLDefinitions.h:1056
NBLoadedSUMOTLDef
A loaded (complete) traffic light logic.
Definition: NBLoadedSUMOTLDef.h:44