Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEPlanCreator.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
23#include "GNEPlanSelector.h"
24
25// ===========================================================================
26// class declaration
27// ===========================================================================
28
29class GNEFrame;
30class GNEPathManager;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
38 FXDECLARE(GNEPlanCreator)
39
40public:
42 class PlanPath {
43
44 public:
46 PlanPath(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEEdge* fromEdge, GNEEdge* toEdge);
47
49 PlanPath(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEEdge* fromEdge, GNEJunction* toJunction);
50
52 PlanPath(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEJunction* fromJunction, GNEEdge* toEdge);
53
55 PlanPath(GNEPathManager* pathManager, const SUMOVehicleClass vClass, GNEJunction* fromJunction, GNEJunction* toJunction);
56
58 const std::vector<GNEEdge*>& getSubPath() const;
59
61 bool isConflictVClass() const;
62
64 bool isConflictDisconnected() const;
65
66 protected:
68 std::vector<GNEEdge*> mySubPath;
69
72
75
76 private:
78 PlanPath();
79
81 PlanPath(PlanPath*) = delete;
82
85 };
86
88 GNEPlanCreator(GNEFrame* frameParent, GNEPathManager* pathManager);
89
92
94 bool planCanBeCreated(const GNEDemandElement* planTemplate) const;
95
97 void showPlanCreatorModule(const GNEPlanSelector* planSelector, const GNEDemandElement* previousPlan);
98
101
103 bool addRoute(GNEDemandElement* route);
104
106 bool addEdge(GNELane* lane);
107
109 bool addJunction(GNEJunction* junction);
110
112 bool addTAZ(GNEAdditional* taz);
113
115 bool addStoppingPlace(GNEAdditional* stoppingPlace);
116
119
121 double getClickedPositionOverLane() const;
122
124 const std::vector<PlanPath>& getPath() const;
125
127 void drawTemporalRoute(const GUIVisualizationSettings& s) const;
128
130 void abortPathCreation();
131
133 void removeLastElement();
134
138 long onCmdCreatePath(FXObject*, FXSelector, void*);
139
141 long onCmdUseLastRoute(FXObject*, FXSelector, void*);
142
144 long onUpdUseLastRoute(FXObject*, FXSelector, void*);
145
147 long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
148
150 long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
152
153protected:
155 FOX_CONSTRUCTOR(GNEPlanCreator)
156
157 // @brief planParents
159 CONSECUTIVE_EDGES = 1 << 0, // Plan is placed over consecutive edges
160 ROUTE = 1 << 1, // Plan is placed over a single route
161 EDGE = 1 << 2, // Plan is placed over a single edge
162 STOPPINGPLACE = 1 << 3, // Plan is placed over a stoppingPlace
163 START_EDGE = 1 << 4, // Plan begins in edge
164 START_TAZ = 1 << 5, // Plan begins in TAZ
165 START_JUNCTION = 1 << 6, // Plan begins in junction
166 START_STOPPINGPLACE = 1 << 7, // Plan begins in busStop
167 END_EDGE = 1 << 8, // Plan ends in edge
168 END_TAZ = 1 << 9, // Plan ends in TAZ
169 END_JUNCTION = 1 << 10, // Plan ends in junction
170 END_STOPPINGPLACE = 1 << 11, // Plan ends in stoppingPlace
171 };
172
174 void clearPath();
175
177 void recalculatePath();
178
181
184
187
190
193
196
199
201 std::vector<PlanPath> myPath;
202
204 FXButton* myUseLastRoute;
205
208
211
214
216 FXLabel* myInfoLabel;
217
218private:
220 int getNumberOfSelectedElements() const;
221
223 void updateRemoveLastItemButton() const;
224
226 void showCreationButtons();
227
229 void hideCreationButtons();
230
232 void updateInfoLabel();
233
235 bool addSingleEdge(GNELane* lane);
236
238 bool addSingleStoppingPlace(GNEAdditional* stoppingPlace);
239
241 bool addConsecutiveEdge(GNEEdge* edge);
242
244 bool addFromToJunction(GNEJunction* junction);
245
247 bool addFromToTAZ(GNEAdditional* taz);
248
250 bool addFromToEdge(GNEEdge* edge);
251
253 bool addFromToStoppingPlace(GNEAdditional* stoppingPlace);
254
257
260};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
plan parameters (used for group all from-to parameters related with plans)
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
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
bool myConflictVClass
flag to mark this path as conflicted
bool isConflictDisconnected() const
check if current path is conflict due is disconnected
bool myConflictDisconnected
flag to mark this path as disconnected
const std::vector< GNEEdge * > & getSubPath() const
get sub path
PlanPath()
default constructor
std::vector< GNEEdge * > mySubPath
sub path
bool isConflictVClass() const
check if current path is conflict due vClass
PlanPath(PlanPath *)=delete
Invalidated copy constructor.
PlanPath & operator=(PlanPath *)=delete
Invalidated assignment operator.
bool addStoppingPlace(GNEAdditional *stoppingPlace)
add from to stoppingPlace
bool addConsecutiveEdge(GNEEdge *edge)
add consecutive edge
void removeLastElement()
remove path element
bool addRoute(GNEDemandElement *route)
add route
double myClickedPositionOverLane
clicked position over lane
const GNEDemandElement * myPreviousPlanElement
previous person plan element
double getClickedPositionOverLane() const
get clicked position over lane
bool addFromToJunction(GNEJunction *junction)
add junction
bool planCanBeCreated(const GNEDemandElement *planTemplate) const
check if plan can be created
long onUpdUseLastRoute(FXObject *, FXSelector, void *)
Called when update button "Use last route".
bool addSingleEdge(GNELane *lane)
add edge
GNEFrame * myFrameParent
current frame parent
int myPlanParents
allowed plan parents
void hidePathCreatorModule()
show GNEPlanCreator
long onCmdCreatePath(FXObject *, FXSelector, void *)
void showCreationButtons()
show creation buttons
long onCmdUseLastRoute(FXObject *, FXSelector, void *)
Called when the user click over button "Use last route".
bool addTAZ(GNEAdditional *taz)
add TAZ
void updateRemoveLastItemButton() const
check if enable remove last item button
GNEPlanCreator & operator=(GNEPlanCreator *)=delete
Invalidated assignment operator.
bool addJunction(GNEJunction *junction)
add junction
int getNumberOfSelectedElements() const
get number of selected elements
void recalculatePath()
recalculate path
CommonXMLStructure::PlanParameters myPlanParameteres
plan parameters
bool addEdge(GNELane *lane)
add edge (clicking over lanes)
SUMOVehicleClass myVClass
current vClass
bool addFromToEdge(GNEEdge *edge)
add from to edge
~GNEPlanCreator()
destructor
FXButton * myAbortCreationButton
button for abort route creation
GNEPathManager * myPathManager
path manager used in this plan creator
PlanParents
FOX need this.
void abortPathCreation()
abort path creation
long onCmdAbortPathCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Abort route creation".
void clearPath()
clear edges
FXButton * myFinishCreationButton
button for finish route creation
void drawTemporalRoute(const GUIVisualizationSettings &s) const
draw temporal route
bool addFromToTAZ(GNEAdditional *taz)
add TAZ
long onCmdRemoveLastElement(FXObject *, FXSelector, void *)
Called when the user click over button "Remove las inserted edge".
FXButton * myRemoveLastInsertedElement
button for removing last inserted element
std::vector< PlanPath > myPath
vector with current path
const std::vector< PlanPath > & getPath() const
get path route
GNEPlanCreator(GNEPlanCreator *)=delete
Invalidated copy constructor.
FXButton * myUseLastRoute
button for use last inserted route
bool addFromToStoppingPlace(GNEAdditional *stoppingPlace)
add from to stoppingPlace
FXLabel * myInfoLabel
info label
void hideCreationButtons()
hide creation buttons
void showPlanCreatorModule(const GNEPlanSelector *planSelector, const GNEDemandElement *previousPlan)
show plan creator for the given tag property
const CommonXMLStructure::PlanParameters & getPlanParameteres() const
get plan parameters
void updateInfoLabel()
update info label
bool addSingleStoppingPlace(GNEAdditional *stoppingPlace)
add stoppingPlace
Stores the information about how to visualize structures.
MFXGroupBoxModule (based on FXGroupBox)