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>
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, FXGroupBoxModule, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
55 FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, FXGroupBoxModule, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
56 
57 
58 // ===========================================================================
59 // method definitions
60 // ===========================================================================
61 
62 // ---------------------------------------------------------------------------
63 // GNEConnectorFrame::CurrentLane - methods
64 // ---------------------------------------------------------------------------
65 
67  FXGroupBoxModule(connectorFrameParent->myContentFrame, "Lane") {
68  // create lane label
69  myCurrentLaneLabel = new FXLabel(getCollapsableFrame(), "No lane selected", 0, GUIDesignLabelLeft);
70 }
71 
72 
74 
75 
76 void
78  if (laneID.empty()) {
79  myCurrentLaneLabel->setText("No lane selected");
80  } else {
81  myCurrentLaneLabel->setText((std::string("Current Lane: ") + laneID).c_str());
82  }
83 }
84 
85 // ---------------------------------------------------------------------------
86 // GNEConnectorFrame::ConnectionModifications - methods
87 // ---------------------------------------------------------------------------
88 
90  FXGroupBoxModule(connectorFrameParent->myContentFrame, "Modifications"),
91  myConnectorFrameParent(connectorFrameParent) {
92 
93  // Create "Cancel" button
94  myCancelButton = new FXButton(getCollapsableFrame(), "Cancel\t\tDiscard connection modifications (Esc)",
96  // Create "OK" button
97  mySaveButton = new FXButton(getCollapsableFrame(), "OK\t\tSave connection modifications (Enter)",
99 
100  // Create checkbox for protect routes
101  myProtectRoutesCheckBox = new FXCheckButton(getCollapsableFrame(), "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("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& i : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
128  if (i->isDemandElementValid() != GNEDemandElement::Problem::OK) {
129  FXMessageBox::warning(getApp(), MBOX_OK,
130  "Error saving connection operations", "%s",
131  ("Connection edition cannot be saved because route '" + i->getID() + "' is broken.").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("Changes accepted");
140  }
141  myConnectorFrameParent->cleanup();
142  myConnectorFrameParent->getViewNet()->updateViewNet();
143  }
144  return 1;
145 }
146 
147 // ---------------------------------------------------------------------------
148 // GNEConnectorFrame::ConnectionOperations - methods
149 // ---------------------------------------------------------------------------
150 
152  FXGroupBoxModule(connectorFrameParent->myContentFrame, "Operations"),
153  myConnectorFrameParent(connectorFrameParent) {
154 
155  // Create "Select Dead Ends" button
156  mySelectDeadEndsButton = new FXButton(getCollapsableFrame(), "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
158  // Create "Select Dead Starts" button
159  mySelectDeadStartsButton = new FXButton(getCollapsableFrame(), "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
161  // Create "Select Conflicts" button
162  mySelectConflictsButton = new FXButton(getCollapsableFrame(), "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
164  // Create "Select Edges which may always pass" button
165  mySelectPassingButton = new FXButton(getCollapsableFrame(), "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
167  // Create "Clear Selected" button
168  myClearSelectedButton = new FXButton(getCollapsableFrame(), "Clear Selected\t\tClears all connections of all selected objects",
170  // Create "Reset Selected" button
171  myResetSelectedButton = new FXButton(getCollapsableFrame(), "Reset Selected\t\tRecomputes connections at all selected junctions",
173 }
174 
175 
177 
178 
179 long
181  // select all lanes that have no successor lane
182  std::vector<GNEAttributeCarrier*> deadEnds;
183  // every edge knows its outgoing connections so we can look at each edge in isolation
184  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
185  for (const auto& lane : edge.second->getLanes()) {
186  if (edge.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
187  deadEnds.push_back(lane);
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  for (const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
203  // first collect all outgoing lanes
204  for (const auto& outgoingEdge : junction.second->getGNEOutgoingEdges()) {
205  for (const auto& lane : outgoingEdge->getLanes()) {
206  deadStarts.insert(lane);
207  }
208  }
209  // then remove all approached lanes
210  for (const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
211  for (const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
212  deadStarts.erase(net->getAttributeCarriers()->retrieveEdge(connection.toEdge->getID())->getLanes()[connection.toLane]);
213  }
214  }
215  }
216  std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
217  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(selectObjects, GNESelectorFrame::ModificationMode::Operation::REPLACE);
218  return 1;
219 }
220 
221 
222 long
224  std::vector<GNEAttributeCarrier*> conflicts;
225  // conflicts happen per edge so we can look at each edge in isolation
226  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
227  const EdgeVector destinations = edge.second->getNBEdge()->getConnectedEdges();
228  for (const auto& destination : destinations) {
229  GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(destination->getID());
230  for (const auto& lane : dest->getLanes()) {
231  const bool isConflicted = count_if(edge.second->getNBEdge()->getConnections().begin(), edge.second->getNBEdge()->getConnections().end(),
232  NBEdge::connections_toedgelane_finder(destination, (int)lane->getIndex(), -1)) > 1;
233  if (isConflicted) {
234  conflicts.push_back(lane);
235  }
236  }
237  }
238 
239  }
240  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::Operation::REPLACE);
241  return 1;
242 }
243 
244 
245 long
247  std::vector<GNEAttributeCarrier*> pass;
248  for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
249  for (const auto& connection : edge.second->getNBEdge()->getConnections()) {
250  if (connection.mayDefinitelyPass) {
251  pass.push_back(edge.second->getLanes()[connection.fromLane]);
252  }
253  }
254  }
255  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::Operation::REPLACE);
256  return 1;
257 }
258 
259 
260 long
262  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
263  myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, "clear connections from selected lanes, edges and " + toString(SUMO_TAG_JUNCTION) + "s");
264  // clear junction's connection
265  const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
266  for (const auto& junction : selectedJunctions) {
267  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
268  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
269  }
270  // clear edge's connection
271  const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
272  for (const auto& edge : selectedEdges) {
273  for (const auto& lane : edge->getLanes()) {
274  myConnectorFrameParent->removeConnections(lane);
275  }
276  }
277  // clear lane's connection
278  const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
279  for (const auto& lane : selectedLanes) {
280  myConnectorFrameParent->removeConnections(lane);
281  }
282  myConnectorFrameParent->getViewNet()->getUndoList()->end();
283  return 1;
284 }
285 
286 
287 long
289  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
290  myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, "reset connections from selected lanes");
291  const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
292  for (const auto& junction : selectedJunctions) {
293  junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
294  }
295  myConnectorFrameParent->getViewNet()->getUndoList()->end();
296  if (selectedJunctions.size() > 0) {
297  auto viewNet = myConnectorFrameParent->getViewNet();
298  viewNet->getNet()->requireRecompute();
299  viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
300  }
301  return 1;
302 }
303 
304 // ---------------------------------------------------------------------------
305 // GNEConnectorFrame::ConnectionSelection - methods
306 // ---------------------------------------------------------------------------
307 
309  FXGroupBoxModule(connectorFrameParent->myContentFrame, "Selection") {
310  // create Selection Hint
311  myHoldShiftLabel = new FXLabel(getCollapsableFrame(), "Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0, GUIDesignLabelFrameInformation);
312  myHoldControlLabel = new FXLabel(getCollapsableFrame(), "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  FXGroupBoxModule(connectorFrameParent->myContentFrame, "Information") {
324 
325  // create possible target label
326  FXLabel* possibleTargetLabel = new FXLabel(getCollapsableFrame(), "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(getCollapsableFrame(), "Source lane", 0, GUIDesignLabelLeft);
332  sourceLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
333 
334  // create target label
335  FXLabel* targetLabel = new FXLabel(getCollapsableFrame(), "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(getCollapsableFrame(), "Target (pass)", 0, GUIDesignLabelLeft);
340  targetPassLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
341 
342  // create conflict label
343  FXLabel* conflictLabel = new FXLabel(getCollapsableFrame(), "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
371  myLegend = new Legend(this);
372 }
373 
374 
376 
377 
378 void
380  // get lane front
381  GNELane* clickedLane = objectsUnderCursor.getLaneFront();
382  // iterate over lanes
383  for (const auto& lane : objectsUnderCursor.getLanes()) {
384  // if parent edge of lane is front element, update clickedLane
385  if (lane->getParentEdge() == myViewNet->getFrontAttributeCarrier()) {
386  clickedLane = lane;
387  }
388  }
389  // build connection
391 }
392 
393 
397 }
398 
399 
400 void
402  // select lane as current lane
403  buildConnection(lane, false, false, true); // select as current lane
404  // iterate over all potential targets
405  for (const auto& potentialTarget : myPotentialTargets) {
406  // remove connections using the apropiate parameters in function "buildConnection"
407  buildConnection(potentialTarget, false, false, false);
408  }
409  // save modifications
411 }
412 
413 
414 void
415 GNEConnectorFrame::buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle) {
416  if (myCurrentEditedLane == 0) {
417  myCurrentEditedLane = lane;
419  initTargets();
420  myNumChanges = 0;
422  } else if (myPotentialTargets.count(lane)
423  || (allowConflict && lane->getParentEdge()->getFromJunction() == myCurrentEditedLane->getParentEdge()->getToJunction())) {
424  const int fromIndex = myCurrentEditedLane->getIndex();
426  GNEEdge* destEdge = lane->getParentEdge();
427  std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
428  bool changed = false;
429  // get lane status
430  LaneStatus status = getLaneStatus(connections, lane);
431  if (status == LaneStatus::CONFLICTED && allowConflict) {
432  status = LaneStatus::UNCONNECTED;
433  }
434  // create depending of status
435  switch (status) {
437  if (toggle) {
438  // create new connection
439  NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
440  // if the connection was previously deleted (by clicking the same lane twice), restore all values
442  // fromLane must be the same, only check toLane
443  if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
444  newCon = c;
445  newCon.mayDefinitelyPass = mayDefinitelyPass;
446  }
447  }
448  NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
449  myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
450  if (mayDefinitelyPass) {
452  } else {
454  }
456  }
457  break;
460  // remove connection
461  GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
462  myDeletedConnections.push_back(con->getNBEdgeConnection());
465  changed = true;
466  break;
467  }
469  SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
470  SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
471  if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
472  myViewNet->setStatusBarText("Pedestrian connections are generated automatically");
473  } else if ((fromPermissions & toPermissions) == 0) {
474  myViewNet->setStatusBarText("Incompatible vehicle class permissions");
475  } else {
476  myViewNet->setStatusBarText("Another lane from the same edge already connects to that lane");
477  }
478  break;
479  }
480  if (changed) {
481  myNumChanges += 1;
482  }
483  } else {
484  myViewNet->setStatusBarText("Invalid target for " + toString(SUMO_TAG_CONNECTION));
485  }
487 }
488 
489 
490 void
492  // gather potential targets
494  // get potencial targets
495  for (const auto& NBEEdge : nbn->getOutgoingEdges()) {
496  GNEEdge* edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(NBEEdge->getID());
497  for (const auto& lane : edge->getLanes()) {
498  myPotentialTargets.insert(lane);
499  }
500  }
501  // set color for existing connections
502  std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
503  for (const auto& lane : myPotentialTargets) {
504  switch (getLaneStatus(connections, lane)) {
507  break;
510  break;
513  break;
516  break;
517  }
518  }
519 }
520 
521 
522 void
524  // restore colors of potential targets
525  for (auto it : myPotentialTargets) {
526  it->setSpecialColor(0);
527  }
528  // clear attributes
529  myPotentialTargets.clear();
530  myNumChanges = 0;
532  myCurrentEditedLane = nullptr;
533  myDeletedConnections.clear();
535 }
536 
537 
539 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const {
541  const int fromIndex = myCurrentEditedLane->getIndex();
542  NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
543  const int toIndex = targetLane->getIndex();
544  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
545  connections.begin(), connections.end(),
546  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
547  const bool isConnected = con_it != connections.end();
548  if (isConnected) {
549  if (con_it->mayDefinitelyPass) {
551  } else {
552  return LaneStatus::CONNECTED;
553  }
554  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
555  || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
556  return LaneStatus::CONFLICTED;
557  } else {
559  }
560 }
561 
562 
563 /****************************************************************************/
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
Definition: GUIAppEnum.h:909
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:797
@ MID_CANCEL
Cancel-button pressed.
Definition: GUIAppEnum.h:255
@ MID_CHOOSEN_CLEAR
Clear set.
Definition: GUIAppEnum.h:559
@ MID_OK
Ok-button pressed.
Definition: GUIAppEnum.h:253
@ MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
select lanes that have no connection leading to it
Definition: GUIAppEnum.h:911
@ MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
select lanes that are connected from concurrent lanes
Definition: GUIAppEnum.h:913
@ MID_CHOOSEN_RESET
Reset set.
Definition: GUIAppEnum.h:563
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
Definition: GUIAppEnum.h:915
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:193
#define GUIDesignButton
Definition: GUIDesigns.h:68
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:145
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:244
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
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
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
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(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
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:435
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:782
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:1923
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:133
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:114
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
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:797
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:1031
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:113
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:546
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
const std::string & getID() const
get ID
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 * getLaneFront() const
get front lane or a pointer to nullptr
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 modul
Definition: GNEViewNet.cpp:543
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:629
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.
Definition: Lane.h:33
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:4022
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1206
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:1249
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:261
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:197
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:240
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:234