Eclipse SUMO - Simulation of Urban MObility
GNEPOI.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-2022 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 POIS in netedit (adapted from
19 // GUIPointOfInterest and NLHandler)
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
25 
26 #include "GNEShape.h"
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 class GNELane;
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
43 class GNEPOI : public PointOfInterest, public GNEShape {
44 
45 public:
47  using GNEShape::getID;
48 
50  GNEPOI(SumoXMLTag tag, GNENet* net);
51 
69  GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, const double xLon,
70  const double yLat, const bool geo, const double layer, const double angle, const std::string& imgFile,
71  const bool relativePath, const double width, const double height, const std::string& name,
72  const std::map<std::string, std::string>& parameters);
73 
91  GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane, const bool friendlyPos,
92  const double posLat, const double layer, const double angle, const std::string& imgFile, const bool relativePath, const double width,
93  const double height, const std::string& name, const std::map<std::string, std::string>& parameters);
94 
96  ~GNEPOI();
97 
102 
104  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
105 
107  std::string generateChildID(SumoXMLTag childTag);
108 
113  void setParameter(const std::string& key, const std::string& value);
114 
117 
121  void updateGeometry();
122 
124  Position getPositionInView() const;
125 
127  double getExaggeration(const GUIVisualizationSettings& s) const;
128 
130  void updateCenteringBoundary(const bool updateGrid);
131 
135  void writeShape(OutputDevice& device);
136 
138  GUIGlID getGlID() const;
139 
141 
144 
147  std::string getParentName() const;
148 
157 
166 
171  void drawGL(const GUIVisualizationSettings& s) const;
173 
176 
180  std::string getAttribute(SumoXMLAttr key) const;
181 
187  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
188 
194  bool isValid(SumoXMLAttr key, const std::string& value);
195 
196  /* @brief method for check if the value for certain attribute is set
197  * @param[in] key The attribute key
198  */
199  bool isAttributeEnabled(SumoXMLAttr key) const;
201 
203  const std::map<std::string, std::string>& getACParametersMap() const;
204 
205 protected:
208 
211 
212 private:
214  void setAttribute(SumoXMLAttr key, const std::string& value);
215 
217  void setMoveShape(const GNEMoveResult& moveResult);
218 
220  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
221 
223  GNEPOI(const GNEPOI&) = delete;
224 
226  GNEPOI& operator=(const GNEPOI&) = delete;
227 };
unsigned int GUIGlID
Definition: GUIGlObject.h:40
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
Definition: GNEPOI.h:43
GNEPOI & operator=(const GNEPOI &)=delete
Invalidated assignment operator.
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEPOI.cpp:526
PositionVector myShapeWidth
shape width of POI
Definition: GNEPOI.h:207
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPOI.cpp:248
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:232
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPOI.cpp:689
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:82
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPOI.cpp:238
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPOI.cpp:515
Position getPositionInView() const
Returns position of shape in view.
Definition: GNEPOI.cpp:201
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPOI.cpp:670
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:270
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEPOI.cpp:213
void writeShape(OutputDevice &device)
writte shape element into a xml file
Definition: GNEPOI.cpp:161
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEPOI.cpp:130
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNEPOI.cpp:124
GNEPOI(const GNEPOI &)=delete
Invalidated copy constructor.
PositionVector myShapeHeight
shape height of POI
Definition: GNEPOI.h:210
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPOI.cpp:281
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspond attribute are valids
Definition: GNEPOI.cpp:437
GNEPOI(SumoXMLTag tag, GNENet *net)
Constructor.
Definition: GNEPOI.cpp:43
void updateGeometry()
update pre-computed geometry information
Definition: GNEPOI.cpp:174
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNEPOI.cpp:207
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEPOI.cpp:86
std::string getAttribute(SumoXMLAttr key) const
method for getting the Attribute of an XML key
Definition: GNEPOI.cpp:342
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: GNEPOI.cpp:136
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEPOI.cpp:407
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition: GNEPOI.cpp:142
const std::string & getID() const
get ID (all shapes have one)
Definition: GNEShape.cpp:53
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point-of-interest.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.