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
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNENet.h>
30
31#include "GNEConnectorFrame.h"
32
33// ===========================================================================
34// FOX callback mapping
35// ===========================================================================
36
41
50
51// Object implementation
52FXIMPLEMENT(GNEConnectorFrame::ConnectionModifications, MFXGroupBoxModule, ConnectionModificationsMap, ARRAYNUMBER(ConnectionModificationsMap))
53FXIMPLEMENT(GNEConnectorFrame::ConnectionOperations, MFXGroupBoxModule, ConnectionOperationsMap, ARRAYNUMBER(ConnectionOperationsMap))
54
55
56// ===========================================================================
57// method definitions
58// ===========================================================================
59
60// ---------------------------------------------------------------------------
61// GNEConnectorFrame::CurrentLane - methods
62// ---------------------------------------------------------------------------
63
65 MFXGroupBoxModule(connectorFrameParent, TL("Lane")) {
66 // create lane label
67 myCurrentLaneLabel = new FXLabel(getCollapsableFrame(), TL("No lane selected"), 0, GUIDesignLabel(JUSTIFY_LEFT));
68}
69
70
72
73
74void
76 if (laneID.empty()) {
77 myCurrentLaneLabel->setText(TL("No lane selected"));
78 } else {
79 myCurrentLaneLabel->setText((std::string(TL("Current Lane: ")) + laneID).c_str());
80 }
81}
82
83// ---------------------------------------------------------------------------
84// GNEConnectorFrame::ConnectionModifications - methods
85// ---------------------------------------------------------------------------
86
88 MFXGroupBoxModule(connectorFrameParent, TL("Modifications")),
89 myConnectorFrameParent(connectorFrameParent) {
90
91 // Create "Cancel" button
92 myCancelButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Cancel"), "", TL("Discard connection modifications (Esc)"),
94 // Create "OK" button
95 mySaveButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("OK"), "", TL("Save connection modifications (Enter)"),
97
98 // Create checkbox for protect routes
99 myProtectRoutesCheckBox = new FXCheckButton(getCollapsableFrame(), TL("Protect routes"), this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
100}
101
102
104
105
106long
108 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
109 myConnectorFrameParent->getViewNet()->getUndoList()->abortAllChangeGroups();
110 if (myConnectorFrameParent->myNumChanges) {
111 myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes reverted"));
112 }
113 myConnectorFrameParent->cleanup();
114 myConnectorFrameParent->getViewNet()->updateViewNet();
115 }
116 return 1;
117}
118
119
120long
122 if (myConnectorFrameParent->myCurrentEditedLane != 0) {
123 // check if routes has to be protected
124 if (myProtectRoutesCheckBox->isEnabled() && (myProtectRoutesCheckBox->getCheck() == TRUE)) {
125 for (const auto& demandElement : myConnectorFrameParent->myCurrentEditedLane->getParentEdge()->getChildDemandElements()) {
126 if (demandElement->isDemandElementValid() != GNEDemandElement::Problem::OK) {
127 FXMessageBox::warning(getApp(), MBOX_OK,
128 TL("Error saving connection operations"), "%s",
129 (TLF("Connection edition cannot be saved because route '%' is broken.", demandElement->getID()).c_str()));
130 return 1;
131 }
132 }
133 }
134 // finish route editing
135 myConnectorFrameParent->getViewNet()->getUndoList()->end();
136 if (myConnectorFrameParent->myNumChanges) {
137 myConnectorFrameParent->getViewNet()->setStatusBarText(TL("Changes accepted"));
138 }
139 myConnectorFrameParent->cleanup();
140 // mark network for recomputing
141 myConnectorFrameParent->getViewNet()->getNet()->requireRecompute();
142 }
143 return 1;
144}
145
146// ---------------------------------------------------------------------------
147// GNEConnectorFrame::ConnectionOperations - methods
148// ---------------------------------------------------------------------------
149
151 MFXGroupBoxModule(connectorFrameParent, TL("Operations")),
152 myConnectorFrameParent(connectorFrameParent) {
153
154 // Create "Select Dead Ends" button
155 mySelectDeadEndsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Ends"), "", TL("Selects all lanes that have no outgoing connection (clears previous selection)"),
157 // Create "Select Dead Starts" button
158 mySelectDeadStartsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Dead Starts"), "", TL("Selects all lanes that have no incoming connection (clears previous selection)"),
160 // Create "Select Conflicts" button
161 mySelectConflictsButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Conflicts"), "", TL("Selects all lanes with more than one incoming connection from the same edge (clears previous selection)"),
163 // Create "Select Edges which may always pass" button
164 mySelectPassingButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Select Passing"), "", TL("Selects all lanes with a connection that has the 'pass' attribute set"),
166 // Create "Clear Selected" button
167 myClearSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Clear Selected"), "", TL("Clears all connections of all selected objects"),
169 // Create "Reset Selected" button
170 myResetSelectedButton = GUIDesigns::buildFXButton(getCollapsableFrame(), TL("Reset Selected"), "", TL("Recomputes connections at all selected junctions"),
172}
173
174
176
177
178long
180 // select all lanes that have no successor lane
181 std::vector<GNEAttributeCarrier*> deadEnds;
182 // every edge knows its outgoing connections so we can look at each edge in isolation
183 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
184 for (const auto& lane : edge.second->getChildLanes()) {
185 if (edge.second->getNBEdge()->getConnectionsFromLane(lane->getIndex()).size() == 0) {
186 deadEnds.push_back(lane);
187 }
188 }
189 }
190 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(deadEnds, GNESelectorFrame::ModificationMode::Operation::REPLACE);
191 myConnectorFrameParent->getViewNet()->updateViewNet();
192 return 1;
193}
194
195
196long
198 // select all lanes that have no predecessor lane
199 std::set<GNEAttributeCarrier*> deadStarts;
200 GNENet* net = myConnectorFrameParent->getViewNet()->getNet();
201 // every edge knows only its outgoing connections so we look at whole junctions
202 for (const auto& junction : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
203 // first collect all outgoing lanes
204 for (const auto& outgoingEdge : junction.second->getGNEOutgoingEdges()) {
205 for (const auto& lane : outgoingEdge->getChildLanes()) {
206 deadStarts.insert(lane);
207 }
208 }
209 // then remove all approached lanes
210 for (const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
211 for (const auto& connection : incomingEdge->getNBEdge()->getConnections()) {
212 deadStarts.erase(net->getAttributeCarriers()->retrieveEdge(connection.toEdge->getID())->getChildLanes()[connection.toLane]);
213 }
214 }
215 }
216 std::vector<GNEAttributeCarrier*> selectObjects(deadStarts.begin(), deadStarts.end());
217 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(selectObjects, GNESelectorFrame::ModificationMode::Operation::REPLACE);
218 myConnectorFrameParent->getViewNet()->updateViewNet();
219 return 1;
220}
221
222
223long
225 std::vector<GNEAttributeCarrier*> conflicts;
226 // conflicts happen per edge so we can look at each edge in isolation
227 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
228 const EdgeVector destinations = edge.second->getNBEdge()->getConnectedEdges();
229 for (const auto& destination : destinations) {
230 GNEEdge* dest = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveEdge(destination->getID());
231 for (const auto& lane : dest->getChildLanes()) {
232 const bool isConflicted = count_if(edge.second->getNBEdge()->getConnections().begin(), edge.second->getNBEdge()->getConnections().end(),
233 NBEdge::connections_toedgelane_finder(destination, (int)lane->getIndex(), -1)) > 1;
234 if (isConflicted) {
235 conflicts.push_back(lane);
236 }
237 }
238 }
239
240 }
241 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(conflicts, GNESelectorFrame::ModificationMode::Operation::REPLACE);
242 myConnectorFrameParent->getViewNet()->updateViewNet();
243 return 1;
244}
245
246
247long
249 std::vector<GNEAttributeCarrier*> pass;
250 for (const auto& edge : myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
251 for (const auto& connection : edge.second->getNBEdge()->getConnections()) {
252 if (connection.mayDefinitelyPass) {
253 pass.push_back(edge.second->getChildLanes()[connection.fromLane]);
254 }
255 }
256 }
257 myConnectorFrameParent->getViewNet()->getViewParent()->getSelectorFrame()->handleIDs(pass, GNESelectorFrame::ModificationMode::Operation::REPLACE);
258 myConnectorFrameParent->getViewNet()->updateViewNet();
259 return 1;
260}
261
262
263long
265 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
266 myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("clear connections from selected lanes, edges and junctions"));
267 // clear junction's connection
268 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
269 for (const auto& junction : selectedJunctions) {
270 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList()); // clear connections
271 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList(), GNEAttributeCarrier::FEATURE_MODIFIED); // prevent re-guessing
272 }
273 // clear edge's connection
274 const auto selectedEdges = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedEdges();
275 for (const auto& edge : selectedEdges) {
276 for (const auto& lane : edge->getChildLanes()) {
277 myConnectorFrameParent->removeConnections(lane);
278 }
279 }
280 // clear lane's connection
281 const auto selectedLanes = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedLanes();
282 for (const auto& lane : selectedLanes) {
283 myConnectorFrameParent->removeConnections(lane);
284 }
285 myConnectorFrameParent->getViewNet()->getUndoList()->end();
286 myConnectorFrameParent->getViewNet()->updateViewNet();
287 return 1;
288}
289
290
291long
293 myConnectorFrameParent->myConnectionModifications->onCmdCancelModifications(0, 0, 0);
294 myConnectorFrameParent->getViewNet()->getUndoList()->begin(GUIIcon::CONNECTION, TL("reset connections from selected lanes"));
295 const auto selectedJunctions = myConnectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getSelectedJunctions();
296 for (const auto& junction : selectedJunctions) {
297 junction->setLogicValid(false, myConnectorFrameParent->getViewNet()->getUndoList());
298 }
299 myConnectorFrameParent->getViewNet()->getUndoList()->end();
300 if (selectedJunctions.size() > 0) {
301 auto viewNet = myConnectorFrameParent->getViewNet();
302 viewNet->getNet()->requireRecompute();
303 viewNet->getNet()->computeNetwork(viewNet->getViewParent()->getGNEAppWindows());
304 }
305 myConnectorFrameParent->getViewNet()->updateViewNet();
306 return 1;
307}
308
309// ---------------------------------------------------------------------------
310// GNEConnectorFrame::ConnectionSelection - methods
311// ---------------------------------------------------------------------------
312
314 MFXGroupBoxModule(connectorFrameParent, TL("Selection")) {
315 // create label
316 new MFXDynamicLabel(getCollapsableFrame(), (std::string("- ") + TL("Hold <SHIFT> while clicking to create unyielding connections (pass=true).")).c_str(), 0, GUIDesignLabelFrameInformation);
317 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);
318}
319
320
322
323// ---------------------------------------------------------------------------
324// GNEConnectorFrame::ConnectionLegend - methods
325// ---------------------------------------------------------------------------
326
328 MFXGroupBoxModule(connectorFrameParent, TL("Information")) {
329
330 // create possible target label
331 FXLabel* possibleTargetLabel = new FXLabel(getCollapsableFrame(), TL("Possible Target"), 0, GUIDesignLabel(JUSTIFY_LEFT));
332 possibleTargetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
333 possibleTargetLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
334
335 // create source label
336 FXLabel* sourceLabel = new FXLabel(getCollapsableFrame(), TL("Source lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
337 sourceLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
338
339 // create target label
340 FXLabel* targetLabel = new FXLabel(getCollapsableFrame(), TL("Target lane"), 0, GUIDesignLabel(JUSTIFY_LEFT));
341 targetLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
342
343 // create target (pass) label
344 FXLabel* targetPassLabel = new FXLabel(getCollapsableFrame(), TL("Target (pass)"), 0, GUIDesignLabel(JUSTIFY_LEFT));
345 targetPassLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
346
347 // create conflict label
348 FXLabel* conflictLabel = new FXLabel(getCollapsableFrame(), TL("Conflict"), 0, GUIDesignLabel(JUSTIFY_LEFT));
349 conflictLabel->setBackColor(MFXUtils::getFXColor(connectorFrameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.conflict));
350}
351
352
354
355// ---------------------------------------------------------------------------
356// GNEConnectorFrame - methods
357// ---------------------------------------------------------------------------
358
360 GNEFrame(viewParent, viewNet, TL("Edit Connections")),
362 myNumChanges(0) {
363 // create current lane module
364 myCurrentLane = new CurrentLane(this);
365
366 // create connection modifications module
368
369 // create connection operations module
371
372 // create connection selection module
374
375 // create connection legend module
376 myLegend = new Legend(this);
377}
378
379
381
382
383void
385 // get lane front
386 GNELane* clickedLane = viewObjects.getLaneFrontNonLocked();
387 // iterate over lanes
388 for (const auto& lane : viewObjects.getLanes()) {
389 // if parent edge of lane is front element, update clickedLane
390 if (lane->getParentEdge()->isMarkedForDrawingFront()) {
391 clickedLane = lane;
392 }
393 }
394 // build connection
396}
397
398
403
404
405void
407 // select lane as current lane
408 buildConnection(lane, false, false, true); // select as current lane
409 // iterate over all potential targets
410 for (const auto& potentialTarget : myPotentialTargets) {
411 // remove connections using the appropiate parameters in function "buildConnection"
412 buildConnection(potentialTarget, false, false, false);
413 }
414 // save modifications
416}
417
418
419void
420GNEConnectorFrame::buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle) {
421 if (myCurrentEditedLane == 0) {
422 myCurrentEditedLane = lane;
424 initTargets();
425 myNumChanges = 0;
426 myViewNet->getUndoList()->begin(GUIIcon::CONNECTION, TL("modify connections"));
427 } else if (myPotentialTargets.count(lane)
428 || (allowConflict && lane->getParentEdge()->getFromJunction() == myCurrentEditedLane->getParentEdge()->getToJunction())) {
429 const int fromIndex = myCurrentEditedLane->getIndex();
431 GNEEdge* destEdge = lane->getParentEdge();
432 std::vector<NBEdge::Connection> connections = srcEdge->getNBEdge()->getConnectionsFromLane(fromIndex);
433 bool changed = false;
434 // get lane status
435 LaneStatus status = getLaneStatus(connections, lane);
436 if (status == LaneStatus::CONFLICTED && allowConflict) {
438 }
439 // create depending of status
440 switch (status) {
442 if (toggle) {
443 // create new connection
444 NBEdge::Connection newCon(fromIndex, destEdge->getNBEdge(), lane->getIndex(), mayDefinitelyPass);
445 // if the connection was previously deleted (by clicking the same lane twice), restore all values
447 // fromLane must be the same, only check toLane
448 if (c.toEdge == destEdge->getNBEdge() && c.toLane == lane->getIndex()) {
449 newCon = c;
450 newCon.mayDefinitelyPass = mayDefinitelyPass;
451 }
452 }
453 NBConnection newNBCon(srcEdge->getNBEdge(), fromIndex, destEdge->getNBEdge(), lane->getIndex(), newCon.tlLinkIndex);
454 myViewNet->getUndoList()->add(new GNEChange_Connection(srcEdge, newCon, false, true), true);
455 if (mayDefinitelyPass) {
457 } else {
459 }
461 }
462 break;
465 // remove connection
466 GNEConnection* con = srcEdge->retrieveGNEConnection(fromIndex, destEdge->getNBEdge(), lane->getIndex());
470 changed = true;
471 break;
472 }
474 SVCPermissions fromPermissions = srcEdge->getNBEdge()->getPermissions(fromIndex);
475 SVCPermissions toPermissions = destEdge->getNBEdge()->getPermissions(lane->getIndex());
476 if ((fromPermissions & toPermissions) == SVC_PEDESTRIAN) {
477 myViewNet->setStatusBarText(TL("Pedestrian connections are generated automatically"));
478 } else if ((fromPermissions & toPermissions) == 0) {
479 myViewNet->setStatusBarText(TL("Incompatible vehicle class permissions"));
480 } else {
481 myViewNet->setStatusBarText(TL("Another lane from the same edge already connects to that lane"));
482 }
483 break;
484 }
485 if (changed) {
486 myNumChanges += 1;
487 }
488 } else {
489 myViewNet->setStatusBarText(TL("Invalid target for connection"));
490 }
492}
493
494
495void
497 // gather potential targets
499 // get potential targets
500 for (const auto& NBEEdge : nbn->getOutgoingEdges()) {
501 GNEEdge* edge = myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(NBEEdge->getID());
502 for (const auto& lane : edge->getChildLanes()) {
503 myPotentialTargets.insert(lane);
504 }
505 }
506 // set color for existing connections
507 std::vector<NBEdge::Connection> connections = myCurrentEditedLane->getParentEdge()->getNBEdge()->getConnectionsFromLane(myCurrentEditedLane->getIndex());
508 for (const auto& lane : myPotentialTargets) {
509 switch (getLaneStatus(connections, lane)) {
512 break;
515 break;
518 break;
521 break;
522 }
523 }
524}
525
526
527void
529 // restore colors of potential targets
530 for (auto it : myPotentialTargets) {
531 it->setSpecialColor(0);
532 }
533 // clear attributes
534 myPotentialTargets.clear();
535 myNumChanges = 0;
537 myCurrentEditedLane = nullptr;
538 myDeletedConnections.clear();
540}
541
542
544GNEConnectorFrame::getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const {
546 const int fromIndex = myCurrentEditedLane->getIndex();
547 NBEdge* destEdge = targetLane->getParentEdge()->getNBEdge();
548 const int toIndex = targetLane->getIndex();
549 std::vector<NBEdge::Connection>::const_iterator con_it = find_if(
550 connections.begin(), connections.end(),
551 NBEdge::connections_finder(fromIndex, destEdge, toIndex));
552 const bool isConnected = con_it != connections.end();
553 if (isConnected) {
554 if (con_it->mayDefinitelyPass) {
556 } else {
558 }
559 } else if (srcEdge->hasConnectionTo(destEdge, toIndex)
560 || (srcEdge->getPermissions(fromIndex) & destEdge->getPermissions(toIndex) & ~SVC_PEDESTRIAN) == 0) {
562 } else {
564 }
565}
566
567
568/****************************************************************************/
FXDEFMAP(GNEConnectorFrame::ConnectionModifications) ConnectionModificationsMap[]
@ MID_GNE_CONNECTORFRAME_SELECTDEADENDS
select dead end lanes
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition GUIAppEnum.h:991
@ MID_CANCEL
Cancel-button pressed.
Definition GUIAppEnum.h:308
@ MID_CHOOSEN_CLEAR
Clear set.
Definition GUIAppEnum.h:605
@ MID_OK
Ok-button pressed.
Definition GUIAppEnum.h:306
@ 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:609
@ MID_GNE_CONNECTORFRAME_SELECTPASS
select lanes with connections that have the pass attribute set to 'true'
#define GUIDesignButton
Definition GUIDesigns.h:82
#define GUIDesignLabel(justify)
Definition GUIDesigns.h:243
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:192
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition GUIDesigns.h:279
#define TL(string)
Definition MsgHandler.h:305
#define TLF(string,...)
Definition MsgHandler.h:307
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.
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:829
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:74
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:2326
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:79
GNEViewNet * getViewNet() const
get view net
Definition GNEFrame.cpp:155
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.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:650
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition GNELane.cpp:906
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:202
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:682
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:147
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2195
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:4488
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition NBEdge.cpp:1287
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:1325
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