Eclipse SUMO - Simulation of Urban MObility
GNEPathCreator.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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, const bool shiftKeyPressed, const bool controlKeyPressed);
115
117 bool addEdge(GNEEdge* edge, const bool shiftKeyPressed, const bool controlKeyPressed);
118
120 const std::vector<GNEEdge*>& getSelectedEdges() const;
121
123 const std::vector<GNEJunction*>& getSelectedJunctions() const;
124
126 bool addStoppingPlace(GNEAdditional* stoppingPlace, const bool shiftKeyPressed, const bool controlKeyPressed);
127
129 GNEAdditional* getToStoppingPlace(SumoXMLTag expectedTag) const;
130
132 bool addRoute(GNEDemandElement* route, const bool shiftKeyPressed, const bool controlKeyPressed);
133
135 GNEDemandElement* getRoute() const;
136
138 const std::vector<Path>& getPath() const;
139
142
145
147 void updateEdgeColors();
148
150 void clearJunctionColors();
151
153 void clearEdgeColors();
154
156 void drawTemporalRoute(const GUIVisualizationSettings& s) const;
157
159 bool createPath(const bool useLastRoute);
160
162 void abortPathCreation();
163
165 void removeLastElement();
166
170 long onCmdCreatePath(FXObject*, FXSelector, void*);
171
173 long onCmdUseLastRoute(FXObject*, FXSelector, void*);
174
176 long onUpdUseLastRoute(FXObject*, FXSelector, void*);
177
179 long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
180
182 long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
183
185 long onCmdShowCandidateEdges(FXObject*, FXSelector, void*);
187
188protected:
189 FOX_CONSTRUCTOR(GNEPathCreator)
190
191 // @brief creation mode
192 enum Mode {
193 CONSECUTIVE_EDGES = 1 << 0, // Path's edges are consecutives
194 NONCONSECUTIVE_EDGES = 1 << 1, // Path's edges aren't consecutives
195 START_EDGE = 1 << 2, // Path begins in an edge
196 END_EDGE = 1 << 3, // Path ends in an edge
197 START_JUNCTION = 1 << 4, // Path begins in an edge
198 END_JUNCTION = 1 << 5, // Path ends in an edge
199 STOP = 1 << 6, // Path is an stop
200 ONLY_FROMTO = 1 << 7, // Path only had two elements (first and last)
201 END_BUSSTOP = 1 << 8, // Path ends in a busStop
202 END_CONTAINERSTOP = 1 << 9, // Path ends in a containerStop
203 ROUTE = 1 << 10, // Path uses a route
204 REQUIRE_FIRSTELEMENT = 1 << 11, // Path start always in a previous element
205 SHOW_CANDIDATE_EDGES = 1 << 12, // Show candidate edges
206 SHOW_CANDIDATE_JUNCTIONS = 1 << 13, // show candidate junctions
207 };
208
211
213 void clearPath();
214
216 void recalculatePath();
217
219 void setSpecialCandidates(GNEEdge* originEdge);
220
222 void setPossibleCandidates(GNEEdge* originEdge, const SUMOVehicleClass vClass);
223
226
229
232
234 std::vector<GNEJunction*> mySelectedJunctions;
235
237 std::vector<GNEEdge*> mySelectedEdges;
238
241
244
246 std::vector<Path> myPath;
247
250
252 FXButton* myUseLastRoute;
253
256
259
262
264 FXCheckButton* myShowCandidateEdges;
265
267 FXLabel* myShiftLabel;
268
271
274private:
277
280};
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.
Definition: GNEAdditional.h:48
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
GNEDemandElement * myRoute
route (usually a busStop)
void abortPathCreation()
abort path creation
void updateInfoRouteLabel()
update InfoRouteLabel
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 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
GNEPathCreator(GNEFrame *frameParent)
default constructor
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
bool addJunction(GNEJunction *junction, const bool shiftKeyPressed, const bool controlKeyPressed)
add junction
Stores the information about how to visualize structures.
MFXGroupBoxModule (based on FXGroupBox)