Path: blob/main/src/netedit/frames/network/GNECrossingFrame.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 GNECrossingFrame.h14/// @author Pablo Alvarez Lopez15/// @date Oct 201616///17// The Widget for add Crossing elements18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/frames/GNEFrame.h>232425// ===========================================================================26// class definitions27// ===========================================================================2829// ===========================================================================30// class definitions31// ===========================================================================32/**33* @class GNECrossingFrame34* The Widget for setting internal attributes of Crossing elements35*/36class GNECrossingFrame : public GNEFrame {3738public:3940// ===========================================================================41// class CurrentJunction42// ===========================================================================4344class JunctionInformation : public MFXGroupBoxModule {4546public:47/// @brief constructor48JunctionInformation(GNECrossingFrame* crossingFrameParent);4950/// @brief destructor51~JunctionInformation();5253/// @brief set current junction label54void updateCurrentJunctionLabel(const std::string& junctionID);5556private:57/// @brief Text field for junction ID58FXTextField* myTextFieldJunctionID;59};6061// ===========================================================================62// class EdgesSelector63// ===========================================================================6465class EdgesSelector : public MFXGroupBoxModule {66/// @brief FOX-declaration67FXDECLARE(GNECrossingFrame::EdgesSelector)6869public:70/// @brief constructor71EdgesSelector(GNECrossingFrame* crossingFrameParent);7273/// @brief destructor74~EdgesSelector();7576/// @brief get current junction77GNEJunction* getCurrentJunction() const;7879/// @brief enable edgeSelector80void enableEdgeSelector(GNEJunction* currentJunction);8182/// @brief disable edgeSelector83void disableEdgeSelector();8485/// @brief restore colors of all edges86void restoreEdgeColors();8788/// @name FOX-callbacks89/// @{90/// @brief called when useSelectedEdges button edge is pressed91long onCmdUseSelectedEdges(FXObject*, FXSelector, void*);9293/// @brief called when clear selection button is pressed94long onCmdClearSelection(FXObject*, FXSelector, void*);9596/// @}9798protected:99/// @brief FOX needs this100FOX_CONSTRUCTOR(EdgesSelector)101102private:103/// @brief pointer to GNECrossingFrame parent104GNECrossingFrame* myCrossingFrameParent;105106/// @brief CheckBox for selected edges107FXButton* myUseSelectedEdges;108109/// @brief button for clear selection110FXButton* myClearEdgesSelection;111112/// @brief current Junction113GNEJunction* myCurrentJunction;114};115116// ===========================================================================117// class CrossingParameters118// ===========================================================================119120class CrossingParameters : public MFXGroupBoxModule {121/// @brief FOX-declaration122FXDECLARE(GNECrossingFrame::CrossingParameters)123124public:125/// @brief constructor126CrossingParameters(GNECrossingFrame* crossingFrameParent);127128/// @brief destructor129~CrossingParameters();130131/// @brief enable crossing parameters and set the default value of parameters132void enableCrossingParameters(bool hasTLS);133134/// @brief disable crossing parameters and clear parameters135void disableCrossingParameters();136137/// @brief check if currently the CrossingParameters is enabled138bool isCrossingParametersEnabled() const;139140/// @brief mark or dismark edge141void markEdge(GNEEdge* edge);142143/// @brief clear edges144void clearEdges();145146/// @brief use selected eges147void useSelectedEdges(GNEJunction* parentJunction);148149/// @brief get crossing NBedges150std::vector<NBEdge*> getCrossingEdges() const;151152/// @brief get crossing priority153bool getCrossingPriority() const;154155/// @brief get crossing width156double getCrossingWidth() const;157158/// @brief check if current parameters are valid159bool isCurrentParametersValid() const;160161/// @name FOX-callbacks162/// @{163/// @brief Called when user set a value164long onCmdSetAttribute(FXObject*, FXSelector, void*);165166/// @brief Called when help button is pressed167long onCmdHelp(FXObject*, FXSelector, void*);168/// @}169170protected:171/// @brief FOX needs this172FOX_CONSTRUCTOR(CrossingParameters)173174private:175/// @brief pointer to GNECrossingFrame parent176GNECrossingFrame* myCrossingFrameParent;177178/// @brief current selected edges179std::vector<GNEEdge*> myCurrentSelectedEdges;180181/// @brief current invalid edges182std::vector<GNEEdge*> myCurrentInvalidEdges;183184/// @brief Label for edges185FXLabel* myCrossingEdgesLabel;186187/// @brief TextField for edges188FXTextField* myCrossingEdges;189190/// @brief Label for Priority191FXLabel* myCrossingPriorityLabel;192193/// @brief CheckBox for Priority194FXCheckButton* myCrossingPriorityCheckButton;195196/// @brief Label for width197FXLabel* myCrossingWidthLabel;198199/// @brief TextField for width200FXTextField* myCrossingWidth;201202/// @brief button for help203FXButton* myHelpCrossingAttribute;204205/// @brief flag to check if current parameters are valid206bool myCurrentParametersValid;207};208209// ===========================================================================210// class CreateCrossing211// ===========================================================================212213class CreateCrossing : public MFXGroupBoxModule {214/// @brief FOX-declaration215FXDECLARE(GNECrossingFrame::CreateCrossing)216217public:218/// @brief constructor219CreateCrossing(GNECrossingFrame* crossingFrameParent);220221/// @brief destructor222~CreateCrossing();223224/// @brief enable or disable button create crossing225void setCreateCrossingButton(bool value);226227/// @name FOX-callbacks228/// @{229/// @brief Called when the user press the button create edge230long onCmdCreateCrossing(FXObject*, FXSelector, void*);231/// @}232233protected:234/// @brief FOX needs this235FOX_CONSTRUCTOR(CreateCrossing)236237private:238/// @brief pointer to crossingFrame parent239GNECrossingFrame* myCrossingFrameParent;240241/// @field FXButton for create Crossing242FXButton* myCreateCrossingButton;243};244245// ===========================================================================246// class Information247// ===========================================================================248249class Information : public MFXGroupBoxModule {250251public:252/// @brief constructor253Information(GNECrossingFrame* crossingFrameParent);254255/// @brief destructor256~Information();257};258259/**@brief Constructor260* @brief viewParent GNEViewParent in which this GNEFrame is placed261* @brief viewNet viewNet that uses this GNEFrame262*/263GNECrossingFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);264265/// @brief Destructor266~GNECrossingFrame();267268/// @brief hide crossing frame269void hide();270271/**@brief add Crossing element272* @param viewObjects collection of objects under cursor after click over view273*/274void addCrossing(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);275276/// @brief create crossing (used when user press ENTER key in Crossing mode)277void createCrossingHotkey();278279/// @brief clear edges (used when user press ESC key in Crossing mode)280void clearEdgesHotkey();281282/// @brief get edge selector modul283GNECrossingFrame::EdgesSelector* getEdgesSelector() const;284285protected:286/// @brief FOX need this287FOX_CONSTRUCTOR(GNECrossingFrame)288289private:290/// @brief junction information modul291GNECrossingFrame::JunctionInformation* myJunctionInformation = nullptr;292293/// @brief edge selector modul294GNECrossingFrame::EdgesSelector* myEdgeSelector = nullptr;295296/// @brief crossing parameters modul297GNECrossingFrame::CrossingParameters* myCrossingParameters = nullptr;298299/// @brief create crossing modul300GNECrossingFrame::CreateCrossing* myCreateCrossing = nullptr;301302/// @brief information modul303GNECrossingFrame::Information* myInformation = nullptr;304};305306307