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