Eclipse SUMO - Simulation of Urban MObility
GNEWalkingArea.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 // A class for visualizing and editing WalkingAreas
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include "GNENetworkElement.h"
24 #include <netbuild/NBNode.h>
25 
26 // ===========================================================================
27 // class declarations
28 // ===========================================================================
30 class PositionVector;
31 class GNEJunction;
32 class GNEEdge;
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
45 
46 public:
51  GNEWalkingArea(GNEJunction* parentJunction, const std::string& ID);
52 
55 
58 
60  void updateGeometry();
61 
64 
66 
69 
71  bool checkDrawFromContour() const;
72 
74  bool checkDrawToContour() const;
75 
77  bool checkDrawRelatedContour() const;
78 
80  bool checkDrawOverContour() const;
81 
83  bool checkDrawDeleteContour() const;
84 
86  bool checkDrawSelectContour() const;
87 
89  bool checkDrawMoveContour() const;
90 
92 
97 
99  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
100 
102 
105 
108 
111 
119 
122 
124  void updateCenteringBoundary(const bool updateGrid);
125 
130  void drawGL(const GUIVisualizationSettings& s) const;
131 
133  void deleteGLObject();
134 
136  void updateGLObject();
138 
141  /* @brief method for getting the Attribute of an XML key
142  * @param[in] key The attribute key
143  * @return string with the value associated to key
144  */
145  std::string getAttribute(SumoXMLAttr key) const;
146 
147  /* @brief method for setting the attribute and letting the object perform additional changes
148  * @param[in] key The attribute key
149  * @param[in] value The new value
150  * @param[in] undoList The undoList on which to register changes
151  */
152  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
153 
154  /* @brief method for checking if the key and their correspond attribute are valids
155  * @param[in] key The attribute key
156  * @param[in] value The value associated to key key
157  * @return true if the value is valid, false in other case
158  */
159  bool isValid(SumoXMLAttr key, const std::string& value);
160 
161  /* @brief method for check if the value for certain attribute is set
162  * @param[in] key The attribute key
163  */
164  bool isAttributeEnabled(SumoXMLAttr key) const;
165 
167 
169  const Parameterised::Map& getACParametersMap() const;
170 
171 protected:
174 
177 
179  mutable double myExaggeration;
180 
183 
184 private:
187  const PositionVector& shape, const double exaggeration) const;
188 
190  bool drawInContourMode() const;
191 
194 
196  void setAttribute(SumoXMLAttr key, const std::string& value);
197 
199  void setMoveShape(const GNEMoveResult& moveResult);
200 
202  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
203 
205  GNEWalkingArea(const GNEWalkingArea&) = delete;
206 
209 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
move operation
move result
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
~GNEWalkingArea()
Destructor.
bool checkDrawMoveContour() const
check if draw move contour (red)
GNEMoveOperation * getMoveOperation()
get move operation
std::string getAttribute(SumoXMLAttr key) const
void drawWalkingArea(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double exaggeration) const
draw walking area
bool checkDrawToContour() const
check if draw from contour (magenta)
GNEContour myInnenContour
variable used for draw innen contour
bool checkDrawOverContour() const
check if draw over contour (orange)
GNEWalkingArea(const GNEWalkingArea &)=delete
Invalidated copy constructor.
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool checkDrawSelectContour() const
check if draw select contour (blue)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double myExaggeration
exaggeration used in tesselation
bool checkDrawFromContour() const
check if draw from contour (green)
Position getPositionInView() const
Returns position of hierarchical element in view.
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
NBNode::WalkingArea & getNBWalkingArea() const
get referente to NBode::WalkingArea
void deleteGLObject()
delete element
bool isValid(SumoXMLAttr key, const std::string &value)
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
bool drawInContourMode() const
check if draw walking area in contour mode
GNEWalkingArea & operator=(const GNEWalkingArea &)=delete
Invalidated assignment operator.
GNEJunction * myParentJunction
the parent junction of this crossing
TesselatedPolygon myTesselation
An object that stores the shape and its tesselation.
GNEWalkingArea(GNEJunction *parentJunction, const std::string &ID)
Constructor.
void updateGLObject()
update GLObject (geometry, ID, etc.)
void drawTesselatedWalkingArea(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d) const
draw tesselated walking area
void updateGeometry()
update pre-computed geometry information
GNEJunction * getParentJunction() const
get parent Junction
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
bool isAttributeEnabled(SumoXMLAttr key) const
const Parameterised::Map & getACParametersMap() const
get parameters map
The popup menu of a globject.
Stores the information about how to visualize structures.
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.
A definition of a pedestrian walking area.
Definition: NBNode.h:177