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