Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEConnectorFrame.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2011-2026 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
26#include <netedit/GNENet.h>
27#include <netedit/GNEUndoList.h>
32
33#include "GNEConnectorFrame.h"
34
35// ===========================================================================
36// FOX callback mapping
37// ===========================================================================
38
43
52
58
59// Object implementation
60FXIMPLEMENT(GNEConnectorFrame::ConnectionModifications, GNEGroupBoxModule, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
61FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, GNEGroupBoxModule, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
62FXIMPLEMENT(GNEConnectorFrame::ConnectionVisualization, GNEGroupBoxModule, ConnectionVisualizationMap, ARRAYNUMBER(ConnectionVisualizationMap))
63
64
65// ===========================================================================
66// method definitions
67// ===========================================================================
68
69// ---------------------------------------------------------------------------
70// GNEConnectorFrame::CurrentLane - methods
71// ---------------------------------------------------------------------------
72
74 GNEGroupBoxModule(connectorFrameParent, TL("Lane")) {
75 // create lane label
76 myCurrentLaneLabel = new FXLabel(getCollapsableFrame(), TL("No lane selected"), 0, GUIDesignLabel(JUSTIFY_LEFT));
77}
78
79
81
82
83void
85 if (laneID.empty()) {
86 myCurrentLaneLabel->setText(TL("No lane selected"));
87 } else {
88 myCurrentLaneLabel->setText((std::string(TL("Current Lane: ")) + laneID).c_str());
89 }
90}
91
92// ---------------------------------------------------------------------------
93// GNEConnectorFrame::ConnectionModifications - methods
94// ---------------------------------------------------------------------------
95
97 GNEGroupBoxModule(connectorFrameParent, TL("Modifications")),
98 myConnectorFrameParent(connectorFrameParent) {
99
100 // Create "Cancel" button
101 myCancelButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Cancel"), "", TL("Discard connection modifications (Esc)"),
103 // Create "OK" button
104 mySaveButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("OK"), "", TL("Save connection modifications (Enter)"),
106
107 // Create checkbox for protect routes
108 myProtectRoutesCheckBox = new FXCheckButton(getCollapsableFrame(), TL("Protect routes"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
109}
110
111
113
114
115long
117 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
118 myConnectorFrameParent->getViewNet()->getUndoList()->abortAllChangeGroups();
119 if (myConnectorFrameParent->myNumChanges) {
120 myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes reverted"));
121 }
122 myConnectorFrameParent->cleanup();
123 myConnectorFrameParent->getViewNet()->updateViewNet();
124 }
125 return 1;
126}
127
128
129long
131 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
132 // check if routes has to be protected
133 if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
134 for (const auto& demandElement : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
135 if (demandElement->isDemandElementValid() != GNEDemandElement::Problem::OK) {
136 // open warning dialog
137 GNEWarningBasicDialog(myConnectorFrameParent->getViewNet()->getViewParent()->getGNEAppWindows(),
138 TL("Error saving connection operations"),
139 TLF("Connection edition cannot be saved because route '%s' is broken.", demandElement->getID()));
140 return 1;
141 }
142 }
143 }
144 // finish route editing
145 myConnectorFrameParent->getViewNet()->getUndoList()->end();
146 if (myConnectorFrameParent->myNumChanges) {
147 myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes accepted"));
148 }
149 myConnectorFrameParent->cleanup();
150 // mark network for recomputing
151 myConnectorFrameParent->getViewNet()->getNet()->requireRecompute();
152 }
153 return 1;
154}
155
156// ---------------------------------------------------------------------------
157// GNEConnectorFrame::ConnectionOperations - methods
158// ---------------------------------------------------------------------------
159
161 GNEGroupBoxModule(connectorFrameParent, TL("Operations")),
162 myConnectorFrameParent(connectorFrameParent) {
163
164 // Create "Select Dead Ends" button
165 mySelectDeadEndsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Ends"), "", TL("Selects all lanes that have no outgoing connection (clears previous selection)"),
167 // Create "Select Dead Starts" button
168 mySelectDeadStartsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Starts"), "", TL("Selects all lanes that have no incoming connection (clears previous selection)"),
170 // Create "Select Conflicts" button
171 mySelectConflictsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Conflicts"), "", TL("Selects all lanes with more than one incoming connection from the same edge (clears previous selection)"),
173 // Create "Select Edges which may always pass" button
174 mySelectPassingButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Passing"), "", TL("Selects all lanes with a connection that has the 'pass' attribute set"),
176 // Create "Clear Selected" button
177 myClearSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Clear Selected"), "", TL("Clears all connections of all selected objects"),
179 // Create "Reset Selected" button
180 myResetSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Reset Selected"), "", TL("Recomputes connections at all selected junctions"),
182}
183
184
186
187
188long
190 // select all lanes that have no successor lane
191 std::vector<GNEAttributeCarrier*> deadEnds;
192 // every edge knows its outgoing connections so we can look at each edge in isolation
193 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
194 for (const auto& lane : edge.second->getChildLanes()) {
195 if (edge.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
196 deadEnds.push_back(lane);
197 }
198 }
199 }
200 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(deadEnds, GNESelectorFrame::ModificationMode::Operation::REPLACE);
201 myConnectorFrameParent->getViewNet()->updateViewNet();
202 return 1;
203}
204
205
206long
208 // select all lanes that have no predecessor lane
209 std::set<GNEAttributeCarrier*> deadStarts;
210 GNENet* net = myConnectorFrameParent->getViewNet()->getNet();
211 // every edge knows only its outgoing connections so we look at whole junctions
212 for (const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
213 // first collect all outgoing lanes
214 for (const auto& outgoingEdge : junction.second->getGNEOutgoingEdges()) {
215 for (const auto& lane : outgoingEdge->getChildLanes()) {
216 deadStarts.insert(lane);
217 }
218 }
219 // then remove all approached lanes
220 for (const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
221 for (const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
222 deadStarts.erase(net->getAttributeCarriers()->retrieveEdge(connection.toEdge->getID())->getChildLanes()[connection.toLane]);
223 }
224 }
225 }
226 std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
227 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(selectObjects, GNESelectorFrame::ModificationMode::Operation::REPLACE);
228 myConnectorFrameParent->getViewNet()->updateViewNet();
229 return 1;
230}
231
232
233long
235 std::vector<GNEAttributeCarrier*> conflicts;
236 // conflicts happen per edge so we can look at each edge in isolation
237 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
238 const EdgeVector destinations = edge.second->getNBEdge()->getConnectedEdges();
239 for (const auto& destination : destinations) {
240 GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(destination->getID());
241 for (const auto& lane : dest->getChildLanes()) {
242 const bool isConflicted = count_if(edge.second->getNBEdge()->getConnections().begin(), edge.second->getNBEdge()->getConnections().end(),
243 NBEdge::connections_toedgelane_finder(destination, (int)lane->getIndex(), -1)) > 1;
244 if (isConflicted) {
245 conflicts.push_back(lane);
246 }
247 }
248 }
249
250 }
251 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::Operation::REPLACE);
252 myConnectorFrameParent->getViewNet()->updateViewNet();
253 return 1;
254}
255
256
257long
259 std::vector<GNEAttributeCarrier*> pass;
260 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
261 for (const auto& connection : edge.second->getNBEdge()->getConnections()) {
262 if (connection.mayDefinitelyPass) {
263 pass.push_back(edge.second->getChildLanes()[connection.fromLane]);
264 }
265 }
266 }
267 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::Operation::REPLACE);
268 myConnectorFrameParent->getViewNet()->updateViewNet();
269 return 1;
270}
271
272
273long
275 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
276 myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("clear connections from selected lanes, edges and junctions"));
277 // clear junction's connection
278 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
279 for (const auto& junction : selectedJunctions) {
280 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
281 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
282 }
283 // clear edge's connection
284 const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
285 for (const auto& edge : selectedEdges) {
286 for (const auto& lane : edge->getChildLanes()) {
287 myConnectorFrameParent->removeConnections(lane);
288 }
289 }
290 // clear lane's connection
291 const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
292 for (const auto& lane : selectedLanes) {
293 myConnectorFrameParent->removeConnections(lane);
294 }
295 myConnectorFrameParent->getViewNet()->getUndoList()->end();
296 myConnectorFrameParent->getViewNet()->updateViewNet();
297 return 1;
298}
299
300
301long
303 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
304 myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("reset connections from selected lanes"));
305 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
306 for (const auto& junction : selectedJunctions) {
307 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
308 }
309 myConnectorFrameParent->getViewNet()->getUndoList()->end();
310 if (selectedJunctions.size() > 0) {
311 auto viewNet = myConnectorFrameParent->getViewNet();
312 viewNet->getNet()->requireRecompute();
313 viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
314 }
315 myConnectorFrameParent->getViewNet()->updateViewNet();
316 return 1;
317}
318
319// ---------------------------------------------------------------------------
320// GNEConnectorFrame::ConnectionVisualization - methods
321// ---------------------------------------------------------------------------
322
324 GNEGroupBoxModule(connectorFrameParent, TL("Visualization")),
325 myConnectorFrameParent(connectorFrameParent) {
326
327 // Create checkbox for show in inspect mode
329
330 // Create checkbox for toggle hide other sources
332 myToggleHideOtherSources->setCheck(FALSE);
333
334 // Create checkbox for toggle inspect connections buttons
336}
337
338
340
341
342void
344 // mirror the value of show connections
345 if (myConnectorFrameParent->getViewNet()->getNetworkViewOptions().menuCheckShowConnections->amChecked()) {
346 myToggleVisibleInInspectMode->setCheck(TRUE, FALSE);
347 } else {
348 myToggleVisibleInInspectMode->setCheck(FALSE, FALSE);
349 }
350}
351
352
353bool
355 return myToggleVisibleInInspectMode->getCheck() == TRUE;
356}
357
358
359bool
361 return myToggleHideOtherSources->getCheck() == TRUE;
362}
363
364
365bool
367 return myToggleInspectConnectionsCheckbutton->getCheck() == TRUE;
368}
369
370
372 return myConnectorFrameParent->getViewNet()->onCmdToggleShowConnections(obj, sel, ptr);
373}
374
375
376long
378 myConnectorFrameParent->getViewNet()->updateViewNet();
379 return 1;
380}
381
382
383long
385 myConnectorFrameParent->getViewNet()->updateViewNet();
386 return 1;
387}
388
389// ---------------------------------------------------------------------------
390// GNEConnectorFrame::ConnectionSelection - methods
391// ---------------------------------------------------------------------------
392
394 GNEGroupBoxModule(connectorFrameParent, TL("Selection")) {
395 // create label
396 new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Hold <SHIFT> while clicking to create unyielding connections (pass=true).")).c_str(), 0, GUIDesignLabelFrameInformation);
397 new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Hold <CTRL> while clicking to create conflicting connections (i.e. at zipper nodes or with incompatible permissions)")).c_str(), 0, GUIDesignLabelFrameInformation);
398}
399
400
402
403// ---------------------------------------------------------------------------
404// GNEConnectorFrame::ConnectionLegend - methods
405// ---------------------------------------------------------------------------
406
408 GNEGroupBoxModule(connectorFrameParent, TL("Information")) {
409
410 // create possible target label
411 FXLabel* possibleTargetLabel = new FXLabel(getCollapsableFrame(), TL("Possible Target"), 0, GUIDesignLabel(JUSTIFY_LEFT));
412 possibleTargetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
413 possibleTargetLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
414
415 // create source label
416 FXLabel* sourceLabel = new FXLabel(getCollapsableFrame(), TL("Source lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
417 sourceLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
418
419 // create target label
420 FXLabel* targetLabel = new FXLabel(getCollapsableFrame(), TL("Target lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
421 targetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
422
423 // create target (pass) label
424 FXLabel* targetPassLabel = new FXLabel(getCollapsableFrame(), TL("Target (pass)"), 0, GUIDesignLabel(JUSTIFY_LEFT));
425 targetPassLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
426
427 // create conflict label
428 FXLabel* conflictLabel = new FXLabel(getCollapsableFrame(), TL("Conflict"), 0, GUIDesignLabel(JUSTIFY_LEFT));
429 conflictLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.conflict));
430}
431
432
434
435// ---------------------------------------------------------------------------
436// GNEConnectorFrame - methods
437// ---------------------------------------------------------------------------
438
440 GNEFrame(viewParent, viewNet, TL("Edit Connections")),
442 myNumChanges(0) {
443 // create current lane module
444 myCurrentLane = new CurrentLane(this);
445
446 // create connection modifications module
448
449 // create connection visualization module
451
452 // create connection selection module
454
455 // create connection legend module
456 myLegend = new Legend(this);
457}
458
459
461
462
463void
468
469
470void
472 // get lane front
473 GNELane* clickedLane = viewObjects.getLaneFrontNonLocked();
474 // iterate over lanes
475 for (const auto& lane : viewObjects.getLanes()) {
476 // if parent edge of lane is front element, update clickedLane
477 if (lane->getParentEdge()->isMarkedForDrawingFront()) {
478 clickedLane = lane;
479 }
480 }
481 // build connection
483}
484
485
486GNELane*
490
491
496
497
502
503
504void
506 // select lane as current lane
507 buildConnection(lane, false, false, true); // select as current lane
508 // iterate over all potential targets
509 for (const auto& potentialTarget : myPotentialTargets) {
510 // remove connections using the appropiate parameters in function "buildConnection"
511 buildConnection(potentialTarget, false, false, false);
512 }
513 // save modifications
515}
516
517
518void
519GNEConnectorFrame::buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle) {
520 if (myCurrentEditedLane == 0) {
521 myCurrentEditedLane = lane;
523 initTargets();
524 myNumChanges = 0;
525 myViewNet->getUndoList()->begin(GUIIcon::CONNECTION, TL("modify connections"));
526 } else if (myPotentialTargets.count(lane)
527 || (allowConflict && lane->getParentEdge()->getFromJunction() == myCurrentEditedLane->getParentEdge()->getToJunction())) {
528 const int fromIndex = myCurrentEditedLane->getIndex();
530 GNEEdge* destEdge = lane->getParentEdge();
531 std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
532 bool changed = false;
533 // get lane status
534 LaneStatus status = getLaneStatus(connections, lane);
535 if (status == LaneStatus::CONFLICTED && allowConflict) {
537 }
538 // create depending of status
539 switch (status) {
541 if (toggle) {
542 // create new connection
543 NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
544 // if the connection was previously deleted (by clicking the same lane twice), restore all values
546 // fromLane must be the same, only check toLane
547 if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
548 newCon = c;
549 newCon.mayDefinitelyPass = mayDefinitelyPass;
550 }
551 }
552 NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
553 myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
554 if (mayDefinitelyPass) {
556 } else {
558 }
560 }
561 break;
564 // remove connection
565 GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
569 changed = true;
570 break;
571 }
573 SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
574 SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
575 if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
576 myViewNet->setStatusBarText(TL("Pedestrian connections are generated automatically"));
577 } else if ((fromPermissions & toPermissions) == 0) {
578 myViewNet->setStatusBarText(TL("Incompatible vehicle class permissions"));
579 } else {
580 myViewNet->setStatusBarText(TL("Another lane from the same edge already connects to that lane"));
581 }
582 break;
583 }
584 default:
585 break;
586 }
587 if (changed) {
588 myNumChanges += 1;
589 }
590 } else {
591 myViewNet->setStatusBarText(TL("Invalid target for connection"));
592 }
594}
595
596
597void
599 // gather potential targets
601 // get potential targets
602 for (const auto& NBEEdge : nbn->getOutgoingEdges()) {
603 GNEEdge* edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(NBEEdge->getID());
604 for (const auto& lane : edge->getChildLanes()) {
605 myPotentialTargets.insert(lane);
606 }
607 }
608 // set color for existing connections
609 std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
610 for (const auto& lane : myPotentialTargets) {
611 switch (getLaneStatus(connections, lane)) {
614 break;
617 break;
620 break;
623 break;
624 }
625 }
626}
627
628
629void
631 // restore colors of potential targets
632 for (auto it : myPotentialTargets) {
633 it->setSpecialColor(0);
634 }
635 // clear attributes
636 myPotentialTargets.clear();
637 myNumChanges = 0;
639 myCurrentEditedLane = nullptr;
640 myDeletedConnections.clear();
642}
643
644
646GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const {
648 const int fromIndex = myCurrentEditedLane->getIndex();
649 NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
650 const int toIndex = targetLane->getIndex();
651 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
652 connections.begin(), connections.end(),
653 NBEdge::connections_finder(fromIndex, destEdge, toIndex));
654 const bool isConnected = con_it != connections.end();
655 if (isConnected) {
656 if (con_it->mayDefinitelyPass) {
658 } else {
660 }
661 } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
662 || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
664 } else {
666 }
667}
668
669
670/****************************************************************************/
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
@ MID_GNE_CONNECTORFRAME_VISIBLEININSPECTMODE
toogle inspect connections
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_CANCEL
Cancel-button pressed.
Definition GUIAppEnum.h:310
@ MID_CHOOSEN_CLEAR
Clear set.
Definition GUIAppEnum.h:611
@ MID_OK
Ok-button pressed.
Definition GUIAppEnum.h:308
@ MID_GNE_CONNECTORFRAME_HIDEOTHERSOURCES
toogle show only from source connections
@ MID_GNE_CONNECTORFRAME_INSPECTCONNECTIONS
toogle inspect connections
@ MID_GNE_CONNECTORFRAME_SELECTDEADSTARTS
select lanes that have no connection leading to it
@ MID_GNE_CONNECTORFRAME_SELECTCONFLICTS
select lanes that are connected from concurrent lanes
@ MID_CHOOSEN_RESET
Reset set.
Definition GUIAppEnum.h:615
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
#define GUIDesignButton
Definition GUIDesigns.h:100
#define GUIDesignLabel(justify)
Definition GUIDesigns.h:245
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:194
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition GUIDesigns.h:281
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition NBCont.h:42
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_PEDESTRIAN
pedestrian
const std::string getID() const override
get ID (all Attribute Carriers have one)
GNENet * getNet() const
get pointer to net
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
ConnectionModifications(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
FXButton * mySelectConflictsButton
"Select Conflicts" button
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
FXButton * myClearSelectedButton
"Clear Selected"
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
ConnectionOperations(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
FXButton * myResetSelectedButton
"Reset Selected"
FXButton * mySelectPassingButton
"Select Edges which may always pass"
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
void updateShowConnections()
update show connections
ConnectionVisualization(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
long onCmdToggleInspectConnections(FXObject *, FXSelector, void *)
Called when the user toggles the inspect connections checkbox.
bool inspectConnections() const
check if inspect connections
long onCmdToggleHideOtherSources(FXObject *, FXSelector, void *)
Called when the user toggles the show only from checkbox.
FXCheckButton * myToggleInspectConnectionsCheckbutton
"Inspect connections" check button
bool showConnections() const
check if show connections
FXCheckButton * myToggleVisibleInInspectMode
"Visible in inspet mode" check button
FXCheckButton * myToggleHideOtherSources
"Hide other sources" check button
long onCmdToggleVisibleInInspectMode(FXObject *obj, FXSelector sel, void *ptr)
Called when the user toggles the show always connection checkbox.
bool showOnlyFromConnections() const
check if show only from connections
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
Legend(GNEConnectorFrame *connectorFrameParent)
constructor
int myNumChanges
number of changes
GNELane * getCurrentEditedLane() const
get the lane of which connections are to be modified
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
void cleanup()
clean up when deselecting current lane
void initTargets()
init targets
GNEConnectorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
ConnectionVisualization * getConnectionVisualization()
get pointer to ConnectionVisualization module
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications module
GNEConnectorFrame::Legend * myLegend
Legend module.
void buildConnection(GNELane *lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle)
either sets the current lane or toggles the connection of the current lane to this lane (if they shar...
~GNEConnectorFrame()
Destructor.
void removeConnections(GNELane *lane)
remove connections
GNEConnectorFrame::ConnectionVisualization * myConnectionVisualization
ConnectionVisualization module.
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
void show()
show Frame
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, const GNELane *targetLane) const
return the status of toLane
GNEConnectorFrame::ConnectionModifications * myConnectionModifications
ConnectionModifications module.
void handleLaneClick(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
either sets the current lane or toggles the connection of the
GNELane * myCurrentEditedLane
the lane of which connections are to be modified
LaneStatus
the status of a target lane
GNEConnectorFrame::ConnectionSelection * myConnectionSelection
ConnectionSelection module.
CurrentLane * myCurrentLane
CurrentLane module.
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:773
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:87
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:2236
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:92
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:145
GNEViewNet * myViewNet
FOX need this.
Definition GNEFrame.h:122
virtual void show()
show Frame
Definition GNEFrame.cpp:110
GNEGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
NBNode * getNBNode() const
Return net build node.
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:636
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition GNELane.cpp:898
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:216
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition GNENet.cpp:706
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
class used to group all variables related with objects under cursor after a click over view
GNELane * getLaneFrontNonLocked() const
get front lane or a pointer to nullptr checking if is locked
const std::vector< GNELane * > & getLanes() const
get lanes
GNENet * getNet() const
get the net object
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
GNEUndoList * getUndoList() const
get the undoList object
void setStatusBarText(const std::string &text)
set statusBar text
A single child window which contains a view of the simulation area.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
A list item which allows for custom coloring.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:146
static const NBConnection InvalidConnection
The representation of a single edge during network building.
Definition NBEdge.h:92
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition NBEdge.cpp:4543
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition NBEdge.cpp:1310
bool hasConnectionTo(const NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition NBEdge.cpp:1348
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:275
static const RGBColor WHITE
Definition RGBColor.h:205
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool controlKeyPressed() const
check if CONTROL is pressed during current event
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source
A structure which describes a connection between edges or lanes.
Definition NBEdge.h:201
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition NBEdge.h:228
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition NBEdge.h:222