Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/demand/GNERouteDistribution.h
185851 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 GNERouteDistribution.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2022
17
///
18
// Route distribution used in netedit
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEDemandElement.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNERouteDistribution : public GNEDemandElement {
30
31
public:
32
/// @brief default constructor
33
GNERouteDistribution(GNENet* net);
34
35
/// @brief parameter constructor
36
GNERouteDistribution(const std::string& ID, GNENet* net, FileBucket* fileBucket);
37
38
/// @brief destructor
39
~GNERouteDistribution();
40
41
/// @brief methods to retrieve the elements linked to this routeDistribution
42
/// @{
43
44
/// @brief get GNEMoveElement associated with this routeDistribution
45
GNEMoveElement* getMoveElement() const override;
46
47
/// @brief get parameters associated with this routeDistribution
48
Parameterised* getParameters() override;
49
50
/// @brief get parameters associated with this routeDistribution (constant)
51
const Parameterised* getParameters() const override;
52
53
/// @}
54
55
/**@brief write demand element element into a xml file
56
* @param[in] device device in which write parameters of demand element element
57
*/
58
void writeDemandElement(OutputDevice& device) const override;
59
60
/// @brief check if current demand element is valid to be written into XML
61
Problem isDemandElementValid() const override;
62
63
/// @brief return a string with the current demand element problem
64
std::string getDemandElementProblem() const override;
65
66
/// @brief fix demand element problem
67
void fixDemandElementProblem() override;
68
69
/// @name members and functions relative to elements common to all demand elements
70
/// @{
71
/// @brief obtain VClass related with this demand element
72
SUMOVehicleClass getVClass() const override;
73
74
/// @brief get color
75
const RGBColor& getColor() const override;
76
77
/// @}
78
79
/// @name Functions related with geometry of element
80
/// @{
81
/// @brief update pre-computed geometry information
82
void updateGeometry() override;
83
84
/// @brief Returns position of additional in view
85
Position getPositionInView() const override;
86
/// @}
87
88
/// @name inherited from GUIGlObject
89
/// @{
90
/**@brief Returns the name of the parent object
91
* @return This object's parent id
92
*/
93
std::string getParentName() const override;
94
95
/**@brief Returns the boundary to which the view shall be centered in order to show the object
96
* @return The boundary the object is within
97
*/
98
Boundary getCenteringBoundary() const override;
99
100
/// @brief split geometry
101
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
102
103
/**@brief Draws the object
104
* @param[in] s The settings for the current view (may influence drawing)
105
* @see GUIGlObject::drawGL
106
*/
107
void drawGL(const GUIVisualizationSettings& s) const override;
108
109
/// @}
110
111
/// @name inherited from GNEPathElement
112
/// @{
113
114
/// @brief compute pathElement
115
void computePathElement() override;
116
117
/**@brief Draws partial object over lane
118
* @param[in] s The settings for the current view (may influence drawing)
119
* @param[in] segment lane segment
120
* @param[in] offsetFront front offset
121
*/
122
void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
123
124
/**@brief Draws partial object over junction
125
* @param[in] s The settings for the current view (may influence drawing)
126
* @param[in] segment junction segment
127
* @param[in] offsetFront front offset
128
*/
129
void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
130
131
/// @brief get first path lane
132
GNELane* getFirstPathLane() const override;
133
134
/// @brief get last path lane
135
GNELane* getLastPathLane() const override;
136
/// @}
137
138
/// @brief inherited from GNEAttributeCarrier
139
/// @{
140
/* @brief method for getting the Attribute of an XML key
141
* @param[in] key The attribute key
142
* @return string with the value associated to key
143
*/
144
std::string getAttribute(SumoXMLAttr key) const override;
145
146
/* @brief method for getting the Attribute of an XML key in double format
147
* @param[in] key The attribute key
148
* @return double with the value associated to key
149
*/
150
double getAttributeDouble(SumoXMLAttr key) const override;
151
152
/* @brief method for getting the Attribute of an XML key in position format
153
* @param[in] key The attribute key
154
* @return position with the value associated to key
155
*/
156
Position getAttributePosition(SumoXMLAttr key) const override;
157
158
/* @brief method for setting the attribute and letting the object perform additional changes
159
* @param[in] key The attribute key
160
* @param[in] value The new value
161
* @param[in] undoList The undoList on which to register changes
162
* @param[in] net optionally the GNENet to inform about gui updates
163
*/
164
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
165
166
/* @brief method for setting the attribute and letting the object perform additional changes
167
* @param[in] key The attribute key
168
* @param[in] value The new value
169
* @param[in] undoList The undoList on which to register changes
170
*/
171
bool isValid(SumoXMLAttr key, const std::string& value) override;
172
173
/// @brief get PopPup ID (Used in AC Hierarchy)
174
std::string getPopUpID() const override;
175
176
/// @brief get Hierarchy Name (Used in AC Hierarchy)
177
std::string getHierarchyName() const override;
178
/// @}
179
180
private:
181
/// @brief method for setting the attribute and nothing else
182
void setAttribute(SumoXMLAttr key, const std::string& value) override;
183
184
/// @brief Invalidated copy constructor.
185
GNERouteDistribution(GNERouteDistribution*) = delete;
186
187
/// @brief Invalidated assignment operator
188
GNERouteDistribution* operator=(GNERouteDistribution*) = delete;
189
};
190
191