Path: blob/main/src/netedit/frames/demand/GNERouteFrame.h
169684 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 GNERouteFrame.h14/// @author Pablo Alvarez Lopez15/// @date Dec 201616///17// The Widget for create route elements18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/frames/GNEFrame.h>2324// ===========================================================================25// class definitions26// ===========================================================================2728class GNEAttributesEditor;29class GNEPathLegendModule;30class GNERoute;31class GNEPathCreator;3233// ===========================================================================34// class definitions35// ===========================================================================3637class GNERouteFrame : public GNEFrame {3839public:4041/// @brief route creation modes42enum class RouteMode {43INVALID, // invalid RouteMode44NONCONSECUTIVE_EDGES, // Create route clicking over non consecutive edges45CONSECUTIVE_EDGES // Create route clicking over consecutive edges46};4748// ===========================================================================49// class RouteModeSelector50// ===========================================================================5152class RouteModeSelector : public MFXGroupBoxModule {53/// @brief FOX-declaration54FXDECLARE(GNERouteFrame::RouteModeSelector)5556public:57/// @brief constructor58RouteModeSelector(GNERouteFrame* routeFrameParent);5960/// @brief destructor61~RouteModeSelector();6263/// @brief get current route mode64const RouteMode& getCurrentRouteMode() const;6566/// @brief check if current mode is Valid67bool isValidMode() const;6869/// @brief check if current VClass is Valid70bool isValidVehicleClass() const;7172/// @brief called after setting a new route or vclass, for showing moduls73void areParametersValid();7475/// @name FOX-callbacks76/// @{77/// @brief Called when the user select another route mode in ComboBox78long onCmdSelectRouteMode(FXObject*, FXSelector, void*);7980/// @brief Called when the user select another VClass81long onCmdSelectVClass(FXObject*, FXSelector, void*);82/// @}8384protected:85FOX_CONSTRUCTOR(RouteModeSelector)8687private:88/// @brief pointer to Frame Parent89GNERouteFrame* myRouteFrameParent;9091/// @brief comboBox with the list of route modes92MFXComboBoxIcon* myRouteModeMatchBox = nullptr;9394/// @brief comboBox with the list of VClass95MFXComboBoxIcon* myVClassMatchBox = nullptr;9697/// @brief current selected route mode98RouteMode myCurrentRouteMode = RouteMode::NONCONSECUTIVE_EDGES;99100/// @brief flag to check if VClass is Valid101bool myValidVClass = true;102103/// @brief list of Route modes that will be shown in Match Box104std::vector<std::pair<RouteMode, std::string> > myRouteModesStrings;105};106107/**@brief Constructor108* @brief viewParent GNEViewParent in which this GNEFrame is placed109* @brief viewNet viewNet that uses this GNEFrame110*/111GNERouteFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);112113/// @brief Destructor114~GNERouteFrame();115116/// @brief show delete frame117void show();118119/// @brief hide delete frame120void hide();121122/**@brief add route edge123* @param edge edge to be added124* @param mouseButtonKeyPressed key pressed during click125* @return true if element was successfully added126*/127bool addEdgeRoute(GNEEdge* clickedEdge, const GNEViewNetHelper::MouseButtonKeyPressed& mouseButtonKeyPressed);128129/// @brief get path creator module130GNEPathCreator* getPathCreator() const;131132protected:133/// @brief create path134bool createPath(const bool useLastRoute);135136private:137/// @brief route base object138CommonXMLStructure::SumoBaseObject* myRouteBaseObject = nullptr;139140/// @brief route mode selector141RouteModeSelector* myRouteModeSelector = nullptr;142143/// @brief internal route attributes editor144GNEAttributesEditor* myRouteAttributesEditor = nullptr;145146/// @brief path creator modul147GNEPathCreator* myPathCreator = nullptr;148149/// @brief path legend modul150GNEPathLegendModule* myPathLegend = nullptr;151};152153154