Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEPathCreator.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Frame for create paths
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
24
25// ===========================================================================
26// class declaration
27// ===========================================================================
28
29class GNEFrame;
31class GNEPathManager;
32
33// ===========================================================================
34// class definitions
35// ===========================================================================
36
39 FXDECLARE(GNEPathCreator)
40
41public:
43 class Path {
44
45 public:
47 Path(const SUMOVehicleClass vClass, GNEEdge* edge);
48
50 Path(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEEdge* edgeFrom, GNEEdge* edgeTo);
51
53 Path(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEJunction* junctionFrom, GNEJunction* junctionTo);
54
56 const std::vector<GNEEdge*>& getSubPath() const;
57
59 bool isConflictVClass() const;
60
62 bool isConflictDisconnected() const;
63
64 protected:
66 std::vector<GNEEdge*> mySubPath;
67
70
73
74 private:
76 Path();
77
79 Path(Path*) = delete;
80
82 Path& operator=(Path*) = delete;
83 };
84
86 GNEPathCreator(GNEFrame* frameParent, GNEPathManager* pathManager);
87
90
92 void showPathCreatorModule(const GNETagProperties* tagProperty, const bool consecutives);
93
96
99
101 void setVClass(SUMOVehicleClass vClass);
102
104 bool addJunction(GNEJunction* junction);
105
107 bool addTAZ(GNETAZ* taz);
108
110 bool addEdge(GNEEdge* edge, const bool shiftKeyPressed, const bool controlKeyPressed);
111
113 const std::vector<GNEEdge*>& getSelectedEdges() const;
114
116 const std::vector<GNEJunction*>& getSelectedJunctions() const;
117
119 const std::vector<GNETAZ*>& getSelectedTAZs() const;
120
122 bool addRoute(GNEDemandElement* route);
123
125 GNEDemandElement* getRoute() const;
126
128 const std::vector<Path>& getPath() const;
129
132
135
137 void updateEdgeColors();
138
140 void clearJunctionColors();
141
143 void clearEdgeColors();
144
146 void drawTemporalRoute(const GUIVisualizationSettings& s) const;
147
149 bool createPath(const bool useLastRoute);
150
152 void abortPathCreation();
153
155 void removeLastElement();
156
160 long onCmdCreatePath(FXObject*, FXSelector, void*);
161
163 long onCmdUseLastRoute(FXObject*, FXSelector, void*);
164
166 long onUpdUseLastRoute(FXObject*, FXSelector, void*);
167
169 long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
170
172 long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
173
175 long onCmdShowCandidateEdges(FXObject*, FXSelector, void*);
177
178protected:
179 FOX_CONSTRUCTOR(GNEPathCreator)
180
181 // @brief creation mode
182 enum Mode {
183 ONLY_FROMTO = 1 << 0, // Path only had two elements (first and last)
184 CONSECUTIVE_EDGES = 1 << 1, // Path's edges are consecutives
185 NONCONSECUTIVE_EDGES = 1 << 2, // Path's edges aren't consecutives
186 START_EDGE = 1 << 3, // Path begins in edge
187 END_EDGE = 1 << 4, // Path ends in edge
188 START_JUNCTION = 1 << 5, // Path begins in junction
189 END_JUNCTION = 1 << 6, // Path ends in junction
190 START_TAZ = 1 << 7, // Path begins in TAZ
191 END_TAZ = 1 << 8, // Path ends in TAZ
192 ROUTE = 1 << 9, // Path is over an existent edge
193 SHOW_CANDIDATE_EDGES = 1 << 10, // Show candidate edges
194 SHOW_CANDIDATE_JUNCTIONS = 1 << 11, // show candidate junctions
195 };
196
199
201 void clearPath();
202
204 void recalculatePath();
205
207 void setSpecialCandidates(GNEEdge* originEdge);
208
210 void setPossibleCandidates(GNEEdge* originEdge, const SUMOVehicleClass vClass);
211
214
217
220
223
225 std::vector<GNEJunction*> mySelectedJunctions;
226
228 std::vector<GNETAZ*> mySelectedTAZs;
229
231 std::vector<GNEEdge*> mySelectedEdges;
232
235
237 std::vector<Path> myPath;
238
241
243 FXButton* myUseLastRoute;
244
247
250
253
255 FXCheckButton* myShowCandidateEdges;
256
258 FXLabel* myShiftLabel;
259
262
265private:
268
271};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
FOX-declaration.
bool isConflictVClass() const
check if current path is conflict due vClass
bool myConflictDisconnected
flag to mark this path as disconnected
bool myConflictVClass
flag to mark this path as conflicted
bool isConflictDisconnected() const
check if current path is conflict due is disconnected
std::vector< GNEEdge * > mySubPath
sub path
Path()
default constructor
Path(Path *)=delete
Invalidated copy constructor.
const std::vector< GNEEdge * > & getSubPath() const
get sub path
Path & operator=(Path *)=delete
Invalidated assignment operator.
GNEPathCreator & operator=(GNEPathCreator *)=delete
Invalidated assignment operator.
long onCmdCreatePath(FXObject *, FXSelector, void *)
std::vector< Path > myPath
vector with current path
FXButton * myAbortCreationButton
button for abort route creation
void updateEdgeColors()
update edge colors
long onCmdAbortPathCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Abort route creation".
FXLabel * myControlLabel
label for control information
GNEFrame * myFrameParent
current frame parent
std::vector< GNEEdge * > mySelectedEdges
vector with selected edges
std::vector< GNETAZ * > mySelectedTAZs
vector with selected TAZs
GNEDemandElement * myRoute
route (usually a busStop)
const std::vector< GNETAZ * > & getSelectedTAZs() const
get current selected TAZs
bool addRoute(GNEDemandElement *route)
add route
void abortPathCreation()
abort path creation
void updateInfoRouteLabel()
update InfoRouteLabel
bool addTAZ(GNETAZ *taz)
add TAZ
FXCheckButton * myShowCandidateEdges
CheckBox for show candidate edges.
GNEPathManager * myPathManager
path manager
long onCmdShowCandidateEdges(FXObject *, FXSelector, void *)
Called when the user click over check button "show candidate edges".
~GNEPathCreator()
destructor
const std::vector< GNEJunction * > & getSelectedJunctions() const
get current selected junctions
void clearPath()
clear edges (and restore colors)
SUMOVehicleClass myVClass
current vClass
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
void setPossibleCandidates(GNEEdge *originEdge, const SUMOVehicleClass vClass)
set edgereachability (This function will be called recursively)
long onCmdUseLastRoute(FXObject *, FXSelector, void *)
Called when the user click over button "Use last route".
void clearEdgeColors()
clear edge colors
bool addEdge(GNEEdge *edge, const bool shiftKeyPressed, const bool controlKeyPressed)
add edge
GNEPathCreator(GNEPathCreator *)=delete
Invalidated copy constructor.
GNEDemandElement * getRoute() const
get route
void removeLastElement()
remove path element
bool addJunction(GNEJunction *junction)
add junction
bool createPath(const bool useLastRoute)
create path
void setVClass(SUMOVehicleClass vClass)
set vClass
void updateJunctionColors()
update junction colors
void drawTemporalRoute(const GUIVisualizationSettings &s) const
draw temporal route
SUMOVehicleClass getVClass() const
get vClass
FXButton * myRemoveLastInsertedElement
button for removing last inserted element
long onCmdRemoveLastElement(FXObject *, FXSelector, void *)
Called when the user click over button "Remove las inserted edge".
int myCreationMode
current creation mode
FXLabel * myInfoRouteLabel
label with route info
FXLabel * myBackSpaceLabel
label for backSpace information
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
void setSpecialCandidates(GNEEdge *originEdge)
set special candidates (This function will be called recursively)
FXButton * myFinishCreationButton
button for finish route creation
long onUpdUseLastRoute(FXObject *, FXSelector, void *)
Called when update button "Use last route".
FXLabel * myShiftLabel
label for shift information
void recalculatePath()
recalculate path
const std::vector< Path > & getPath() const
get path route
void clearJunctionColors()
clear junction colors
void hidePathCreatorModule()
show GNEPathCreator
void showPathCreatorModule(const GNETagProperties *tagProperty, const bool consecutives)
show GNEPathCreator for the given tag
FXButton * myUseLastRoute
button for use last inserted route
std::vector< GNEJunction * > mySelectedJunctions
vector with selected junctions
Stores the information about how to visualize structures.
MFXGroupBoxModule (based on FXGroupBox)