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