Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/demand/GNEDemandElementPlan.h
185790 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file GNEDemandElementPlan.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Sep 2023
17
///
18
// An auxiliar, asbtract class for plan elements
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/geom/Position.h>
24
#include <utils/xml/SUMOXMLDefinitions.h>
25
#include <utils/vehicle/SUMOVehicleParameter.h>
26
#include <netedit/elements/moving/GNEMoveElementPlan.h>
27
28
#include "GNEPlanParents.h"
29
30
// ===========================================================================
31
// class declaration
32
// ===========================================================================
33
34
class SUMOVehicleParameter;
35
class GNEDemandElement;
36
class GNEEdge;
37
class GNEJunction;
38
class GNEAdditional;
39
class GNERoute;
40
41
// ===========================================================================
42
// class definitions
43
// ===========================================================================
44
45
class GNEDemandElementPlan {
46
47
protected:
48
/// @brief move element plan
49
GNEMoveElementPlan* myMoveElementPlan = nullptr;
50
51
/// @brief variable used for draw central contour
52
GNEContour myPlanContour;
53
54
/// @brief variable used for draw contour end
55
GNEContour myPlanContourEnd;
56
57
/// @brief plan boundary
58
Boundary myPlanBoundary;
59
60
/// @brief constructor
61
GNEDemandElementPlan(GNEDemandElement* planElement, const double departPosition, const double arrivalPosition);
62
63
/// @brief write plan element common attributes
64
void writeLocationAttributes(OutputDevice& device) const;
65
66
/// @brief write initial stop stage if plan starts at a stopping place
67
void writeOriginStop(OutputDevice& device) const;
68
69
/// @brief Returns an own popup-menu
70
GUIGLObjectPopupMenu* getPlanPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent);
71
72
/// @name path functions
73
/// @{
74
75
/// @brief get first plan path lane
76
GNELane* getFirstPlanPathLane() const;
77
78
/// @brief get last plan path lane
79
GNELane* getLastPlanPathLane() const;
80
81
/// @brief compute plan pathElement
82
void computePlanPathElement();
83
84
/// @}
85
86
/// @name geometry functions
87
/// @{
88
89
/// @brief update pre-computed geometry information
90
void updatePlanGeometry();
91
92
/// @brief get plan centering boundary
93
Boundary getPlanCenteringBoundary() const;
94
95
/// @brief update plan centering boundary
96
void updatePlanCenteringBoundary(const bool updateGrid);
97
98
/// @brief Returns position of additional in view
99
Position getPlanPositionInView() const;
100
101
/// @}
102
103
/// @name attribute functions
104
/// @{
105
106
/// @brief get plan attribute string
107
std::string getPlanAttribute(SumoXMLAttr key) const;
108
109
/// @brief get plan attribute double
110
double getPlanAttributeDouble(SumoXMLAttr key) const;
111
112
/// @brief get plan attribute position
113
Position getPlanAttributePosition(SumoXMLAttr key) const;
114
115
/// @brief set plan attribute
116
void setPlanAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
117
118
/// @brief check if plan attribute is valid
119
bool isPlanValid(SumoXMLAttr key, const std::string& value);
120
121
/// @brief check if plan attribute is enabled
122
bool isPlanAttributeEnabled(SumoXMLAttr key) const;
123
124
/// @brief set plan attribute (intern)
125
void setPlanAttribute(SumoXMLAttr key, const std::string& value);
126
127
/// @brief get plan Hierarchy Name (Used in AC Hierarchy)
128
std::string getPlanHierarchyName() const;
129
130
/// @}
131
132
/// @name drawing functions
133
/// @{
134
135
/// @brief check if person plan can be drawn
136
bool checkDrawPersonPlan() const;
137
138
/// @brief check if container plan can be drawn
139
bool checkDrawContainerPlan() const;
140
141
/// @brief draw plan
142
void drawPlanGL(const bool drawPlan, const GUIVisualizationSettings& s, const RGBColor& planColor, const RGBColor& planSelectedColor) const;
143
144
/// @brief draw plan partial lane
145
void drawPlanLanePartial(const bool drawPlan, const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront,
146
const double planWidth, const RGBColor& planColor, const RGBColor& planSelectedColor) const;
147
148
/// @brief draw plan partial junction
149
void drawPlanJunctionPartial(const bool drawPlan, const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront,
150
const double planWidth, const RGBColor& planColor, const RGBColor& planSelectedColor) const;
151
152
/// @}
153
154
/// @brief check if plan is valid
155
GNEDemandElement::Problem isPlanPersonValid() const;
156
157
/// @brief get plan problem
158
std::string getPersonPlanProblem() const;
159
160
/// @brief depart position (used in tranships)
161
double myDepartPosition;
162
163
/// @brief arrival position (used in all plans over edges)
164
double myArrivalPosition;
165
166
private:
167
/// @brief get end position radius
168
double getEndPosRadius(const GUIVisualizationSettings& s, const GNESegment* segment, const bool drawHalfWidth) const;
169
170
/// @brief draw from arrow
171
void drawFromArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNESegment* segment) const;
172
173
/// @brief draw to arrow
174
void drawToArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNESegment* segment) const;
175
176
/// @brief draw to arrow
177
void drawEndPosition(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const double endPosRadius) const;
178
179
/// @brief replace plan parent
180
void replacePlanParent(const std::string& newParentID);
181
182
/// @brief pointer to plan element
183
GNEDemandElement* myPlanElement;
184
185
/// @brief arrival position diameter
186
static const double myArrivalPositionDiameter;
187
188
/// @brief Invalidated copy constructor.
189
GNEDemandElementPlan(const GNEDemandElementPlan&) = delete;
190
191
/// @brief Invalidated assignment operator.
192
GNEDemandElementPlan& operator=(const GNEDemandElementPlan&) = delete;
193
};
194
195