Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/data/GNEEdgeData.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 GNEEdgeData.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2020
17
///
18
// class for edge data
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEGenericData.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
/**
29
* @class GNEEdgeData
30
* @brief An Element which don't belong to GNENet but has influence in the simulation
31
*/
32
class GNEEdgeData : public GNEGenericData {
33
34
public:
35
/// @brief default Constructor
36
GNEEdgeData(GNENet* net);
37
38
/**@brief Constructor
39
* @param[in] dataIntervalParent pointer to data interval parent
40
* @param[in] edge pointer to Edge parent
41
* @param[in] parameters parameters map
42
*/
43
GNEEdgeData(GNEDataInterval* dataIntervalParent, GNEEdge* edge, const Parameterised::Map& parameters);
44
45
/// @brief Destructor
46
~GNEEdgeData();
47
48
/// @brief get edge data color
49
RGBColor setColor(const GUIVisualizationSettings& s) const;
50
51
double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
52
53
/// @brief check if current edge data is visible
54
bool isGenericDataVisible() const;
55
56
/// @brief update pre-computed geometry information
57
void updateGeometry();
58
59
/// @brief Returns element position in view
60
Position getPositionInView() const;
61
62
/// @name members and functions relative to write data sets into XML
63
/// @{
64
/**@brief write data set element into a xml file
65
* @param[in] device device in which write parameters of data set element
66
*/
67
void writeGenericData(OutputDevice& device) const;
68
69
/// @brief check if current data set is valid to be written into XML (by default true, can be reimplemented in children)
70
bool isGenericDataValid() const;
71
72
/// @brief return a string with the current data set problem (by default empty, can be reimplemented in children)
73
std::string getGenericDataProblem() const;
74
75
/// @brief fix data set problem (by default throw an exception, has to be reimplemented in children)
76
void fixGenericDataProblem();
77
/// @}
78
79
/// @name inherited from GUIGlObject
80
/// @{
81
82
/**@brief Draws the object
83
* @param[in] s The settings for the current view (may influence drawing)
84
* @see GUIGlObject::drawGL
85
*/
86
void drawGL(const GUIVisualizationSettings& s) const;
87
88
//// @brief Returns the boundary to which the view shall be centered in order to show the object
89
Boundary getCenteringBoundary() const;
90
91
/// @}
92
93
/// @name inherited from GNEPathElement
94
/// @{
95
96
/// @brief compute pathElement
97
void computePathElement();
98
99
/**@brief Draws partial object over lane
100
* @param[in] s The settings for the current view (may influence drawing)
101
* @param[in] segment lane segment
102
* @param[in] offsetFront front offset
103
*/
104
void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
105
106
/**@brief Draws partial object over junction
107
* @param[in] s The settings for the current view (may influence drawing)
108
* @param[in] segment junction segment
109
* @param[in] offsetFront front offset
110
*/
111
void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
112
113
/// @brief get first path lane
114
GNELane* getFirstPathLane() const;
115
116
/// @brief get last path lane
117
GNELane* getLastPathLane() const;
118
/// @}
119
120
/// @name inherited from GNEAttributeCarrier
121
/// @{
122
/* @brief method for getting the Attribute of an XML key
123
* @param[in] key The attribute key
124
* @return string with the value associated to key
125
*/
126
std::string getAttribute(SumoXMLAttr key) const;
127
128
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
129
* @param[in] key The attribute key
130
* @return double with the value associated to key
131
*/
132
double getAttributeDouble(SumoXMLAttr key) const;
133
134
/**@brief method for setting the attribute and letting the object perform data set 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 conrrespond 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 method for check if the value for certain attribute is set
149
* @param[in] key The attribute key
150
*/
151
bool isAttributeEnabled(SumoXMLAttr key) const;
152
153
/// @brief get PopPup ID (Used in AC Hierarchy)
154
std::string getPopUpID() const;
155
156
/// @brief get Hierarchy Name (Used in AC Hierarchy)
157
std::string getHierarchyName() const;
158
/// @}
159
160
private:
161
/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)
162
void setAttribute(SumoXMLAttr key, const std::string& value);
163
164
/// @brief Invalidated copy constructor.
165
GNEEdgeData(const GNEEdgeData&) = delete;
166
167
/// @brief Invalidated assignment operator.
168
GNEEdgeData& operator=(const GNEEdgeData&) = delete;
169
};
170
171
/****************************************************************************/
172
173