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-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 //
19 /****************************************************************************/
20 #pragma once
21 #include <netedit/GNEMoveElement.h>
23 
24 #include "GNETAZElement.h"
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
33 class GNETAZ : public GNETAZElement, private SUMOPolygon, public GNEMoveElement {
34 
35 public:
38 
44  GNETAZ(const std::string& id, GNENet* net, PositionVector shape, RGBColor color, bool blockMovement);
45 
47  ~GNETAZ();
48 
52  GNEMoveOperation* getMoveOperation(const double shapeOffset);
53 
55  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
56 
58  const PositionVector& getTAZElementShape() const;
59 
63  void writeTAZElement(OutputDevice& device) const;
64 
68  void updateGeometry();
69 
72 
75 
77 
79  bool isShapeBlocked() const;
80 
85  std::string getParentName() const;
86 
91  void drawGL(const GUIVisualizationSettings& s) const;
93 
96  /* @brief method for getting the Attribute of an XML key
97  * @param[in] key The attribute key
98  * @return string with the value associated to key
99  */
100  std::string getAttribute(SumoXMLAttr key) const;
101 
102  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
103  * @param[in] key The attribute key
104  * @return double with the value associated to key
105  */
106  double getAttributeDouble(SumoXMLAttr key) const;
107 
108  /* @brief method for setting the attribute and letting the object perform additional changes
109  * @param[in] key The attribute key
110  * @param[in] value The new value
111  * @param[in] undoList The undoList on which to register changes
112  */
113  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
114 
115  /* @brief method for checking if the key and their conrrespond attribute are valids
116  * @param[in] key The attribute key
117  * @param[in] value The value asociated to key key
118  * @return true if the value is valid, false in other case
119  */
120  bool isValid(SumoXMLAttr key, const std::string& value);
121 
122  /* @brief method for check if the value for certain attribute is set
123  * @param[in] key The attribute key
124  */
125  bool isAttributeEnabled(SumoXMLAttr key) const;
126 
128  std::string getPopUpID() const;
129 
131  std::string getHierarchyName() const;
133 
135  void updateParentAdditional();
136 
137 protected:
140 
143 
146 
147 private:
149  static const double myHintSize;
150 
152  static const double myHintSizeSquared;
153 
156 
159 
162 
165 
168 
171 
173  void setAttribute(SumoXMLAttr key, const std::string& value);
174 
176  void setMoveShape(const GNEMoveResult& moveResult);
177 
179  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
180 
182  GNETAZ(const GNETAZ&) = delete;
183 
185  GNETAZ& operator=(const GNETAZ&) = delete;
186 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
class for NETEDIT geometries over lanes
Definition: GNEGeometry.h:76
move element
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
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:33
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:170
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNETAZ.cpp:442
GNETAZ(const std::string &id, GNENet *net, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:43
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:164
const PositionVector & getTAZElementShape() const
get TAZ Shape
Definition: GNETAZ.cpp:138
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:149
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:203
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:448
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNETAZ.cpp:63
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:191
GNEGeometry::Geometry myTAZGeometry
geometry for lenghts/rotations
Definition: GNETAZ.h:145
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:176
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:59
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:161
void updateParentAdditional()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:460
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNETAZ.cpp:559
void writeTAZElement(OutputDevice &device) const
writte TAZElement element into a xml file
Definition: GNETAZ.cpp:144
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:163
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNETAZ.cpp:411
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:167
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:170
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:454
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:197
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNETAZ.cpp:104
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:323
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:388
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:152
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:158
GNETAZ & operator=(const GNETAZ &)=delete
Invalidated assignment operator.
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:142
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNETAZ.cpp:568
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNETAZ.cpp:367
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNETAZ.h:139
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:155
GNETAZ(const GNETAZ &)=delete
Invalidated copy constructor.
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
A list of positions.