Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNECalibratorFlow.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 GNECalibratorFlow.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
// Flow used by GNECalibrators
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
#include <utils/vehicle/SUMOVehicleParameter.h>
23
24
#include "GNEAdditional.h"
25
26
// ===========================================================================
27
// class declaration
28
// ===========================================================================
29
30
class GNECalibrator;
31
class GNECalibratorDialog;
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
37
class GNECalibratorFlow : public GNEAdditional, public SUMOVehicleParameter {
38
39
public:
40
/// @brief default constructor
41
GNECalibratorFlow(GNENet* net);
42
43
/// @brief default constructor (used only in GNECalibratorDialog)
44
GNECalibratorFlow(GNEAdditional* calibratorParent, GNEDemandElement* vehicleType, GNEDemandElement* route);
45
46
/// @brief parameter constructor
47
GNECalibratorFlow(GNEAdditional* calibratorParent, GNEDemandElement* vehicleType, GNEDemandElement* route, const SUMOVehicleParameter& vehicleParameters);
48
49
/// @brief destructor
50
~GNECalibratorFlow();
51
52
/**@brief get move operation
53
* @note returned GNEMoveOperation can be nullptr
54
*/
55
GNEMoveOperation* getMoveOperation();
56
57
/// @name members and functions relative to write additionals into XML
58
/// @{
59
60
/**@brief write additional element into a xml file
61
* @param[in] device device in which write parameters of additional element
62
*/
63
void writeAdditional(OutputDevice& device) const;
64
65
/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)
66
bool isAdditionalValid() const;
67
68
/// @brief return a string with the current additional problem (must be reimplemented in all detector children)
69
std::string getAdditionalProblem() const;
70
71
/// @brief fix additional problem (must be reimplemented in all detector children)
72
void fixAdditionalProblem();
73
74
/// @}
75
76
/// @name Function related with contour drawing
77
/// @{
78
79
/// @brief check if draw move contour (red)
80
bool checkDrawMoveContour() const;
81
82
/// @}
83
84
/// @name Functions related with geometry of element
85
/// @{
86
87
/// @brief update pre-computed geometry information
88
void updateGeometry();
89
90
/// @brief Returns position of additional in view
91
Position getPositionInView() const;
92
93
/// @brief update centering boundary (implies change in RTREE)
94
void updateCenteringBoundary(const bool updateGrid);
95
96
/// @brief split geometry
97
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
98
99
/// @}
100
101
/// @name inherited from GUIGlObject
102
/// @{
103
104
/**@brief Returns the name of the parent object
105
* @return This object's parent id
106
*/
107
std::string getParentName() const;
108
109
/**@brief Draws the object
110
* @param[in] s The settings for the current view (may influence drawing)
111
* @see GUIGlObject::drawGL
112
*/
113
void drawGL(const GUIVisualizationSettings& s) const;
114
115
/// @}
116
117
/// @brief inherited from GNEAttributeCarrier
118
/// @{
119
120
/* @brief method for getting the Attribute of an XML key
121
* @param[in] key The attribute key
122
* @return string with the value associated to key
123
*/
124
std::string getAttribute(SumoXMLAttr key) const;
125
126
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
127
* @param[in] key The attribute key
128
* @return double with the value associated to key
129
*/
130
double getAttributeDouble(SumoXMLAttr key) const;
131
132
/// @brief get parameters map
133
const Parameterised::Map& getACParametersMap() const;
134
135
/* @brief method for setting the attribute and letting the object perform additional changes
136
* @param[in] key The attribute key
137
* @param[in] value The new value
138
* @param[in] undoList The undoList on which to register changes
139
* @param[in] net optionally the GNENet to inform about gui updates
140
*/
141
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
142
143
/* @brief method for setting the attribute and letting the object perform additional changes
144
* @param[in] key The attribute key
145
* @param[in] value The new value
146
* @param[in] undoList The undoList on which to register changes
147
*/
148
bool isValid(SumoXMLAttr key, const std::string& value);
149
150
/* @brief method for check if the value for certain attribute is set
151
* @param[in] key The attribute key
152
*/
153
bool isAttributeEnabled(SumoXMLAttr key) const;
154
155
/// @brief get PopPup ID (Used in AC Hierarchy)
156
std::string getPopUpID() const;
157
158
/// @brief get Hierarchy Name (Used in AC Hierarchy)
159
std::string getHierarchyName() const;
160
161
/// @}
162
163
private:
164
/// @brief method for setting the attribute and nothing else
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 toggle attribute
174
void toggleAttribute(SumoXMLAttr key, const bool value);
175
176
/// @brief Invalidated copy constructor.
177
GNECalibratorFlow(const GNECalibratorFlow&) = delete;
178
179
/// @brief Invalidated assignment operator
180
GNECalibratorFlow& operator=(const GNECalibratorFlow&) = delete;
181
};
182
183