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-2022 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, MFXGroupBoxModule, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
54 FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, MFXGroupBoxModule, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
55 
56 
57 // ===========================================================================
58 // method definitions
59 // ===========================================================================
60 
61 // ---------------------------------------------------------------------------
62 // GNEConnectorFrame::CurrentLane - methods
63 // ---------------------------------------------------------------------------
64 
66  MFXGroupBoxModule(connectorFrameParent, TL("Lane")) {
67  // create lane label
68  myCurrentLaneLabel = new FXLabel(getCollapsableFrame(), "No lane selected", 0, GUIDesignLabelLeft);
69 }
70 
71 
73 
74 
75 void
77  if (laneID.empty()) {
78  myCurrentLaneLabel->setText(TL("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  MFXGroupBoxModule(connectorFrameParent, TL("Modifications")),
90  myConnectorFrameParent(connectorFrameParent) {
91 
92  // Create "Cancel" button
93  myCancelButton = new FXButton(getCollapsableFrame(), TL("Cancel\t\tDiscard connection modifications (Esc)"),
95  // Create "OK" button
96  mySaveButton = new FXButton(getCollapsableFrame(), TL("OK\t\tSave connection modifications (Enter)"),
98 
99  // Create checkbox for protect routes
100  myProtectRoutesCheckBox = new FXCheckButton(getCollapsableFrame(), TL("Protect routes"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
101 }
102 
103 
105 
106 
107 long
109  if (myConnectorFrameParent->myCurrentEditedLane != 0) {
110  myConnectorFrameParent->getViewNet()->getUndoList()->abortAllChangeGroups();
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() != GNEDemandElement::Problem::OK) {
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()->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  MFXGroupBoxModule(connectorFrameParent, TL("Operations")),
152  myConnectorFrameParent(connectorFrameParent) {
153 
154  // Create "Select Dead Ends" button
155  mySelectDeadEndsButton = new FXButton(getCollapsableFrame(), TL("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(getCollapsableFrame(), TL("Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)"),
160  // Create "Select Conflicts" button
161  mySelectConflictsButton = new FXButton(getCollapsableFrame(), TL("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(getCollapsableFrame(), TL("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(getCollapsableFrame(), TL("Clear Selected\t\tClears all connections of all selected objects"),
169  // Create "Reset Selected" button
170  myResetSelectedButton = new FXButton(getCollapsableFrame(), TL("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  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
184  for (const auto& lane : edge.second->getLanes()) {
185  if (edge.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
186  deadEnds.push_back(lane);
187  }
188  }
189  }
190  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(deadEnds, GNESelectorFrame::ModificationMode::Operation::REPLACE);
191  return 1;
192 }
193 
194 
195 long
197  // select all lanes that have no predecessor lane
198  std::set<GNEAttributeCarrier*> deadStarts;
199  GNENet* net = myConnectorFrameParent->getViewNet()->getNet();
200  // every edge knows only its outgoing connections so we look at whole junctions
201  for (const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
202  // first collect all outgoing lanes
203  for (const auto& outgoingEdge : junction.second->getGNEOutgoingEdges()) {
204  for (const auto& lane : outgoingEdge->getLanes()) {
205  deadStarts.insert(lane);
206  }
207  }
208  // then remove all approached lanes
209  for (const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
210  for (const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
211  deadStarts.erase(net->getAttributeCarriers()->retrieveEdge(connection.toEdge->getID())->getLanes()[connection.toLane]);
212  }
213  }
214  }
215  std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
216  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(selectObjects, GNESelectorFrame::ModificationMode::Operation::REPLACE);
217  return 1;
218 }
219 
220 
221 long
223  std::vector<GNEAttributeCarrier*> conflicts;
224  // conflicts happen per edge so we can look at each edge in isolation
225  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
226  const EdgeVector destinations = edge.second->getNBEdge()->getConnectedEdges();
227  for (const auto& destination : destinations) {
228  GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(destination->getID());
229  for (const auto& lane : dest->getLanes()) {
230  const bool isConflicted = count_if(edge.second->getNBEdge()->getConnections().begin(), edge.second->getNBEdge()->getConnections().end(),
231  NBEdge::connections_toedgelane_finder(destination, (int)lane->getIndex(), -1)) > 1;
232  if (isConflicted) {
233  conflicts.push_back(lane);
234  }
235  }
236  }
237 
238  }
239  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::Operation::REPLACE);
240  return 1;
241 }
242 
243 
244 long
246  std::vector<GNEAttributeCarrier*> pass;
247  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
248  for (const auto& connection : edge.second->getNBEdge()->getConnections()) {
249  if (connection.mayDefinitelyPass) {
250  pass.push_back(edge.second->getLanes()[connection.fromLane]);
251  }
252  }
253  }
254  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::Operation::REPLACE);
255  return 1;
256 }
257 
258 
259 long
261  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
262  myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, "clear connections from selected lanes, edges and " + toString(SUMO_TAG_JUNCTION) + "s");
263  // clear junction's connection
264  const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
265  for (const auto& junction : selectedJunctions) {
266  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
267  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
268  }
269  // clear edge's connection
270  const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
271  for (const auto& edge : selectedEdges) {
272  for (const auto& lane : edge->getLanes()) {
273  myConnectorFrameParent->removeConnections(lane);
274  }
275  }
276  // clear lane's connection
277  const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
278  for (const auto& lane : selectedLanes) {
279  myConnectorFrameParent->removeConnections(lane);
280  }
281  myConnectorFrameParent->getViewNet()->getUndoList()->end();
282  return 1;
283 }
284 
285 
286 long
288  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
289  myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, "reset connections from selected lanes");
290  const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
291  for (const auto& junction : selectedJunctions) {
292  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
293  }
294  myConnectorFrameParent->getViewNet()->getUndoList()->end();
295  if (selectedJunctions.size() > 0) {
296  auto viewNet = myConnectorFrameParent->getViewNet();
297  viewNet->getNet()->requireRecompute();
298  viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
299  }
300  return 1;
301 }
302 
303 // ---------------------------------------------------------------------------
304 // GNEConnectorFrame::ConnectionSelection - methods
305 // ---------------------------------------------------------------------------
306 
308  MFXGroupBoxModule(connectorFrameParent, TL("Selection")) {
309  // create Selection Hint
310  myHoldShiftLabel = new FXLabel(getCollapsableFrame(), "Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0, GUIDesignLabelFrameInformation);
311  myHoldControlLabel = new FXLabel(getCollapsableFrame(), "Hold <CTRL> while clicking\nto create conflicting\nconnections (i.e. at zipper\nnodes or with incompatible\npermissions)", 0, GUIDesignLabelFrameInformation);
312 }
313 
314 
316 
317 // ---------------------------------------------------------------------------
318 // GNEConnectorFrame::ConnectionLegend - methods
319 // ---------------------------------------------------------------------------
320 
322  MFXGroupBoxModule(connectorFrameParent, TL("Information")) {
323 
324  // create possible target label
325  FXLabel* possibleTargetLabel = new FXLabel(getCollapsableFrame(), "Possible Target", 0, GUIDesignLabelLeft);
326  possibleTargetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
327  possibleTargetLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
328 
329  // create source label
330  FXLabel* sourceLabel = new FXLabel(getCollapsableFrame(), "Source lane", 0, GUIDesignLabelLeft);
331  sourceLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
332 
333  // create target label
334  FXLabel* targetLabel = new FXLabel(getCollapsableFrame(), "Target lane", 0, GUIDesignLabelLeft);
335  targetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
336 
337  // create target (pass) label
338  FXLabel* targetPassLabel = new FXLabel(getCollapsableFrame(), "Target (pass)", 0, GUIDesignLabelLeft);
339  targetPassLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
340 
341  // create conflict label
342  FXLabel* conflictLabel = new FXLabel(getCollapsableFrame(), "Conflict", 0, GUIDesignLabelLeft);
343  conflictLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.conflict));
344 }
345 
346 
348 
349 // ---------------------------------------------------------------------------
350 // GNEConnectorFrame - methods
351 // ---------------------------------------------------------------------------
352 
354  GNEFrame(viewParent, viewNet, "Edit Connections"),
356  myNumChanges(0) {
357  // create current lane modul
358  myCurrentLane = new CurrentLane(this);
359 
360  // create connection modifications modul
362 
363  // create connection operations modul
365 
366  // create connection selection modul
368 
369  // create connection legend modul
370  myLegend = new Legend(this);
371 }
372 
373 
375 
376 
377 void
379  // get lane front
380  GNELane* clickedLane = objectsUnderCursor.getLaneFrontNonLocked();
381  // iterate over lanes
382  for (const auto& lane : objectsUnderCursor.getLanes()) {
383  // if parent edge of lane is front element, update clickedLane
384  if (lane->getParentEdge() == myViewNet->getFrontAttributeCarrier()) {
385  clickedLane = lane;
386  }
387  }
388  // build connection
390 }
391 
392 
396 }
397 
398 
399 void
401  // select lane as current lane
402  buildConnection(lane, false, false, true); // select as current lane
403  // iterate over all potential targets
404  for (const auto& potentialTarget : myPotentialTargets) {
405  // remove connections using the apropiate parameters in function "buildConnection"
406  buildConnection(potentialTarget, false, false, false);
407  }
408  // save modifications
410 }
411 
412 
413 void
414 GNEConnectorFrame::buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle) {
415  if (myCurrentEditedLane == 0) {
416  myCurrentEditedLane = lane;
418  initTargets();
419  myNumChanges = 0;
421  } else if (myPotentialTargets.count(lane)
422  || (allowConflict && lane->getParentEdge()->getFromJunction() == myCurrentEditedLane->getParentEdge()->getToJunction())) {
423  const int fromIndex = myCurrentEditedLane->getIndex();
425  GNEEdge* destEdge = lane->getParentEdge();
426  std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
427  bool changed = false;
428  // get lane status
429  LaneStatus status = getLaneStatus(connections, lane);
430  if (status == LaneStatus::CONFLICTED && allowConflict) {
431  status = LaneStatus::UNCONNECTED;
432  }
433  // create depending of status
434  switch (status) {
436  if (toggle) {
437  // create new connection
438  NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
439  // if the connection was previously deleted (by clicking the same lane twice), restore all values
441  // fromLane must be the same, only check toLane
442  if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
443  newCon = c;
444  newCon.mayDefinitelyPass = mayDefinitelyPass;
445  }
446  }
447  NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
448  myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
449  if (mayDefinitelyPass) {
451  } else {
453  }
455  }
456  break;
459  // remove connection
460  GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
461  myDeletedConnections.push_back(con->getNBEdgeConnection());
464  changed = true;
465  break;
466  }
468  SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
469  SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
470  if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
471  myViewNet->setStatusBarText("Pedestrian connections are generated automatically");
472  } else if ((fromPermissions & toPermissions) == 0) {
473  myViewNet->setStatusBarText("Incompatible vehicle class permissions");
474  } else {
475  myViewNet->setStatusBarText("Another lane from the same edge already connects to that lane");
476  }
477  break;
478  }
479  if (changed) {
480  myNumChanges += 1;
481  }
482  } else {
483  myViewNet->setStatusBarText("Invalid target for " + toString(SUMO_TAG_CONNECTION));
484  }
486 }
487 
488 
489 void
491  // gather potential targets
493  // get potencial targets
494  for (const auto& NBEEdge : nbn->getOutgoingEdges()) {
495  GNEEdge* edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(NBEEdge->getID());
496  for (const auto& lane : edge->getLanes()) {
497  myPotentialTargets.insert(lane);
498  }
499  }
500  // set color for existing connections
501  std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
502  for (const auto& lane : myPotentialTargets) {
503  switch (getLaneStatus(connections, lane)) {
506  break;
509  break;
512  break;
515  break;
516  }
517  }
518 }
519 
520 
521 void
523  // restore colors of potential targets
524  for (auto it : myPotentialTargets) {
525  it->setSpecialColor(0);
526  }
527  // clear attributes
528  myPotentialTargets.clear();
529  myNumChanges = 0;
531  myCurrentEditedLane = nullptr;
532  myDeletedConnections.clear();
534 }
535 
536 
538 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const {
540  const int fromIndex = myCurrentEditedLane->getIndex();
541  NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
542  const int toIndex = targetLane->getIndex();
543  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
544  connections.begin(), connections.end(),
545  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
546  const bool isConnected = con_it != connections.end();
547  if (isConnected) {
548  if (con_it->mayDefinitelyPass) {
550  } else {
551  return LaneStatus::CONNECTED;
552  }
553  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
554  || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
555  return LaneStatus::CONFLICTED;
556  } else {
558  }
559 }
560 
561 
562 /****************************************************************************/
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
Definition: GUIAppEnum.h:992
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:870
@ MID_CANCEL
Cancel-button pressed.
Definition: GUIAppEnum.h:261
@ MID_CHOOSEN_CLEAR
Clear set.
Definition: GUIAppEnum.h:596
@ MID_OK
Ok-button pressed.
Definition: GUIAppEnum.h:259
@ MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
select lanes that have no connection leading to it
Definition: GUIAppEnum.h:994
@ MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
select lanes that are connected from concurrent lanes
Definition: GUIAppEnum.h:996
@ MID_CHOOSEN_RESET
Reset set.
Definition: GUIAppEnum.h:600
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
Definition: GUIAppEnum.h:998
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:217
#define GUIDesignButton
Definition: GUIDesigns.h:77
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:169
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:271
#define TL(string)
Definition: MsgHandler.h:282
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
@ 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:46
const std::string getID() const
get ID (all Attribute Carriers have one)
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
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
Legend(GNEConnectorFrame *connectorFrameParent)
constructor
int myNumChanges
number of changes
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
GNEConnectorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
GNEConnectorFrame::ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
GNEConnectorFrame::Legend * myLegend
Legend 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
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::ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
LaneStatus
the status of a target lane
GNEConnectorFrame::ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
CurrentLane * myCurrentLane
CurrentLane modul.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:77
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:481
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:839
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:2056
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:150
GNEViewNet * myViewNet
FOX need this.
Definition: GNEFrame.h:117
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
NBNode * getNBNode() const
Return net build node.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:876
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:1114
GNEEdge * getParentEdge() const
get parent edge
Definition: GNELane.cpp:124
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition: GNENet.cpp:596
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
class used to group all variables related with objects under cursor after a click over view
const std::vector< GNELane * > & getLanes() const
get lanes
GNELane * getLaneFrontNonLocked() const
get front lane or a pointer to nullptr checking if is locked
GNENet * getNet() const
get the net object
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:662
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set statusBar text
Definition: GNEViewNet.cpp:768
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:84
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
Definition: Lane.h:33
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
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:92
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:4137
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1241
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:1279
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:263
static const RGBColor WHITE
Definition: RGBColor.h:192
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:201
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:245
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:239