Eclipse SUMO - Simulation of Urban MObility
PointOfInterest.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2005-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 /****************************************************************************/
21 // A point-of-interest (2D)
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
31 #include <utils/geom/Position.h>
33 
34 #include "Shape.h"
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
43 class PointOfInterest : public Shape, public Position, public Parameterised {
44 
45 public:
66  PointOfInterest(const std::string& id, const std::string& type,
67  const RGBColor& color, const Position& pos, bool geo,
68  const std::string& lane, double posOverLane,
69  bool friendlyPos, double posLat,
70  const std::string& icon,
71  double layer = DEFAULT_LAYER,
72  double angle = DEFAULT_ANGLE,
73  const std::string& imgFile = DEFAULT_IMG_FILE,
74  bool relativePath = DEFAULT_RELATIVEPATH,
75  double width = DEFAULT_IMG_WIDTH,
76  double height = DEFAULT_IMG_HEIGHT,
77  const std::string& name = DEFAULT_NAME,
78  const Parameterised::Map& parameters = DEFAULT_PARAMETERS);
79 
82 
85 
87  POIIcon getIcon() const;
88 
90  const std::string& getIconStr() const;
91 
93  double getWidth() const;
94 
96  double getHeight() const;
97 
99  Position getCenter() const;
100 
102  bool getFriendlyPos() const;
103 
105 
106 
109 
111  void setIcon(const std::string& icon);
112 
114  void setWidth(double width);
115 
117  void setHeight(double height);
118 
120  void setFriendlyPos(const bool friendlyPos);
121 
123 
124  /* @brief POI definition to the given device
125  * @param[in] geo Whether to write the output in geo-coordinates
126  */
127  void writeXML(OutputDevice& out, const bool geo = false, const double zOffset = 0., const std::string laneID = "", const double pos = 0., const bool friendlyPos = false, const double posLat = 0.) const;
128 
129 protected:
131  bool myGeo;
132 
134  std::string myLane;
135 
138 
141 
143  double myPosLat;
144 
147 
150 
153 };
POIIcon
POI icons.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point-of-interest.
PointOfInterest(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, bool friendlyPos, double posLat, const std::string &icon, double layer=DEFAULT_LAYER, double angle=DEFAULT_ANGLE, const std::string &imgFile=DEFAULT_IMG_FILE, bool relativePath=DEFAULT_RELATIVEPATH, double width=DEFAULT_IMG_WIDTH, double height=DEFAULT_IMG_HEIGHT, const std::string &name=DEFAULT_NAME, const Parameterised::Map &parameters=DEFAULT_PARAMETERS)
Constructor.
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
POIIcon myIcon
POI icon.
POIIcon getIcon() const
get icon
~PointOfInterest()
Destructor.
bool getFriendlyPos() const
returns friendly position
void setHeight(double height)
set the image height of the POI
double myHalfImgHeight
The half height of the image when rendering this POI.
void setFriendlyPos(const bool friendlyPos)
set friendly position
double myPosLat
lateral position over lane in which this POI is placed (main used by netedit)
Position getCenter() const
Returns the image center of the POI.
void setWidth(double width)
set the image width of the POI
double getHeight() const
Returns the image height of the POI.
bool myFriendlyPos
friendlyPos enable or disable friendly position for position over lane
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
void setIcon(const std::string &icon)
set icon
double myPosOverLane
position over lane in which this POI is placed (main used by netedit)
double getWidth() const
Returns the image width of the POI.
const std::string & getIconStr() const
get icon(in string format)
void writeXML(OutputDevice &out, const bool geo=false, const double zOffset=0., const std::string laneID="", const double pos=0., const bool friendlyPos=false, const double posLat=0.) const
double myHalfImgWidth
The half width of the image when rendering this POI.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A 2D- or 3D-Shape.
Definition: Shape.h:38
static const bool DEFAULT_RELATIVEPATH
Definition: Shape.h:48
static const double DEFAULT_LAYER
Definition: Shape.h:43
static const double DEFAULT_IMG_WIDTH
Definition: Shape.h:49
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
static const double DEFAULT_ANGLE
Definition: Shape.h:46
static const std::string DEFAULT_NAME
Definition: Shape.h:51
static const double DEFAULT_IMG_HEIGHT
Definition: Shape.h:50
static const Parameterised::Map DEFAULT_PARAMETERS
Definition: Shape.h:52