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