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) 2011-2017 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 #include <iostream>
40 
41 #include "GNEInspectorFrame.h"
42 #include "GNEConnectorFrame.h"
43 #include "GNESelectorFrame.h"
44 #include "GNEViewParent.h"
45 #include "GNEViewNet.h"
46 #include "GNEChange_Connection.h"
47 #include "GNEUndoList.h"
48 #include "GNENet.h"
49 #include "GNELane.h"
50 #include "GNEConnection.h"
51 #include "GNEInternalLane.h"
52 #include "GNEEdge.h"
53 #include "GNEJunction.h"
54 
55 
56 // ===========================================================================
57 // FOX callback mapping
58 // ===========================================================================
59 FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[] = {
60  FXMAPFUNC(SEL_COMMAND, MID_CANCEL, GNEConnectorFrame::onCmdCancel),
61  FXMAPFUNC(SEL_COMMAND, MID_OK, GNEConnectorFrame::onCmdOK),
68 };
69 
70 // Object implementation
71 FXIMPLEMENT(GNEConnectorFrame, FXVerticalFrame, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap))
72 
73 // ===========================================================================
74 // static members
75 // ===========================================================================
76 RGBColor GNEConnectorFrame::sourceColor;
77 RGBColor GNEConnectorFrame::potentialTargetColor;
78 RGBColor GNEConnectorFrame::targetColor;
79 RGBColor GNEConnectorFrame::targetPassColor;
80 RGBColor GNEConnectorFrame::conflictColor;
81 
82 // ===========================================================================
83 // method definitions
84 // ===========================================================================
85 GNEConnectorFrame::GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
86  GNEFrame(horizontalFrameParent, viewNet, "Edit Connections"),
87  myCurrentLane(0) {
88  // Create groupbox for lane information
89  myGroupBoxDescription = new FXGroupBox(myContentFrame, "Lane", GUIDesignGroupBoxFrame);
90 
91  // Create label for lane description and update it
92  myLaneDescriptionLabel = new FXLabel(myGroupBoxDescription, "", 0, GUIDesignLabelLeft);
93  updateDescription();
94 
95  // Create GroupBox for Buttons
96  myGroupBoxModifications = new FXGroupBox(myContentFrame, "Modifications", GUIDesignGroupBoxFrame);
97 
98  // Create "Cancel" button
99  myCancelButton = new FXButton(myGroupBoxModifications, "Cancel\t\tDiscard connection modifications (Esc)",
101  // Create "OK" button
102  mySaveButton = new FXButton(myGroupBoxModifications, "OK\t\tSave connection modifications (Enter)",
104 
105  // Create groupbox for operations
106  myGroupBoxOperations = new FXGroupBox(myContentFrame, "Operations", GUIDesignGroupBoxFrame);
107 
108  // Create "Select Dead Ends" button
109  mySelectDeadEndsButton = new FXButton(myGroupBoxOperations, "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
111  // Create "Select Dead Starts" button
112  mySelectDeadStartsButton = new FXButton(myGroupBoxOperations, "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
114  // Create "Select Conflicts" button
115  mySelectConflictsButton = new FXButton(myGroupBoxOperations, "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
117  // Create "Select Edges which may always pass" button
118  mySelectPassingButton = new FXButton(myGroupBoxOperations, "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
120  // Create "Clear Selected" button
121  myClearSelectedButton = new FXButton(myGroupBoxOperations, "Clear Selected\t\tClears all connections of all selected objects",
123  // Create "Reset Selected" button
124  myResetSelectedButton = new FXButton(myGroupBoxOperations, "Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions",
126 
127  // Create groupbox for selection hints
128  myGroupBoxSelection = new FXGroupBox(myContentFrame, "Selection", GUIDesignGroupBoxFrame);
129 
130  // Selection Hint
131  myHoldShiftLabel = new FXLabel(myGroupBoxSelection, "Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0, GUIDesignLabelLeft);
132  myHoldControlLabel = new FXLabel(myGroupBoxSelection, "Hold <CTRL> while clicking\nto create conflicting\nconnections (i.e. at zipper nodes)", 0, GUIDesignLabelLeft);
133 
134  // init colors here to avoid static order fiasco (https://isocpp.org/wiki/faq/ctors#static-init-order)
135  sourceColor = RGBColor::CYAN;
136  potentialTargetColor = RGBColor(0, 64, 0, 255);
137  targetColor = RGBColor::GREEN;
138  targetPassColor = RGBColor::MAGENTA;
139  conflictColor = RGBColor::YELLOW;
140 
141 
142  // create groupbox for legend
143  myGroupBoxLegend = new FXGroupBox(myContentFrame, "Legend", GUIDesignGroupBoxFrame);
144 
145  // create source label
146  mySourceLabel = new FXLabel(myGroupBoxLegend, "Source", 0, GUIDesignLabelLeft);
147  mySourceLabel->setBackColor(MFXUtils::getFXColor(sourceColor));
148 
149  // create target label
150  myTargetLabel = new FXLabel(myGroupBoxLegend, "Target", 0, GUIDesignLabelLeft);
151  myTargetLabel->setBackColor(MFXUtils::getFXColor(targetColor));
152 
153  // create possible target label
154  myPossibleTargetLabel = new FXLabel(myGroupBoxLegend, "Possible Target", 0, GUIDesignLabelLeft);
155  myPossibleTargetLabel->setBackColor(MFXUtils::getFXColor(potentialTargetColor));
156 
157  // create target (pass) label
158  myTargetPassLabel = new FXLabel(myGroupBoxLegend, "Target (pass)", 0, GUIDesignLabelLeft);
159  myTargetPassLabel->setBackColor(MFXUtils::getFXColor(targetPassColor));
160 
161  // create conflict label
162  myConflictLabel = new FXLabel(myGroupBoxLegend, "Conflict", 0, GUIDesignLabelLeft);
163  myConflictLabel->setBackColor(MFXUtils::getFXColor(conflictColor));
164 }
165 
166 
168 
169 
170 void
171 GNEConnectorFrame::handleLaneClick(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle) {
172  if (myCurrentLane == 0) {
173  myCurrentLane = lane;
175  initTargets();
176  myNumChanges = 0;
177  myViewNet->getUndoList()->p_begin("modify " + toString(SUMO_TAG_CONNECTION) + "s");
178  } else if (myPotentialTargets.count(lane)
179  || (allowConflict && lane->getParentEdge().getGNEJunctionSource() == myCurrentLane->getParentEdge().getGNEJunctionDestiny())) {
180  const int fromIndex = myCurrentLane->getIndex();
181  GNEEdge& srcEdge = myCurrentLane->getParentEdge();
182  GNEEdge& destEdge = lane->getParentEdge();
183  std::vector<NBEdge::Connection> connections = srcEdge.getNBEdge()->getConnectionsFromLane(fromIndex);
184  bool changed = false;
185  LaneStatus status = getLaneStatus(connections, lane);
186  if (status == CONFLICTED && allowConflict) {
187  status = UNCONNECTED;
188  }
189  switch (status) {
190  case UNCONNECTED:
191  if (toggle) {
192  // create new connection
193  NBEdge::Connection newCon(fromIndex, destEdge.getNBEdge(), lane->getIndex(), mayDefinitelyPass);
194  myViewNet->getUndoList()->add(new GNEChange_Connection(&srcEdge, newCon, false, true), true);
195  lane->setSpecialColor(mayDefinitelyPass ? &targetPassColor : &targetColor);
197  }
198  break;
199  case CONNECTED:
200  case CONNECTED_PASS: {
201  // remove connection
202  GNEConnection* con = srcEdge.retrieveGNEConnection(fromIndex, destEdge.getNBEdge(), lane->getIndex());
205  changed = true;
206  break;
207  }
208  case CONFLICTED:
209  myViewNet->setStatusBarText("Another lane from the same edge already connects to that " + toString(SUMO_TAG_LANE));
210  break;
211  }
212  if (changed) {
213  myNumChanges += 1;
214  }
215  } else {
216  myViewNet->setStatusBarText("Invalid target for " + toString(SUMO_TAG_CONNECTION));
217  }
219 }
220 
221 
222 long
223 GNEConnectorFrame::onCmdCancel(FXObject*, FXSelector, void*) {
224  if (myCurrentLane != 0) {
226  if (myNumChanges) {
227  myViewNet->setStatusBarText("Changes reverted");
228  }
229  cleanup();
230  myViewNet->update();
231  }
232  return 1;
233 }
234 
235 
236 long
237 GNEConnectorFrame::onCmdOK(FXObject*, FXSelector, void*) {
238  if (myCurrentLane != 0) {
240  if (myNumChanges) {
241  myViewNet->setStatusBarText("Changes accepted");
242  }
243  cleanup();
244  myViewNet->update();
245  }
246  return 1;
247 }
248 
249 
250 long
251 GNEConnectorFrame::onCmdSelectDeadEnds(FXObject*, FXSelector, void*) {
252  std::vector<GUIGlID> selectIDs;
253  // every edge knows its outgoing connections so we can look at each edge in isolation
254  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
255  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
256  const GNEEdge::LaneVector& lanes = (*edge_it)->getLanes();
257  for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
258  if ((*edge_it)->getNBEdge()->getConnectionsFromLane((*it_lane)->getIndex()).size() == 0) {
259  selectIDs.push_back((*it_lane)->getGlID());
260  }
261  }
262  }
264  return 1;
265 }
266 
267 
268 long
269 GNEConnectorFrame::onCmdSelectDeadStarts(FXObject*, FXSelector, void*) {
270  GNENet* net = myViewNet->getNet();
271  std::set<GUIGlID> selectIDs;
272  // every edge knows only its outgoing connections so we look at whole junctions
273  const std::vector<GNEJunction*> junctions = net->retrieveJunctions();
274  for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
275  // first collect all outgoing lanes
276  const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
277  for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
278  GNEEdge* edge = net->retrieveEdge((*it)->getID());
279  const std::set<GUIGlID> laneIDs = edge->getLaneGlIDs();
280  for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
281  selectIDs.insert(*lid_it);
282  }
283  }
284  // then remove all approached lanes
285  const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
286  for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
287  GNEEdge* edge = net->retrieveEdge((*it)->getID());
288  NBEdge* nbe = edge->getNBEdge();
289  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
290  for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
291  GNEEdge* approachedEdge = net->retrieveEdge(con_it->toEdge->getID());
292  GNELane* approachedLane = approachedEdge->getLanes()[con_it->toLane];
293  selectIDs.erase(approachedLane->getGlID());
294  }
295  }
296  }
298  std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
300  return 1;
301 }
302 
303 
304 long
305 GNEConnectorFrame::onCmdSelectConflicts(FXObject*, FXSelector, void*) {
306  std::vector<GUIGlID> selectIDs;
307  // conflicts happen per edge so we can look at each edge in isolation
308  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
309  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
310  NBEdge* nbe = (*edge_it)->getNBEdge();
311  const EdgeVector destinations = nbe->getConnectedEdges();
312  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
313  for (EdgeVector::const_iterator dest_it = destinations.begin(); dest_it != destinations.end(); dest_it++) {
314  GNEEdge* dest = myViewNet->getNet()->retrieveEdge((*dest_it)->getID());
315  const GNEEdge::LaneVector& destLanes = dest->getLanes();
316  for (GNEEdge::LaneVector::const_iterator it_lane = destLanes.begin(); it_lane != destLanes.end(); it_lane++) {
317  const bool isConflicted = count_if(
318  connections.begin(), connections.end(),
319  NBEdge::connections_toedgelane_finder(*dest_it, (int)(*it_lane)->getIndex(), -1)) > 1;
320  if (isConflicted) {
321  selectIDs.push_back((*it_lane)->getGlID());
322  }
323  }
324  }
325 
326  }
328  return 1;
329 }
330 
331 
332 long
333 GNEConnectorFrame::onCmdSelectPass(FXObject*, FXSelector, void*) {
334  std::vector<GUIGlID> selectIDs;
335  const std::vector<GNEEdge*> edges = myViewNet->getNet()->retrieveEdges();
336  for (std::vector<GNEEdge*>::const_iterator edge_it = edges.begin(); edge_it != edges.end(); edge_it++) {
337  GNEEdge* edge = *edge_it;
338  NBEdge* nbe = edge->getNBEdge();
339  const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
340  for (std::vector<NBEdge::Connection>::const_iterator it = connections.begin(); it != connections.end(); ++it) {
341  if (it->mayDefinitelyPass) {
342  GNELane* lane = edge->getLanes()[it->fromLane];
343  selectIDs.push_back(lane->getGlID());
344  }
345  }
346  }
348  return 1;
349 }
350 
351 
352 long
354  onCmdCancel(0, 0, 0);
355  myViewNet->getUndoList()->p_begin("clear connections from selected lanes, edges and " + toString(SUMO_TAG_JUNCTION) + "s");
356  const std::set<GUIGlID> ids = gSelected.getSelected();
357  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
358  GUIGlID id = *it;
360  if (object) {
361  switch (object->getType()) {
362  case GLO_JUNCTION: {
363  GNEJunction* junction = dynamic_cast<GNEJunction*>(object);
364  junction->setLogicValid(false, myViewNet->getUndoList()); // clear connections
365  junction->setLogicValid(false, myViewNet->getUndoList(), GNEAttributeCarrier::MODIFIED); // prevent re-guessing
366  break;
367  }
368  case GLO_EDGE: {
369  const GNEEdge::LaneVector& lanes = dynamic_cast<GNEEdge*>(object)->getLanes();
370  for (GNEEdge::LaneVector::const_iterator l_it = lanes.begin(); l_it != lanes.end(); ++l_it) {
371  removeConnections(*l_it);
372  }
373  break;
374  }
375  case GLO_LANE:
376  removeConnections(dynamic_cast<GNELane*>(object));
377  break;
378  default:
379  break;
380  }
381  }
382  }
384  return 1;
385 }
386 
387 
388 void
390  handleLaneClick(lane, false, false, true); // select as current lane
391  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
392  handleLaneClick(*it, false, false, false); // deselect
393  }
394  onCmdOK(0, 0, 0); // save
395 }
396 
397 
398 long
400  onCmdCancel(0, 0, 0);
401  myViewNet->getUndoList()->p_begin("reset connections from selected lanes");
402  const std::set<GUIGlID> nodeIDs = gSelected.getSelected(GLO_JUNCTION);
403  for (std::set<GUIGlID>::const_iterator nid_it = nodeIDs.begin(); nid_it != nodeIDs.end(); nid_it++) {
405  if (object) {
406  GNEJunction* junction = dynamic_cast<GNEJunction*>(object);
407  if (junction) {
408  junction->setLogicValid(false, myViewNet->getUndoList());
409  } else {
410  throw ProcessError("Wrong object type returned from gIDStorage");
411  }
412  }
413  }
415  return 1;
416 }
417 
418 
419 void
421  if (myCurrentLane == 0) {
422  myLaneDescriptionLabel->setText("No Lane Selected\n");
423  } else {
424  myLaneDescriptionLabel->setText(("Lane id: " + myCurrentLane->getMicrosimID() + "\nNumber of changes: " + toString(myNumChanges)).c_str());
425  }
426 }
427 
428 
429 void
431  // gather potential targets
433 
434  const EdgeVector& outgoing = nbn->getOutgoingEdges();
435  for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
436  GNEEdge* edge = myViewNet->getNet()->retrieveEdge((*it)->getID());
437  const GNEEdge::LaneVector& lanes = edge->getLanes();
438  for (GNEEdge::LaneVector::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); it_lane++) {
439  myPotentialTargets.insert(*it_lane);
440  }
441  }
442  // set color for existing connections
443  const int fromIndex = myCurrentLane->getIndex();
445  std::vector<NBEdge::Connection> connections = srcEdge->getConnectionsFromLane(fromIndex);
446  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
447  switch (getLaneStatus(connections, *it)) {
448  case CONNECTED:
449  (*it)->setSpecialColor(&targetColor);
450  break;
451  case CONNECTED_PASS:
452  (*it)->setSpecialColor(&targetPassColor);
453  break;
454  case CONFLICTED:
455  (*it)->setSpecialColor(&conflictColor);
456  break;
457  case UNCONNECTED:
458  (*it)->setSpecialColor(&potentialTargetColor);
459  break;
460  }
461  }
462 }
463 
464 
465 void
467  // clean up
468  for (std::set<GNELane*>::iterator it = myPotentialTargets.begin(); it != myPotentialTargets.end(); it++) {
469  (*it)->setSpecialColor(0);
470  }
471  myPotentialTargets.clear();
472  myNumChanges = 0;
474  myCurrentLane = 0;
476 }
477 
478 
480 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane) {
482  const int fromIndex = myCurrentLane->getIndex();
483  NBEdge* destEdge = targetLane->getParentEdge().getNBEdge();
484  const int toIndex = targetLane->getIndex();
485  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
486  connections.begin(), connections.end(),
487  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
488  const bool isConnected = con_it != connections.end();
489  if (isConnected) {
490  if (con_it->mayDefinitelyPass) {
491  return CONNECTED_PASS;
492  } else {
493  return CONNECTED;
494  }
495  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)) {
496  return CONFLICTED;
497  } else {
498  return UNCONNECTED;
499  }
500 }
501 
502 
503 /****************************************************************************/
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:978
static RGBColor targetColor
color for the to-lane of a connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:165
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:899
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:194
begin/end of the description of a junction
begin/end of the description of a single lane
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
select lanes that are connected from concurrent lanes
Definition: GUIAppEnum.h:698
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1023
long onCmdSelectPass(FXObject *, FXSelector, void *)
std::set< GUIGlID > getLaneGlIDs()
returns GLIDs of all lanes
Definition: GNEEdge.cpp:589
void setLogicValid(bool valid, GNEUndoList *undoList=0, const std::string &status=GUESSED)
connectio between two lanes
The representation of a single edge during network building.
Definition: NBEdge.h:71
std::vector< GNELane * > LaneVector
Definition of the lane&#39;s vector.
Definition: GNEEdge.h:66
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 connection
Definition: GNENet.cpp:478
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:92
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:85
void handleIDs(std::vector< GUIGlID > ids, bool selectEdgesEnabled, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
GNEViewParent * getViewParent() const
get the net object
FXDEFMAP(GNEConnectorFrame) GNEConnectorFrameMap[]
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:701
GUIGlID getGlID() const
Returns the numerical id of the object.
GNEUndoList * getUndoList() const
get the undoList object
GNEViewNet * myViewNet
the window to inform when the tls is modfied
Definition: GNEFrame.h:95
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
Definition: NBEdge.cpp:1120
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 (The edges which start at this node)
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:180
int myNumChanges
number of changes
const std::set< GUIGlID > & getSelected() const
Returns the set 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:1064
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1085
select dead end lanes
Definition: GUIAppEnum.h:694
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:92
void removeConnections(GNELane *lane)
remove connections
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Cancel-button pressed.
Definition: GUIAppEnum.h:65
GNEConnection * retrieveGNEConnection(int fromLane, NBEdge *to, int toLane, bool createIfNoExist=true)
get GNEConnection if exist, and if not create it if create is enabled
Definition: GNEEdge.cpp:1152
static RGBColor sourceColor
color for the from-lane of a connection
static const RGBColor MAGENTA
Definition: RGBColor.h:184
static RGBColor targetPassColor
color for the to-lane of a connection with pass attribute
Clear set.
Definition: GUIAppEnum.h:351
void p_abort()
reverts and discards ALL active command groups
select lanes with connections that have the pass attribute set to &#39;true&#39;
Definition: GUIAppEnum.h:700
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection)
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:58
unsigned int GUIGlID
Definition: GUIGlObject.h:50
long onCmdOK(FXObject *, FXSelector, void *)
void updateDescription() const
update description
Reset set.
Definition: GUIAppEnum.h:353
static const RGBColor YELLOW
Definition: RGBColor.h:182
#define GUIDesignButton
Definition: GUIDesigns.h:57
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:599
static const RGBColor CYAN
Definition: RGBColor.h:183
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:932
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:219
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
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
void setSpecialColor(const RGBColor *Color2)
Definition: GNELane.cpp:866
select lanes that have no connection leading to it
Definition: GUIAppEnum.h:696
an edge
FXLabel * myLaneDescriptionLabel
the label that shows the current editing state
GNENet * getNet() const
get the net object
LaneStatus
the status of a target lane
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:121
Represents a single node (junction) during network building.
Definition: NBNode.h:75
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:298
GNELane * myCurrentLane
the lane of which connections are to be modified
~GNEConnectorFrame()
Destructor.
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:144
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:306
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:835
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void cleanup()
clean up when deselecting current lane
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_MODE_SELECT
a junction
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:200