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