Eclipse SUMO - Simulation of Urban MObility
GNEConnectorFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2011-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // The Widget for modifying lane-to-lane connections
19 /****************************************************************************/
20 #include <config.h>
21 
25 #include <netedit/GNEViewParent.h>
26 #include <netedit/GNEUndoList.h>
27 #include <netedit/GNENet.h>
28 #include <netedit/GNEViewNet.h>
32 
33 
34 // ===========================================================================
35 // FOX callback mapping
36 // ===========================================================================
37 
38 FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[] = {
41 };
42 
43 FXDEFMAP(GNEConnectorFrame::ConnectionOperations) ConnectionOperationsMap[] = {
50 };
51 
52 // Object implementation
53 FXIMPLEMENT(GNEConnectorFrame::ConnectionModifications, FXGroupBox, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
54 FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, FXGroupBox, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
55 
56 
57 // ===========================================================================
58 // method definitions
59 // ===========================================================================
60 
61 // ---------------------------------------------------------------------------
62 // GNEConnectorFrame::CurrentLane - methods
63 // ---------------------------------------------------------------------------
64 
66  FXGroupBox(connectorFrameParent->myContentFrame, "Lane", GUIDesignGroupBoxFrame) {
67  // create lane label
68  myCurrentLaneLabel = new FXLabel(this, "No lane selected", 0, GUIDesignLabelLeft);
69 }
70 
71 
73 
74 
75 void
77  if (laneID.empty()) {
78  myCurrentLaneLabel->setText("No lane selected");
79  } else {
80  myCurrentLaneLabel->setText((std::string("Current Lane: ") + laneID).c_str());
81  }
82 }
83 
84 // ---------------------------------------------------------------------------
85 // GNEConnectorFrame::ConnectionModifications - methods
86 // ---------------------------------------------------------------------------
87 
89  FXGroupBox(connectorFrameParent->myContentFrame, "Modifications", GUIDesignGroupBoxFrame),
90  myConnectorFrameParent(connectorFrameParent) {
91 
92  // Create "Cancel" button
93  myCancelButton = new FXButton(this, "Cancel\t\tDiscard connection modifications (Esc)",
95  // Create "OK" button
96  mySaveButton = new FXButton(this, "OK\t\tSave connection modifications (Enter)",
98 
99  // Create checkbox for protect routes
100  myProtectRoutesCheckBox = new FXCheckButton(this, "Protect routes", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
101 }
102 
103 
105 
106 
107 long
109  if (myConnectorFrameParent->myCurrentEditedLane != 0) {
110  myConnectorFrameParent->getViewNet()->getUndoList()->p_abort();
111  if (myConnectorFrameParent->myNumChanges) {
112  myConnectorFrameParent->getViewNet()->setStatusBarText("Changes reverted");
113  }
114  myConnectorFrameParent->cleanup();
115  myConnectorFrameParent->getViewNet()->updateViewNet();
116  }
117  return 1;
118 }
119 
120 
121 long
123  if (myConnectorFrameParent->myCurrentEditedLane != 0) {
124  // check if routes has to be protected
125  if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
126  for (const auto& i : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
127  if (!i->isDemandElementValid()) {
128  FXMessageBox::warning(getApp(), MBOX_OK,
129  "Error saving connection operations", "%s",
130  ("Connection edition cannot be saved because route '" + i->getID() + "' is broken.").c_str());
131  return 1;
132  }
133  }
134  }
135  // finish route editing
136  myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
137  if (myConnectorFrameParent->myNumChanges) {
138  myConnectorFrameParent->getViewNet()->setStatusBarText("Changes accepted");
139  }
140  myConnectorFrameParent->cleanup();
141  myConnectorFrameParent->getViewNet()->updateViewNet();
142  }
143  return 1;
144 }
145 
146 // ---------------------------------------------------------------------------
147 // GNEConnectorFrame::ConnectionOperations - methods
148 // ---------------------------------------------------------------------------
149 
151  FXGroupBox(connectorFrameParent->myContentFrame, "Operations", GUIDesignGroupBoxFrame),
152  myConnectorFrameParent(connectorFrameParent) {
153 
154  // Create "Select Dead Ends" button
155  mySelectDeadEndsButton = new FXButton(this, "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
157  // Create "Select Dead Starts" button
158  mySelectDeadStartsButton = new FXButton(this, "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
160  // Create "Select Conflicts" button
161  mySelectConflictsButton = new FXButton(this, "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
163  // Create "Select Edges which may always pass" button
164  mySelectPassingButton = new FXButton(this, "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
166  // Create "Clear Selected" button
167  myClearSelectedButton = new FXButton(this, "Clear Selected\t\tClears all connections of all selected objects",
169  // Create "Reset Selected" button
170  myResetSelectedButton = new FXButton(this, "Reset Selected\t\tRecomputes connections at all selected junctions",
172 }
173 
174 
176 
177 
178 long
180  // select all lanes that have no successor lane
181  std::vector<GNEAttributeCarrier*> deadEnds;
182  // every edge knows its outgoing connections so we can look at each edge in isolation
183  const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
184  for (auto i : edges) {
185  for (auto j : i->getLanes()) {
186  if (i->getNBEdge()->getConnectionsFromLane(j->getIndex()).size() == 0) {
187  deadEnds.push_back(j);
188  }
189  }
190  }
191  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(deadEnds, GNESelectorFrame::ModificationMode::Operation::REPLACE);
192  return 1;
193 }
194 
195 
196 long
198  // select all lanes that have no predecessor lane
199  std::set<GNEAttributeCarrier*> deadStarts;
200  GNENet* net = myConnectorFrameParent->getViewNet()->getNet();
201  // every edge knows only its outgoing connections so we look at whole junctions
202  const std::vector<GNEJunction*> junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions();
203  for (auto i : junctions) {
204  // first collect all outgoing lanes
205  for (auto j : i->getNBNode()->getOutgoingEdges()) {
206  GNEEdge* edge = net->retrieveEdge(j->getID());
207  for (auto k : edge->getLanes()) {
208  deadStarts.insert(k);
209  }
210  }
211  // then remove all approached lanes
212  for (auto j : i->getNBNode()->getIncomingEdges()) {
213  GNEEdge* edge = net->retrieveEdge(j->getID());
214  for (auto k : edge->getNBEdge()->getConnections()) {
215  deadStarts.erase(net->retrieveEdge(k.toEdge->getID())->getLanes()[k.toLane]);
216  }
217  }
218  }
219  std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
220  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(selectObjects, GNESelectorFrame::ModificationMode::Operation::REPLACE);
221  return 1;
222 }
223 
224 
225 long
227  std::vector<GNEAttributeCarrier*> conflicts;
228  // conflicts happen per edge so we can look at each edge in isolation
229  const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
230  for (auto i : edges) {
231  const EdgeVector destinations = i->getNBEdge()->getConnectedEdges();
232  for (auto j : destinations) {
233  GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdge(j->getID());
234  for (auto k : dest->getLanes()) {
235  const bool isConflicted = count_if(i->getNBEdge()->getConnections().begin(), i->getNBEdge()->getConnections().end(),
236  NBEdge::connections_toedgelane_finder(j, (int)(k)->getIndex(), -1)) > 1;
237  if (isConflicted) {
238  conflicts.push_back(k);
239  }
240  }
241  }
242 
243  }
244  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::Operation::REPLACE);
245  return 1;
246 }
247 
248 
249 long
251  std::vector<GNEAttributeCarrier*> pass;
252  const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
253  for (auto i : edges) {
254  for (auto j : i->getNBEdge()->getConnections()) {
255  if (j.mayDefinitelyPass) {
256  pass.push_back(i->getLanes()[j.fromLane]);
257  }
258  }
259  }
260  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::Operation::REPLACE);
261  return 1;
262 }
263 
264 
265 long
267  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
268  myConnectorFrameParent->getViewNet()->getUndoList()->p_begin("clear connections from selected lanes, edges and " + toString(SUMO_TAG_JUNCTION) + "s");
269  // clear junction's connection
270  auto junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions(true);
271  for (auto i : junctions) {
272  i->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
273  i->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
274  }
275  // clear edge's connection
276  auto edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges(true);
277  for (auto i : edges) {
278  for (auto j : i->getLanes()) {
279  myConnectorFrameParent->removeConnections(j);
280  }
281  }
282  // clear lane's connection
283  auto lanes = myConnectorFrameParent->getViewNet()->getNet()->retrieveLanes(true);
284  for (auto i : lanes) {
285  myConnectorFrameParent->removeConnections(dynamic_cast<GNELane*>(i));
286  }
287  myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
288  return 1;
289 }
290 
291 
292 long
294  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
295  myConnectorFrameParent->getViewNet()->getUndoList()->p_begin("reset connections from selected lanes");
296  auto junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions(true);
297  for (auto i : junctions) {
298  i->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
299  }
300  myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
301  return 1;
302 }
303 
304 // ---------------------------------------------------------------------------
305 // GNEConnectorFrame::ConnectionSelection - methods
306 // ---------------------------------------------------------------------------
307 
309  FXGroupBox(connectorFrameParent->myContentFrame, "Selection", GUIDesignGroupBoxFrame) {
310  // create Selection Hint
311  myHoldShiftLabel = new FXLabel(this, "Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0, GUIDesignLabelFrameInformation);
312  myHoldControlLabel = new FXLabel(this, "Hold <CTRL> while clicking\nto create conflicting\nconnections (i.e. at zipper\nnodes or with incompatible\npermissions)", 0, GUIDesignLabelFrameInformation);
313 }
314 
315 
317 
318 // ---------------------------------------------------------------------------
319 // GNEConnectorFrame::ConnectionLegend - methods
320 // ---------------------------------------------------------------------------
321 
323  FXGroupBox(connectorFrameParent->myContentFrame, "Legend", GUIDesignGroupBoxFrame) {
324 
325  // create possible target label
326  FXLabel* possibleTargetLabel = new FXLabel(this, "Possible Target", 0, GUIDesignLabelLeft);
327  possibleTargetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
328  possibleTargetLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
329 
330  // create source label
331  FXLabel* sourceLabel = new FXLabel(this, "Source lane", 0, GUIDesignLabelLeft);
332  sourceLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
333 
334  // create target label
335  FXLabel* targetLabel = new FXLabel(this, "Target lane", 0, GUIDesignLabelLeft);
336  targetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
337 
338  // create target (pass) label
339  FXLabel* targetPassLabel = new FXLabel(this, "Target (pass)", 0, GUIDesignLabelLeft);
340  targetPassLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
341 
342  // create conflict label
343  FXLabel* conflictLabel = new FXLabel(this, "Conflict", 0, GUIDesignLabelLeft);
344  conflictLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.conflict));
345 }
346 
347 
349 
350 // ---------------------------------------------------------------------------
351 // GNEConnectorFrame - methods
352 // ---------------------------------------------------------------------------
353 
354 GNEConnectorFrame::GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
355  GNEFrame(horizontalFrameParent, viewNet, "Edit Connections"),
357  myNumChanges(0) {
358  // create current lane modul
359  myCurrentLane = new CurrentLane(this);
360 
361  // create connection modifications modul
363 
364  // create connection operations modul
366 
367  // create connection selection modul
369 
370  // create connection legend modul
372 }
373 
374 
376 
377 
378 void
380  // build connection
382 }
383 
384 
388 }
389 
390 
391 void
393  // select lane as current lane
394  buildConnection(lane, false, false, true); // select as current lane
395  // iterate over all potential targets
396  for (auto i : myPotentialTargets) {
397  // remove connections using the apropiate parameters in function "buildConnection"
398  buildConnection(i, false, false, false);
399  }
400  // save modifications
402 }
403 
404 
405 void
406 GNEConnectorFrame::buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle) {
407  if (myCurrentEditedLane == 0) {
408  myCurrentEditedLane = lane;
410  initTargets();
411  myNumChanges = 0;
412  myViewNet->getUndoList()->p_begin("modify " + toString(SUMO_TAG_CONNECTION) + "s");
413  } else if (myPotentialTargets.count(lane)
414  || (allowConflict && lane->getParentEdge()->getParentJunctions().front() == myCurrentEditedLane->getParentEdge()->getParentJunctions().back())) {
415  const int fromIndex = myCurrentEditedLane->getIndex();
417  GNEEdge* destEdge = lane->getParentEdge();
418  std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
419  bool changed = false;
420  // get lane status
421  LaneStatus status = getLaneStatus(connections, lane);
422  if (status == LaneStatus::CONFLICTED && allowConflict) {
423  status = LaneStatus::UNCONNECTED;
424  }
425  // create depending of status
426  switch (status) {
428  if (toggle) {
429  // create new connection
430  NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
431  // if the connection was previously deleted (by clicking the same lane twice), restore all values
433  // fromLane must be the same, only check toLane
434  if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
435  newCon = c;
436  newCon.mayDefinitelyPass = mayDefinitelyPass;
437  }
438  }
439  NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
440  myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
441  if (mayDefinitelyPass) {
443  } else {
445  }
446  srcEdge->getParentJunctions().back()->invalidateTLS(myViewNet->getUndoList(), NBConnection::InvalidConnection, newNBCon);
447  }
448  break;
451  // remove connection
452  GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
453  myDeletedConnections.push_back(con->getNBEdgeConnection());
456  changed = true;
457  break;
458  }
460  SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
461  SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
462  if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
463  myViewNet->setStatusBarText("Pedestrian connections are generated automatically");
464  } else if ((fromPermissions & toPermissions) == 0) {
465  myViewNet->setStatusBarText("Incompatible vehicle class permissions");
466  } else {
467  myViewNet->setStatusBarText("Another lane from the same edge already connects to that lane");
468  }
469  break;
470  }
471  if (changed) {
472  myNumChanges += 1;
473  }
474  } else {
475  myViewNet->setStatusBarText("Invalid target for " + toString(SUMO_TAG_CONNECTION));
476  }
478 }
479 
480 
481 void
483  // gather potential targets
484  NBNode* nbn = myCurrentEditedLane->getParentEdge()->getParentJunctions().back()->getNBNode();
485  // get potencial targets
486  for (const auto& NBEEdge : nbn->getOutgoingEdges()) {
487  GNEEdge* edge = myViewNet->getNet()->retrieveEdge(NBEEdge->getID());
488  for (const auto& lane : edge->getLanes()) {
489  myPotentialTargets.insert(lane);
490  }
491  }
492  // set color for existing connections
493  std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
494  for (const auto& lane : myPotentialTargets) {
495  switch (getLaneStatus(connections, lane)) {
498  break;
501  break;
504  break;
507  break;
508  }
509  }
510 }
511 
512 
513 void
515  // restore colors of potential targets
516  for (auto it : myPotentialTargets) {
517  it->setSpecialColor(0);
518  }
519  // clear attributes
520  myPotentialTargets.clear();
521  myNumChanges = 0;
523  myCurrentEditedLane = nullptr;
524  myDeletedConnections.clear();
526 }
527 
528 
530 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const {
532  const int fromIndex = myCurrentEditedLane->getIndex();
533  NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
534  const int toIndex = targetLane->getIndex();
535  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
536  connections.begin(), connections.end(),
537  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
538  const bool isConnected = con_it != connections.end();
539  if (isConnected) {
540  if (con_it->mayDefinitelyPass) {
542  } else {
543  return LaneStatus::CONNECTED;
544  }
545  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
546  || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
547  return LaneStatus::CONFLICTED;
548  } else {
550  }
551 }
552 
553 
554 /****************************************************************************/
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
Definition: GUIAppEnum.h:818
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:717
@ MID_CANCEL
Cancel-button pressed.
Definition: GUIAppEnum.h:247
@ MID_CHOOSEN_CLEAR
Clear set.
Definition: GUIAppEnum.h:543
@ MID_OK
Ok-button pressed.
Definition: GUIAppEnum.h:245
@ MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
select lanes that have no connection leading to it
Definition: GUIAppEnum.h:820
@ MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
select lanes that are connected from concurrent lanes
Definition: GUIAppEnum.h:822
@ MID_CHOOSEN_RESET
Reset set.
Definition: GUIAppEnum.h:545
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
Definition: GUIAppEnum.h:824
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:175
#define GUIDesignButton
Definition: GUIDesigns.h:62
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:278
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:133
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:223
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
@ SVC_PEDESTRIAN
pedestrian
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SUMO_TAG_CONNECTION
connectio between two lanes
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
GNENet * getNet() const
get pointer to net
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
ConnectionLegend(GNEConnectorFrame *connectorFrameParent)
constructor
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
ConnectionModifications(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
FXButton * mySelectConflictsButton
"Select Conflicts" button
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
FXButton * myClearSelectedButton
"Clear Selected"
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
ConnectionOperations(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
FXButton * myResetSelectedButton
"Reset Selected"
FXButton * mySelectPassingButton
"Select Edges which may always pass"
FXLabel * myHoldShiftLabel
Selection Hint.
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
FXLabel * myHoldControlLabel
hold control label
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
int myNumChanges
number of changes
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
void cleanup()
clean up when deselecting current lane
void initTargets()
init targets
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
void buildConnection(GNELane *lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
~GNEConnectorFrame()
Destructor.
void removeConnections(GNELane *lane)
remove connections
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, const GNELane *targetLane) const
return the status of toLane
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
LaneStatus
the status of a target lane
CurrentLane * myCurrentLane
CurrentLane modul.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:399
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:723
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:1681
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:133
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:113
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:116
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:733
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:1017
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:111
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
Definition: GNENet.cpp:1141
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition: GNENet.cpp:494
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1370
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
const std::string & getID() const
get ID
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:71
class used to group all variables related with objects under cursor after a click over view
GNELane * getLaneFront() const
get front lane or a pointer to nullptr
GNENet * getNet() const
get the net object
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed modul
Definition: GNEViewNet.cpp:497
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:575
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:112
static const NBConnection InvalidConnection
Definition: NBConnection.h:124
The representation of a single edge during network building.
Definition: NBEdge.h:91
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3655
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1152
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:964
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:1195
Represents a single node (junction) during network building.
Definition: NBNode.h:66
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
Definition: NBNode.h:259
static const RGBColor WHITE
Definition: RGBColor.h:187
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool controlKeyPressed() const
check if CONTROL is pressed during current event
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:188
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:227
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:221