Eclipse SUMO - Simulation of Urban MObility
GNEEdgeData.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 /****************************************************************************/
18 // class for edge data
19 /****************************************************************************/
20 #pragma once
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 
27 #include "GNEGenericData.h"
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
32 
37 class GNEEdgeData : public GNEGenericData {
38 
39 public:
45  GNEEdgeData(GNEDataInterval* dataIntervalParent, GNEEdge* edgeParent, const std::map<std::string, std::string>& parameters);
46 
48  ~GNEEdgeData();
49 
51  const RGBColor& getColor() const;
52 
54  bool isGenericDataVisible() const;
55 
57  void updateGeometry();
58 
61 
64 
67  void writeGenericData(OutputDevice& device) const;
68 
70  bool isGenericDataValid() const;
71 
73  std::string getGenericDataProblem() const;
74 
76  void fixGenericDataProblem();
78 
81 
86  void drawGL(const GUIVisualizationSettings& s) const;
87 
93  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const;
94 
101  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const;
102 
105 
107 
110  /* @brief method for getting the Attribute of an XML key
111  * @param[in] key The attribute key
112  * @return string with the value associated to key
113  */
114  std::string getAttribute(SumoXMLAttr key) const;
115 
116  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
117  * @param[in] key The attribute key
118  * @return double with the value associated to key
119  */
120  double getAttributeDouble(SumoXMLAttr key) const;
121 
127  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
128 
134  bool isValid(SumoXMLAttr key, const std::string& value);
135 
136  /* @brief method for enable attribute
137  * @param[in] key The attribute key
138  * @param[in] undoList The undoList on which to register changes
139  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
140  */
141  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
142 
143  /* @brief method for disable attribute
144  * @param[in] key The attribute key
145  * @param[in] undoList The undoList on which to register changes
146  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
147  */
148  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
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 
156  std::string getPopUpID() const;
157 
159  std::string getHierarchyName() const;
161 
162 private:
164  void setAttribute(SumoXMLAttr key, const std::string& value);
165 
167  void setEnabledAttribute(const int enabledAttributes);
168 
170  GNEEdgeData(const GNEEdgeData&) = delete;
171 
173  GNEEdgeData& operator=(const GNEEdgeData&) = delete;
174 };
175 
176 /****************************************************************************/
177 
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEEdgeData.h:37
bool isGenericDataVisible() const
check if current edge data is visible
Definition: GNEEdgeData.cpp:80
GNEEdgeData & operator=(const GNEEdgeData &)=delete
Invalidated assignment operator.
std::string getAttribute(SumoXMLAttr key) const
void writeGenericData(OutputDevice &device) const
writte data set element into a xml file
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNEEdgeData(const GNEEdgeData &)=delete
Invalidated copy constructor.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform data set changes
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
bool isAttributeEnabled(SumoXMLAttr key) const
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getAttributeDouble(SumoXMLAttr key) const
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Boundary getCenteringBoundary() const
~GNEEdgeData()
Destructor.
Definition: GNEEdgeData.cpp:54
std::string getGenericDataProblem() const
return a string with the current data set problem (by default empty, can be reimplemented in children...
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object (lane)
const RGBColor & getColor() const
get edge data color
Definition: GNEEdgeData.cpp:58
void updateGeometry()
update pre-computed geometry information
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNEEdgeData(GNEDataInterval *dataIntervalParent, GNEEdge *edgeParent, const std::map< std::string, std::string > &parameters)
Constructor.
Definition: GNEEdgeData.cpp:48
bool isGenericDataValid() const
check if current data set is valid to be writed into XML (by default true, can be reimplemented in ch...
void fixGenericDataProblem()
fix data set problem (by default throw an exception, has to be reimplemented in children)
Position getPositionInView() const
Returns element position in view.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
An Element which don't belongs to GNENet but has influency in the simulation.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36