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 /****************************************************************************/
15 //
16 /****************************************************************************/
17 #ifndef GNETAZ_h
18 #define GNETAZ_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNEAdditional.h"
26 
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 class GNETAZ : public GNEAdditional {
36 
37 public:
43  GNETAZ(const std::string& id, GNEViewNet* viewNet, PositionVector shape, RGBColor color, bool blockMovement);
44 
46  ~GNETAZ();
47 
50 
53  void moveGeometry(const Position& offset);
54 
58  void commitGeometryMoving(GNEUndoList* undoList);
59 
61  void updateGeometry();
62 
65 
69 
72 
77  int moveVertexShape(const int index, const Position& oldPos, const Position& offset);
78 
83  void moveEntireShape(const PositionVector& oldShape, const Position& offset);
84 
89  void commitShapeChange(const PositionVector& oldShape, GNEUndoList* undoList);
90 
97  int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid);
98 
100  void deleteGeometryPoint(const Position& pos, bool allowUndo = true);
101 
103  bool isShapeBlocked() const;
105 
110  std::string getParentName() const;
111 
116  void drawGL(const GUIVisualizationSettings& s) const;
118 
121  /* @brief method for getting the Attribute of an XML key
122  * @param[in] key The attribute key
123  * @return string with the value associated to key
124  */
125  std::string getAttribute(SumoXMLAttr key) const;
126 
127  /* @brief method for setting the attribute and letting the object perform additional changes
128  * @param[in] key The attribute key
129  * @param[in] value The new value
130  * @param[in] undoList The undoList on which to register changes
131  */
132  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
133 
134  /* @brief method for checking if the key and their conrrespond attribute are valids
135  * @param[in] key The attribute key
136  * @param[in] value The value asociated to key key
137  * @return true if the value is valid, false in other case
138  */
139  bool isValid(SumoXMLAttr key, const std::string& value);
140 
142  std::string getPopUpID() const;
143 
145  std::string getHierarchyName() const;
147 
149  void updateAdditionalParent();
150 
151 protected:
154 
157 
160 
161 private:
163  static const double myHintSize;
164 
166  static const double myHintSizeSquared;
167 
170 
173 
176 
179 
182 
185 
187  void setAttribute(SumoXMLAttr key, const std::string& value);
188 
190  GNETAZ(const GNETAZ&) = delete;
191 
193  GNETAZ& operator=(const GNETAZ&) = delete;
194 };
195 
196 #endif
197 /****************************************************************************/
GNETAZ::myCurrentMovingVertexIndex
int myCurrentMovingVertexIndex
index of vertex that is been moved (-1 means that none vertex is been moved)
Definition: GNETAZ.h:159
GNETAZ::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:64
GNETAZ::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:346
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEAdditional.h
GNETAZ::deleteGeometryPoint
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNETAZ.cpp:210
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:189
GNETAZ::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:255
GNETAZ::myAverageWeightSink
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:184
GNETAZ::updateAdditionalParent
void updateAdditionalParent()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:451
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:410
GNEViewNet
Definition: GNEViewNet.h:43
GNETAZ::myColor
RGBColor myColor
TAZ Color.
Definition: GNETAZ.h:153
PositionVector
A list of positions.
Definition: PositionVector.h:46
GNETAZ::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNETAZ.cpp:91
GNETAZ::operator=
GNETAZ & operator=(const GNETAZ &)=delete
Invalidated assignment operator.
GNETAZ::myMaxWeightSource
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:169
GNETAZ::GNETAZ
GNETAZ(const std::string &id, GNEViewNet *viewNet, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:44
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:162
RGBColor
Definition: RGBColor.h:40
GNETAZ::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:445
GNETAZ::~GNETAZ
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:60
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNETAZ::myHintSizeSquared
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:166
GNETAZ::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNETAZ.cpp:102
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNETAZ::myHintSize
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:163
GNETAZ
Definition: GNETAZ.h:35
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:111
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:388
GNETAZ::myAverageWeightSource
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:175
GNETAZ::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:76
GNETAZ::isShapeBlocked
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:243
GNETAZ::myBlockShape
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:156
GNETAZ::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:70
GNETAZ::myMinWeightSource
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:172
GNETAZ::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:439
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNETAZ::moveEntireShape
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNETAZ.cpp:146
GNETAZ::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:249
GNETAZ::myMaxWeightSink
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:178
GNETAZ::myMinWeightSink
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:181