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.dev/sumo
3 // Copyright (C) 2011-2024 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 
26 #include <netedit/GNEViewParent.h>
27 #include <netedit/GNEUndoList.h>
28 #include <netedit/GNENet.h>
29 #include <netedit/GNEViewNet.h>
33 
34 
35 // ===========================================================================
36 // FOX callback mapping
37 // ===========================================================================
38 
39 FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[] = {
42 };
43 
44 FXDEFMAP(GNEConnectorFrame::ConnectionOperations) ConnectionOperationsMap[] = {
51 };
52 
53 // Object implementation
54 FXIMPLEMENT(GNEConnectorFrame::ConnectionModifications, MFXGroupBoxModule, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
55 FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, MFXGroupBoxModule, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
56 
57 
58 // ===========================================================================
59 // method definitions
60 // ===========================================================================
61 
62 // ---------------------------------------------------------------------------
63 // GNEConnectorFrame::CurrentLane - methods
64 // ---------------------------------------------------------------------------
65 
67  MFXGroupBoxModule(connectorFrameParent, TL("Lane")) {
68  // create lane label
69  myCurrentLaneLabel = new FXLabel(getCollapsableFrame(), TL("No lane selected"), 0, GUIDesignLabel(JUSTIFY_LEFT));
70 }
71 
72 
74 
75 
76 void
78  if (laneID.empty()) {
79  myCurrentLaneLabel->setText(TL("No lane selected"));
80  } else {
81  myCurrentLaneLabel->setText((std::string(TL("Current Lane: ")) + laneID).c_str());
82  }
83 }
84 
85 // ---------------------------------------------------------------------------
86 // GNEConnectorFrame::ConnectionModifications - methods
87 // ---------------------------------------------------------------------------
88 
90  MFXGroupBoxModule(connectorFrameParent, TL("Modifications")),
91  myConnectorFrameParent(connectorFrameParent) {
92 
93  // Create "Cancel" button
94  myCancelButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Cancel"), "", TL("Discard connection modifications (Esc)"),
96  // Create "OK" button
97  mySaveButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("OK"), "", TL("Save connection modifications (Enter)"),
99 
100  // Create checkbox for protect routes
101  myProtectRoutesCheckBox = new FXCheckButton(getCollapsableFrame(), TL("Protect routes"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
102 }
103 
104 
106 
107 
108 long
110  if (myConnectorFrameParent->myCurrentEditedLane != 0) {
111  myConnectorFrameParent->getViewNet()->getUndoList()->abortAllChangeGroups();
112  if (myConnectorFrameParent->myNumChanges) {
113  myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes reverted"));
114  }
115  myConnectorFrameParent->cleanup();
116  myConnectorFrameParent->getViewNet()->updateViewNet();
117  }
118  return 1;
119 }
120 
121 
122 long
124  if (myConnectorFrameParent->myCurrentEditedLane != 0) {
125  // check if routes has to be protected
126  if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
127  for (const auto& demandElement : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
128  if (demandElement->isDemandElementValid() != GNEDemandElement::Problem::OK) {
129  FXMessageBox::warning(getApp(), MBOX_OK,
130  TL("Error saving connection operations"), "%s",
131  (TLF("Connection edition cannot be saved because route '%' is broken.", demandElement->getID()).c_str()));
132  return 1;
133  }
134  }
135  }
136  // finish route editing
137  myConnectorFrameParent->getViewNet()->getUndoList()->end();
138  if (myConnectorFrameParent->myNumChanges) {
139  myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes accepted"));
140  }
141  myConnectorFrameParent->cleanup();
142  // mark network for recomputing
143  myConnectorFrameParent->getViewNet()->getNet()->requireRecompute();
144  // update viewNet
145  myConnectorFrameParent->getViewNet()->updateViewNet();
146  }
147  return 1;
148 }
149 
150 // ---------------------------------------------------------------------------
151 // GNEConnectorFrame::ConnectionOperations - methods
152 // ---------------------------------------------------------------------------
153 
155  MFXGroupBoxModule(connectorFrameParent, TL("Operations")),
156  myConnectorFrameParent(connectorFrameParent) {
157 
158  // Create "Select Dead Ends" button
159  mySelectDeadEndsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Ends"), "", TL("Selects all lanes that have no outgoing connection (clears previous selection)"),
161  // Create "Select Dead Starts" button
162  mySelectDeadStartsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Starts"), "", TL("Selects all lanes that have no incoming connection (clears previous selection)"),
164  // Create "Select Conflicts" button
165  mySelectConflictsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Conflicts"), "", TL("Selects all lanes with more than one incoming connection from the same edge (clears previous selection)"),
167  // Create "Select Edges which may always pass" button
168  mySelectPassingButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Passing"), "", TL("Selects all lanes with a connection that has the 'pass' attribute set"),
170  // Create "Clear Selected" button
171  myClearSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Clear Selected"), "", TL("Clears all connections of all selected objects"),
173  // Create "Reset Selected" button
174  myResetSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Reset Selected"), "", TL("Recomputes connections at all selected junctions"),
176 }
177 
178 
180 
181 
182 long
184  // select all lanes that have no successor lane
185  std::vector<GNEAttributeCarrier*> deadEnds;
186  // every edge knows its outgoing connections so we can look at each edge in isolation
187  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
188  for (const auto& lane : edge.second.second->getLanes()) {
189  if (edge.second.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
190  deadEnds.push_back(lane);
191  }
192  }
193  }
194  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(deadEnds, GNESelectorFrame::ModificationMode::Operation::REPLACE);
195  return 1;
196 }
197 
198 
199 long
201  // select all lanes that have no predecessor lane
202  std::set<GNEAttributeCarrier*> deadStarts;
203  GNENet* net = myConnectorFrameParent->getViewNet()->getNet();
204  // every edge knows only its outgoing connections so we look at whole junctions
205  for (const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
206  // first collect all outgoing lanes
207  for (const auto& outgoingEdge : junction.second.second->getGNEOutgoingEdges()) {
208  for (const auto& lane : outgoingEdge->getLanes()) {
209  deadStarts.insert(lane);
210  }
211  }
212  // then remove all approached lanes
213  for (const auto& incomingEdge : junction.second.second->getGNEIncomingEdges()) {
214  for (const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
215  deadStarts.erase(net->getAttributeCarriers()->retrieveEdge(connection.toEdge->getID())->getLanes()[connection.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  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
230  const EdgeVector destinations = edge.second.second->getNBEdge()->getConnectedEdges();
231  for (const auto& destination : destinations) {
232  GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(destination->getID());
233  for (const auto& lane : dest->getLanes()) {
234  const bool isConflicted = count_if(edge.second.second->getNBEdge()->getConnections().begin(), edge.second.second->getNBEdge()->getConnections().end(),
235  NBEdge::connections_toedgelane_finder(destination, (int)lane->getIndex(), -1)) > 1;
236  if (isConflicted) {
237  conflicts.push_back(lane);
238  }
239  }
240  }
241 
242  }
243  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::Operation::REPLACE);
244  return 1;
245 }
246 
247 
248 long
250  std::vector<GNEAttributeCarrier*> pass;
251  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
252  for (const auto& connection : edge.second.second->getNBEdge()->getConnections()) {
253  if (connection.mayDefinitelyPass) {
254  pass.push_back(edge.second.second->getLanes()[connection.fromLane]);
255  }
256  }
257  }
258  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::Operation::REPLACE);
259  return 1;
260 }
261 
262 
263 long
265  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
266  myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("clear connections from selected lanes, edges and junctions"));
267  // clear junction's connection
268  const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
269  for (const auto& junction : selectedJunctions) {
270  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
271  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
272  }
273  // clear edge's connection
274  const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
275  for (const auto& edge : selectedEdges) {
276  for (const auto& lane : edge->getLanes()) {
277  myConnectorFrameParent->removeConnections(lane);
278  }
279  }
280  // clear lane's connection
281  const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
282  for (const auto& lane : selectedLanes) {
283  myConnectorFrameParent->removeConnections(lane);
284  }
285  myConnectorFrameParent->getViewNet()->getUndoList()->end();
286  return 1;
287 }
288 
289 
290 long
292  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
293  myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("reset connections from selected lanes"));
294  const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
295  for (const auto& junction : selectedJunctions) {
296  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
297  }
298  myConnectorFrameParent->getViewNet()->getUndoList()->end();
299  if (selectedJunctions.size() > 0) {
300  auto viewNet = myConnectorFrameParent->getViewNet();
301  viewNet->getNet()->requireRecompute();
302  viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
303  }
304  return 1;
305 }
306 
307 // ---------------------------------------------------------------------------
308 // GNEConnectorFrame::ConnectionSelection - methods
309 // ---------------------------------------------------------------------------
310 
312  MFXGroupBoxModule(connectorFrameParent, TL("Selection")) {
313  // create label
314  new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Hold <SHIFT> while clicking to create unyielding connections (pass=true).")).c_str(), 0, GUIDesignLabelFrameInformation);
315  new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Hold <CTRL> while clicking to create conflicting connections (i.e. at zipper nodes or with incompatible permissions)")).c_str(), 0, GUIDesignLabelFrameInformation);
316 }
317 
318 
320 
321 // ---------------------------------------------------------------------------
322 // GNEConnectorFrame::ConnectionLegend - methods
323 // ---------------------------------------------------------------------------
324 
326  MFXGroupBoxModule(connectorFrameParent, TL("Information")) {
327 
328  // create possible target label
329  FXLabel* possibleTargetLabel = new FXLabel(getCollapsableFrame(), TL("Possible Target"), 0, GUIDesignLabel(JUSTIFY_LEFT));
330  possibleTargetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
331  possibleTargetLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
332 
333  // create source label
334  FXLabel* sourceLabel = new FXLabel(getCollapsableFrame(), TL("Source lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
335  sourceLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
336 
337  // create target label
338  FXLabel* targetLabel = new FXLabel(getCollapsableFrame(), TL("Target lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
339  targetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
340 
341  // create target (pass) label
342  FXLabel* targetPassLabel = new FXLabel(getCollapsableFrame(), TL("Target (pass)"), 0, GUIDesignLabel(JUSTIFY_LEFT));
343  targetPassLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
344 
345  // create conflict label
346  FXLabel* conflictLabel = new FXLabel(getCollapsableFrame(), TL("Conflict"), 0, GUIDesignLabel(JUSTIFY_LEFT));
347  conflictLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.conflict));
348 }
349 
350 
352 
353 // ---------------------------------------------------------------------------
354 // GNEConnectorFrame - methods
355 // ---------------------------------------------------------------------------
356 
358  GNEFrame(viewParent, viewNet, TL("Edit Connections")),
360  myNumChanges(0) {
361  // create current lane module
362  myCurrentLane = new CurrentLane(this);
363 
364  // create connection modifications module
366 
367  // create connection operations module
369 
370  // create connection selection module
372 
373  // create connection legend module
374  myLegend = new Legend(this);
375 }
376 
377 
379 
380 
381 void
383  // get lane front
384  GNELane* clickedLane = viewObjects.getLaneFrontNonLocked();
385  // iterate over lanes
386  for (const auto& lane : viewObjects.getLanes()) {
387  // if parent edge of lane is front element, update clickedLane
388  if (lane->getParentEdge() == myViewNet->getFrontAttributeCarrier()) {
389  clickedLane = lane;
390  }
391  }
392  // build connection
394 }
395 
396 
400 }
401 
402 
403 void
405  // select lane as current lane
406  buildConnection(lane, false, false, true); // select as current lane
407  // iterate over all potential targets
408  for (const auto& potentialTarget : myPotentialTargets) {
409  // remove connections using the appropiate parameters in function "buildConnection"
410  buildConnection(potentialTarget, false, false, false);
411  }
412  // save modifications
414 }
415 
416 
417 void
418 GNEConnectorFrame::buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle) {
419  if (myCurrentEditedLane == 0) {
420  myCurrentEditedLane = lane;
422  initTargets();
423  myNumChanges = 0;
424  myViewNet->getUndoList()->begin(GUIIcon::CONNECTION, TL("modify connections"));
425  } else if (myPotentialTargets.count(lane)
426  || (allowConflict && lane->getParentEdge()->getFromJunction() == myCurrentEditedLane->getParentEdge()->getToJunction())) {
427  const int fromIndex = myCurrentEditedLane->getIndex();
429  GNEEdge* destEdge = lane->getParentEdge();
430  std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
431  bool changed = false;
432  // get lane status
433  LaneStatus status = getLaneStatus(connections, lane);
434  if (status == LaneStatus::CONFLICTED && allowConflict) {
435  status = LaneStatus::UNCONNECTED;
436  }
437  // create depending of status
438  switch (status) {
440  if (toggle) {
441  // create new connection
442  NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
443  // if the connection was previously deleted (by clicking the same lane twice), restore all values
445  // fromLane must be the same, only check toLane
446  if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
447  newCon = c;
448  newCon.mayDefinitelyPass = mayDefinitelyPass;
449  }
450  }
451  NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
452  myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
453  if (mayDefinitelyPass) {
455  } else {
457  }
459  }
460  break;
463  // remove connection
464  GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
465  myDeletedConnections.push_back(con->getNBEdgeConnection());
468  changed = true;
469  break;
470  }
472  SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
473  SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
474  if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
475  myViewNet->setStatusBarText(TL("Pedestrian connections are generated automatically"));
476  } else if ((fromPermissions & toPermissions) == 0) {
477  myViewNet->setStatusBarText(TL("Incompatible vehicle class permissions"));
478  } else {
479  myViewNet->setStatusBarText(TL("Another lane from the same edge already connects to that lane"));
480  }
481  break;
482  }
483  if (changed) {
484  myNumChanges += 1;
485  }
486  } else {
487  myViewNet->setStatusBarText(TL("Invalid target for connection"));
488  }
490 }
491 
492 
493 void
495  // gather potential targets
497  // get potential targets
498  for (const auto& NBEEdge : nbn->getOutgoingEdges()) {
499  GNEEdge* edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(NBEEdge->getID());
500  for (const auto& lane : edge->getLanes()) {
501  myPotentialTargets.insert(lane);
502  }
503  }
504  // set color for existing connections
505  std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
506  for (const auto& lane : myPotentialTargets) {
507  switch (getLaneStatus(connections, lane)) {
510  break;
513  break;
516  break;
519  break;
520  }
521  }
522 }
523 
524 
525 void
527  // restore colors of potential targets
528  for (auto it : myPotentialTargets) {
529  it->setSpecialColor(0);
530  }
531  // clear attributes
532  myPotentialTargets.clear();
533  myNumChanges = 0;
535  myCurrentEditedLane = nullptr;
536  myDeletedConnections.clear();
538 }
539 
540 
542 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const {
544  const int fromIndex = myCurrentEditedLane->getIndex();
545  NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
546  const int toIndex = targetLane->getIndex();
547  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
548  connections.begin(), connections.end(),
549  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
550  const bool isConnected = con_it != connections.end();
551  if (isConnected) {
552  if (con_it->mayDefinitelyPass) {
554  } else {
555  return LaneStatus::CONNECTED;
556  }
557  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
558  || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
559  return LaneStatus::CONFLICTED;
560  } else {
562  }
563 }
564 
565 
566 /****************************************************************************/
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
Definition: GUIAppEnum.h:1068
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:930
@ MID_CANCEL
Cancel-button pressed.
Definition: GUIAppEnum.h:306
@ MID_CHOOSEN_CLEAR
Clear set.
Definition: GUIAppEnum.h:601
@ MID_OK
Ok-button pressed.
Definition: GUIAppEnum.h:304
@ MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
select lanes that have no connection leading to it
Definition: GUIAppEnum.h:1070
@ MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
select lanes that are connected from concurrent lanes
Definition: GUIAppEnum.h:1072
@ MID_CHOOSEN_RESET
Reset set.
Definition: GUIAppEnum.h:605
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
Definition: GUIAppEnum.h:1074
#define GUIDesignButton
Definition: GUIDesigns.h:88
#define GUIDesignLabel(justify)
Definition: GUIDesigns.h:249
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:198
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:285
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_PEDESTRIAN
pedestrian
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"
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
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...
~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.
void handleLaneClick(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
either sets the current lane or toggles the connection of the
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:683
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:1047
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:2208
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:642
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:887
GNEEdge * getParentEdge() const
get parent edge
Definition: GNELane.cpp:196
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:617
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:121
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2056
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
GNELane * getLaneFrontNonLocked() const
get front lane or a pointer to nullptr checking if is locked
const std::vector< GNELane * > & getLanes() const
get lanes
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:733
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set statusBar text
Definition: GNEViewNet.cpp:841
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:88
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
Definition: GUIDesigns.cpp:128
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
A list item which allows for custom coloring.
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:4306
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1252
bool hasConnectionTo(const NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:1290
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:273
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:228
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:222