SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 "GNEConnection.h"
52 #include "GNEInternalLane.h"
53 #include "GNEEdge.h"
54 #include "GNEJunction.h"
55 
56 #ifdef CHECK_MEMORY_LEAKS
57 #include <foreign/nvwa/debug_new.h>
58 #endif // CHECK_MEMORY_LEAKS
59 
60 
61 // ===========================================================================
62 // FOX callback mapping
63 // ===========================================================================
64 FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[] = {
65  FXMAPFUNC(SEL_COMMAND, MID_CANCEL, GNEConnectorFrame::onCmdCancel),
66  FXMAPFUNC(SEL_COMMAND, MID_OK, GNEConnectorFrame::onCmdOK),
73 };
74 
75 // Object implementation
76 FXIMPLEMENT(GNEConnectorFrame, FXScrollWindow, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
77 
78 // ===========================================================================
79 // static members
80 // ===========================================================================
81 RGBColor GNEConnectorFrame::sourceColor;
82 RGBColor GNEConnectorFrame::potentialTargetColor;
83 RGBColor GNEConnectorFrame::targetColor;
84 RGBColor GNEConnectorFrame::targetPassColor;
85 RGBColor GNEConnectorFrame::conflictColor;
86 
87 // ===========================================================================
88 // method definitions
89 // ===========================================================================
90 GNEConnectorFrame::GNEConnectorFrame(FXComposite* parent, GNEViewNet* viewNet):
91  GNEFrame(parent, viewNet, "Edit Connections"),
92  myCurrentLane(0) {
93  // heading
94  myDescription = new FXLabel(myContentFrame, "", 0, JUSTIFY_LEFT);
95  new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
96  updateDescription();
97 
98  // buttons
99  // "Cancel"
100  new FXButton(myContentFrame, "Cancel\t\tDiscard connection modifications (Esc)", 0, this, MID_CANCEL,
101  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
102  0, 0, 0, 0, 4, 4, 3, 3);
103  // "OK"
104  new FXButton(myContentFrame, "OK\t\tSave connection modifications (Enter)", 0, this, MID_OK,
105  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
106  0, 0, 0, 0, 4, 4, 3, 3);
107  new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
108  // "Select Dead Ends"
109  new FXButton(myContentFrame,
110  "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
111  0, this, MID_GNE_SELECT_DEAD_ENDS,
112  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
113  0, 0, 0, 0, 4, 4, 3, 3);
114  // "Select Dead Starts"
115  new FXButton(myContentFrame,
116  "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
118  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
119  0, 0, 0, 0, 4, 4, 3, 3);
120  // "Select Conflicts"
121  new FXButton(myContentFrame,
122  "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
123  0, this, MID_GNE_SELECT_CONFLICTS,
124  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
125  0, 0, 0, 0, 4, 4, 3, 3);
126  // "Select Edges which may always pass"
127  new FXButton(myContentFrame,
128  "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
129  0, this, MID_GNE_SELECT_PASS,
130  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
131  0, 0, 0, 0, 4, 4, 3, 3);
132  // "Clear Selected"
133  new FXButton(myContentFrame,
134  "Clear Selected\t\tClears all connections of all selected objects",
135  0, this, MID_CHOOSEN_CLEAR,
136  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
137  0, 0, 0, 0, 4, 4, 3, 3);
138  // "Reset Selected"
139  new FXButton(myContentFrame,
140  "Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
141  0, this, MID_CHOOSEN_RESET,
142  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
143  0, 0, 0, 0, 4, 4, 3, 3);
144 
145  new FXHorizontalSeparator(this, SEPARATOR_GROOVE | LAYOUT_FILL_X);
146  // Selection Hint
147  new FXLabel(myContentFrame, "Hold <SHIFT> while\nclicking to create\nunyielding conn's.\n", 0, JUSTIFY_LEFT);
148  new FXLabel(myContentFrame, "Hold <CTRL> while\nclicking to create\nconflicting conn's.\n", 0, JUSTIFY_LEFT);
149  // Legend
150  // init colors here to avoid static order fiasco (https://isocpp.org/wiki/faq/ctors#static-init-order)
151  sourceColor = RGBColor::CYAN;
152  potentialTargetColor = RGBColor(0, 64, 0, 255);
153  targetColor = RGBColor::GREEN;
154  targetPassColor = RGBColor::MAGENTA;
155  conflictColor = RGBColor::YELLOW;
156 
157  new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4);
158  FXLabel* l;
159  new FXLabel(myContentFrame, "Color Legend:", 0, JUSTIFY_LEFT);
160  l = new FXLabel(myContentFrame, "Source", 0, JUSTIFY_LEFT);
161  l->setBackColor(MFXUtils::getFXColor(sourceColor));
162  l = new FXLabel(myContentFrame, "Target", 0, JUSTIFY_LEFT);
163  l->setBackColor(MFXUtils::getFXColor(targetColor));
164  l = new FXLabel(myContentFrame, "Possible Target", 0, JUSTIFY_LEFT);
165  l->setBackColor(MFXUtils::getFXColor(potentialTargetColor));
166  l = new FXLabel(myContentFrame, "Target (pass)", 0, JUSTIFY_LEFT);
167  l->setBackColor(MFXUtils::getFXColor(targetPassColor));
168  l = new FXLabel(myContentFrame, "Conflict", 0, JUSTIFY_LEFT);
169  l->setBackColor(MFXUtils::getFXColor(conflictColor));
170 }
171 
172 
174 }
175 
176 
177 void
179  // Show Scroll window
180  FXScrollWindow::show();
181  // Show Frame Area in which this GNEFrame is placed
183 }
184 
185 
186 void
188  // Hide ScrollWindow
189  FXScrollWindow::hide();
190  // Hide Frame Area in which this GNEFrame is placed
192 }
193 
194 
195 void
196 GNEConnectorFrame::handleLaneClick(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle) {
197  if (myCurrentLane == 0) {
198  myCurrentLane = lane;
200  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  LaneStatus status = getLaneStatus(connections, lane);
211  if (status == CONFLICTED && allowConflict) {
212  status = UNCONNECTED;
213  }
214  switch (status) {
215  case UNCONNECTED:
216  if (toggle) {
217  // create new connection
218  NBEdge::Connection newCon(fromIndex, destEdge.getNBEdge(), lane->getIndex());
219  myViewNet->getUndoList()->add(new GNEChange_Connection(&srcEdge, newCon, true), true);
220  lane->setSpecialColor(mayDefinitelyPass ? &targetPassColor : &targetColor);
221  GNEJunction* affected = srcEdge.getGNEJunctionDest();
222  affected->invalidateTLS(myViewNet->getUndoList());
223  }
224  break;
225  case CONNECTED:
226  case CONNECTED_PASS: {
227  // remove connection
228  GNEConnection* con = srcEdge.retrieveConnection(fromIndex, destEdge.getNBEdge(), lane->getIndex());
231  changed = true;
232  break;
233  }
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  }
241  } else {
242  myViewNet->setStatusBarText("Invalid target for connection");
243  }
245 }
246 
247 
248 long
249 GNEConnectorFrame::onCmdCancel(FXObject*, FXSelector, void*) {
250  if (myCurrentLane != 0) {
252  if (myNumChanges) {
253  myViewNet->setStatusBarText("Changes reverted");
254  }
255  cleanup();
256  myViewNet->update();
257  }
258  return 1;
259 }
260 
261 
262 long
263 GNEConnectorFrame::onCmdOK(FXObject*, FXSelector, void*) {
264  if (myCurrentLane != 0) {
266  if (myNumChanges) {
267  myViewNet->setStatusBarText("Changes accepted");
268  }
269  cleanup();
270  myViewNet->update();
271  }
272  return 1;
273 }
274 
275 
276 long
277 GNEConnectorFrame::onCmdSelectDeadEnds(FXObject*, FXSelector, void*) {
278  std::vector<GUIGlID> selectIDs;
279  // every edge knows its outgoing connections so we can look at each edge in isolation
280  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
281  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
282  const GNEEdge::LaneVector& lanes = (*edge_it)->getLanes();
283  for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
284  if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
285  selectIDs.push_back((*it_lane)->getGlID());
286  }
287  }
288  }
290  return 1;
291 }
292 
293 
294 long
295 GNEConnectorFrame::onCmdSelectDeadStarts(FXObject*, FXSelector, void*) {
296  GNENet* net = myViewNet->getNet();
297  std::set<GUIGlID> selectIDs;
298  // every edge knows only its outgoing connections so we look at whole junctions
299  const std::vector<GNEJunction*> junctions = net->retrieveJunctions();
300  for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
301  // first collect all outgoing lanes
302  const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
303  for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
304  GNEEdge* edge = net->retrieveEdge((*it)->getID());
305  const std::set<GUIGlID> laneIDs = edge->getLaneGlIDs();
306  for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
307  selectIDs.insert(*lid_it);
308  }
309  }
310  // then remove all approached lanes
311  const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
312  for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
313  GNEEdge* edge = net->retrieveEdge((*it)->getID());
314  NBEdge* nbe = edge->getNBEdge();
315  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
316  for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
317  GNEEdge* approachedEdge = net->retrieveEdge(con_it->toEdge->getID());
318  GNELane* approachedLane = approachedEdge->getLanes()[con_it->toLane];
319  selectIDs.erase(approachedLane->getGlID());
320  }
321  }
322  }
324  std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
326  return 1;
327 }
328 
329 
330 long
331 GNEConnectorFrame::onCmdSelectConflicts(FXObject*, FXSelector, void*) {
332  std::vector<GUIGlID> selectIDs;
333  // conflicts happen per edge so we can look at each edge in isolation
334  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
335  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
336  NBEdge* nbe = (*edge_it)->getNBEdge();
337  const EdgeVector destinations = nbe->getConnectedEdges();
338  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
339  for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
340  GNEEdge* dest = myViewNet->getNet()->retrieveEdge((*dest_it)->getID());
341  const GNEEdge::LaneVector& destLanes = dest->getLanes();
342  for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
343  const bool isConflicted = count_if(
344  connections.begin(), connections.end(),
345  NBEdge::connections_toedgelane_finder(*dest_it, (int)(*it_lane)->getIndex(), -1)) > 1;
346  if (isConflicted) {
347  selectIDs.push_back((*it_lane)->getGlID());
348  }
349  }
350  }
351 
352  }
354  return 1;
355 }
356 
357 
358 long
359 GNEConnectorFrame::onCmdSelectPass(FXObject*, FXSelector, void*) {
360  std::vector<GUIGlID> selectIDs;
361  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
362  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
363  GNEEdge* edge = *edge_it;
364  NBEdge* nbe = edge->getNBEdge();
365  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
366  for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
367  if (it->mayDefinitelyPass) {
368  GNELane* lane = edge->getLanes()[it->fromLane];
369  selectIDs.push_back(lane->getGlID());
370  }
371  }
372  }
374  return 1;
375 }
376 
377 
378 long
380  onCmdCancel(0, 0, 0);
381  myViewNet->getUndoList()->p_begin("clear connections from selected lanes, edges and junctions");
382  const std::set<GUIGlID> ids = gSelected.getSelected();
383  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
384  GUIGlID id = *it;
386  if (object) {
387  switch (object->getType()) {
388  case GLO_JUNCTION: {
389  GNEJunction* junction = dynamic_cast<GNEJunction*>(object);
390  junction->setLogicValid(false, myViewNet->getUndoList()); // clear connections
391  junction->setLogicValid(false, myViewNet->getUndoList(), GNEAttributeCarrier::MODIFIED); // prevent re-guessing
392  break;
393  }
394  case GLO_EDGE: {
395  const GNEEdge::LaneVector& lanes = dynamic_cast<GNEEdge*>(object)->getLanes();
396  for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
397  removeConnections(*l_it);
398  }
399  break;
400  }
401  case GLO_LANE:
402  removeConnections(dynamic_cast<GNELane*>(object));
403  break;
404  default:
405  break;
406  }
407  }
408  }
410  return 1;
411 }
412 
413 
414 void
416  handleLaneClick(lane, false, false, true); // select as current lane
417  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
418  handleLaneClick(*it, false, false, false); // deselect
419  }
420  onCmdOK(0, 0, 0); // save
421 }
422 
423 
424 long
426  onCmdCancel(0, 0, 0);
427  myViewNet->getUndoList()->p_begin("reset connections from selected lanes");
428  const std::set<GUIGlID> nodeIDs = gSelected.getSelected(GLO_JUNCTION);
429  for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
431  if (object) {
432  GNEJunction* junction = dynamic_cast<GNEJunction*>(object);
433  if (junction) {
434  junction->setLogicValid(false, myViewNet->getUndoList());
435  } else {
436  throw ProcessError("Wrong object type returned from gIDStorage");
437  }
438  }
439  }
441  return 1;
442 }
443 
444 
445 void
447  if (myCurrentLane == 0) {
448  myDescription->setText("No Lane Selected\n");
449  } else {
450  myDescription->setText((
451  myCurrentLane->getMicrosimID() + "\n(" +
452  toString(myNumChanges) + " changes)").c_str());
453  }
454 }
455 
456 
457 void
459  // gather potential targets
461 
462  const EdgeVector& outgoing = nbn->getOutgoingEdges();
463  for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
464  GNEEdge* edge = myViewNet->getNet()->retrieveEdge((*it)->getID());
465  const GNEEdge::LaneVector& lanes = edge->getLanes();
466  for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
467  myPotentialTargets.insert(*it_lane);
468  }
469  }
470  // set color for existing connections
471  const int fromIndex = myCurrentLane->getIndex();
473  std::vector<NBEdge::Connection> connections = srcEdge->getConnectionsFromLane(fromIndex);
474  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
475  switch (getLaneStatus(connections, *it)) {
476  case CONNECTED:
477  (*it)->setSpecialColor(&targetColor);
478  break;
479  case CONNECTED_PASS:
480  (*it)->setSpecialColor(&targetPassColor);
481  break;
482  case CONFLICTED:
483  (*it)->setSpecialColor(&conflictColor);
484  break;
485  case UNCONNECTED:
486  (*it)->setSpecialColor(&potentialTargetColor);
487  break;
488  }
489  }
490 }
491 
492 
493 void
495  // clean up
496  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
497  (*it)->setSpecialColor(0);
498  }
499  myPotentialTargets.clear();
500  myNumChanges = 0;
502  myCurrentLane = 0;
504 }
505 
506 
508 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane) {
510  const int fromIndex = myCurrentLane->getIndex();
511  NBEdge* destEdge = targetLane->getParentEdge().getNBEdge();
512  const int toIndex = targetLane->getIndex();
513  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
514  connections.begin(), connections.end(),
515  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
516  const bool isConnected = con_it != connections.end();
517  if (isConnected) {
518  if (con_it->mayDefinitelyPass) {
519  return CONNECTED_PASS;
520  } else {
521  return CONNECTED;
522  }
523  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)) {
524  return CONFLICTED;
525  } else {
526  return UNCONNECTED;
527  }
528 }
529 
530 
531 /****************************************************************************/
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:764
static RGBColor targetColor
color for the to-lane of a connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:157
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:702
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:912
long onCmdSelectPass(FXObject *, FXSelector, void *)
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
Definition: GNEEdge.cpp:475
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
The representation of a single edge during network building.
Definition: NBEdge.h:71
void showFramesArea()
show frames area if at least a GNEFrame is showed
std::vector< GNELane * > LaneVector
Definition of the lane's vector.
Definition: GNEEdge.h:63
NBNode * getNBNode() const
Return net build node.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connectino
Definition: GNENet.cpp:384
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:87
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:55
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:86
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:906
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:663
GUIGlID getGlID() const
Returns the numerical id of the object.
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:918
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:1009
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'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...
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:953
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1061
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
void removeConnections(GNELane *lane)
remove connections
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GNEJunction * getGNEJunctionDest() const
returns the destination-junction
Definition: GNEEdge.cpp:165
Cancel-button pressed.
Definition: GUIAppEnum.h:65
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
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
Clear set.
Definition: GUIAppEnum.h:347
void p_abort()
reverts and discards ALL active command groups
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:55
unsigned int GUIGlID
Definition: GUIGlObject.h:50
long onCmdOK(FXObject *, FXSelector, void *)
void updateDescription() const
update description
Reset set.
Definition: GUIAppEnum.h:349
void hide()
hide Frame
static const RGBColor YELLOW
Definition: RGBColor.h:192
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:485
static const RGBColor CYAN
Definition: RGBColor.h:193
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:717
std::vector< NBEdge * > EdgeVector
Definition: NBCont.h:41
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:856
an edge
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:912
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:316
GNELane * myCurrentLane
the lane of which connections are to be modified
GNEConnection * retrieveConnection(int fromLane, NBEdge *to, int toLane)
get connection
Definition: GNEEdge.cpp:903
~GNEConnectorFrame()
Destructor.
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:261
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:803
void cleanup()
clean up when deselecting current lane
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
a junction