Path: blob/main/src/netedit/frames/network/GNECrossingFrame.h
193905 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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>23#include <netedit/GNEViewNetHelper.h>24#include <netedit/frames/common/GNEGroupBoxModule.h>2526// ===========================================================================27// class definitions28// ===========================================================================2930class GNECrossingFrame : public GNEFrame {3132public:3334// ===========================================================================35// class CurrentJunction36// ===========================================================================3738class JunctionInformation : public GNEGroupBoxModule {3940public:41/// @brief constructor42JunctionInformation(GNECrossingFrame* crossingFrameParent);4344/// @brief destructor45~JunctionInformation();4647/// @brief set current junction label48void updateCurrentJunctionLabel(const std::string& junctionID);4950private:51/// @brief Text field for junction ID52FXTextField* myTextFieldJunctionID;53};5455// ===========================================================================56// class EdgesSelector57// ===========================================================================5859class EdgesSelector : public GNEGroupBoxModule {60/// @brief FOX-declaration61FXDECLARE(GNECrossingFrame::EdgesSelector)6263public:64/// @brief constructor65EdgesSelector(GNECrossingFrame* crossingFrameParent);6667/// @brief destructor68~EdgesSelector();6970/// @brief get current junction71GNEJunction* getCurrentJunction() const;7273/// @brief enable edgeSelector74void enableEdgeSelector(GNEJunction* currentJunction);7576/// @brief disable edgeSelector77void disableEdgeSelector();7879/// @brief restore colors of all edges80void restoreEdgeColors();8182/// @name FOX-callbacks83/// @{84/// @brief called when useSelectedEdges button edge is pressed85long onCmdUseSelectedEdges(FXObject*, FXSelector, void*);8687/// @brief called when clear selection button is pressed88long onCmdClearSelection(FXObject*, FXSelector, void*);8990/// @}9192protected:93/// @brief FOX needs this94FOX_CONSTRUCTOR(EdgesSelector)9596private:97/// @brief pointer to GNECrossingFrame parent98GNECrossingFrame* myCrossingFrameParent;99100/// @brief CheckBox for selected edges101FXButton* myUseSelectedEdges;102103/// @brief button for clear selection104FXButton* myClearEdgesSelection;105106/// @brief current Junction107GNEJunction* myCurrentJunction;108};109110// ===========================================================================111// class CrossingParameters112// ===========================================================================113114class CrossingParameters : public GNEGroupBoxModule {115/// @brief FOX-declaration116FXDECLARE(GNECrossingFrame::CrossingParameters)117118public:119/// @brief constructor120CrossingParameters(GNECrossingFrame* crossingFrameParent);121122/// @brief destructor123~CrossingParameters();124125/// @brief enable crossing parameters and set the default value of parameters126void enableCrossingParameters(bool hasTLS);127128/// @brief disable crossing parameters and clear parameters129void disableCrossingParameters();130131/// @brief check if currently the CrossingParameters is enabled132bool isCrossingParametersEnabled() const;133134/// @brief mark or dismark edge135void markEdge(GNEEdge* edge);136137/// @brief clear edges138void clearEdges();139140/// @brief use selected eges141void useSelectedEdges(GNEJunction* parentJunction);142143/// @brief get crossing NBedges144std::vector<NBEdge*> getCrossingEdges() const;145146/// @brief get crossing priority147bool getCrossingPriority() const;148149/// @brief get crossing width150double getCrossingWidth() const;151152/// @brief check if current parameters are valid153bool isCurrentParametersValid() const;154155/// @name FOX-callbacks156/// @{157/// @brief Called when user set a value158long onCmdSetAttribute(FXObject*, FXSelector, void*);159160/// @brief Called when help button is pressed161long onCmdHelp(FXObject*, FXSelector, void*);162/// @}163164protected:165/// @brief FOX needs this166FOX_CONSTRUCTOR(CrossingParameters)167168private:169/// @brief pointer to GNECrossingFrame parent170GNECrossingFrame* myCrossingFrameParent;171172/// @brief current selected edges173std::vector<GNEEdge*> myCurrentSelectedEdges;174175/// @brief current invalid edges176std::vector<GNEEdge*> myCurrentInvalidEdges;177178/// @brief Label for edges179FXLabel* myCrossingEdgesLabel;180181/// @brief TextField for edges182FXTextField* myCrossingEdges;183184/// @brief Label for Priority185FXLabel* myCrossingPriorityLabel;186187/// @brief CheckBox for Priority188FXCheckButton* myCrossingPriorityCheckButton;189190/// @brief Label for width191FXLabel* myCrossingWidthLabel;192193/// @brief TextField for width194FXTextField* myCrossingWidth;195196/// @brief button for help197FXButton* myHelpCrossingAttribute;198199/// @brief flag to check if current parameters are valid200bool myCurrentParametersValid;201};202203// ===========================================================================204// class CreateCrossing205// ===========================================================================206207class CreateCrossing : public GNEGroupBoxModule {208/// @brief FOX-declaration209FXDECLARE(GNECrossingFrame::CreateCrossing)210211public:212/// @brief constructor213CreateCrossing(GNECrossingFrame* crossingFrameParent);214215/// @brief destructor216~CreateCrossing();217218/// @brief enable or disable button create crossing219void setCreateCrossingButton(bool value);220221/// @name FOX-callbacks222/// @{223/// @brief Called when the user press the button create edge224long onCmdCreateCrossing(FXObject*, FXSelector, void*);225/// @}226227protected:228/// @brief FOX needs this229FOX_CONSTRUCTOR(CreateCrossing)230231private:232/// @brief pointer to crossingFrame parent233GNECrossingFrame* myCrossingFrameParent;234235/// @field FXButton for create Crossing236FXButton* myCreateCrossingButton;237};238239// ===========================================================================240// class Information241// ===========================================================================242243class Information : public GNEGroupBoxModule {244245public:246/// @brief constructor247Information(GNECrossingFrame* crossingFrameParent);248249/// @brief destructor250~Information();251};252253/**@brief Constructor254* @brief viewParent GNEViewParent in which this GNEFrame is placed255* @brief viewNet viewNet that uses this GNEFrame256*/257GNECrossingFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);258259/// @brief Destructor260~GNECrossingFrame();261262/// @brief hide crossing frame263void hide();264265/**@brief add Crossing element266* @param viewObjects collection of objects under cursor after click over view267*/268void addCrossing(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);269270/// @brief create crossing (used when user press ENTER key in Crossing mode)271void createCrossingHotkey();272273/// @brief clear edges (used when user press ESC key in Crossing mode)274void clearEdgesHotkey();275276/// @brief get edge selector modul277GNECrossingFrame::EdgesSelector* getEdgesSelector() const;278279protected:280/// @brief FOX need this281FOX_CONSTRUCTOR(GNECrossingFrame)282283private:284/// @brief junction information modul285GNECrossingFrame::JunctionInformation* myJunctionInformation = nullptr;286287/// @brief edge selector modul288GNECrossingFrame::EdgesSelector* myEdgeSelector = nullptr;289290/// @brief crossing parameters modul291GNECrossingFrame::CrossingParameters* myCrossingParameters = nullptr;292293/// @brief create crossing modul294GNECrossingFrame::CreateCrossing* myCreateCrossing = nullptr;295296/// @brief information modul297GNECrossingFrame::Information* myInformation = nullptr;298};299300301