Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2024 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;
30class GNEPathManager;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
38 FXDECLARE(GNEPathCreator)
39
40public:
42 class Path {
43
44 public:
46 Path(const SUMOVehicleClass vClass, GNEEdge* edge);
47
49 Path(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEEdge* edgeFrom, GNEEdge* edgeTo);
50
52 Path(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEJunction* junctionFrom, GNEJunction* junctionTo);
53
55 const std::vector<GNEEdge*>& getSubPath() const;
56
58 bool isConflictVClass() const;
59
61 bool isConflictDisconnected() const;
62
63 protected:
65 std::vector<GNEEdge*> mySubPath;
66
69
72
73 private:
75 Path();
76
78 Path(Path*) = delete;
79
81 Path& operator=(Path*) = delete;
82 };
83
85 GNEPathCreator(GNEFrame* frameParent, GNEPathManager* pathManager);
86
89
91 void showPathCreatorModule(const GNETagProperties& tagProperty, const bool consecutives);
92
95
98
100 void setVClass(SUMOVehicleClass vClass);
101
103 bool addJunction(GNEJunction* junction);
104
106 bool addTAZ(GNETAZ* taz);
107
109 bool addEdge(GNEEdge* edge, const bool shiftKeyPressed, const bool controlKeyPressed);
110
112 const std::vector<GNEEdge*>& getSelectedEdges() const;
113
115 const std::vector<GNEJunction*>& getSelectedJunctions() const;
116
118 const std::vector<GNETAZ*>& getSelectedTAZs() const;
119
121 bool addRoute(GNEDemandElement* route);
122
124 GNEDemandElement* getRoute() const;
125
127 const std::vector<Path>& getPath() const;
128
131
134
136 void updateEdgeColors();
137
139 void clearJunctionColors();
140
142 void clearEdgeColors();
143
145 void drawTemporalRoute(const GUIVisualizationSettings& s) const;
146
148 bool createPath(const bool useLastRoute);
149
151 void abortPathCreation();
152
154 void removeLastElement();
155
159 long onCmdCreatePath(FXObject*, FXSelector, void*);
160
162 long onCmdUseLastRoute(FXObject*, FXSelector, void*);
163
165 long onUpdUseLastRoute(FXObject*, FXSelector, void*);
166
168 long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
169
171 long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
172
174 long onCmdShowCandidateEdges(FXObject*, FXSelector, void*);
176
177protected:
178 FOX_CONSTRUCTOR(GNEPathCreator)
179
180 // @brief creation mode
181 enum Mode {
182 ONLY_FROMTO = 1 << 0, // Path only had two elements (first and last)
183 CONSECUTIVE_EDGES = 1 << 1, // Path's edges are consecutives
184 NONCONSECUTIVE_EDGES = 1 << 2, // Path's edges aren't consecutives
185 START_EDGE = 1 << 3, // Path begins in edge
186 END_EDGE = 1 << 4, // Path ends in edge
187 START_JUNCTION = 1 << 5, // Path begins in junction
188 END_JUNCTION = 1 << 6, // Path ends in junction
189 START_TAZ = 1 << 7, // Path begins in TAZ
190 END_TAZ = 1 << 8, // Path ends in TAZ
191 ROUTE = 1 << 9, // Path is over an existent edge
192 SHOW_CANDIDATE_EDGES = 1 << 10, // Show candidate edges
193 SHOW_CANDIDATE_JUNCTIONS = 1 << 11, // show candidate junctions
194 };
195
198
200 void clearPath();
201
203 void recalculatePath();
204
206 void setSpecialCandidates(GNEEdge* originEdge);
207
209 void setPossibleCandidates(GNEEdge* originEdge, const SUMOVehicleClass vClass);
210
213
216
219
222
224 std::vector<GNEJunction*> mySelectedJunctions;
225
227 std::vector<GNETAZ*> mySelectedTAZs;
228
230 std::vector<GNEEdge*> mySelectedEdges;
231
234
236 std::vector<Path> myPath;
237
240
242 FXButton* myUseLastRoute;
243
246
249
252
254 FXCheckButton* myShowCandidateEdges;
255
257 FXLabel* myShiftLabel;
258
261
264private:
267
270};
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)
void showPathCreatorModule(const GNETagProperties &tagProperty, const bool consecutives)
show GNEPathCreator for the given tag
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
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)