Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/data/GNETAZRelData.h
193871 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 GNETAZRelData.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2020
17
///
18
// class for TAZ relation data
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/elements/GNEContour.h>
24
#include <utils/gui/div/GUIGeometry.h>
25
26
#include "GNEGenericData.h"
27
28
// ===========================================================================
29
// class definitions
30
// ===========================================================================
31
/**
32
* @class GNETAZRelData
33
* @brief An Element which don't belong to GNENet but has influence in the simulation
34
*/
35
class GNETAZRelData : public GNEGenericData {
36
37
public:
38
/// @brief default Constructor
39
GNETAZRelData(GNENet* net);
40
41
/**@brief Constructor for two TAZs
42
* @param[in] dataIntervalParent pointer to data interval parent
43
* @param[in] fromTAZ pointer to from TAZ
44
* @param[in] toTAZ pointer to to TAZ
45
* @param[in] parameters parameters map
46
*/
47
GNETAZRelData(GNEDataInterval* dataIntervalParent, GNEAdditional* fromTAZ, GNEAdditional* toTAZ,
48
const Parameterised::Map& parameters);
49
50
/**@brief Constructor for one TAZ
51
* @param[in] dataIntervalParent pointer to data interval parent
52
* @param[in] TAZ pointer to TAZ
53
* @param[in] parameters parameters map
54
*/
55
GNETAZRelData(GNEDataInterval* dataIntervalParent, GNEAdditional* TAZ,
56
const Parameterised::Map& parameters);
57
58
/// @brief Destructor
59
~GNETAZRelData();
60
61
/// @brief get TAZ rel data color
62
RGBColor setColor(const GUIVisualizationSettings& s) const;
63
double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;
64
double getScaleValue(const GUIVisualizationSettings& s, int activeScheme) const;
65
66
/// @brief check if current TAZ rel data is visible
67
bool isGenericDataVisible() const override;
68
69
/// @brief update pre-computed geometry information
70
void updateGeometry() override;
71
72
/// @brief Returns element position in view
73
Position getPositionInView() const override;
74
75
/// @name members and functions relative to write data sets into XML
76
/// @{
77
/**@brief write data set element into a xml file
78
* @param[in] device device in which write parameters of data set element
79
*/
80
void writeGenericData(OutputDevice& device) const override;
81
82
/// @brief check if current data set is valid to be written into XML (by default true, can be reimplemented in children)
83
bool isGenericDataValid() const override;
84
85
/// @brief return a string with the current data set problem (by default empty, can be reimplemented in children)
86
std::string getGenericDataProblem() const override;
87
88
/// @brief fix data set problem (by default throw an exception, has to be reimplemented in children)
89
void fixGenericDataProblem() override;
90
/// @}
91
92
/// @name inherited from GUIGlObject
93
/// @{
94
95
/**@brief Draws the object
96
* @param[in] s The settings for the current view (may influence drawing)
97
* @see GUIGlObject::drawGL
98
*/
99
void drawGL(const GUIVisualizationSettings& s) const override;
100
101
//// @brief Returns the boundary to which the view shall be centered in order to show the object
102
Boundary getCenteringBoundary() const override;
103
104
/// @}
105
106
/// @name inherited from GNEPathElement
107
/// @{
108
109
/// @brief compute pathElement
110
void computePathElement() override;
111
112
/**@brief Draws partial object over lane
113
* @param[in] s The settings for the current view (may influence drawing)
114
* @param[in] segment lane segment
115
* @param[in] offsetFront front offset
116
*/
117
void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
118
119
/**@brief Draws partial object over junction
120
* @param[in] s The settings for the current view (may influence drawing)
121
* @param[in] segment junction segment
122
* @param[in] offsetFront front offset
123
*/
124
void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
125
126
/// @brief get first path lane
127
GNELane* getFirstPathLane() const override;
128
129
/// @brief get last path lane
130
GNELane* getLastPathLane() const override;
131
/// @}
132
133
/// @name inherited from GNEAttributeCarrier
134
/// @{
135
/* @brief method for getting the Attribute of an XML key
136
* @param[in] key The attribute key
137
* @return string with the value associated to key
138
*/
139
std::string getAttribute(SumoXMLAttr key) const override;
140
141
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
142
* @param[in] key The attribute key
143
* @return double with the value associated to key
144
*/
145
double getAttributeDouble(SumoXMLAttr key) const override;
146
147
/**@brief method for setting the attribute and letting the object perform data set changes
148
* @param[in] key The attribute key
149
* @param[in] value The new value
150
* @param[in] undoList The undoList on which to register changes
151
*/
152
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
153
154
/**@brief method for checking if the key and their conrrespond attribute are valids
155
* @param[in] key The attribute key
156
* @param[in] value The value associated to key key
157
* @return true if the value is valid, false in other case
158
*/
159
bool isValid(SumoXMLAttr key, const std::string& value) override;
160
161
/* @brief method for check if the value for certain attribute is set
162
* @param[in] key The attribute key
163
*/
164
bool isAttributeEnabled(SumoXMLAttr key) const override;
165
166
/// @brief get PopPup ID (Used in AC Hierarchy)
167
std::string getPopUpID() const override;
168
169
/// @brief get Hierarchy Name (Used in AC Hierarchy)
170
std::string getHierarchyName() const override;
171
/// @}
172
173
protected:
174
/// @brief variable used for draw contours
175
GNEContour myTAZRelDataContour;
176
177
/// @brief Geometry for TAZRel data
178
GUIGeometry myTAZRelGeometry;
179
180
/// @brief Geometry for TAZRel data (center)
181
GUIGeometry myTAZRelGeometryCenter;
182
183
/// @brief TAZRel data width
184
mutable double myLastWidth;
185
186
private:
187
/// @brief check draw conditions
188
bool drawTAZRel() const;
189
190
/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)
191
void setAttribute(SumoXMLAttr key, const std::string& value) override;
192
193
/// @brief sets the color according to the current scheme index and some tazRel function
194
bool setFunctionalColor(int activeScheme, RGBColor& col) const;
195
196
/// @brief Invalidated copy constructor.
197
GNETAZRelData(const GNETAZRelData&) = delete;
198
199
/// @brief Invalidated assignment operator.
200
GNETAZRelData& operator=(const GNETAZRelData&) = delete;
201
};
202
203
/****************************************************************************/
204
205