Eclipse SUMO - Simulation of Urban MObility
GNETAZRelData.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 TAZ relation 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 GNETAZRelData : public GNEGenericData {
38 
39 public:
46  GNETAZRelData(GNEDataInterval* dataIntervalParent, GNETAZElement* fromTAZ, GNETAZElement* toTAZ,
47  const std::map<std::string, std::string>& parameters);
48 
51 
53  const RGBColor& getColor() const;
54 
56  bool isGenericDataVisible() const;
57 
59  void updateGeometry();
60 
63 
66 
69  void writeGenericData(OutputDevice& device) const;
70 
72  bool isGenericDataValid() const;
73 
75  std::string getGenericDataProblem() const;
76 
78  void fixGenericDataProblem();
80 
83 
88  void drawGL(const GUIVisualizationSettings& s) const;
89 
95  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const;
96 
103  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const;
104 
107 
109 
112  /* @brief method for getting the Attribute of an XML key
113  * @param[in] key The attribute key
114  * @return string with the value associated to key
115  */
116  std::string getAttribute(SumoXMLAttr key) const;
117 
118  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
119  * @param[in] key The attribute key
120  * @return double with the value associated to key
121  */
122  double getAttributeDouble(SumoXMLAttr key) const;
123 
129  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
130 
136  bool isValid(SumoXMLAttr key, const std::string& value);
137 
138  /* @brief method for enable attribute
139  * @param[in] key The attribute key
140  * @param[in] undoList The undoList on which to register changes
141  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
142  */
143  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
144 
145  /* @brief method for disable attribute
146  * @param[in] key The attribute key
147  * @param[in] undoList The undoList on which to register changes
148  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
149  */
150  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
151 
152  /* @brief method for check if the value for certain attribute is set
153  * @param[in] key The attribute key
154  */
155  bool isAttributeEnabled(SumoXMLAttr key) const;
156 
158  std::string getPopUpID() const;
159 
161  std::string getHierarchyName() const;
163 
164 private:
166  void setAttribute(SumoXMLAttr key, const std::string& value);
167 
169  void setEnabledAttribute(const int enabledAttributes);
170 
172  GNETAZRelData(const GNETAZRelData&) = delete;
173 
176 };
177 
178 /****************************************************************************/
179 
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.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZRelData.h:37
bool isGenericDataValid() const
check if current data set is valid to be writed into XML (by default true, can be reimplemented in ch...
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object (lane)
GNETAZRelData(GNEDataInterval *dataIntervalParent, GNETAZElement *fromTAZ, GNETAZElement *toTAZ, const std::map< std::string, std::string > &parameters)
Constructor.
void writeGenericData(OutputDevice &device) const
writte data set element into a xml file
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Boundary getCenteringBoundary() const
GNETAZRelData(const GNETAZRelData &)=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
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
bool isGenericDataVisible() const
check if current TAZ rel data is visible
std::string getGenericDataProblem() const
return a string with the current data set problem (by default empty, can be reimplemented in children...
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
const RGBColor & getColor() const
get TAZ rel data color
std::string getAttribute(SumoXMLAttr key) const
GNETAZRelData & operator=(const GNETAZRelData &)=delete
Invalidated assignment operator.
void updateGeometry()
update pre-computed geometry information
Position getPositionInView() const
Returns element position in view.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void fixGenericDataProblem()
fix data set problem (by default throw an exception, has to be reimplemented in children)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
bool isAttributeEnabled(SumoXMLAttr key) const
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
double getAttributeDouble(SumoXMLAttr key) const
~GNETAZRelData()
Destructor.
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