Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/shapes/PointOfInterest.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2005-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
/****************************************************************************/
14
/// @file PointOfInterest.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @author Melanie Knocke
19
/// @date 2005-09-15
20
///
21
// A point-of-interest (2D)
22
/****************************************************************************/
23
#pragma once
24
#include <config.h>
25
26
#include <utils/common/FileHelpers.h>
27
#include <utils/common/Parameterised.h>
28
#include <utils/common/StringBijection.h>
29
#include <utils/common/StringUtils.h>
30
#include <utils/geom/GeoConvHelper.h>
31
#include <utils/geom/Position.h>
32
#include <utils/iodevices/OutputDevice.h>
33
34
#include "Shape.h"
35
36
// ===========================================================================
37
// class definitions
38
// ===========================================================================
39
/**
40
* @class PointOfInterest
41
* @brief A point-of-interest
42
*/
43
class PointOfInterest : public Shape, public Position, public Parameterised {
44
45
public:
46
/** @brief Constructor
47
* @param[in] id The name of the POI
48
* @param[in] type The (abstract) type of the POI
49
* @param[in] color The color of the POI
50
* @param[in] pos The position of the POI
51
* @param[in[ geo use GEO coordinates (lon/lat)
52
* @param[in] lane The Lane in which this POI is placed
53
* @param[in] friendlyPos friendly position
54
* @param[in] posOverLane The position over Lane
55
* @param[in] posLat The position lateral over Lane
56
* @param[in] icon The icon of the POI
57
* @param[in] layer The layer of the POI
58
* @param[in] angle The rotation of the POI
59
* @param[in] imgFile The raster image of the shape
60
* @param[in] width The width of the POI image
61
* @param[in] height The height of the POI image
62
* @param[in] name POI name
63
* @param[in] parameters generic parameters
64
*/
65
PointOfInterest(const std::string& id, const std::string& type,
66
const RGBColor& color, const Position& pos, bool geo,
67
const std::string& lane, double posOverLane,
68
bool friendlyPos, double posLat,
69
const std::string& icon,
70
double layer = DEFAULT_LAYER,
71
double angle = DEFAULT_ANGLE,
72
const std::string& imgFile = DEFAULT_IMG_FILE,
73
double width = DEFAULT_IMG_WIDTH,
74
double height = DEFAULT_IMG_HEIGHT,
75
const std::string& name = DEFAULT_NAME,
76
const Parameterised::Map& parameters = DEFAULT_PARAMETERS);
77
78
/// @brief Destructor
79
~PointOfInterest();
80
81
/// @name Getter
82
/// @{
83
84
/// @brief get icon
85
POIIcon getIcon() const;
86
87
/// @brief get icon(in string format)
88
const std::string& getIconStr() const;
89
90
/// @brief Returns the image width of the POI
91
double getWidth() const;
92
93
/// @brief Returns the image height of the POI
94
double getHeight() const;
95
96
/// @brief Returns the image center of the POI
97
Position getCenter() const;
98
99
/// @brief returns friendly position
100
bool getFriendlyPos() const;
101
102
/// @}
103
104
105
/// @name Setter
106
/// @{
107
108
/// @brief set icon
109
void setIcon(const std::string& icon);
110
111
/// @brief set the image width of the POI
112
void setWidth(double width);
113
114
/// @brief set the image height of the POI
115
void setHeight(double height);
116
117
/// @brief set friendly position
118
void setFriendlyPos(const bool friendlyPos);
119
120
/// @}
121
122
/* @brief POI definition to the given device
123
* @param[in] geo Whether to write the output in geo-coordinates
124
*/
125
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;
126
127
protected:
128
/// @brief flag to check if POI was loaded as GEO Position (main used by netedit)
129
bool myGeo;
130
131
/// @brief ID of lane in which this POI is placed (main used by netedit)
132
std::string myLane;
133
134
/// @brief position over lane in which this POI is placed (main used by netedit)
135
double myPosOverLane;
136
137
/// @brief friendlyPos enable or disable friendly position for position over lane
138
bool myFriendlyPos;
139
140
/// @brief lateral position over lane in which this POI is placed (main used by netedit)
141
double myPosLat;
142
143
/// @brief POI icon
144
POIIcon myIcon;
145
146
/// @brief The half width of the image when rendering this POI
147
double myHalfImgWidth;
148
149
/// @brief The half height of the image when rendering this POI
150
double myHalfImgHeight;
151
};
152
153