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;
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
34
37 FXDECLARE(GNEPlanCreator)
38
39public:
41 class PlanPath {
42
43 public:
45 PlanPath(GNEViewNet* viewNet, const SUMOVehicleClass vClass, GNEEdge* fromEdge, GNEEdge* toEdge);
46
48 PlanPath(GNEViewNet* viewNet, const SUMOVehicleClass vClass, GNEEdge* fromEdge, GNEJunction* toJunction);
49
51 PlanPath(GNEViewNet* viewNet, const SUMOVehicleClass vClass, GNEJunction* fromJunction, GNEEdge* toEdge);
52
54 PlanPath(GNEViewNet* viewNet, const SUMOVehicleClass vClass, GNEJunction* fromJunction, GNEJunction* toJunction);
55
57 const std::vector<GNEEdge*>& getSubPath() const;
58
60 bool isConflictVClass() const;
61
63 bool isConflictDisconnected() const;
64
65 protected:
67 std::vector<GNEEdge*> mySubPath;
68
71
74
75 private:
77 PlanPath();
78
80 PlanPath(PlanPath*) = delete;
81
84 };
85
87 GNEPlanCreator(GNEFrame* frameParent);
88
91
93 bool planCanBeCreated(const GNEDemandElement* planTemplate) const;
94
96 void showPlanCreatorModule(const GNEPlanSelector* planSelector, const GNEDemandElement* previousPlan);
97
100
102 bool addRoute(GNEDemandElement* route);
103
105 bool addEdge(GNELane* lane);
106
108 bool addJunction(GNEJunction* junction);
109
111 bool addTAZ(GNEAdditional* taz);
112
114 bool addStoppingPlace(GNEAdditional* stoppingPlace);
115
118
120 double getClickedPositionOverLane() const;
121
123 const std::vector<PlanPath>& getPath() const;
124
126 void drawTemporalRoute(const GUIVisualizationSettings& s) const;
127
129 void abortPathCreation();
130
132 void removeLastElement();
133
137 long onCmdCreatePath(FXObject*, FXSelector, void*);
138
140 long onCmdUseLastRoute(FXObject*, FXSelector, void*);
141
143 long onUpdUseLastRoute(FXObject*, FXSelector, void*);
144
146 long onCmdAbortPathCreation(FXObject*, FXSelector, void*);
147
149 long onCmdRemoveLastElement(FXObject*, FXSelector, void*);
151
152protected:
154 FOX_CONSTRUCTOR(GNEPlanCreator)
155
156 // @brief planParents
158 CONSECUTIVE_EDGES = 1 << 0, // Plan is placed over consecutive edges
159 ROUTE = 1 << 1, // Plan is placed over a single route
160 EDGE = 1 << 2, // Plan is placed over a single edge
161 STOPPINGPLACE = 1 << 3, // Plan is placed over a stoppingPlace
162 START_EDGE = 1 << 4, // Plan begins in edge
163 START_TAZ = 1 << 5, // Plan begins in TAZ
164 START_JUNCTION = 1 << 6, // Plan begins in junction
165 START_STOPPINGPLACE = 1 << 7, // Plan begins in busStop
166 END_EDGE = 1 << 8, // Plan ends in edge
167 END_TAZ = 1 << 9, // Plan ends in TAZ
168 END_JUNCTION = 1 << 10, // Plan ends in junction
169 END_STOPPINGPLACE = 1 << 11, // Plan ends in stoppingPlace
170 };
171
173 void clearPath();
174
176 void recalculatePath();
177
180
183
186
189
192
195
197 std::vector<PlanPath> myPath;
198
200 FXButton* myUseLastRoute;
201
204
207
210
212 FXLabel* myInfoLabel;
213
214private:
216 int getNumberOfSelectedElements() const;
217
219 void updateRemoveLastItemButton() const;
220
222 void showCreationButtons();
223
225 void hideCreationButtons();
226
228 void updateInfoLabel();
229
231 bool addSingleEdge(GNELane* lane);
232
234 bool addSingleStoppingPlace(GNEAdditional* stoppingPlace);
235
237 bool addConsecutiveEdge(GNEEdge* edge);
238
240 bool addFromToJunction(GNEJunction* junction);
241
243 bool addFromToTAZ(GNEAdditional* taz);
244
246 bool addFromToEdge(GNEEdge* edge);
247
249 bool addFromToStoppingPlace(GNEAdditional* stoppingPlace);
250
253
256};
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
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)