Eclipse SUMO - Simulation of Urban MObility
GNETAZ.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 //
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include <netedit/GNEMoveElement.h>
24 
25 #include "GNETAZElement.h"
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNETAZ : public GNETAZElement, private SUMOPolygon, public GNEMoveElement {
35 
36 public:
39 
41  GNETAZ(GNENet* net);
42 
53  GNETAZ(const std::string& id, GNENet* net, const PositionVector& shape, const Position& TAZ, const bool fill,
54  const RGBColor& color, const std::string& name, const std::map<std::string, std::string>& parameters);
55 
57  ~GNETAZ();
58 
63 
69  int getVertexIndex(Position pos, bool snapToGrid);
70 
72  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
73 
75  const PositionVector& getTAZElementShape() const;
76 
80  void writeTAZElement(OutputDevice& device) const;
81 
85  void updateGeometry();
86 
89 
91  double getExaggeration(const GUIVisualizationSettings& s) const;
92 
95 
97 
102  std::string getParentName() const;
103 
112 
117  void drawGL(const GUIVisualizationSettings& s) const;
119 
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 getting the Attribute of an XML key in position format (to avoid unnecessary parse<position>(...) for certain attributes)
135  * @param[in] key The attribute key
136  * @return double with the value associated to key
137  */
139 
140  /* @brief method for setting the attribute and letting the object perform additional changes
141  * @param[in] key The attribute key
142  * @param[in] value The new value
143  * @param[in] undoList The undoList on which to register changes
144  */
145  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
146 
147  /* @brief method for checking if the key and their conrrespond attribute are valids
148  * @param[in] key The attribute key
149  * @param[in] value The value asociated to key key
150  * @return true if the value is valid, false in other case
151  */
152  bool isValid(SumoXMLAttr key, const std::string& value);
153 
154  /* @brief method for check if the value for certain attribute is set
155  * @param[in] key The attribute key
156  */
157  bool isAttributeEnabled(SumoXMLAttr key) const;
158 
160  std::string getPopUpID() const;
161 
163  std::string getHierarchyName() const;
165 
167  void updateTAZStadistic();
168 
169 protected:
172 
175 
178 
179 private:
181  static const double myHintSize;
182 
184  static const double myHintSizeSquared;
185 
188 
191 
194 
197 
200 
203 
205  void drawDottedContours(const GUIVisualizationSettings& s, const double TAZExaggeration) const;
206 
208  void setAttribute(SumoXMLAttr key, const std::string& value);
209 
211  void setMoveShape(const GNEMoveResult& moveResult);
212 
214  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
215 
217  GNETAZ(const GNETAZ&) = delete;
218 
220  GNETAZ& operator=(const GNETAZ&) = delete;
221 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
move element
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
const std::string & getID() const
get ID
Definition: GNETAZ.h:34
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:205
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNETAZ.cpp:550
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:196
const PositionVector & getTAZElementShape() const
get TAZ Shape
Definition: GNETAZ.cpp:155
Position myTAZCenter
TAZ center.
Definition: GNETAZ.h:177
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:181
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:261
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:556
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNETAZ.cpp:211
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:217
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNETAZ.cpp:475
void drawDottedContours(const GUIVisualizationSettings &s, const double TAZExaggeration) const
draw dotted contours
Definition: GNETAZ.cpp:625
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:83
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:193
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNETAZ.cpp:758
void updateTAZStadistic()
update TAZ Stadistic
Definition: GNETAZ.cpp:568
void writeTAZElement(OutputDevice &device) const
writte TAZElement element into a xml file
Definition: GNETAZ.cpp:161
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:194
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNETAZ.cpp:509
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:199
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNETAZ.cpp:87
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:202
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:562
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:234
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNETAZ.cpp:121
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:382
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNETAZ.cpp:240
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform TAZElement changes
Definition: GNETAZ.cpp:486
GUIGeometry myTAZGeometry
geometry for lenghts/rotations
Definition: GNETAZ.h:174
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:184
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:190
GNETAZ & operator=(const GNETAZ &)=delete
Invalidated assignment operator.
int getVertexIndex(Position pos, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape's edge
Definition: GNETAZ.cpp:105
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNETAZ.cpp:787
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNETAZ.cpp:454
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNETAZ.h:171
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:187
GNETAZ(const GNETAZ &)=delete
Invalidated copy constructor.
GNETAZ(GNENet *net)
@default GNETAZ Constructor
Definition: GNETAZ.cpp:49
The popup menu of a globject.
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
A list of positions.