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-2022 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 #include <config.h>
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 
28 #include "GNEGenericData.h"
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
33 
38 class GNETAZRelData : public GNEGenericData {
39 
40 public:
47  GNETAZRelData(GNEDataInterval* dataIntervalParent, GNETAZElement* fromTAZ, GNETAZElement* toTAZ,
48  const std::map<std::string, std::string>& parameters);
49 
55  GNETAZRelData(GNEDataInterval* dataIntervalParent, GNETAZElement* TAZ,
56  const std::map<std::string, std::string>& parameters);
57 
60 
62  const RGBColor& getColor() const;
63  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
64 
66  bool isGenericDataVisible() const;
67 
69  void updateGeometry();
70 
73 
76 
79  void writeGenericData(OutputDevice& device) const;
80 
82  bool isGenericDataValid() const;
83 
85  std::string getGenericDataProblem() const;
86 
88  void fixGenericDataProblem();
90 
93 
98  void drawGL(const GUIVisualizationSettings& s) const;
99 
101  double getExaggeration(const GUIVisualizationSettings& s) const;
102 
105 
107 
110 
112  void computePathElement();
113 
120  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
121 
129  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
130 
132  GNELane* getFirstPathLane() const;
133 
135  GNELane* getLastPathLane() const;
137 
140  /* @brief method for getting the Attribute of an XML key
141  * @param[in] key The attribute key
142  * @return string with the value associated to key
143  */
144  std::string getAttribute(SumoXMLAttr key) const;
145 
146  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
147  * @param[in] key The attribute key
148  * @return double with the value associated to key
149  */
150  double getAttributeDouble(SumoXMLAttr key) const;
151 
157  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
158 
164  bool isValid(SumoXMLAttr key, const std::string& value);
165 
166  /* @brief method for enable attribute
167  * @param[in] key The attribute key
168  * @param[in] undoList The undoList on which to register changes
169  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
170  */
171  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
172 
173  /* @brief method for disable attribute
174  * @param[in] key The attribute key
175  * @param[in] undoList The undoList on which to register changes
176  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
177  */
178  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
179 
180  /* @brief method for check if the value for certain attribute is set
181  * @param[in] key The attribute key
182  */
183  bool isAttributeEnabled(SumoXMLAttr key) const;
184 
186  std::string getPopUpID() const;
187 
189  std::string getHierarchyName() const;
191 
192 protected:
195 
198 
200  mutable RGBColor myColor;
201 
203  mutable double myLastWidth;
204 
205 private:
207  bool drawTAZRel() const;
208 
210  void setAttribute(SumoXMLAttr key, const std::string& value);
211 
213  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
214 
216  GNETAZRelData(const GNETAZRelData&) = delete;
217 
220 };
221 
222 /****************************************************************************/
223 
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:46
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:38
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
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 GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object (lane)
GNETAZRelData(GNEDataInterval *dataIntervalParent, GNETAZElement *fromTAZ, GNETAZElement *toTAZ, const std::map< std::string, std::string > &parameters)
Constructor for two TAZs.
void writeGenericData(OutputDevice &device) const
writte data set element into a xml file
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
RGBColor myColor
TAZRel data color.
Boundary getCenteringBoundary() const
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
GNETAZRelData(const GNETAZRelData &)=delete
Invalidated copy constructor.
GUIGeometry myTAZRelGeometry
Geometry for TAZRel data.
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
GNELane * getLastPathLane() const
get last path lane
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
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
GNETAZRelData & operator=(const GNETAZRelData &)=delete
Invalidated assignment operator.
void updateGeometry()
update pre-computed geometry information
Position getPositionInView() const
Returns element position in view.
GNELane * getFirstPathLane() const
get first path lane
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GUIGeometry myTAZRelGeometryCenter
Geometry for TAZRel data (center)
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 drawTAZRel() const
check draw conditions
bool isAttributeEnabled(SumoXMLAttr key) const
double myLastWidth
TAZRel data width.
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
void computePathElement()
compute pathElement
~GNETAZRelData()
Destructor.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37