Path: blob/main/src/netedit/frames/network/GNEConnectorFrame.h
169686 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEConnectorFrame.h14/// @author Jakob Erdmann15/// @date May 201116///17// The Widget for modifying lane-to-lane connections18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netbuild/NBEdge.h>23#include <netedit/frames/GNEFrame.h>2425// ===========================================================================26// class definitions27// ===========================================================================28/**29* @class GNEConnectorFrame30* The Widget for modifying selections of network-elements31*/32class GNEConnectorFrame : public GNEFrame {3334public:3536// ===========================================================================37// class CurrentLane38// ===========================================================================3940class CurrentLane : public MFXGroupBoxModule {4142public:43/// @brief constructor44CurrentLane(GNEConnectorFrame* connectorFrameParent);4546/// @brief destructor47~CurrentLane();4849/// @brief set current junction label50void updateCurrentLaneLabel(const std::string& laneID);5152private:53/// @brief Label for current Lane54FXLabel* myCurrentLaneLabel;55};5657// ===========================================================================58// class ConnectionModifications59// ===========================================================================6061class ConnectionModifications : public MFXGroupBoxModule {62/// @brief FOX-declaration63FXDECLARE(GNEConnectorFrame::ConnectionModifications)6465public:66/// @brief constructor67ConnectionModifications(GNEConnectorFrame* connectorFrameParent);6869/// @brief destructor70~ConnectionModifications();7172/// @name FOX-callbacks73/// @{7475/// @brief Called when the user presses the OK-Button saves any connection modifications76long onCmdSaveModifications(FXObject*, FXSelector, void*);7778/// @brief Called when the user presses the Cancel-button discards any connection modifications79long onCmdCancelModifications(FXObject*, FXSelector, void*);80/// @}8182protected:83FOX_CONSTRUCTOR(ConnectionModifications)8485private:86/// @brief pointer to connectorFrame parent87GNEConnectorFrame* myConnectorFrameParent;8889/// @brief "Cancel" button90FXButton* myCancelButton;9192/// @brief "OK" button93FXButton* mySaveButton;9495/// @brief protect routes checkbox96FXCheckButton* myProtectRoutesCheckBox;97};9899// ===========================================================================100// class ConnectionOperations101// ===========================================================================102103class ConnectionOperations : public MFXGroupBoxModule {104/// @brief FOX-declaration105FXDECLARE(GNEConnectorFrame::ConnectionOperations)106107public:108/// @brief constructor109ConnectionOperations(GNEConnectorFrame* connectorFrameParent);110111/// @brief destructor112~ConnectionOperations();113114/// @name FOX-callbacks115/// @{116117/// @brief Called when the user presses the select dead ends button118long onCmdSelectDeadEnds(FXObject*, FXSelector, void*);119120/// @brief Called when the user presses the select dead starts button121long onCmdSelectDeadStarts(FXObject*, FXSelector, void*);122123/// @brief Called when the user presses the select conflicts button124long onCmdSelectConflicts(FXObject*, FXSelector, void*);125126/// @brief Called when the user presses the select pass button127long onCmdSelectPass(FXObject*, FXSelector, void*);128129/// @brief Called when the user presses the clear selected connections button130long onCmdClearSelectedConnections(FXObject*, FXSelector, void*);131132/// @brief Called when the user presses the reset selected connections button133long onCmdResetSelectedConnections(FXObject*, FXSelector, void*);134/// @}135136protected:137FOX_CONSTRUCTOR(ConnectionOperations)138139private:140/// @brief pointer to connectorFrame parent141GNEConnectorFrame* myConnectorFrameParent;142143/// @brief "Select Dead Ends" button144FXButton* mySelectDeadEndsButton;145146/// @brief "Select Dead Starts" button147FXButton* mySelectDeadStartsButton;148149/// @brief "Select Conflicts" button150FXButton* mySelectConflictsButton;151152/// @brief "Select Edges which may always pass"153FXButton* mySelectPassingButton;154155/// @brief "Clear Selected"156FXButton* myClearSelectedButton;157158/// @brief "Reset Selected"159FXButton* myResetSelectedButton;160};161162// ===========================================================================163// class ConnectionSelection164// ===========================================================================165166class ConnectionSelection : public MFXGroupBoxModule {167168public:169/// @brief constructor170ConnectionSelection(GNEConnectorFrame* connectorFrameParent);171172/// @brief destructor173~ConnectionSelection();174};175176// ===========================================================================177// class Legend178// ===========================================================================179180class Legend : public MFXGroupBoxModule {181182public:183/// @brief constructor184Legend(GNEConnectorFrame* connectorFrameParent);185186/// @brief destructor187~Legend();188189private:190};191192/**@brief Constructor193* @brief viewParent GNEViewParent in which this GNEFrame is placed194* @brief viewNet viewNet that uses this GNEFrame195*/196GNEConnectorFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);197198/// @brief Destructor199~GNEConnectorFrame();200201/**@brief either sets the current lane or toggles the connection of the202* @param viewObjects collection of objects under cursor after click over view203*/204void handleLaneClick(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);205206/// @brief get pointer to ConnectionModifications module207ConnectionModifications* getConnectionModifications() const;208209private:210/// @brief the status of a target lane211enum class LaneStatus {212UNCONNECTED,213CONNECTED,214CONNECTED_PASS,215CONFLICTED216};217218/**@brief either sets the current lane or toggles the connection of the219* current lane to this lane (if they share a junction)220* @param[in] lane Either the lane to set as current lane, or the destination from current lane221* @param[in] mayDefinitelyPass Whether new connections shall have the pass attribute set222* @param[in] toggle Whether non-existing connections shall be created223*/224void buildConnection(GNELane* lane, const bool mayDefinitelyPass, const bool allowConflict, const bool toggle);225226/// @brief init targets227void initTargets();228229/// @brief clean up when deselecting current lane230void cleanup();231232/// @brief remove connections233void removeConnections(GNELane* lane);234235/// @brief return the status of toLane236LaneStatus getLaneStatus(const std::vector<NBEdge::Connection>& connections, const GNELane* targetLane) const;237238/// @brief CurrentLane module239CurrentLane* myCurrentLane;240241/// @brief ConnectionModifications module242GNEConnectorFrame::ConnectionModifications* myConnectionModifications = nullptr;243244/// @brief ConnectionOperations module245GNEConnectorFrame::ConnectionOperations* myConnectionOperations = nullptr;246247/// @brief ConnectionSelection module248GNEConnectorFrame::ConnectionSelection* myConnectionSelection = nullptr;249250/// @brief Legend module251GNEConnectorFrame::Legend* myLegend = nullptr;252253/// @brief the lane of which connections are to be modified254GNELane* myCurrentEditedLane;255256/// @brief the set of lanes to which the current lane may be connected257std::set<GNELane*> myPotentialTargets;258259/// @brief number of changes260int myNumChanges;261262/// @brief the internal lanes belonging the current junction indexed by their tl-index263std::map<int, GNEInternalLane*> myInternalLanes;264265/// @brief vector of connections deleted in the current editing step266std::vector<NBEdge::Connection> myDeletedConnections;267};268269270