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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // The Widget for modifying lane-to-lane connections
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
26 #include <netedit/GNEViewParent.h>
27 #include <netedit/GNEUndoList.h>
28 #include <netedit/GNENet.h>
29 #include <netedit/GNEViewNet.h>
35 
36 #include "GNEConnectorFrame.h"
37 #include "GNESelectorFrame.h"
38 
39 
40 // ===========================================================================
41 // FOX callback mapping
42 // ===========================================================================
43 
44 FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[] = {
47 };
48 
49 FXDEFMAP(GNEConnectorFrame::ConnectionOperations) ConnectionOperationsMap[] = {
56 };
57 
58 // Object implementation
59 FXIMPLEMENT(GNEConnectorFrame::ConnectionModifications, FXGroupBox, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
60 FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, FXGroupBox, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
61 
62 
63 // ===========================================================================
64 // method definitions
65 // ===========================================================================
66 
67 // ---------------------------------------------------------------------------
68 // GNEConnectorFrame::CurrentLane - methods
69 // ---------------------------------------------------------------------------
70 
72  FXGroupBox(connectorFrameParent->myContentFrame, "Lane", GUIDesignGroupBoxFrame) {
73  // create lane label
74  myCurrentLaneLabel = new FXLabel(this, "No lane selected", 0, GUIDesignLabelLeft);
75 }
76 
77 
79 
80 
81 void
83  if (laneID.empty()) {
84  myCurrentLaneLabel->setText("No lane selected");
85  } else {
86  myCurrentLaneLabel->setText((std::string("Current Lane: ") + laneID).c_str());
87  }
88 }
89 
90 // ---------------------------------------------------------------------------
91 // GNEConnectorFrame::ConnectionModifications - methods
92 // ---------------------------------------------------------------------------
93 
95  FXGroupBox(connectorFrameParent->myContentFrame, "Modifications", GUIDesignGroupBoxFrame),
96  myConnectorFrameParent(connectorFrameParent) {
97 
98  // Create "Cancel" button
99  myCancelButton = new FXButton(this, "Cancel\t\tDiscard connection modifications (Esc)",
101  // Create "OK" button
102  mySaveButton = new FXButton(this, "OK\t\tSave connection modifications (Enter)",
104 
105  // Create checkbox for protect routes
106  myProtectRoutesCheckBox = new FXCheckButton(this, "Protect routes", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
107 }
108 
109 
111 
112 
113 long
115  if (myConnectorFrameParent->myCurrentEditedLane != 0) {
116  myConnectorFrameParent->getViewNet()->getUndoList()->p_abort();
117  if (myConnectorFrameParent->myNumChanges) {
118  myConnectorFrameParent->getViewNet()->setStatusBarText("Changes reverted");
119  }
120  myConnectorFrameParent->cleanup();
121  myConnectorFrameParent->getViewNet()->update();
122  }
123  return 1;
124 }
125 
126 
127 long
129  if (myConnectorFrameParent->myCurrentEditedLane != 0) {
130  // check if routes has to be protected
131  if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
132  for (const auto& i : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
133  if (!i->isDemandElementValid()) {
134  FXMessageBox::warning(getApp(), MBOX_OK,
135  "Error saving connection operations", "%s",
136  ("Connection edition cannot be saved because route '" + i->getID() + "' is broken.").c_str());
137  return 1;
138  }
139  }
140  }
141  // finish route editing
142  myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
143  if (myConnectorFrameParent->myNumChanges) {
144  myConnectorFrameParent->getViewNet()->setStatusBarText("Changes accepted");
145  }
146  myConnectorFrameParent->cleanup();
147  myConnectorFrameParent->getViewNet()->update();
148  }
149  return 1;
150 }
151 
152 // ---------------------------------------------------------------------------
153 // GNEConnectorFrame::ConnectionOperations - methods
154 // ---------------------------------------------------------------------------
155 
157  FXGroupBox(connectorFrameParent->myContentFrame, "Operations", GUIDesignGroupBoxFrame),
158  myConnectorFrameParent(connectorFrameParent) {
159 
160  // Create "Select Dead Ends" button
161  mySelectDeadEndsButton = new FXButton(this, "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)",
163  // Create "Select Dead Starts" button
164  mySelectDeadStartsButton = new FXButton(this, "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)",
166  // Create "Select Conflicts" button
167  mySelectConflictsButton = new FXButton(this, "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)",
169  // Create "Select Edges which may always pass" button
170  mySelectPassingButton = new FXButton(this, "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set",
172  // Create "Clear Selected" button
173  myClearSelectedButton = new FXButton(this, "Clear Selected\t\tClears all connections of all selected objects",
175  // Create "Reset Selected" button
176  myResetSelectedButton = new FXButton(this, "Reset Selected\t\tRecomputes connections at all selected junctions",
178 }
179 
180 
182 
183 
184 long
186  // select all lanes that have no successor lane
187  std::vector<GNEAttributeCarrier*> deadEnds;
188  // every edge knows its outgoing connections so we can look at each edge in isolation
189  const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
190  for (auto i : edges) {
191  for (auto j : i->getLanes()) {
192  if (i->getNBEdge()->getConnectionsFromLane(j->getIndex()).size() == 0) {
193  deadEnds.push_back(j);
194  }
195  }
196  }
197  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(deadEnds, GNESelectorFrame::ModificationMode::SET_REPLACE);
198  return 1;
199 }
200 
201 
202 long
204  // select all lanes that have no predecessor lane
205  std::set<GNEAttributeCarrier*> deadStarts;
206  GNENet* net = myConnectorFrameParent->getViewNet()->getNet();
207  // every edge knows only its outgoing connections so we look at whole junctions
208  const std::vector<GNEJunction*> junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions();
209  for (auto i : junctions) {
210  // first collect all outgoing lanes
211  for (auto j : i->getNBNode()->getOutgoingEdges()) {
212  GNEEdge* edge = net->retrieveEdge(j->getID());
213  for (auto k : edge->getLanes()) {
214  deadStarts.insert(k);
215  }
216  }
217  // then remove all approached lanes
218  for (auto j : i->getNBNode()->getIncomingEdges()) {
219  GNEEdge* edge = net->retrieveEdge(j->getID());
220  for (auto k : edge->getNBEdge()->getConnections()) {
221  deadStarts.erase(net->retrieveEdge(k.toEdge->getID())->getLanes()[k.toLane]);
222  }
223  }
224  }
225  std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
226  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(selectObjects, GNESelectorFrame::ModificationMode::SET_REPLACE);
227  return 1;
228 }
229 
230 
231 long
233  std::vector<GNEAttributeCarrier*> conflicts;
234  // conflicts happen per edge so we can look at each edge in isolation
235  const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
236  for (auto i : edges) {
237  const EdgeVector destinations = i->getNBEdge()->getConnectedEdges();
238  for (auto j : destinations) {
239  GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdge(j->getID());
240  for (auto k : dest->getLanes()) {
241  const bool isConflicted = count_if(i->getNBEdge()->getConnections().begin(), i->getNBEdge()->getConnections().end(),
242  NBEdge::connections_toedgelane_finder(j, (int)(k)->getIndex(), -1)) > 1;
243  if (isConflicted) {
244  conflicts.push_back(k);
245  }
246  }
247  }
248 
249  }
250  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::SET_REPLACE);
251  return 1;
252 }
253 
254 
255 long
257  std::vector<GNEAttributeCarrier*> pass;
258  const std::vector<GNEEdge*> edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges();
259  for (auto i : edges) {
260  for (auto j : i->getNBEdge()->getConnections()) {
261  if (j.mayDefinitelyPass) {
262  pass.push_back(i->getLanes()[j.fromLane]);
263  }
264  }
265  }
266  myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::SET_REPLACE);
267  return 1;
268 }
269 
270 
271 long
273  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
274  myConnectorFrameParent->getViewNet()->getUndoList()->p_begin("clear connections from selected lanes, edges and " + toString(SUMO_TAG_JUNCTION) + "s");
275  // clear junction's connection
276  auto junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions(true);
277  for (auto i : junctions) {
278  i->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
279  i->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
280  }
281  // clear edge's connection
282  auto edges = myConnectorFrameParent->getViewNet()->getNet()->retrieveEdges(true);
283  for (auto i : edges) {
284  for (auto j : i->getLanes()) {
285  myConnectorFrameParent->removeConnections(j);
286  }
287  }
288  // clear lane's connection
289  auto lanes = myConnectorFrameParent->getViewNet()->getNet()->retrieveLanes(true);
290  for (auto i : lanes) {
291  myConnectorFrameParent->removeConnections(dynamic_cast<GNELane*>(i));
292  }
293  myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
294  return 1;
295 }
296 
297 
298 long
300  myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
301  myConnectorFrameParent->getViewNet()->getUndoList()->p_begin("reset connections from selected lanes");
302  auto junctions = myConnectorFrameParent->getViewNet()->getNet()->retrieveJunctions(true);
303  for (auto i : junctions) {
304  i->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
305  }
306  myConnectorFrameParent->getViewNet()->getUndoList()->p_end();
307  return 1;
308 }
309 
310 // ---------------------------------------------------------------------------
311 // GNEConnectorFrame::ConnectionSelection - methods
312 // ---------------------------------------------------------------------------
313 
315  FXGroupBox(connectorFrameParent->myContentFrame, "Selection", GUIDesignGroupBoxFrame) {
316  // create Selection Hint
317  myHoldShiftLabel = new FXLabel(this, "Hold <SHIFT> while clicking\nto create unyielding\nconnections (pass=true).", 0, GUIDesignLabelFrameInformation);
318  myHoldControlLabel = new FXLabel(this, "Hold <CTRL> while clicking\nto create conflicting\nconnections (i.e. at zipper\nnodes or with incompatible\npermissions)", 0, GUIDesignLabelFrameInformation);
319 }
320 
321 
323 
324 // ---------------------------------------------------------------------------
325 // GNEConnectorFrame::ConnectionLegend - methods
326 // ---------------------------------------------------------------------------
327 
329  FXGroupBox(connectorFrameParent->myContentFrame, "Legend", GUIDesignGroupBoxFrame),
330  mySourceColor(RGBColor::CYAN),
331  myTargetColor(RGBColor::GREEN),
332  myPotentialTargetColor(RGBColor(0, 64, 0, 255)),
333  myTargetPassColor(RGBColor::MAGENTA),
334  myConflictColor(RGBColor::YELLOW) {
335 
336  // create source label
337  mySourceLabel = new FXLabel(this, "Source lane", 0, GUIDesignLabelLeft);
339 
340  // create target label
341  myTargetLabel = new FXLabel(this, "Target lane", 0, GUIDesignLabelLeft);
343 
344  // create possible target label
345  myPossibleTargetLabel = new FXLabel(this, "Possible Target", 0, GUIDesignLabelLeft);
347 
348  // create target (pass) label
349  myTargetPassLabel = new FXLabel(this, "Target (pass)", 0, GUIDesignLabelLeft);
351 
352  // create conflict label
353  myConflictLabel = new FXLabel(this, "Conflict", 0, GUIDesignLabelLeft);
355 }
356 
357 
359 
360 
361 const RGBColor&
363  return mySourceColor;
364 }
365 
366 
367 const RGBColor&
369  return myTargetColor;
370 }
371 
372 
373 const RGBColor&
375  return myPotentialTargetColor;
376 }
377 
378 
379 const RGBColor&
381  return myTargetPassColor;
382 }
383 
384 
385 const RGBColor&
387  return myConflictColor;
388 }
389 
390 // ---------------------------------------------------------------------------
391 // GNEConnectorFrame - methods
392 // ---------------------------------------------------------------------------
393 
394 GNEConnectorFrame::GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet):
395  GNEFrame(horizontalFrameParent, viewNet, "Edit Connections"),
397  // create current lane modul
398  myCurrentLane = new CurrentLane(this);
399 
400  // create connection modifications modul
402 
403  // create connection operations modul
405 
406  // create connection selection modul
408 
409  // create connection legend modul
411 }
412 
413 
415 
416 
417 void
419  // build connection
421 }
422 
423 
427 }
428 
429 
430 void
432  // select lane as current lane
433  buildConnection(lane, false, false, true); // select as current lane
434  // iterate over all potential targets
435  for (auto i : myPotentialTargets) {
436  // remove connections using the apropiate parameters in function "buildConnection"
437  buildConnection(i, false, false, false);
438  }
439  // save modifications
441 }
442 
443 
444 void
445 GNEConnectorFrame::buildConnection(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle) {
446  if (myCurrentEditedLane == 0) {
447  myCurrentEditedLane = lane;
449  initTargets();
450  myNumChanges = 0;
451  myViewNet->getUndoList()->p_begin("modify " + toString(SUMO_TAG_CONNECTION) + "s");
452  } else if (myPotentialTargets.count(lane)
454  const int fromIndex = myCurrentEditedLane->getIndex();
456  GNEEdge* destEdge = lane->getParentEdge();
457  std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
458  bool changed = false;
459  LaneStatus status = getLaneStatus(connections, lane);
460  if (status == CONFLICTED && allowConflict) {
461  status = UNCONNECTED;
462  }
463  switch (status) {
464  case UNCONNECTED:
465  if (toggle) {
466  // create new connection
467  NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
468  // if the connection was previously deleted (by clicking the same lane twice), restore all values
470  // fromLane must be the same, only check toLane
471  if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
472  newCon = c;
473  newCon.mayDefinitelyPass = mayDefinitelyPass;
474  }
475  }
476  NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
477  myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
480  }
481  break;
482  case CONNECTED:
483  case CONNECTED_PASS: {
484  // remove connection
485  GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
486  myDeletedConnections.push_back(con->getNBEdgeConnection());
489  changed = true;
490  break;
491  }
492  case CONFLICTED:
493  SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
494  SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
495  if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
496  myViewNet->setStatusBarText("Pedestrian connections are generated automatically");
497  } else if ((fromPermissions & toPermissions) == 0) {
498  myViewNet->setStatusBarText("Incompatible vehicle class permissions");
499  } else {
500  myViewNet->setStatusBarText("Another lane from the same edge already connects to that lane");
501  }
502  break;
503  }
504  if (changed) {
505  myNumChanges += 1;
506  }
507  } else {
508  myViewNet->setStatusBarText("Invalid target for " + toString(SUMO_TAG_CONNECTION));
509  }
511 }
512 
513 
514 void
516  // gather potential targets
518 
519  for (auto it : nbn->getOutgoingEdges()) {
520  GNEEdge* edge = myViewNet->getNet()->retrieveEdge(it->getID());
521  for (auto it_lane : edge->getLanes()) {
522  myPotentialTargets.insert(it_lane);
523  }
524  }
525  // set color for existing connections
526  std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
527  for (auto it : myPotentialTargets) {
528  switch (getLaneStatus(connections, it)) {
529  case CONNECTED:
530  it->setSpecialColor(&myConnectionLegend->getTargetColor());
531  break;
532  case CONNECTED_PASS:
533  it->setSpecialColor(&myConnectionLegend->getTargetPassColor());
534  break;
535  case CONFLICTED:
536  it->setSpecialColor(&myConnectionLegend->getConflictColor());
537  break;
538  case UNCONNECTED:
539  it->setSpecialColor(&myConnectionLegend->getPotentialTargetColor());
540  break;
541  }
542  }
543 }
544 
545 
546 void
548  // restore colors of potential targets
549  for (auto it : myPotentialTargets) {
550  it->setSpecialColor(0);
551  }
552  // clear attributes
553  myPotentialTargets.clear();
554  myNumChanges = 0;
556  myCurrentEditedLane = nullptr;
557  myDeletedConnections.clear();
559 }
560 
561 
563 GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, GNELane* targetLane) {
565  const int fromIndex = myCurrentEditedLane->getIndex();
566  NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
567  const int toIndex = targetLane->getIndex();
568  std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
569  connections.begin(), connections.end(),
570  NBEdge::connections_finder(fromIndex, destEdge, toIndex));
571  const bool isConnected = con_it != connections.end();
572  if (isConnected) {
573  if (con_it->mayDefinitelyPass) {
574  return CONNECTED_PASS;
575  } else {
576  return CONNECTED;
577  }
578  } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
579  || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
580  return CONFLICTED;
581  } else {
582  return UNCONNECTED;
583  }
584 }
585 
586 /****************************************************************************/
GNEConnectorFrame::myConnectionLegend
ConnectionLegend * myConnectionLegend
ConnectionLegend modul.
Definition: GNEConnectorFrame.h:304
NBConnection::InvalidConnection
const static NBConnection InvalidConnection
Definition: NBConnection.h:126
GNEConnectorFrame::getConnectionModifications
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications modul
Definition: GNEConnectorFrame.cpp:425
GNEConnectorFrame::ConnectionLegend::myTargetColor
RGBColor myTargetColor
color for the to-lane of a connection
Definition: GNEConnectorFrame.h:233
SVC_PEDESTRIAN
@ SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
ICON_ACCEPT
@ ICON_ACCEPT
Definition: GUIIcons.h:386
GNEConnectorFrame::ConnectionOperations::mySelectConflictsButton
FXButton * mySelectConflictsButton
"Select Conflicts" button
Definition: GNEConnectorFrame.h:152
GNEConnectorFrame::ConnectionOperations::onCmdResetSelectedConnections
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
Definition: GNEConnectorFrame.cpp:299
GNEConnectorFrame.h
GNEConnectorFrame::~GNEConnectorFrame
~GNEConnectorFrame()
Destructor.
Definition: GNEConnectorFrame.cpp:414
GNEConnectorFrame::ConnectionModifications::onCmdSaveModifications
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
Definition: GNEConnectorFrame.cpp:128
MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
@ MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
select lanes that have no connection leading to it
Definition: GUIAppEnum.h:724
GNEViewNetHelper::KeyPressed::shiftKeyPressed
bool shiftKeyPressed() const
check if SHIFT key was pressed during click
Definition: GNEViewNetHelper.cpp:376
GNEConnectorFrame::ConnectionOperations
Definition: GNEConnectorFrame.h:105
GNEConnectorFrame::ConnectionLegend::myPossibleTargetLabel
FXLabel * myPossibleTargetLabel
possible target label
Definition: GNEConnectorFrame.h:221
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
GNEConnectorFrame::removeConnections
void removeConnections(GNELane *lane)
remove connections
Definition: GNEConnectorFrame.cpp:431
GNEConnectorFrame::ConnectionOperations::onCmdClearSelectedConnections
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
Definition: GNEConnectorFrame.cpp:272
GNEConnectorFrame::myConnectionSelection
ConnectionSelection * myConnectionSelection
ConnectionSelection modul.
Definition: GNEConnectorFrame.h:301
NBEdge::connections_toedgelane_finder
Definition: NBEdge.h:1673
GNEConnectorFrame::ConnectionOperations::~ConnectionOperations
~ConnectionOperations()
destructor
Definition: GNEConnectorFrame.cpp:181
GNEConnectorFrame::CurrentLane
Definition: GNEConnectorFrame.h:42
GNEConnectorFrame::ConnectionSelection
Definition: GNEConnectorFrame.h:168
GNELane::getParentEdge
GNEEdge * getParentEdge() const
Returns underlying parent edge.
Definition: GNELane.cpp:1371
GNEConnectorFrame::ConnectionSelection::ConnectionSelection
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:314
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
GNEConnectorFrame::ConnectionSelection::~ConnectionSelection
~ConnectionSelection()
destructor
Definition: GNEConnectorFrame.cpp:322
GNEViewNetHelper::KeyPressed::controlKeyPressed
bool controlKeyPressed() const
check if CONTROL key was pressed during click
Definition: GNEViewNetHelper.cpp:386
EdgeVector
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
GNEConnectorFrame::ConnectionLegend::getPotentialTargetColor
const RGBColor & getPotentialTargetColor() const
get color for potential to-lane targets (currently unconnected)
Definition: GNEConnectorFrame.cpp:374
GNESelectorFrame::ModificationMode::SET_REPLACE
@ SET_REPLACE
Definition: GNESelectorFrame.h:131
MID_CHOOSEN_CLEAR
@ MID_CHOOSEN_CLEAR
Clear set.
Definition: GUIAppEnum.h:518
NBNode::getOutgoingEdges
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
Definition: NBNode.h:260
NBEdge::getConnectionsFromLane
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1100
GNEViewNet::setStatusBarText
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:523
GNEFrame
Definition: GNEFrame.h:34
MID_GNE_CONNECTORFRAME_SELECTDEADENDS
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
Definition: GUIAppEnum.h:722
GNEConnectorFrame::ConnectionLegend::~ConnectionLegend
~ConnectionLegend()
destructor
Definition: GNEConnectorFrame.cpp:358
GNEViewNet
Definition: GNEViewNet.h:42
GNEConnectorFrame::ConnectionOperations::onCmdSelectPass
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
Definition: GNEConnectorFrame.cpp:256
GUIDesigns.h
NBEdge::getPermissions
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3404
NBEdge::Connection::tlLinkIndex
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:221
MID_CANCEL
@ MID_CANCEL
Cancel-button pressed.
Definition: GUIAppEnum.h:230
MID_GNE_SET_ATTRIBUTE
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:646
GNEConnectorFrame::ConnectionLegend::getTargetColor
const RGBColor & getTargetColor() const
get color for the to-lane of a connection
Definition: GNEConnectorFrame.cpp:368
GUIIconSubSys::getIcon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition: GUIIconSubSys.cpp:609
GNEFrame::myContentFrame
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:124
GNEConnectorFrame::getLaneStatus
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, GNELane *targetLane)
return the status of toLane
Definition: GNEConnectorFrame.cpp:563
GNEConnectorFrame::ConnectionModifications::myProtectRoutesCheckBox
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
Definition: GNEConnectorFrame.h:98
GNEConnectorFrame::ConnectionLegend::ConnectionLegend
ConnectionLegend(GNEConnectorFrame *connectorFrameParent)
constructor
Definition: GNEConnectorFrame.cpp:328
GNEConnectorFrame
Definition: GNEConnectorFrame.h:34
GUIDesignButton
#define GUIDesignButton
Definition: GUIDesigns.h:50
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
GNEConnectorFrame::myCurrentLane
CurrentLane * myCurrentLane
CurrentLane modul.
Definition: GNEConnectorFrame.h:292
GUIAppEnum.h
GNEConnectorFrame::ConnectionLegend
Definition: GNEConnectorFrame.h:189
GNEJunction.h
GUIDesignLabelFrameInformation
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:194
GNELane::getIndex
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:774
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEConnectorFrame::myConnectionModifications
ConnectionModifications * myConnectionModifications
ConnectionModifications modul.
Definition: GNEConnectorFrame.h:295
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNEJunction::getNBNode
NBNode * getNBNode() const
Return net build node.
Definition: GNEJunction.cpp:398
GNEConnectorFrame::ConnectionModifications::ConnectionModifications
ConnectionModifications(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
Definition: GNEConnectorFrame.cpp:94
GNEConnectorFrame::myConnectionOperations
ConnectionOperations * myConnectionOperations
ConnectionOperations modul.
Definition: GNEConnectorFrame.h:298
RGBColor
Definition: RGBColor.h:39
NBEdge::connections_finder
Definition: NBEdge.h:1703
MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
@ MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
select lanes that are connected from concurrent lanes
Definition: GUIAppEnum.h:726
GNEConnectorFrame::ConnectionLegend::getSourceColor
const RGBColor & getSourceColor() const
get color for the from-lane of a connection
Definition: GNEConnectorFrame.cpp:362
GNEConnectorFrame::CurrentLane::~CurrentLane
~CurrentLane()
destructor
Definition: GNEConnectorFrame.cpp:78
GNEJunction::invalidateTLS
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
Definition: GNEJunction.cpp:815
NBEdge::Connection::mayDefinitelyPass
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:227
GNEConnectorFrame::ConnectionOperations::myResetSelectedButton
FXButton * myResetSelectedButton
"Reset Selected"
Definition: GNEConnectorFrame.h:161
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
GNEConnectorFrame::ConnectionOperations::onCmdSelectDeadStarts
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
Definition: GNEConnectorFrame.cpp:203
FXDEFMAP
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
GNEConnectorFrame::initTargets
void initTargets()
init targets
Definition: GNEConnectorFrame.cpp:515
GNEEdge::getNBEdge
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:631
GNEViewNetHelper::ObjectsUnderCursor
class used to group all variables related with objects under cursor after a click over view
Definition: GNEViewNetHelper.h:148
GNEConnection::getNBEdgeConnection
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
Definition: GNEConnection.cpp:202
GNEConnectorFrame::handleLaneClick
void handleLaneClick(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor)
either sets the current lane or toggles the connection of the
Definition: GNEConnectorFrame.cpp:418
GNEDemandElement.h
GNEConnectorFrame::ConnectionModifications::mySaveButton
FXButton * mySaveButton
"OK" button
Definition: GNEConnectorFrame.h:95
GNEConnectorFrame::myNumChanges
int myNumChanges
number of changes
Definition: GNEConnectorFrame.h:313
GNEConnectorFrame::ConnectionLegend::myTargetPassLabel
FXLabel * myTargetPassLabel
target pass label
Definition: GNEConnectorFrame.h:224
MID_CHOOSEN_RESET
@ MID_CHOOSEN_RESET
Reset set.
Definition: GUIAppEnum.h:520
GNEConnectorFrame::ConnectionLegend::myTargetPassColor
RGBColor myTargetPassColor
color for the to-lane of a connection with pass attribute
Definition: GNEConnectorFrame.h:239
MID_OK
@ MID_OK
Ok-button pressed.
Definition: GUIAppEnum.h:228
GNEViewNet.h
GNEConnectorFrame::ConnectionModifications::myCancelButton
FXButton * myCancelButton
"Cancel" button
Definition: GNEConnectorFrame.h:92
GNEConnectorFrame::ConnectionOperations::onCmdSelectConflicts
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
Definition: GNEConnectorFrame.cpp:232
GNEConnectorFrame::myPotentialTargets
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
Definition: GNEConnectorFrame.h:310
GNEConnectorFrame::LaneStatus
LaneStatus
the status of a target lane
Definition: GNEConnectorFrame.h:264
GUIDesignLabelLeft
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:149
GNEViewNet::getKeyPressed
const GNEViewNetHelper::KeyPressed & getKeyPressed() const
get Key Pressed modul
Definition: GNEViewNet.cpp:464
GNEConnectorFrame::ConnectionSelection::myHoldControlLabel
FXLabel * myHoldControlLabel
hold control label
Definition: GNEConnectorFrame.h:182
GUIDesignCheckButton
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:115
GNEEdge.h
GNEFrame::myViewNet
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:121
GNEViewNet::getUndoList
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:1020
GNEConnectorFrame::cleanup
void cleanup()
clean up when deselecting current lane
Definition: GNEConnectorFrame.cpp:547
GUIDesignGroupBoxFrame
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:239
GNEChange_Connection
Definition: GNEChange_Connection.h:44
NBConnection
Definition: NBConnection.h:43
GNEConnectorFrame::CurrentLane::updateCurrentLaneLabel
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
Definition: GNEConnectorFrame.cpp:82
GNEEdge::getGNEJunctionDestiny
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:493
GNEEdge::retrieveGNEConnection
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:1853
GNEEdge::getLanes
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:874
GNENet::deleteConnection
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition: GNENet.cpp:587
GNELane.h
GNELane::setSpecialColor
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:934
GNEConnectorFrame::ConnectionLegend::getTargetPassColor
const RGBColor & getTargetPassColor() const
get color for the to-lane of a connection with pass attribute
Definition: GNEConnectorFrame.cpp:380
GNENet::getViewNet
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2117
GNEConnectorFrame::ConnectionLegend::myPotentialTargetColor
RGBColor myPotentialTargetColor
color for potential to-lane targets (currently unconnected)
Definition: GNEConnectorFrame.h:236
GNEConnectorFrame::ConnectionModifications::onCmdCancelModifications
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
Definition: GNEConnectorFrame.cpp:114
GNEViewParent.h
GNENet::retrieveJunctions
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1261
GNEEdge::getGNEJunctionSource
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:487
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNEConnectorFrame::GNEConnectorFrame
GNEConnectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
Definition: GNEConnectorFrame.cpp:394
GNESelectorFrame.h
GNEConnectorFrame::ConnectionLegend::myTargetLabel
FXLabel * myTargetLabel
target label
Definition: GNEConnectorFrame.h:218
MID_GNE_CONNECTORFRAME_SELECTPASS
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
Definition: GUIAppEnum.h:728
GNENetElement::getNet
GNENet * getNet() const
get Net in which this element is placed
Definition: GNENetElement.cpp:58
GNEConnectorFrame::ConnectionSelection::myHoldShiftLabel
FXLabel * myHoldShiftLabel
Selection Hint.
Definition: GNEConnectorFrame.h:179
GNEAttributeCarrier::FEATURE_MODIFIED
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
Definition: GNEAttributeCarrier.h:598
GNEConnectorFrame::myDeletedConnections
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
Definition: GNEConnectorFrame.h:319
ICON_CANCEL
@ ICON_CANCEL
Definition: GUIIcons.h:387
GNEConnectorFrame::ConnectionOperations::mySelectDeadStartsButton
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
Definition: GNEConnectorFrame.h:149
GNEConnectorFrame::buildConnection
void buildConnection(GNELane *lane, bool mayDefinitelyPass, bool allowConflict, bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
Definition: GNEConnectorFrame.cpp:445
SUMO_TAG_CONNECTION
@ SUMO_TAG_CONNECTION
connectio between two lanes
Definition: SUMOXMLDefinitions.h:202
GNEConnectorFrame::ConnectionOperations::ConnectionOperations
ConnectionOperations(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
Definition: GNEConnectorFrame.cpp:156
GNEConnectorFrame::UNCONNECTED
@ UNCONNECTED
Definition: GNEConnectorFrame.h:265
GNEConnectorFrame::ConnectionOperations::myClearSelectedButton
FXButton * myClearSelectedButton
"Clear Selected"
Definition: GNEConnectorFrame.h:158
GNEConnectorFrame::myCurrentEditedLane
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
Definition: GNEConnectorFrame.h:307
GNENet::retrieveEdge
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1069
GNEConnection
Definition: GNEConnection.h:38
GNEConnectorFrame::ConnectionOperations::mySelectPassingButton
FXButton * mySelectPassingButton
"Select Edges which may always pass"
Definition: GNEConnectorFrame.h:155
GNEConnectorFrame::ConnectionModifications::~ConnectionModifications
~ConnectionModifications()
destructor
Definition: GNEConnectorFrame.cpp:110
GNEViewNetHelper::ObjectsUnderCursor::getLaneFront
GNELane * getLaneFront() const
get front lane (or a pointer to nullptr if there isn't)
Definition: GNEViewNetHelper.cpp:278
config.h
GNEConnectorFrame::ConnectionModifications
Definition: GNEConnectorFrame.h:63
Lane
C++ TraCI client API implementation.
GNEConnectorFrame::ConnectionLegend::getConflictColor
const RGBColor & getConflictColor() const
get color for a to-lane that cannot be used because another connection conflicts
Definition: GNEConnectorFrame.cpp:386
GNEConnectorFrame::ConnectionLegend::myConflictColor
RGBColor myConflictColor
color for a to-lane that cannot be used because another connection conflicts
Definition: GNEConnectorFrame.h:242
MFXUtils::getFXColor
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:113
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
GNEConnectorFrame::ConnectionLegend::mySourceColor
RGBColor mySourceColor
color for the from-lane of a connection
Definition: GNEConnectorFrame.h:230
NBEdge::hasConnectionTo
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:1143
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:189
GNEUndoList::p_begin
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:72
GNEConnectorFrame::CONNECTED
@ CONNECTED
Definition: GNEConnectorFrame.h:266
GNEConnectorFrame::ConnectionOperations::onCmdSelectDeadEnds
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
Definition: GNEConnectorFrame.cpp:185
GNEConnectorFrame::CONNECTED_PASS
@ CONNECTED_PASS
Definition: GNEConnectorFrame.h:267
GNEConnectorFrame::ConnectionLegend::mySourceLabel
FXLabel * mySourceLabel
source label
Definition: GNEConnectorFrame.h:215
GNEConnectorFrame::ConnectionLegend::myConflictLabel
FXLabel * myConflictLabel
conflict label
Definition: GNEConnectorFrame.h:227
NBEdge::getConnections
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:934
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNENet.h
GNEConnectorFrame::ConnectionOperations::mySelectDeadEndsButton
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
Definition: GNEConnectorFrame.h:146
SUMO_TAG_JUNCTION
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
Definition: SUMOXMLDefinitions.h:59
GNEUndoList.h
GNEConnectorFrame::CONFLICTED
@ CONFLICTED
Definition: GNEConnectorFrame.h:268
GNEChange_Connection.h
GNEConnection.h