/****************************************************************************/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 GNEPathCreator.h14/// @author Pablo Alvarez Lopez15/// @date Mar 202216///17// Frame for create paths18/****************************************************************************/19#pragma once20#include <config.h>2122#include <utils/foxtools/MFXGroupBoxModule.h>2324// ===========================================================================25// class declaration26// ===========================================================================2728class GNEFrame;29class GNETagProperties;30class GNEPathManager;3132// ===========================================================================33// class definitions34// ===========================================================================3536class GNEPathCreator : public MFXGroupBoxModule {37/// @brief FOX-declaration38FXDECLARE(GNEPathCreator)3940public:41/// @brief class for path42class Path {4344public:45/// @brief constructor for single edge46Path(const SUMOVehicleClass vClass, GNEEdge* edge);4748/// @brief constructor for two edges49Path(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEEdge* edgeFrom, GNEEdge* edgeTo);5051/// @brief constructor for two junctions52Path(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEJunction* junctionFrom, GNEJunction* junctionTo);5354/// @brief get sub path55const std::vector<GNEEdge*>& getSubPath() const;5657/// @brief check if current path is conflict due vClass58bool isConflictVClass() const;5960/// @brief check if current path is conflict due is disconnected61bool isConflictDisconnected() const;6263protected:64/// @brief sub path65std::vector<GNEEdge*> mySubPath;6667/// @brief flag to mark this path as conflicted68bool myConflictVClass;6970/// @brief flag to mark this path as disconnected71bool myConflictDisconnected;7273private:74/// @brief default constructor75Path();7677/// @brief Invalidated copy constructor.78Path(Path*) = delete;7980/// @brief Invalidated assignment operator.81Path& operator=(Path*) = delete;82};8384/// @brief default constructor85GNEPathCreator(GNEFrame* frameParent, GNEPathManager* pathManager);8687/// @brief destructor88~GNEPathCreator();8990/// @brief show GNEPathCreator for the given tag91void showPathCreatorModule(const GNETagProperties* tagProperty, const bool consecutives);9293/// @brief show GNEPathCreator94void hidePathCreatorModule();9596/// @brief get vClass97SUMOVehicleClass getVClass() const;9899/// @brief set vClass100void setVClass(SUMOVehicleClass vClass);101102/// @brief add junction103bool addJunction(GNEJunction* junction);104105/// @brief add TAZ106bool addTAZ(GNETAZ* taz);107108/// @brief add edge109bool addEdge(GNEEdge* edge, const bool shiftKeyPressed, const bool controlKeyPressed);110111/// @brief get current selected edges112const std::vector<GNEEdge*>& getSelectedEdges() const;113114/// @brief get current selected junctions115const std::vector<GNEJunction*>& getSelectedJunctions() const;116117/// @brief get current selected TAZs118const std::vector<GNETAZ*>& getSelectedTAZs() const;119120/// @brief add route121bool addRoute(GNEDemandElement* route);122123/// @brief get route124GNEDemandElement* getRoute() const;125126/// @brief get path route127const std::vector<Path>& getPath() const;128129/// @brief draw candidate edges with special color (Only for candidates, special and conflicted)130bool drawCandidateEdgesWithSpecialColor() const;131132/// @brief update junction colors133void updateJunctionColors();134135/// @brief update edge colors136void updateEdgeColors();137138/// @brief clear junction colors139void clearJunctionColors();140141/// @brief clear edge colors142void clearEdgeColors();143144/// @brief draw temporal route145void drawTemporalRoute(const GUIVisualizationSettings& s) const;146147/// @brief create path148bool createPath(const bool useLastRoute);149150/// @brief abort path creation151void abortPathCreation();152153/// @brief remove path element154void removeLastElement();155156/// @name FOX-callbacks157/// @{158/// @brief Called when the user click over button "Finish route creation"159long onCmdCreatePath(FXObject*, FXSelector, void*);160161/// @brief Called when the user click over button "Use last route"162long onCmdUseLastRoute(FXObject*, FXSelector, void*);163164/// @brief Called when update button "Use last route"165long onUpdUseLastRoute(FXObject*, FXSelector, void*);166167/// @brief Called when the user click over button "Abort route creation"168long onCmdAbortPathCreation(FXObject*, FXSelector, void*);169170/// @brief Called when the user click over button "Remove las inserted edge"171long onCmdRemoveLastElement(FXObject*, FXSelector, void*);172173/// @brief Called when the user click over check button "show candidate edges"174long onCmdShowCandidateEdges(FXObject*, FXSelector, void*);175/// @}176177protected:178FOX_CONSTRUCTOR(GNEPathCreator)179180// @brief creation mode181enum Mode {182ONLY_FROMTO = 1 << 0, // Path only had two elements (first and last)183CONSECUTIVE_EDGES = 1 << 1, // Path's edges are consecutives184NONCONSECUTIVE_EDGES = 1 << 2, // Path's edges aren't consecutives185START_EDGE = 1 << 3, // Path begins in edge186END_EDGE = 1 << 4, // Path ends in edge187START_JUNCTION = 1 << 5, // Path begins in junction188END_JUNCTION = 1 << 6, // Path ends in junction189START_TAZ = 1 << 7, // Path begins in TAZ190END_TAZ = 1 << 8, // Path ends in TAZ191ROUTE = 1 << 9, // Path is over an existent edge192SHOW_CANDIDATE_EDGES = 1 << 10, // Show candidate edges193SHOW_CANDIDATE_JUNCTIONS = 1 << 11, // show candidate junctions194};195196/// @brief update InfoRouteLabel197void updateInfoRouteLabel();198199/// @brief clear edges (and restore colors)200void clearPath();201202/// @brief recalculate path203void recalculatePath();204205/// @brief set special candidates (This function will be called recursively)206void setSpecialCandidates(GNEEdge* originEdge);207208/// @brief set edgereachability (This function will be called recursively)209void setPossibleCandidates(GNEEdge* originEdge, const SUMOVehicleClass vClass);210211/// @brief current frame parent212GNEFrame* myFrameParent;213214/// @brief path manager215GNEPathManager* myPathManager;216217/// @brief current vClass218SUMOVehicleClass myVClass;219220/// @brief current creation mode221int myCreationMode;222223/// @brief vector with selected junctions224std::vector<GNEJunction*> mySelectedJunctions;225226/// @brief vector with selected TAZs227std::vector<GNETAZ*> mySelectedTAZs;228229/// @brief vector with selected edges230std::vector<GNEEdge*> mySelectedEdges;231232/// @brief route (usually a busStop)233GNEDemandElement* myRoute;234235/// @brief vector with current path236std::vector<Path> myPath;237238/// @brief label with route info239FXLabel* myInfoRouteLabel;240241/// @brief button for use last inserted route242FXButton* myUseLastRoute;243244/// @brief button for finish route creation245FXButton* myFinishCreationButton;246247/// @brief button for abort route creation248FXButton* myAbortCreationButton;249250/// @brief button for removing last inserted element251FXButton* myRemoveLastInsertedElement;252253/// @brief CheckBox for show candidate edges254FXCheckButton* myShowCandidateEdges;255256/// @brief label for shift information257FXLabel* myShiftLabel;258259/// @brief label for control information260FXLabel* myControlLabel;261262/// @brief label for backSpace information263FXLabel* myBackSpaceLabel;264private:265/// @brief Invalidated copy constructor.266GNEPathCreator(GNEPathCreator*) = delete;267268/// @brief Invalidated assignment operator.269GNEPathCreator& operator=(GNEPathCreator*) = delete;270};271272273