Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEDestProbReroute.h
194760 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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 GNEDestProbReroute.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2017
17
///
18
//
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEAdditional.h"
24
#include "GNEAdditionalListed.h"
25
26
// ===========================================================================
27
// class declarations
28
// ===========================================================================
29
30
class GNEEdge;
31
class GNERerouterInterval;
32
class GNERerouterIntervalDialog;
33
34
// ===========================================================================
35
// class definitions
36
// ===========================================================================
37
38
class GNEDestProbReroute : public GNEAdditional, public GNEAdditionalListed {
39
40
public:
41
/// @brief constructor
42
GNEDestProbReroute(GNENet* net);
43
44
/// @brief constructor
45
GNEDestProbReroute(GNEAdditional* rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability);
46
47
/// @brief destructor
48
~GNEDestProbReroute();
49
50
/// @brief methods to retrieve the elements linked to this destProbReroute
51
/// @{
52
53
/// @brief get GNEMoveElement associated with this destProbReroute
54
GNEMoveElement* getMoveElement() const override;
55
56
/// @brief get parameters associated with this destProbReroute
57
Parameterised* getParameters() override;
58
59
/// @brief get parameters associated with this destProbReroute (constant)
60
const Parameterised* getParameters() const override;
61
62
/// @}
63
64
/// @name members and functions relative to write additionals into XML
65
/// @{
66
67
/**@brief write additional element into a xml file
68
* @param[in] device device in which write parameters of additional element
69
*/
70
void writeAdditional(OutputDevice& device) const override;
71
72
/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)
73
bool isAdditionalValid() const override;
74
75
/// @brief return a string with the current additional problem (must be reimplemented in all detector children)
76
std::string getAdditionalProblem() const override;
77
78
/// @brief fix additional problem (must be reimplemented in all detector children)
79
void fixAdditionalProblem() override;
80
81
/// @}
82
83
/// @name Function related with contour drawing
84
/// @{
85
86
/// @brief check if draw move contour (red)
87
bool checkDrawMoveContour() const override;
88
89
/// @}
90
91
/// @name Functions related with geometry of element
92
/// @{
93
94
/// @brief update pre-computed geometry information
95
void updateGeometry() override;
96
97
/// @brief Returns position of additional in view
98
Position getPositionInView() const override;
99
100
/// @brief update centering boundary (implies change in RTREE)
101
void updateCenteringBoundary(const bool updateGrid) override;
102
103
/// @brief split geometry
104
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
105
106
/// @}
107
108
/// @name inherited from GUIGlObject
109
/// @{
110
111
/**@brief Returns the name of the parent object
112
* @return This object's parent id
113
*/
114
std::string getParentName() const override;
115
116
/**@brief Draws the object
117
* @param[in] s The settings for the current view (may influence drawing)
118
* @see GUIGlObject::drawGL
119
*/
120
void drawGL(const GUIVisualizationSettings& s) const override;
121
122
/// @}
123
124
/// @name inherited from GNEAttributeCarrier
125
/// @{
126
127
/* @brief method for getting the Attribute of an XML key
128
* @param[in] key The attribute key
129
* @return string with the value associated to key
130
*/
131
std::string getAttribute(SumoXMLAttr key) const override;
132
133
/* @brief method for getting the Attribute of an XML key in double format
134
* @param[in] key The attribute key
135
* @return double with the value associated to key
136
*/
137
double getAttributeDouble(SumoXMLAttr key) const override;
138
139
/* @brief method for getting the Attribute of an XML key in position format
140
* @param[in] key The attribute key
141
* @return position with the value associated to key
142
*/
143
Position getAttributePosition(SumoXMLAttr key) const override;
144
145
/* @brief method for getting the Attribute of an XML key in positionVector format
146
* @param[in] key The attribute key
147
* @return positionVector with the value associated to key
148
*/
149
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
150
151
/* @brief method for setting the attribute and letting the object perform additional changes
152
* @param[in] key The attribute key
153
* @param[in] value The new value
154
* @param[in] undoList The undoList on which to register changes
155
*/
156
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
157
158
/* @brief method for checking if the key and their correspond attribute are valids
159
* @param[in] key The attribute key
160
* @param[in] value The value associated to key key
161
* @return true if the value is valid, false in other case
162
*/
163
bool isValid(SumoXMLAttr key, const std::string& value) override;
164
165
/// @brief get PopPup ID (Used in AC Hierarchy)
166
std::string getPopUpID() const override;
167
168
/// @brief get Hierarchy Name (Used in AC Hierarchy)
169
std::string getHierarchyName() const override;
170
171
/// @}
172
173
protected:
174
/// @brief id of new edge destination
175
GNEEdge* myNewEdgeDestination;
176
177
/// @brief probability with which a vehicle will use the given edge as destination
178
double myProbability;
179
180
private:
181
/// @brief set attribute after validation
182
void setAttribute(SumoXMLAttr key, const std::string& value) override;
183
184
/// @brief Invalidated copy constructor.
185
GNEDestProbReroute(const GNEDestProbReroute&) = delete;
186
187
/// @brief Invalidated assignment operator.
188
GNEDestProbReroute& operator=(const GNEDestProbReroute&) = delete;
189
};
190
191