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.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 
29 class GNEFrame;
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
34 
37  FXDECLARE(GNEPathCreator)
38 
39 public:
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 
57  bool isConflictVClass() const;
58 
60  bool isConflictDisconnected() const;
61 
62  protected:
64  std::vector<GNEEdge*> mySubPath;
65 
68 
71 
72  private:
74  Path();
75 
77  Path(Path*) = delete;
78 
80  Path& operator=(Path*) = delete;
81  };
82 
84  GNEPathCreator(GNEFrame* frameParent);
85 
88 
90  void showPathCreatorModule(const GNETagProperties& tagProperty, const bool consecutives);
91 
93  void hidePathCreatorModule();
94 
97 
99  void setVClass(SUMOVehicleClass vClass);
100 
102  bool addJunction(GNEJunction* junction);
103 
105  bool addTAZ(GNETAZ* taz);
106 
108  bool addEdge(GNEEdge* edge, const bool shiftKeyPressed, const bool controlKeyPressed);
109 
111  const std::vector<GNEEdge*>& getSelectedEdges() const;
112 
114  const std::vector<GNEJunction*>& getSelectedJunctions() const;
115 
117  const std::vector<GNETAZ*>& getSelectedTAZs() const;
118 
120  bool addRoute(GNEDemandElement* route);
121 
123  GNEDemandElement* getRoute() const;
124 
126  const std::vector<Path>& getPath() const;
127 
130 
132  void updateJunctionColors();
133 
135  void updateEdgeColors();
136 
138  void clearJunctionColors();
139 
141  void clearEdgeColors();
142 
144  void drawTemporalRoute(const GUIVisualizationSettings& s) const;
145 
147  bool createPath(const bool useLastRoute);
148 
150  void abortPathCreation();
151 
153  void removeLastElement();
154 
158  long onCmdCreatePath(FXObject*, FXSelector, void*);
159 
161  long onCmdUseLastRoute(FXObject*, FXSelector, void*);
162 
164  long onUpdUseLastRoute(FXObject*, FXSelector, void*);
165 
167  long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
168 
170  long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
171 
173  long onCmdShowCandidateEdges(FXObject*, FXSelector, void*);
175 
176 protected:
177  FOX_CONSTRUCTOR(GNEPathCreator)
178 
179  // @brief creation mode
180  enum Mode {
181  ONLY_FROMTO = 1 << 0, // Path only had two elements (first and last)
182  CONSECUTIVE_EDGES = 1 << 1, // Path's edges are consecutives
183  NONCONSECUTIVE_EDGES = 1 << 2, // Path's edges aren't consecutives
184  START_EDGE = 1 << 3, // Path begins in edge
185  END_EDGE = 1 << 4, // Path ends in edge
186  START_JUNCTION = 1 << 5, // Path begins in junction
187  END_JUNCTION = 1 << 6, // Path ends in junction
188  START_TAZ = 1 << 7, // Path begins in TAZ
189  END_TAZ = 1 << 8, // Path ends in TAZ
190  ROUTE = 1 << 9, // Path is over an existent edge
191  SHOW_CANDIDATE_EDGES = 1 << 10, // Show candidate edges
192  SHOW_CANDIDATE_JUNCTIONS = 1 << 11, // show candidate junctions
193  };
194 
196  void updateInfoRouteLabel();
197 
199  void clearPath();
200 
202  void recalculatePath();
203 
205  void setSpecialCandidates(GNEEdge* originEdge);
206 
208  void setPossibleCandidates(GNEEdge* originEdge, const SUMOVehicleClass vClass);
209 
212 
215 
218 
220  std::vector<GNEJunction*> mySelectedJunctions;
221 
223  std::vector<GNETAZ*> mySelectedTAZs;
224 
226  std::vector<GNEEdge*> mySelectedEdges;
227 
230 
232  std::vector<Path> myPath;
233 
236 
238  FXButton* myUseLastRoute;
239 
242 
245 
248 
250  FXCheckButton* myShowCandidateEdges;
251 
253  FXLabel* myShiftLabel;
254 
256  FXLabel* myControlLabel;
257 
260 private:
263 
266 };
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
Path & operator=(Path *)=delete
Invalidated assignment operator.
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
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.
GNEPathCreator & operator=(GNEPathCreator *)=delete
Invalidated assignment operator.
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
GNEPathCreator(GNEFrame *frameParent)
default constructor
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
Definition: GNETAZ.h:34
Stores the information about how to visualize structures.
MFXGroupBoxModule (based on FXGroupBox)