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-2023 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;
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
34
37 FXDECLARE(GNEPathCreator)
38
39public:
41 class Path {
42
43 public:
45 Path(const SUMOVehicleClass vClass, GNEEdge* edge);
46
48 Path(GNEViewNet* viewNet, const SUMOVehicleClass vClass, GNEEdge* edgeFrom, GNEEdge* edgeTo);
49
51 Path(GNEViewNet* viewNet, const SUMOVehicleClass vClass, GNEJunction* junctionFrom, GNEJunction* junctionTo);
52
54 const std::vector<GNEEdge*>& getSubPath() const;
55
58
61
63 bool isConflictVClass() const;
64
66 bool isConflictDisconnected() const;
67
68 protected:
70 std::vector<GNEEdge*> mySubPath;
71
74
77
80
83
84 private:
86 Path();
87
89 Path(Path*) = delete;
90
92 Path& operator=(Path*) = delete;
93 };
94
96 GNEPathCreator(GNEFrame* frameParent);
97
100
102 void showPathCreatorModule(SumoXMLTag element, const bool firstElement, const bool consecutives);
103
106
109
111 void setVClass(SUMOVehicleClass vClass);
112
114 bool addJunction(GNEJunction* junction);
115
117 bool addTAZ(GNETAZ* taz);
118
120 bool addEdge(GNEEdge* edge, const bool shiftKeyPressed, const bool controlKeyPressed);
121
123 const std::vector<GNEEdge*>& getSelectedEdges() const;
124
126 const std::vector<GNEJunction*>& getSelectedJunctions() const;
127
129 const std::vector<GNETAZ*>& getSelectedTAZs() const;
130
132 bool addStoppingPlace(GNEAdditional* stoppingPlace, const bool shiftKeyPressed, const bool controlKeyPressed);
133
135 GNEAdditional* getToStoppingPlace(SumoXMLTag expectedTag) const;
136
138 bool addRoute(GNEDemandElement* route, const bool shiftKeyPressed, const bool controlKeyPressed);
139
141 GNEDemandElement* getRoute() const;
142
144 const std::vector<Path>& getPath() const;
145
148
151
153 void updateEdgeColors();
154
156 void clearJunctionColors();
157
159 void clearEdgeColors();
160
162 void drawTemporalRoute(const GUIVisualizationSettings& s) const;
163
165 bool createPath(const bool useLastRoute);
166
168 void abortPathCreation();
169
171 void removeLastElement();
172
176 long onCmdCreatePath(FXObject*, FXSelector, void*);
177
179 long onCmdUseLastRoute(FXObject*, FXSelector, void*);
180
182 long onUpdUseLastRoute(FXObject*, FXSelector, void*);
183
185 long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
186
188 long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
189
191 long onCmdShowCandidateEdges(FXObject*, FXSelector, void*);
193
194protected:
195 FOX_CONSTRUCTOR(GNEPathCreator)
196
197 // @brief creation mode
198 enum Mode {
199 CONSECUTIVE_EDGES = 1 << 0, // Path's edges are consecutives
200 NONCONSECUTIVE_EDGES = 1 << 1, // Path's edges aren't consecutives
201 START_EDGE = 1 << 2, // Path begins in edge
202 END_EDGE = 1 << 3, // Path ends in edge
203 START_JUNCTION = 1 << 4, // Path begins in junction
204 END_JUNCTION = 1 << 5, // Path ends in junction
205 START_TAZ = 1 << 6, // Path begins in TAZ
206 END_TAZ = 1 << 7, // Path ends in TAZ
207 STOP = 1 << 8, // Path is stop
208 ONLY_FROMTO = 1 << 9, // Path only had two elements (first and last)
209 END_BUSSTOP = 1 << 10, // Path ends in a busStop
210 END_TRAINSTOP = 1 << 11, // Path ends in a trainStop
211 END_CONTAINERSTOP = 1 << 12, // Path ends in a containerStop
212 ROUTE = 1 << 13, // Path uses a route
213 REQUIRE_FIRSTELEMENT = 1 << 14, // Path start always in a previous element
214 SHOW_CANDIDATE_EDGES = 1 << 15, // Show candidate edges
215 SHOW_CANDIDATE_JUNCTIONS = 1 << 16, // show candidate junctions
216 };
217
220
222 void clearPath();
223
225 void recalculatePath();
226
228 void setSpecialCandidates(GNEEdge* originEdge);
229
231 void setPossibleCandidates(GNEEdge* originEdge, const SUMOVehicleClass vClass);
232
235
238
241
243 std::vector<GNEJunction*> mySelectedJunctions;
244
246 std::vector<GNETAZ*> mySelectedTAZs;
247
249 std::vector<GNEEdge*> mySelectedEdges;
250
253
256
258 std::vector<Path> myPath;
259
262
264 FXButton* myUseLastRoute;
265
268
271
274
276 FXCheckButton* myShowCandidateEdges;
277
279 FXLabel* myShiftLabel;
280
283
286private:
289
292};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
An Element which don't belong to GNENet but has influence in the simulation.
An Element which don't belong to GNENet but has influence in the simulation.
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
GNEAdditional * getToBusStop() const
to additional
GNEAdditional * myToBusStop
to additional (usually a busStop)
GNEAdditional * myFromBusStop
from additional (usually a busStop)
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.
GNEAdditional * getFromBusStop() const
get from additional
GNEPathCreator & operator=(GNEPathCreator *)=delete
Invalidated assignment operator.
long onCmdCreatePath(FXObject *, FXSelector, void *)
GNEAdditional * getToStoppingPlace(SumoXMLTag expectedTag) const
get to stoppingPlace
std::vector< Path > myPath
vector with current path
FXButton * myAbortCreationButton
button for abort route creation
bool addStoppingPlace(GNEAdditional *stoppingPlace, const bool shiftKeyPressed, const bool controlKeyPressed)
add stoppingPlace
void updateEdgeColors()
update edge colors
long onCmdAbortPathCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Abort route creation".
bool addRoute(GNEDemandElement *route, const bool shiftKeyPressed, const bool controlKeyPressed)
add route
GNEAdditional * myToStoppingPlace
to additional (usually a busStop)
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
void abortPathCreation()
abort path creation
void updateInfoRouteLabel()
update InfoRouteLabel
bool addTAZ(GNETAZ *taz)
add TAZ
FXCheckButton * myShowCandidateEdges
CheckBox for show candidate edges.
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(SumoXMLTag element, const bool firstElement, 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)