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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 //
15 /****************************************************************************/
16 #ifndef GNETAZ_h
17 #define GNETAZ_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEAdditional.h"
25 
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNETAZ : public GNEAdditional {
35 
36 public:
42  GNETAZ(const std::string& id, GNEViewNet* viewNet, PositionVector shape, RGBColor color, bool blockMovement);
43 
45  ~GNETAZ();
46 
48  const PositionVector& getTAZShape() const;
49 
52 
55  void moveGeometry(const Position& offset);
56 
60  void commitGeometryMoving(GNEUndoList* undoList);
61 
63  void updateGeometry();
64 
67 
70 
72  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
74 
77 
82  int moveVertexShape(const int index, const Position& oldPos, const Position& offset);
83 
88  void moveEntireShape(const PositionVector& oldShape, const Position& offset);
89 
94  void commitShapeChange(const PositionVector& oldShape, GNEUndoList* undoList);
95 
102  int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid);
103 
105  void deleteGeometryPoint(const Position& pos, bool allowUndo = true);
106 
108  bool isShapeBlocked() const;
110 
115  std::string getParentName() const;
116 
121  void drawGL(const GUIVisualizationSettings& s) const;
123 
126  /* @brief method for getting the Attribute of an XML key
127  * @param[in] key The attribute key
128  * @return string with the value associated to key
129  */
130  std::string getAttribute(SumoXMLAttr key) const;
131 
132  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
133  * @param[in] key The attribute key
134  * @return double with the value associated to key
135  */
136  double getAttributeDouble(SumoXMLAttr key) const;
137 
138  /* @brief method for setting the attribute and letting the object perform additional changes
139  * @param[in] key The attribute key
140  * @param[in] value The new value
141  * @param[in] undoList The undoList on which to register changes
142  */
143  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
144 
145  /* @brief method for checking if the key and their conrrespond attribute are valids
146  * @param[in] key The attribute key
147  * @param[in] value The value asociated to key key
148  * @return true if the value is valid, false in other case
149  */
150  bool isValid(SumoXMLAttr key, const std::string& value);
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 
165  void updateParentAdditional();
166 
167 protected:
170 
173 
176 
179 
180 private:
182  static const double myHintSize;
183 
185  static const double myHintSizeSquared;
186 
189 
192 
195 
198 
201 
204 
206  void setAttribute(SumoXMLAttr key, const std::string& value);
207 
209  GNETAZ(const GNETAZ&) = delete;
210 
212  GNETAZ& operator=(const GNETAZ&) = delete;
213 };
214 
215 #endif
216 /****************************************************************************/
GNETAZ::myCurrentMovingVertexIndex
int myCurrentMovingVertexIndex
index of vertex that is been moved (-1 means that none vertex is been moved)
Definition: GNETAZ.h:178
GNETAZ::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:68
GNETAZ::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:353
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEAdditional.h
GNETAZ::deleteGeometryPoint
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNETAZ.cpp:217
GNETAZ::getVertexIndex
int getVertexIndex(Position pos, bool createIfNoExist, 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:196
GNETAZ::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:262
GNETAZ::myAverageWeightSink
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:203
GNETAZ::myTAZShape
PositionVector myTAZShape
TAZ shape.
Definition: GNETAZ.h:172
GNETAZ::updateParentAdditional
void updateParentAdditional()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:485
GNETAZ::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNETAZ.cpp:438
GNETAZ::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNETAZ.cpp:395
GNEViewNet
Definition: GNEViewNet.h:42
GNETAZ::myColor
RGBColor myColor
TAZ Color.
Definition: GNETAZ.h:169
PositionVector
A list of positions.
Definition: PositionVector.h:45
GNETAZ::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNETAZ.cpp:101
GNETAZ::operator=
GNETAZ & operator=(const GNETAZ &)=delete
Invalidated assignment operator.
GNETAZ::myMaxWeightSource
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:188
GNETAZ::GNETAZ
GNETAZ(const std::string &id, GNEViewNet *viewNet, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:43
GNETAZ::commitShapeChange
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(....
Definition: GNETAZ.cpp:169
RGBColor
Definition: RGBColor.h:39
GNETAZ::GNETAZ
GNETAZ(const GNETAZ &)=delete
Invalidated copy constructor.
GNETAZ::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNETAZ.cpp:95
GNETAZ::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:479
GNETAZ::~GNETAZ
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:58
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNETAZ::myHintSizeSquared
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:185
GNETAZ::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNETAZ.cpp:111
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNETAZ::myHintSize
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:182
GNETAZ
Definition: GNETAZ.h:34
GNETAZ::moveVertexShape
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNETAZ.cpp:120
GNENetElement
Definition: GNENetElement.h:43
GNETAZ::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNETAZ.cpp:416
GNETAZ::myAverageWeightSource
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:194
GNETAZ::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:80
GNETAZ::isShapeBlocked
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:250
GNETAZ::myBlockShape
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:175
GNETAZ::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:74
GNETAZ::myMinWeightSource
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:191
GNETAZ::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:473
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNETAZ::moveEntireShape
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNETAZ.cpp:155
GNETAZ::getTAZShape
const PositionVector & getTAZShape() const
get TAZ shape
Definition: GNETAZ.cpp:62
GNETAZ::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNETAZ.cpp:467
GNETAZ::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:256
GNETAZ::myMaxWeightSink
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:197
GNETAZ::myMinWeightSink
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:200