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-2025 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
21#include <netedit/GNENet.h>
22#include <netedit/GNEUndoList.h>
31
32#include "GNEConnectorFrame.h"
33
34// ===========================================================================
35// FOX callback mapping
36// ===========================================================================
37
42
51
52// Object implementation
53FXIMPLEMENT(GNEConnectorFrame::ConnectionModifications, MFXGroupBoxModule, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
54FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, MFXGroupBoxModule, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
55
56
57// ===========================================================================
58// method definitions
59// ===========================================================================
60
61// ---------------------------------------------------------------------------
62// GNEConnectorFrame::CurrentLane - methods
63// ---------------------------------------------------------------------------
64
66 MFXGroupBoxModule(connectorFrameParent, TL("Lane")) {
67 // create lane label
68 myCurrentLaneLabel = new FXLabel(getCollapsableFrame(), TL("No lane selected"), 0, GUIDesignLabel(JUSTIFY_LEFT));
69}
70
71
73
74
75void
77 if (laneID.empty()) {
78 myCurrentLaneLabel->setText(TL("No lane selected"));
79 } else {
80 myCurrentLaneLabel->setText((std::string(TL("Current Lane: ")) + laneID).c_str());
81 }
82}
83
84// ---------------------------------------------------------------------------
85// GNEConnectorFrame::ConnectionModifications - methods
86// ---------------------------------------------------------------------------
87
89 MFXGroupBoxModule(connectorFrameParent, TL("Modifications")),
90 myConnectorFrameParent(connectorFrameParent) {
91
92 // Create "Cancel" button
93 myCancelButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Cancel"), "", TL("Discard connection modifications (Esc)"),
95 // Create "OK" button
96 mySaveButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("OK"), "", TL("Save connection modifications (Enter)"),
98
99 // Create checkbox for protect routes
100 myProtectRoutesCheckBox = new FXCheckButton(getCollapsableFrame(), TL("Protect routes"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
101}
102
103
105
106
107long
109 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
110 myConnectorFrameParent->getViewNet()->getUndoList()->abortAllChangeGroups();
111 if (myConnectorFrameParent->myNumChanges) {
112 myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes reverted"));
113 }
114 myConnectorFrameParent->cleanup();
115 myConnectorFrameParent->getViewNet()->updateViewNet();
116 }
117 return 1;
118}
119
120
121long
123 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
124 // check if routes has to be protected
125 if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
126 for (const auto& demandElement : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
127 if (demandElement->isDemandElementValid() != GNEDemandElement::Problem::OK) {
128 // open warning dialog
129 GNEWarningBasicDialog(myConnectorFrameParent->getViewNet()->getViewParent()->getGNEAppWindows(),
130 TL("Error saving connection operations"),
131 TLF("Connection edition cannot be saved because route '%s' is broken.", demandElement->getID()));
132 return 1;
133 }
134 }
135 }
136 // finish route editing
137 myConnectorFrameParent->getViewNet()->getUndoList()->end();
138 if (myConnectorFrameParent->myNumChanges) {
139 myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes accepted"));
140 }
141 myConnectorFrameParent->cleanup();
142 // mark network for recomputing
143 myConnectorFrameParent->getViewNet()->getNet()->requireRecompute();
144 }
145 return 1;
146}
147
148// ---------------------------------------------------------------------------
149// GNEConnectorFrame::ConnectionOperations - methods
150// ---------------------------------------------------------------------------
151
153 MFXGroupBoxModule(connectorFrameParent, TL("Operations")),
154 myConnectorFrameParent(connectorFrameParent) {
155
156 // Create "Select Dead Ends" button
157 mySelectDeadEndsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Ends"), "", TL("Selects all lanes that have no outgoing connection (clears previous selection)"),
159 // Create "Select Dead Starts" button
160 mySelectDeadStartsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Starts"), "", TL("Selects all lanes that have no incoming connection (clears previous selection)"),
162 // Create "Select Conflicts" button
163 mySelectConflictsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Conflicts"), "", TL("Selects all lanes with more than one incoming connection from the same edge (clears previous selection)"),
165 // Create "Select Edges which may always pass" button
166 mySelectPassingButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Passing"), "", TL("Selects all lanes with a connection that has the 'pass' attribute set"),
168 // Create "Clear Selected" button
169 myClearSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Clear Selected"), "", TL("Clears all connections of all selected objects"),
171 // Create "Reset Selected" button
172 myResetSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Reset Selected"), "", TL("Recomputes connections at all selected junctions"),
174}
175
176
178
179
180long
182 // select all lanes that have no successor lane
183 std::vector<GNEAttributeCarrier*> deadEnds;
184 // every edge knows its outgoing connections so we can look at each edge in isolation
185 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
186 for (const auto& lane : edge.second->getChildLanes()) {
187 if (edge.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
188 deadEnds.push_back(lane);
189 }
190 }
191 }
192 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(deadEnds, GNESelectorFrame::ModificationMode::Operation::REPLACE);
193 myConnectorFrameParent->getViewNet()->updateViewNet();
194 return 1;
195}
196
197
198long
200 // select all lanes that have no predecessor lane
201 std::set<GNEAttributeCarrier*> deadStarts;
202 GNENet* net = myConnectorFrameParent->getViewNet()->getNet();
203 // every edge knows only its outgoing connections so we look at whole junctions
204 for (const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
205 // first collect all outgoing lanes
206 for (const auto& outgoingEdge : junction.second->getGNEOutgoingEdges()) {
207 for (const auto& lane : outgoingEdge->getChildLanes()) {
208 deadStarts.insert(lane);
209 }
210 }
211 // then remove all approached lanes
212 for (const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
213 for (const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
214 deadStarts.erase(net->getAttributeCarriers()->retrieveEdge(connection.toEdge->getID())->getChildLanes()[connection.toLane]);
215 }
216 }
217 }
218 std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
219 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(selectObjects, GNESelectorFrame::ModificationMode::Operation::REPLACE);
220 myConnectorFrameParent->getViewNet()->updateViewNet();
221 return 1;
222}
223
224
225long
227 std::vector<GNEAttributeCarrier*> conflicts;
228 // conflicts happen per edge so we can look at each edge in isolation
229 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
230 const EdgeVector destinations = edge.second->getNBEdge()->getConnectedEdges();
231 for (const auto& destination : destinations) {
232 GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(destination->getID());
233 for (const auto& lane : dest->getChildLanes()) {
234 const bool isConflicted = count_if(edge.second->getNBEdge()->getConnections().begin(), edge.second->getNBEdge()->getConnections().end(),
235 NBEdge::connections_toedgelane_finder(destination, (int)lane->getIndex(), -1)) > 1;
236 if (isConflicted) {
237 conflicts.push_back(lane);
238 }
239 }
240 }
241
242 }
243 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::Operation::REPLACE);
244 myConnectorFrameParent->getViewNet()->updateViewNet();
245 return 1;
246}
247
248
249long
251 std::vector<GNEAttributeCarrier*> pass;
252 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
253 for (const auto& connection : edge.second->getNBEdge()->getConnections()) {
254 if (connection.mayDefinitelyPass) {
255 pass.push_back(edge.second->getChildLanes()[connection.fromLane]);
256 }
257 }
258 }
259 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::Operation::REPLACE);
260 myConnectorFrameParent->getViewNet()->updateViewNet();
261 return 1;
262}
263
264
265long
267 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
268 myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("clear connections from selected lanes, edges and junctions"));
269 // clear junction's connection
270 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
271 for (const auto& junction : selectedJunctions) {
272 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
273 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
274 }
275 // clear edge's connection
276 const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
277 for (const auto& edge : selectedEdges) {
278 for (const auto& lane : edge->getChildLanes()) {
279 myConnectorFrameParent->removeConnections(lane);
280 }
281 }
282 // clear lane's connection
283 const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
284 for (const auto& lane : selectedLanes) {
285 myConnectorFrameParent->removeConnections(lane);
286 }
287 myConnectorFrameParent->getViewNet()->getUndoList()->end();
288 myConnectorFrameParent->getViewNet()->updateViewNet();
289 return 1;
290}
291
292
293long
295 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
296 myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("reset connections from selected lanes"));
297 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
298 for (const auto& junction : selectedJunctions) {
299 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
300 }
301 myConnectorFrameParent->getViewNet()->getUndoList()->end();
302 if (selectedJunctions.size() > 0) {
303 auto viewNet = myConnectorFrameParent->getViewNet();
304 viewNet->getNet()->requireRecompute();
305 viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
306 }
307 myConnectorFrameParent->getViewNet()->updateViewNet();
308 return 1;
309}
310
311// ---------------------------------------------------------------------------
312// GNEConnectorFrame::ConnectionSelection - methods
313// ---------------------------------------------------------------------------
314
316 MFXGroupBoxModule(connectorFrameParent, TL("Selection")) {
317 // create label
318 new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Hold <SHIFT> while clicking to create unyielding connections (pass=true).")).c_str(), 0, GUIDesignLabelFrameInformation);
319 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);
320}
321
322
324
325// ---------------------------------------------------------------------------
326// GNEConnectorFrame::ConnectionLegend - methods
327// ---------------------------------------------------------------------------
328
330 MFXGroupBoxModule(connectorFrameParent, TL("Information")) {
331
332 // create possible target label
333 FXLabel* possibleTargetLabel = new FXLabel(getCollapsableFrame(), TL("Possible Target"), 0, GUIDesignLabel(JUSTIFY_LEFT));
334 possibleTargetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
335 possibleTargetLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
336
337 // create source label
338 FXLabel* sourceLabel = new FXLabel(getCollapsableFrame(), TL("Source lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
339 sourceLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
340
341 // create target label
342 FXLabel* targetLabel = new FXLabel(getCollapsableFrame(), TL("Target lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
343 targetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
344
345 // create target (pass) label
346 FXLabel* targetPassLabel = new FXLabel(getCollapsableFrame(), TL("Target (pass)"), 0, GUIDesignLabel(JUSTIFY_LEFT));
347 targetPassLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
348
349 // create conflict label
350 FXLabel* conflictLabel = new FXLabel(getCollapsableFrame(), TL("Conflict"), 0, GUIDesignLabel(JUSTIFY_LEFT));
351 conflictLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.conflict));
352}
353
354
356
357// ---------------------------------------------------------------------------
358// GNEConnectorFrame - methods
359// ---------------------------------------------------------------------------
360
362 GNEFrame(viewParent, viewNet, TL("Edit Connections")),
364 myNumChanges(0) {
365 // create current lane module
366 myCurrentLane = new CurrentLane(this);
367
368 // create connection modifications module
370
371 // create connection operations module
373
374 // create connection selection module
376
377 // create connection legend module
378 myLegend = new Legend(this);
379}
380
381
383
384
385void
387 // get lane front
388 GNELane* clickedLane = viewObjects.getLaneFrontNonLocked();
389 // iterate over lanes
390 for (const auto& lane : viewObjects.getLanes()) {
391 // if parent edge of lane is front element, update clickedLane
392 if (lane->getParentEdge()->isMarkedForDrawingFront()) {
393 clickedLane = lane;
394 }
395 }
396 // build connection
398}
399
400
405
406
407void
409 // select lane as current lane
410 buildConnection(lane, false, false, true); // select as current lane
411 // iterate over all potential targets
412 for (const auto& potentialTarget : myPotentialTargets) {
413 // remove connections using the appropiate parameters in function "buildConnection"
414 buildConnection(potentialTarget, false, false, false);
415 }
416 // save modifications
418}
419
420
421void
422GNEConnectorFrame::buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle) {
423 if (myCurrentEditedLane == 0) {
424 myCurrentEditedLane = lane;
426 initTargets();
427 myNumChanges = 0;
428 myViewNet->getUndoList()->begin(GUIIcon::CONNECTION, TL("modify connections"));
429 } else if (myPotentialTargets.count(lane)
430 || (allowConflict && lane->getParentEdge()->getFromJunction() == myCurrentEditedLane->getParentEdge()->getToJunction())) {
431 const int fromIndex = myCurrentEditedLane->getIndex();
433 GNEEdge* destEdge = lane->getParentEdge();
434 std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
435 bool changed = false;
436 // get lane status
437 LaneStatus status = getLaneStatus(connections, lane);
438 if (status == LaneStatus::CONFLICTED && allowConflict) {
440 }
441 // create depending of status
442 switch (status) {
444 if (toggle) {
445 // create new connection
446 NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
447 // if the connection was previously deleted (by clicking the same lane twice), restore all values
449 // fromLane must be the same, only check toLane
450 if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
451 newCon = c;
452 newCon.mayDefinitelyPass = mayDefinitelyPass;
453 }
454 }
455 NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
456 myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
457 if (mayDefinitelyPass) {
459 } else {
461 }
463 }
464 break;
467 // remove connection
468 GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
472 changed = true;
473 break;
474 }
476 SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
477 SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
478 if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
479 myViewNet->setStatusBarText(TL("Pedestrian connections are generated automatically"));
480 } else if ((fromPermissions & toPermissions) == 0) {
481 myViewNet->setStatusBarText(TL("Incompatible vehicle class permissions"));
482 } else {
483 myViewNet->setStatusBarText(TL("Another lane from the same edge already connects to that lane"));
484 }
485 break;
486 }
487 if (changed) {
488 myNumChanges += 1;
489 }
490 } else {
491 myViewNet->setStatusBarText(TL("Invalid target for connection"));
492 }
494}
495
496
497void
499 // gather potential targets
501 // get potential targets
502 for (const auto& NBEEdge : nbn->getOutgoingEdges()) {
503 GNEEdge* edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(NBEEdge->getID());
504 for (const auto& lane : edge->getChildLanes()) {
505 myPotentialTargets.insert(lane);
506 }
507 }
508 // set color for existing connections
509 std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
510 for (const auto& lane : myPotentialTargets) {
511 switch (getLaneStatus(connections, lane)) {
514 break;
517 break;
520 break;
523 break;
524 }
525 }
526}
527
528
529void
531 // restore colors of potential targets
532 for (auto it : myPotentialTargets) {
533 it->setSpecialColor(0);
534 }
535 // clear attributes
536 myPotentialTargets.clear();
537 myNumChanges = 0;
539 myCurrentEditedLane = nullptr;
540 myDeletedConnections.clear();
542}
543
544
546GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const {
548 const int fromIndex = myCurrentEditedLane->getIndex();
549 NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
550 const int toIndex = targetLane->getIndex();
551 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
552 connections.begin(), connections.end(),
553 NBEdge::connections_finder(fromIndex, destEdge, toIndex));
554 const bool isConnected = con_it != connections.end();
555 if (isConnected) {
556 if (con_it->mayDefinitelyPass) {
558 } else {
560 }
561 } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
562 || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
564 } else {
566 }
567}
568
569
570/****************************************************************************/
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:993
@ MID_CANCEL
Cancel-button pressed.
Definition GUIAppEnum.h:310
@ MID_CHOOSEN_CLEAR
Clear set.
Definition GUIAppEnum.h:607
@ MID_OK
Ok-button pressed.
Definition GUIAppEnum.h:308
@ 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:611
@ 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
get ID (all Attribute Carriers have one)
GNENet * getNet() const
get pointer to net
static const std::string FEATURE_MODIFIED
feature has been manually modified (implies approval)
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
long onCmdSaveModifications(FXObject *, FXSelector, void *)
Called when the user presses the OK-Button saves any connection modifications.
ConnectionModifications(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
long onCmdCancelModifications(FXObject *, FXSelector, void *)
Called when the user presses the Cancel-button discards any connection modifications.
FXCheckButton * myProtectRoutesCheckBox
protect routes checkbox
FXButton * mySelectDeadStartsButton
"Select Dead Starts" button
FXButton * mySelectConflictsButton
"Select Conflicts" button
long onCmdSelectDeadEnds(FXObject *, FXSelector, void *)
Called when the user presses the select dead ends button.
long onCmdResetSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the reset selected connections button.
long onCmdSelectDeadStarts(FXObject *, FXSelector, void *)
Called when the user presses the select dead starts button.
long onCmdSelectPass(FXObject *, FXSelector, void *)
Called when the user presses the select pass button.
FXButton * mySelectDeadEndsButton
"Select Dead Ends" button
long onCmdClearSelectedConnections(FXObject *, FXSelector, void *)
Called when the user presses the clear selected connections button.
FXButton * myClearSelectedButton
"Clear Selected"
long onCmdSelectConflicts(FXObject *, FXSelector, void *)
Called when the user presses the select conflicts button.
ConnectionOperations(GNEConnectorFrame *connectorFrameParent)
FOX-declaration.
FXButton * myResetSelectedButton
"Reset Selected"
FXButton * mySelectPassingButton
"Select Edges which may always pass"
ConnectionSelection(GNEConnectorFrame *connectorFrameParent)
constructor
void updateCurrentLaneLabel(const std::string &laneID)
set current junction label
Legend(GNEConnectorFrame *connectorFrameParent)
constructor
int myNumChanges
number of changes
std::vector< NBEdge::Connection > myDeletedConnections
vector of connections deleted in the current editing step
void cleanup()
clean up when deselecting current lane
void initTargets()
init targets
GNEConnectorFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
ConnectionModifications * getConnectionModifications() const
get pointer to ConnectionModifications module
GNEConnectorFrame::ConnectionOperations * myConnectionOperations
ConnectionOperations 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
std::set< GNELane * > myPotentialTargets
the set of lanes to which the current lane may be connected
LaneStatus getLaneStatus(const std::vector< NBEdge::Connection > &connections, const GNELane *targetLane) const
return the status of toLane
GNEConnectorFrame::ConnectionModifications * myConnectionModifications
ConnectionModifications 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:753
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:2206
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:92
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:152
GNEViewNet * myViewNet
FOX need this.
Definition GNEFrame.h:121
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:624
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition GNELane.cpp:886
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:214
std::vector< GNEJunction * > getSelectedJunctions() const
return selected junctions
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition GNENet.cpp:679
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
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.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:145
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:4540
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:273
static const RGBColor WHITE
Definition RGBColor.h:195
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