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.dev/sumo
3 // Copyright (C) 2001-2024 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 "GNEAdditional.h"
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNETAZ : public GNEAdditional, public TesselatedPolygon {
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 Parameterised::Map& parameters);
55 
57  ~GNETAZ();
58 
63 
69  int getVertexIndex(Position pos, bool snapToGrid);
70 
72  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
73 
76 
80  void writeAdditional(OutputDevice& device) const;
81 
83  bool isAdditionalValid() const;
84 
86  std::string getAdditionalProblem() const;
87 
89  void fixAdditionalProblem();
90 
92 
95 
97  bool checkDrawMoveContour() const;
98 
100 
103 
105  void updateGeometry();
106 
108  Position getPositionInView() const;
109 
111  double getExaggeration(const GUIVisualizationSettings& s) const;
112 
114  void updateCenteringBoundary(const bool updateGrid);
115 
117  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
118 
120 
123 
126  std::string getParentName() const;
127 
136 
141  void drawGL(const GUIVisualizationSettings& s) const;
142 
144 
147 
148  /* @brief method for getting the Attribute of an XML key
149  * @param[in] key The attribute key
150  * @return string with the value associated to key
151  */
152  std::string getAttribute(SumoXMLAttr key) const;
153 
154  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
155  * @param[in] key The attribute key
156  * @return double with the value associated to key
157  */
158  double getAttributeDouble(SumoXMLAttr key) const;
159 
160  /* @brief method for getting the Attribute of an XML key in position format (to avoid unnecessary parse<position>(...) for certain attributes)
161  * @param[in] key The attribute key
162  * @return double with the value associated to key
163  */
165 
167  const Parameterised::Map& getACParametersMap() const;
168 
169  /* @brief method for setting the attribute and letting the object perform additional changes
170  * @param[in] key The attribute key
171  * @param[in] value The new value
172  * @param[in] undoList The undoList on which to register changes
173  */
174  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
175 
176  /* @brief method for checking if the key and their corresponding attribute are valid
177  * @param[in] key The attribute key
178  * @param[in] value The value associated to key key
179  * @return true if the value is valid, false in other case
180  */
181  bool isValid(SumoXMLAttr key, const std::string& value);
182 
184  std::string getPopUpID() const;
185 
187  std::string getHierarchyName() const;
188 
190 
192  void updateTAZStatistic();
193 
194 protected:
197 
200 
201 private:
203  static const double myHintSize;
204 
206  static const double myHintSizeSquared;
207 
210 
213 
216 
219 
222 
225 
227  void setAttribute(SumoXMLAttr key, const std::string& value);
228 
230  void setMoveShape(const GNEMoveResult& moveResult);
231 
233  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
234 
236  GNETAZ(const GNETAZ&) = delete;
237 
239  GNETAZ& operator=(const GNETAZ&) = delete;
240 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
const std::string getID() const
get ID (all Attribute Carriers have one)
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
Definition: GNETAZ.h:34
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:231
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNETAZ.cpp:243
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
Definition: GNETAZ.cpp:192
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:218
Position myTAZCenter
TAZ center.
Definition: GNETAZ.h:196
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:203
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:304
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:587
GNEContour myTAZCenterContour
TAZ center contour.
Definition: GNETAZ.h:199
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
Definition: GNETAZ.cpp:186
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNETAZ.cpp:237
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNETAZ.cpp:271
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNETAZ.cpp:508
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:81
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:215
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNETAZ.cpp:725
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:219
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
Definition: GNETAZ.cpp:548
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:221
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNETAZ.cpp:85
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:224
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:593
std::string getParentName() const
Returns the name of the parent object.
Definition: GNETAZ.cpp:277
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
Definition: GNETAZ.cpp:198
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Definition: GNETAZ.cpp:153
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNETAZ.cpp:119
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:415
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNETAZ.cpp:283
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:525
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:206
void updateTAZStatistic()
update TAZ Statistic
Definition: GNETAZ.cpp:599
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:212
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:103
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNETAZ.cpp:755
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNETAZ.cpp:519
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNETAZ.cpp:487
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:209
GNETAZ(const GNETAZ &)=delete
Invalidated copy constructor.
bool checkDrawMoveContour() const
check if draw move contour (red)
Definition: GNETAZ.cpp:204
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
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.