Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEPOI.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-2025 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>
23
24#include <utils/shapes/Shape.h>
26
27#include "GNEAdditional.h"
28
29// ===========================================================================
30// class declaration
31// ===========================================================================
32
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
39
40class GNEPOI : public Shape, public GNEAdditional, public Parameterised {
41
42public:
43 // avoid diamond problem
45
47 GNEPOI(SumoXMLTag tag, GNENet* net);
48
66 GNEPOI(const std::string& id, GNENet* net, const std::string& filename, const std::string& type, const RGBColor& color,
67 const Position& pos, const bool geo, POIIcon icon, const double layer, const double angle, const std::string& imgFile,
68 const double width, const double height, const std::string& name, const Parameterised::Map& parameters);
69
88 GNEPOI(const std::string& id, GNENet* net, const std::string& filename, const std::string& type, const RGBColor& color, GNELane* lane,
89 const double posOverLane, const bool friendlyPos, const double posLat, POIIcon icon, const double layer, const double angle,
90 const std::string& imgFile, const double width, const double height, const std::string& name, const Parameterised::Map& parameters);
91
93 ~GNEPOI();
94
97
99 GNEMoveElement* getMoveElement() const override;
100
102 Parameterised* getParameters() override;
103
105 const Parameterised* getParameters() const override;
106
108
110 std::string generateChildID(SumoXMLTag childTag);
111
114
117
119 void updateGeometry() override;
120
122 Position getPositionInView() const override;
123
125 double getExaggeration(const GUIVisualizationSettings& s) const override;
126
128 void updateCenteringBoundary(const bool updateGrid) override;
129
131 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement,
132 const GNENetworkElement* newElement, GNEUndoList* undoList) override;
133
137 void writeAdditional(OutputDevice& device) const override;
138
140 bool isAdditionalValid() const override;
141
143 std::string getAdditionalProblem() const override;
144
146 void fixAdditionalProblem() override;
147
149 GUIGlID getGlID() const;
150
152
155
157 bool checkDrawMoveContour() const override;
158
160
163
166 std::string getParentName() const override;
167
176
181 void drawGL(const GUIVisualizationSettings& s) const override;
182
184
187
192 std::string getAttribute(SumoXMLAttr key) const override;
193
194 /* @brief method for getting the Attribute of an XML key in double format
195 * @param[in] key The attribute key
196 * @return double with the value associated to key
197 */
198 double getAttributeDouble(SumoXMLAttr key) const override;
199
200 /* @brief method for getting the Attribute of an XML key in position format
201 * @param[in] key The attribute key
202 * @return position with the value associated to key
203 */
204 Position getAttributePosition(SumoXMLAttr key) const override;
205
206 /* @brief method for getting the Attribute of an XML key in positionVector format
207 * @param[in] key The attribute key
208 * @return positionVector with the value associated to key
209 */
211
217 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
218
224 bool isValid(SumoXMLAttr key, const std::string& value) override;
225
226 /* @brief method for check if the value for certain attribute is set
227 * @param[in] key The attribute key
228 */
229 bool isAttributeEnabled(SumoXMLAttr key) const override;
230
232
234 std::string getPopUpID() const override;
235
237 std::string getHierarchyName() const override;
238
239protected:
242
244 double myPosOverLane = 0;
245
247 bool myFriendlyPos = false;
248
250 double myWidth = 0;
251
253 double myHeight = 0;
254
256 double myPosLat = 0;
257
260
263
266
267private:
270 const bool movingGeometryPoints) const;
271
274 const double exaggeration, const bool movingGeometryPoints) const;
275
277 void setAttribute(SumoXMLAttr key, const std::string& value) override;
278
280 GNEPOI(const GNEPOI&) = delete;
281
283 GNEPOI& operator=(const GNEPOI&) = delete;
284};
unsigned int GUIGlID
Definition GUIGlObject.h:44
POIIcon
POI icons.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const std::string getID() const
get ID (all Attribute Carriers have one)
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their correspond attribute are valids
Definition GNEPOI.cpp:533
Position getPositionInView() const override
Returns position of shape in view.
Definition GNEPOI.cpp:248
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEPOI.cpp:600
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEPOI.cpp:349
void drawPOI(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool movingGeometryPoints) const
draw POI
Definition GNEPOI.cpp:615
void calculatePOIContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool movingGeometryPoints) const
calculate contour
Definition GNEPOI.cpp:703
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNEPOI.cpp:260
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEPOI.cpp:487
Parameterised * getParameters() override
get parameters associated with this POI
Definition GNEPOI.cpp:113
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEPOI.cpp:606
std::string getParentName() const override
Returns the name of the parent object.
Definition GNEPOI.cpp:317
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:211
std::string getAttribute(SumoXMLAttr key) const override
method for getting the Attribute of an XML key
Definition GNEPOI.cpp:395
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNEPOI.cpp:254
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition GNEPOI.cpp:295
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:199
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
Definition GNEPOI.cpp:497
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:96
GNEMoveElementLaneSingle * myMoveElementLaneSingle
move element over single lane
Definition GNEPOI.h:262
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition GNEPOI.cpp:582
GNEMoveElementViewResizable * myMoveElementViewResizable
move element view resizable
Definition GNEPOI.h:265
double myPosLat
lateral position;
Definition GNEPOI.h:256
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this POI
Definition GNEPOI.cpp:103
double myWidth
width
Definition GNEPOI.h:250
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEPOI.cpp:444
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition GNEPOI.cpp:125
POIIcon myPOIIcon
POI icon.
Definition GNEPOI.h:259
GNEPOI(const GNEPOI &)=delete
Invalidated copy constructor.
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNEPOI.cpp:150
void updateGeometry() override
update pre-computed geometry information
Definition GNEPOI.cpp:221
bool checkDrawMoveContour() const override
check if draw move contour (red)
Definition GNEPOI.cpp:301
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEPOI.cpp:289
double myHeight
height
Definition GNEPOI.h:253
Position myPosOverView
position over view
Definition GNEPOI.h:241
bool isAdditionalValid() const override
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
Definition GNEPOI.cpp:187
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
method for setting the attribute and letting the object perform additional changes
Definition GNEPOI.cpp:503
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition GNEPOI.cpp:327
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition GNEPOI.cpp:131
bool myFriendlyPos
friendly position
Definition GNEPOI.h:247
double myPosOverLane
position over lane
Definition GNEPOI.h:244
GNEPOI & operator=(const GNEPOI &)=delete
Invalidated assignment operator.
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.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
A 2D- or 3D-Shape.
Definition Shape.h:38