SUMO - Simulation of Urban MObility
GNEConnectorFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // The Widget for modifying lane-to-lane connections
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #ifdef HAVE_VERSION_H
32 #include <version.h>
33 #endif
34 
35 #include <iostream>
42 #include "GNEInspectorFrame.h"
43 #include "GNEConnectorFrame.h"
44 #include "GNESelectorFrame.h"
45 #include "GNEViewParent.h"
46 #include "GNEViewNet.h"
47 #include "GNEChange_Connection.h"
48 #include "GNEUndoList.h"
49 #include "GNENet.h"
50 #include "GNELane.h"
51 #include "GNEInternalLane.h"
52 #include "GNEEdge.h"
53 #include "GNEJunction.h"
54 
55 #ifdef CHECK_MEMORY_LEAKS
56 #include <foreign/nvwa/debug_new.h>
57 #endif // CHECK_MEMORY_LEAKS
58 
59 
60 // ===========================================================================
61 // FOX callback mapping
62 // ===========================================================================
63 FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[] = {
64  FXMAPFUNC(SEL_COMMAND, MID_CANCEL, GNEConnectorFrame::onCmdCancel),
65  FXMAPFUNC(SEL_COMMAND, MID_OK, GNEConnectorFrame::onCmdOK),
72 };
73 
74 // Object implementation
75 FXIMPLEMENT(GNEConnectorFrame, FXScrollWindow, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
76 
77 // ===========================================================================
78 // static members
79 // ===========================================================================
80 RGBColor GNEConnectorFrame::sourceColor;
81 RGBColor GNEConnectorFrame::potentialTargetColor;
82 RGBColor GNEConnectorFrame::targetColor;
83 RGBColor GNEConnectorFrame::targetPassColor;
84 RGBColor GNEConnectorFrame::conflictColor;
85 
86 // ===========================================================================
87 // method definitions
88 // ===========================================================================
89 GNEConnectorFrame::GNEConnectorFrame(FXComposite* parent, GNEViewNet* viewNet):
90  GNEFrame(parent, viewNet, "Edit Connections"),
91  myCurrentLane(0) {
92  // heading
93  myDescription = new FXLabel(myContentFrame, "", 0, JUSTIFY_LEFT);
94  new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
95  updateDescription();
96 
97  // buttons
98  // "Cancel"
99  new FXButton(myContentFrame, "Cancel\t\tDiscard connection modifications (Esc)", 0, this, MID_CANCEL,
100  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
101  0, 0, 0, 0, 4, 4, 3, 3);
102  // "OK"
103  new FXButton(myContentFrame, "OK\t\tSave connection modifications (Enter)", 0, this, MID_OK,
104  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
105  0, 0, 0, 0, 4, 4, 3, 3);
106  new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
107  // "Select Dead Ends"
108  new FXButton(myContentFrame,
109  "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
110  0, this, MID_GNE_SELECT_DEAD_ENDS,
111  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
112  0, 0, 0, 0, 4, 4, 3, 3);
113  // "Select Dead Starts"
114  new FXButton(myContentFrame,
115  "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
117  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
118  0, 0, 0, 0, 4, 4, 3, 3);
119  // "Select Conflicts"
120  new FXButton(myContentFrame,
121  "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
122  0, this, MID_GNE_SELECT_CONFLICTS,
123  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
124  0, 0, 0, 0, 4, 4, 3, 3);
125  // "Select Edges which may always pass"
126  new FXButton(myContentFrame,
127  "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
128  0, this, MID_GNE_SELECT_PASS,
129  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
130  0, 0, 0, 0, 4, 4, 3, 3);
131  // "Clear Selected"
132  new FXButton(myContentFrame,
133  "Clear Selected\t\tClears all connections of all selected objects",
134  0, this, MID_CHOOSEN_CLEAR,
135  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
136  0, 0, 0, 0, 4, 4, 3, 3);
137  // "Reset Selected"
138  new FXButton(myContentFrame,
139  "Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
140  0, this, MID_CHOOSEN_RESET,
141  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
142  0, 0, 0, 0, 4, 4, 3, 3);
143 
144  new FXHorizontalSeparator(this, SEPARATOR_GROOVE | LAYOUT_FILL_X);
145  // Selection Hint
146  new FXLabel(myContentFrame, "Hold <SHIFT> while\nclicking to create\nunyielding conn's.\n", 0, JUSTIFY_LEFT);
147  new FXLabel(myContentFrame, "Hold <CTRL> while\nclicking to create\nconflicting conn's.\n", 0, JUSTIFY_LEFT);
148  // Legend
149  // init colors here to avoid static order fiasco (https://isocpp.org/wiki/faq/ctors#static-init-order)
150  sourceColor = RGBColor::CYAN;
151  potentialTargetColor = RGBColor(0, 64, 0, 255);
152  targetColor = RGBColor::GREEN;
153  targetPassColor = RGBColor::MAGENTA;
154  conflictColor = RGBColor::YELLOW;
155 
156  new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
157  FXLabel* l;
158  new FXLabel(myContentFrame, "Color Legend:", 0, JUSTIFY_LEFT);
159  l = new FXLabel(myContentFrame, "Source", 0, JUSTIFY_LEFT);
160  l->setBackColor(MFXUtils::getFXColor(sourceColor));
161  l = new FXLabel(myContentFrame, "Target", 0, JUSTIFY_LEFT);
162  l->setBackColor(MFXUtils::getFXColor(targetColor));
163  l = new FXLabel(myContentFrame, "Possible Target", 0, JUSTIFY_LEFT);
164  l->setBackColor(MFXUtils::getFXColor(potentialTargetColor));
165  l = new FXLabel(myContentFrame, "Target (pass)", 0, JUSTIFY_LEFT);
166  l->setBackColor(MFXUtils::getFXColor(targetPassColor));
167  l = new FXLabel(myContentFrame, "Conflict", 0, JUSTIFY_LEFT);
168  l->setBackColor(MFXUtils::getFXColor(conflictColor));
169 }
170 
171 
173 }
174 
175 
176 void
178  // Show Scroll window
179  FXScrollWindow::show();
180  // Show Frame Area in which this GNEFrame is placed
182 }
183 
184 
185 void
187  // Hide ScrollWindow
188  FXScrollWindow::hide();
189  // Hide Frame Area in which this GNEFrame is placed
191 }
192 
193 
194 void
195 GNEConnectorFrame::handleLaneClick(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle) {
196  if (myCurrentLane == 0) {
197  myCurrentLane = lane;
199  initTargets();
201  myNumChanges = 0;
202  myViewNet->getUndoList()->p_begin("modify connections");
203  } else if (myPotentialTargets.count(lane) || allowConflict) {
204  const int fromIndex = myCurrentLane->getIndex();
205  GNEEdge& srcEdge = myCurrentLane->getParentEdge();
206  GNEEdge& destEdge = lane->getParentEdge();
207  const std::string& destEdgeID = destEdge.getMicrosimID();
208  std::vector<NBEdge::Connection> connections = srcEdge.getNBEdge()->getConnectionsFromLane(fromIndex);
209  bool changed = false;
210  NBConnection deletedConnection = NBConnection::InvalidConnection;
211  LaneStatus status = getLaneStatus(connections, lane);
212  if (status == CONFLICTED && allowConflict) {
213  status = UNCONNECTED;
214  }
215  switch (status) {
216  case UNCONNECTED:
217  if (toggle) {
218  myViewNet->getUndoList()->add(new GNEChange_Connection(&srcEdge, fromIndex,
219  destEdgeID, lane->getIndex(), mayDefinitelyPass, true), true);
220  lane->setSpecialColor(mayDefinitelyPass ? &targetPassColor : &targetColor);
221  changed = true;
222  }
223  break;
224  case CONNECTED:
225  case CONNECTED_PASS:
226  myViewNet->getUndoList()->add(new GNEChange_Connection(&srcEdge, fromIndex, destEdgeID, lane->getIndex(),
227  status == CONNECTED_PASS, false), true);
229  changed = true;
230  deletedConnection = NBConnection(srcEdge.getNBEdge(), fromIndex,
231  destEdge.getNBEdge(), lane->getIndex(),
232  (int)getTLLLinkNumber(connections, lane));
233  break;
234  case CONFLICTED:
235  myViewNet->setStatusBarText("Another lane from the same edge already connects to that lane");
236  break;
237  }
238  if (changed) {
239  myNumChanges += 1;
240  GNEJunction* affected = myViewNet->getNet()->retrieveJunction(srcEdge.getDest()->getMicrosimID());
241  affected->invalidateTLS(myViewNet->getUndoList(), deletedConnection);
243  }
244  } else {
245  myViewNet->setStatusBarText("Invalid target for connection");
246  }
248 }
249 
250 
251 long
252 GNEConnectorFrame::onCmdCancel(FXObject*, FXSelector, void*) {
253  if (myCurrentLane != 0) {
255  if (myNumChanges) {
256  myViewNet->setStatusBarText("Changes reverted");
257  }
258  cleanup();
259  myViewNet->update();
260  }
261  return 1;
262 }
263 
264 
265 long
266 GNEConnectorFrame::onCmdOK(FXObject*, FXSelector, void*) {
267  if (myCurrentLane != 0) {
269  if (myNumChanges) {
270  myViewNet->setStatusBarText("Changes accepted");
271  }
272  cleanup();
273  myViewNet->update();
274  }
275  return 1;
276 }
277 
278 
279 long
280 GNEConnectorFrame::onCmdSelectDeadEnds(FXObject*, FXSelector, void*) {
281  std::vector<GUIGlID> selectIDs;
282  // every edge knows its outgoing connections so we can look at each edge in isolation
283  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
284  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
285  const GNEEdge::LaneVector& lanes = (*edge_it)->getLanes();
286  for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
287  if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
288  selectIDs.push_back((*it_lane)->getGlID());
289  }
290  }
291  }
293  return 1;
294 }
295 
296 
297 long
298 GNEConnectorFrame::onCmdSelectDeadStarts(FXObject*, FXSelector, void*) {
299  GNENet* net = myViewNet->getNet();
300  std::set<GUIGlID> selectIDs;
301  // every edge knows only its outgoing connections so we look at whole junctions
302  const std::vector<GNEJunction*> junctions = net->retrieveJunctions();
303  for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
304  // first collect all outgoing lanes
305  const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
306  for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
307  GNEEdge* edge = net->retrieveEdge((*it)->getID());
308  const std::set<GUIGlID> laneIDs = edge->getLaneGlIDs();
309  for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
310  selectIDs.insert(*lid_it);
311  }
312  }
313  // then remove all approached lanes
314  const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
315  for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
316  GNEEdge* edge = net->retrieveEdge((*it)->getID());
317  NBEdge* nbe = edge->getNBEdge();
318  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
319  for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
320  GNEEdge* approachedEdge = net->retrieveEdge(con_it->toEdge->getID());
321  GNELane* approachedLane = approachedEdge->getLanes()[con_it->toLane];
322  selectIDs.erase(approachedLane->getGlID());
323  }
324  }
325  }
327  std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
329  return 1;
330 }
331 
332 
333 long
334 GNEConnectorFrame::onCmdSelectConflicts(FXObject*, FXSelector, void*) {
335  std::vector<GUIGlID> selectIDs;
336  // conflicts happen per edge so we can look at each edge in isolation
337  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
338  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
339  NBEdge* nbe = (*edge_it)->getNBEdge();
340  const EdgeVector destinations = nbe->getConnectedEdges();
341  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
342  for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
343  GNEEdge* dest = myViewNet->getNet()->retrieveEdge((*dest_it)->getID());
344  const GNEEdge::LaneVector& destLanes = dest->getLanes();
345  for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
346  const bool isConflicted = count_if(
347  connections.begin(), connections.end(),
348  NBEdge::connections_toedgelane_finder(*dest_it, (int)(*it_lane)->getIndex(), -1)) > 1;
349  if (isConflicted) {
350  selectIDs.push_back((*it_lane)->getGlID());
351  }
352  }
353  }
354 
355  }
357  return 1;
358 }
359 
360 
361 long
362 GNEConnectorFrame::onCmdSelectPass(FXObject*, FXSelector, void*) {
363  std::vector<GUIGlID> selectIDs;
364  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
365  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
366  GNEEdge* edge = *edge_it;
367  NBEdge* nbe = edge->getNBEdge();
368  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
369  for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
370  if (it->mayDefinitelyPass) {
371  GNELane* lane = edge->getLanes()[it->fromLane];
372  selectIDs.push_back(lane->getGlID());
373  }
374  }
375  }
377  return 1;
378 }
379 
380 
381 long
383  onCmdCancel(0, 0, 0);
384  myViewNet->getUndoList()->p_begin("clear connections from selected lanes, edges and junctions");
385  const std::set<GUIGlID> ids = gSelected.getSelected();
386  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
387  GUIGlID id = *it;
389  if (object) {
390  switch (object->getType()) {
391  case GLO_JUNCTION: {
392  GNEJunction* junction = dynamic_cast<GNEJunction*>(object);
393  junction->setLogicValid(false, myViewNet->getUndoList()); // clear connections
394  junction->setLogicValid(false, myViewNet->getUndoList(), GNEAttributeCarrier::MODIFIED); // prevent re-guessing
395  break;
396  }
397  case GLO_EDGE: {
398  const GNEEdge::LaneVector& lanes = dynamic_cast<GNEEdge*>(object)->getLanes();
399  for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
400  removeConnections(*l_it);
401  }
402  break;
403  }
404  case GLO_LANE:
405  removeConnections(dynamic_cast<GNELane*>(object));
406  break;
407  default:
408  break;
409  }
410  }
411  }
413  return 1;
414 }
415 
416 
417 void
419  handleLaneClick(lane, false, false, true); // select as current lane
420  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
421  handleLaneClick(*it, false, false, false); // deselect
422  }
423  onCmdOK(0, 0, 0); // save
424 }
425 
426 
427 long
429  onCmdCancel(0, 0, 0);
430  myViewNet->getUndoList()->p_begin("reset connections from selected lanes");
431  const std::set<GUIGlID> nodeIDs = gSelected.getSelected(GLO_JUNCTION);
432  for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
434  if (object) {
435  GNEJunction* junction = dynamic_cast<GNEJunction*>(object);
436  if (junction) {
437  junction->setLogicValid(false, myViewNet->getUndoList());
438  } else {
439  throw ProcessError("Wrong object type returned from gIDStorage");
440  }
441  }
442  }
444  return 1;
445 }
446 
447 
448 void
450  if (myCurrentLane == 0) {
451  myDescription->setText("No Lane Selected\n");
452  } else {
453  myDescription->setText((
454  myCurrentLane->getMicrosimID() + "\n(" +
455  toString(myNumChanges) + " changes)").c_str());
456  }
457 }
458 
459 
460 void
462  // gather potential targets
464 
465  const EdgeVector& outgoing = nbn->getOutgoingEdges();
466  for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
467  GNEEdge* edge = myViewNet->getNet()->retrieveEdge((*it)->getID());
468  const GNEEdge::LaneVector& lanes = edge->getLanes();
469  for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
470  myPotentialTargets.insert(*it_lane);
471  }
472  }
473  // set color for existing connections
474  const int fromIndex = myCurrentLane->getIndex();
476  std::vector<NBEdge::Connection> connections = srcEdge->getConnectionsFromLane(fromIndex);
477  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
478  switch (getLaneStatus(connections, *it)) {
479  case CONNECTED:
480  (*it)->setSpecialColor(&targetColor);
481  break;
482  case CONNECTED_PASS:
483  (*it)->setSpecialColor(&targetPassColor);
484  break;
485  case CONFLICTED:
486  (*it)->setSpecialColor(&conflictColor);
487  break;
488  case UNCONNECTED:
489  (*it)->setSpecialColor(&potentialTargetColor);
490  break;
491  }
492  }
493 }
494 
495 
496 void
498  // clean up
499  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
500  (*it)->setSpecialColor(0);
501  }
502  myPotentialTargets.clear();
503  myNumChanges = 0;
505  myCurrentLane = 0;
506  buildIinternalLanes(0); // only clears
508 }
509 
510 
512 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane) {
514  const int fromIndex = myCurrentLane->getIndex();
515  NBEdge* destEdge = targetLane->getParentEdge().getNBEdge();
516  const int toIndex = targetLane->getIndex();
517  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
518  connections.begin(), connections.end(),
519  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
520  const bool isConnected = con_it != connections.end();
521  if (isConnected) {
522  if (con_it->mayDefinitelyPass) {
523  return CONNECTED_PASS;
524  } else {
525  return CONNECTED;
526  }
527  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)) {
528  return CONFLICTED;
529  } else {
530  return UNCONNECTED;
531  }
532 }
533 
534 
535 int
536 GNEConnectorFrame::getTLLLinkNumber(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane) {
537  const int fromIndex = myCurrentLane->getIndex();
538  NBEdge* destEdge = targetLane->getParentEdge().getNBEdge();
539  const int toIndex = targetLane->getIndex();
540  std::vector<NBEdge::Connection>::const_iterator it = find_if(
541  connections.begin(), connections.end(),
542  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
543  assert(it != connections.end());
544  return it->tlLinkNo;
545 }
546 
547 
548 void
550  // clean up previous objects
552  for (std::map<int, GNEInternalLane*>::iterator it = myInternalLanes.begin(); it != myInternalLanes.end(); it++) {
553  rtree.removeAdditionalGLObject(it->second);
554  delete it->second;
555  }
556  myInternalLanes.clear();
557  if (node != 0) {
558  const int NUM_POINTS = 5;
560  std::string innerID = ":" + node->getID(); // see NWWriter_SUMO::writeInternalEdges
561 
562  int index = 0;
563  const EdgeVector& incoming = node->getIncomingEdges();
564  for (EdgeVector::const_iterator it_edg = incoming.begin(); it_edg != incoming.end(); it_edg++) {
565  const std::vector<NBEdge::Connection>& conns = (*it_edg)->getConnections();
566  for (std::vector<NBEdge::Connection>::const_iterator it_con = conns.begin(); it_con != conns.end(); ++it_con) {
567  const PositionVector shape = node->computeInternalLaneShape(*it_edg, *it_con, NUM_POINTS);
568  LinkState state = node->getLinkState(*it_edg, it_con->toEdge, it_con->fromLane, it_con->toLane, it_con->mayDefinitelyPass, it_con->tlID);
569  GNEInternalLane* ilane = new GNEInternalLane(0, innerID + '_' + toString(index) , shape, -1, state);
570  rtree.addAdditionalGLObject(ilane);
571  myInternalLanes[index] = ilane;
572  index++;
573  }
574  }
575  }
576 }
577 
578 
579 /****************************************************************************/
int NUM_POINTS
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:678
static RGBColor targetColor
color for the to-lane of a connection
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges.
Definition: NBNode.h:240
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:616
void hideFramesArea()
hide frames area if all GNEFrames are hidden
void show()
show Frame
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:798
static const NBConnection InvalidConnection
Definition: NBConnection.h:128
long onCmdSelectPass(FXObject *, FXSelector, void *)
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
Definition: GNEEdge.cpp:414
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
The representation of a single edge during network building.
Definition: NBEdge.h:70
void showFramesArea()
show frames area if at least a GNEFrame is showed
std::vector< GNELane * > LaneVector
Definition of the lane&#39;s positions vector.
Definition: GNEEdge.h:62
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
void removeAdditionalGLObject(GUIGlObject *o)
Removes an additional object (detector/shape/trigger) from being visualised.
Definition: SUMORTree.h:141
NBNode * getNBNode() const
Return net build node.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:86
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:86
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:839
A RT-tree for efficient storing of SUMO&#39;s GL-objects.
Definition: SUMORTree.h:74
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:500
GUIGlID getGlID() const
Returns the numerical id of the object.
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:851
GNEViewNet * myViewNet
the window to inform when the tls is modfied
Definition: GNEFrame.h:85
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
Definition: NBEdge.cpp:881
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges.
Definition: NBNode.h:248
static RGBColor potentialTargetColor
color for potential to-lane targets (currently unconnected)
void handleLaneClick(GNELane *lane, bool mayDefinitelyPass, bool allowConflict, bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
const std::string & getID() const
Returns the id.
Definition: Named.h:66
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
static const std::string MODIFIED
feature has been manually modified (implies approval)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static const RGBColor GREEN
Definition: RGBColor.h:190
int myNumChanges
number of changes
const std::set< GUIGlID > & getSelected() const
Returns the list of ids of all selected objects.
void initTargets()
init targets
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:825
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:870
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:93
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:603
A list of positions.
void removeConnections(GNELane *lane)
remove connections
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Cancel-button pressed.
Definition: GUIAppEnum.h:65
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
static RGBColor sourceColor
color for the from-lane of a connection
static const RGBColor MAGENTA
Definition: RGBColor.h:194
static RGBColor targetPassColor
color for the to-lane of a connection with pass attribute
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
Definition: NBNode.cpp:1596
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
Clear set.
Definition: GUIAppEnum.h:345
void p_abort()
reverts and discards ALL active command groups
SUMORTree & getVisualisationSpeedUp()
Returns the RTree used for visualisation speed-up.
Definition: GNENet.cpp:223
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
unsigned int GUIGlID
Definition: GUIGlObject.h:50
long onCmdOK(FXObject *, FXSelector, void *)
void updateDescription() const
update description
Reset set.
Definition: GUIAppEnum.h:347
void hide()
hide Frame
static const RGBColor YELLOW
Definition: RGBColor.h:192
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:371
PositionVector computeInternalLaneShape(NBEdge *fromE, const NBEdge::Connection &con, int numPoints) const
Compute the shape for an internal lane.
Definition: NBNode.cpp:617
static RGBColor conflictColor
color for a to-lane that cannot be used because another connection conflicts
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:424
static const RGBColor CYAN
Definition: RGBColor.h:193
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:631
std::map< int, GNEInternalLane * > myInternalLanes
the internal lanes belonging the the current junction indexed by their tl-index
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
Definition: SUMORTree.h:129
std::vector< NBEdge * > EdgeVector
Definition: NBCont.h:41
void buildIinternalLanes(NBNode *node)
builds internal lanes for the given node
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
Ok-button pressed.
Definition: GUIAppEnum.h:63
FXLabel * myDescription
the label that shows the current editing state
void setSpecialColor(const RGBColor *Color2)
Definition: GNELane.cpp:669
an edge
GNEJunction * getDest() const
returns the destination-junction
Definition: GNEEdge.cpp:145
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:845
void handleIDs(std::vector< GUIGlID > ids, bool selectEdges, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
LaneStatus
the status of a target lane
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:125
Represents a single node (junction) during network building.
Definition: NBNode.h:74
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the Corresponding-button.
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:301
GNELane * myCurrentLane
the lane of which connections are to be modified
~GNEConnectorFrame()
Destructor.
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:225
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GUISelectedStorage gSelected
A global holder of selected objects.
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:786
void cleanup()
clean up when deselecting current lane
int getTLLLinkNumber(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
a junction