Path: blob/main/src/netedit/frames/network/GNEProhibitionFrame.h
169689 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 GNEProhibitionFrame.h14/// @author Mirko Barthauer (Technische Universitaet Braunschweig)15/// @date May 201816///17// The Widget for remove network-elements18/****************************************************************************/19#pragma once20#include <config.h>21#include <netedit/frames/GNEFrame.h>2223// ===========================================================================24// class declarations25// ===========================================================================26class GNEConnection;27class GNEAttributeCarrier;2829// ===========================================================================30// class definitions31// ===========================================================================32/**33* @class GNEProhibitionFrame34* The Widget for editing connection foes35*/36class GNEProhibitionFrame : public GNEFrame {3738public:3940/// @brief the prohibition status of a connection41enum ConnStatus {42UNDEFINED,43PROHIBITED,44PROHIBITING45};4647// ===========================================================================48// class RelativeToConnection49// ===========================================================================5051class RelativeToConnection : public MFXGroupBoxModule {5253public:54/// @brief constructor55RelativeToConnection(GNEProhibitionFrame* prohibitionFrameParent);5657/// @brief destructor58~RelativeToConnection();5960/// @brief update description61void updateDescription() const;6263private:64/// @brief pointer to prohibition frame parent65GNEProhibitionFrame* myProhibitionFrameParent;6667/// @brief the label that shows the currently selected connection68FXLabel* myConnDescriptionLabel;69};7071// ===========================================================================72// class Legend73// ===========================================================================7475class Legend : public MFXGroupBoxModule {7677public:78/// @brief constructor79Legend(GNEProhibitionFrame* prohibitionFrameParent);8081/// @brief destructor82~Legend();8384/// @brief get color for non-conflicting pairs of connections85const RGBColor& getUndefinedColor() const;8687/// @brief get color for waiting connections88const RGBColor& getProhibitedColor() const;8990/// @brief get color for connections with precedence91const RGBColor& getProhibitingColor() const;9293/// @brief get color for unregulated conflicts94const RGBColor& getUnregulatedConflictColor() const;9596/// @brief get color for mutual conflicts97const RGBColor& getMutualConflictColor() const;9899private:100/// @brief color for non-conflicting pairs of connections101RGBColor myUndefinedColor;102103/// @brief color for waiting connections104RGBColor myProhibitedColor;105106/// @brief color for connections with precedence107RGBColor myProhibitingColor;108109/// @brief color for unregulated conflicts110RGBColor myUnregulatedConflictColor;111112/// @brief color for mutual conflicts113RGBColor myMutualConflictColor;114};115116// ===========================================================================117// class Selection (in the future will be "Modification")118// ===========================================================================119120class Selection : public MFXGroupBoxModule {121/// @brief FOX-declaration122FXDECLARE(GNEProhibitionFrame::Selection)123124public:125/// @brief constructor126Selection(GNEProhibitionFrame* prohibitionFrameParent);127128/// @brief destructor129~Selection();130131/// @name FOX-callbacks132/// @{133134/// @brief Called when the user presses the OK-Button saves any prohibition modifications135long onCmdOK(FXObject*, FXSelector, void*);136137/// @brief Called when the user presses the Cancel-button discards any prohibition modifications138long onCmdCancel(FXObject*, FXSelector, void*);139140/// @brief Called when the user presses the OK-Button saves any prohibition modifications141long onCmdRequireConnection(FXObject*, FXSelector, void*);142143/// @}144145protected:146/// @brief FOX needs this147FOX_CONSTRUCTOR(Selection)148149private:150/// @brief pointer to prohibition frame parent151GNEProhibitionFrame* myProhibitionFrameParent = nullptr;152153/// @brief "Save" button154MFXButtonTooltip* mySaveButton = nullptr;155156/// @brief "Cancel" button157MFXButtonTooltip* myCancelButton = nullptr;158};159160/**@brief Constructor161* @brief viewParent GNEViewParent in which this GNEFrame is placed162* @brief viewNet viewNet that uses this GNEFrame163*/164GNEProhibitionFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);165166/// @brief Destructor167~GNEProhibitionFrame();168169/**@brief handle prohibitions and set the relative coloring170* @param viewObjects collection of objects under cursor after click over view171*/172void handleProhibitionClick(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);173174/// @brief show prohibition frame175void show();176177/// @brief hide prohibition frame178void hide();179180/// @brief get selection module181GNEProhibitionFrame::Selection* getSelectionModul() const;182183protected:184/// @brief FOX needs this185FOX_CONSTRUCTOR(GNEProhibitionFrame)186187/// @brief build prohibition188void buildProhibition(GNEConnection* conn, bool mayDefinitelyPass, bool allowConflict, bool toggle);189190private:191/// @brief Relative To Connection192RelativeToConnection* myRelativeToConnection;193194/// @brief prohibition legend195GNEProhibitionFrame::Legend* myLegend = nullptr;196197/// @brief Selection198GNEProhibitionFrame::Selection* mySelectionModul = nullptr;199200/// @brief the connection which prohibits201GNEConnection* myCurrentConn = nullptr;202203/// @brief the set of connections which204std::set<GNEConnection*> myConcernedConns;205};206207208