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-2018 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(bool updateGrid);
62 
66 
69 
74  int moveVertexShape(const int index, const Position& oldPos, const Position& offset);
75 
80  void moveEntireShape(const PositionVector& oldShape, const Position& offset);
81 
86  void commitShapeChange(const PositionVector& oldShape, GNEUndoList* undoList);
87 
94  int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid);
95 
97  void deleteGeometryPoint(const Position& pos, bool allowUndo = true);
98 
100  bool isShapeBlocked() const;
102 
107  std::string getParentName() const;
108 
113  void drawGL(const GUIVisualizationSettings& s) const;
115 
118  /* @brief method for getting the Attribute of an XML key
119  * @param[in] key The attribute key
120  * @return string with the value associated to key
121  */
122  std::string getAttribute(SumoXMLAttr key) const;
123 
124  /* @brief method for setting the attribute and letting the object perform additional changes
125  * @param[in] key The attribute key
126  * @param[in] value The new value
127  * @param[in] undoList The undoList on which to register changes
128  */
129  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
130 
131  /* @brief method for checking if the key and their conrrespond attribute are valids
132  * @param[in] key The attribute key
133  * @param[in] value The value asociated to key key
134  * @return true if the value is valid, false in other case
135  */
136  bool isValid(SumoXMLAttr key, const std::string& value);
137 
139  std::string getPopUpID() const;
140 
142  std::string getHierarchyName() const;
144 
146  void updateAdditionalParent();
147 
148 protected:
151 
154 
157 
158 private:
160  static const double myHintSize;
161 
163  static const double myHintSizeSquared;
164 
167 
170 
173 
176 
179 
182 
184  void setAttribute(SumoXMLAttr key, const std::string& value);
185 
187  GNETAZ(const GNETAZ&) = delete;
188 
190  GNETAZ& operator=(const GNETAZ&) = delete;
191 };
192 
193 #endif
194 /****************************************************************************/
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:70
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:60
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:368
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNETAZ.cpp:76
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNETAZ.cpp:87
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:166
Stores the information about how to visualize structures.
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNETAZ.cpp:147
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:169
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:153
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:425
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNETAZ.cpp:195
void updateGeometry(bool updateGrid)
update pre-computed geometry information
Definition: GNETAZ.cpp:64
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNETAZ.cpp:96
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:163
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:160
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNETAZ.cpp:131
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:234
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:175
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:419
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:178
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:174
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:326
Definition: GNETAZ.h:35
int myCurrentMovingVertexIndex
index of vertex that is been moved (-1 means that none vertex is been moved)
Definition: GNETAZ.h:156
void updateAdditionalParent()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:431
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNETAZ.cpp:390
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
RGBColor myColor
TAZ Color.
Definition: GNETAZ.h:150
GNETAZ & operator=(const GNETAZ &)=delete
Invalidated assignment operator.
GNETAZ(const std::string &id, GNEViewNet *viewNet, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:44
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:172
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:228
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:181
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:240