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