Eclipse SUMO - Simulation of Urban MObility
POI.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2012-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 // C++ TraCI client API implementation
22 /****************************************************************************/
23 #pragma once
24 #include <vector>
25 #include <libsumo/TraCIDefs.h>
26 
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 #ifndef LIBTRACI
32 class NamedRTree;
33 class PointOfInterest;
34 class PositionVector;
35 #endif
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
45 namespace LIBSUMO_NAMESPACE {
46 class POI {
47 public:
48  static std::string getType(const std::string& poiID);
49  static libsumo::TraCIPosition getPosition(const std::string& poiID, const bool includeZ = false);
50  static libsumo::TraCIColor getColor(const std::string& poiID);
51  static double getWidth(const std::string& poiID);
52  static double getHeight(const std::string& poiID);
53  static double getAngle(const std::string& poiID);
54  static std::string getImageFile(const std::string& poiID);
55 
58 
59  static void setType(const std::string& poiID, const std::string& poiType);
60  static void setColor(const std::string& poiID, const libsumo::TraCIColor& color);
61  static void setPosition(const std::string& poiID, double x, double y);
62  static void setWidth(const std::string& poiID, double width);
63  static void setHeight(const std::string& poiID, double height);
64  static void setAngle(const std::string& poiID, double angle);
65  static void setImageFile(const std::string& poiID, const std::string& imageFile);
66  static bool add(const std::string& poiID, double x, double y, const libsumo::TraCIColor& color,
67  const std::string& poiType = "", int layer = 0, const std::string& imgFile = "",
68  double width = 1, double height = 1, double angle = 0, const std::string& icon = "");
69  static bool remove(const std::string& poiID, int layer = 0);
70  static void highlight(const std::string& poiID, const libsumo::TraCIColor& col = libsumo::TraCIColor(255, 0, 0, 255),
71  double size = -1, const int alphaMax = -1, const double duration = -1, const int type = 0);
72 
73 
74 #ifndef LIBTRACI
75 #ifndef SWIG
79  static NamedRTree* getTree();
80  static void cleanup();
81 
86  static void storeShape(const std::string& id, PositionVector& shape);
87 
88  static std::shared_ptr<VariableWrapper> makeWrapper();
89 
90  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
91 
92 private:
93  static PointOfInterest* getPoI(const std::string& id);
94 
95 
96 private:
99  static NamedRTree* myTree;
100 #endif
101 #endif
102 
104  POI() = delete;
105 };
106 
107 
108 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:116
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:62
static bool remove(const std::string &poiID, int layer=0)
static void setPosition(const std::string &poiID, double x, double y)
static void setHeight(const std::string &poiID, double height)
static std::string getImageFile(const std::string &poiID)
Definition: libsumo/POI.cpp:99
static SubscriptionResults mySubscriptionResults
Definition: POI.h:97
static NamedRTree * getTree()
Returns a tree filled with PoI instances.
static void setColor(const std::string &poiID, const libsumo::TraCIColor &color)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setType(const std::string &poiID, const std::string &poiType)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static void setImageFile(const std::string &poiID, const std::string &imageFile)
static void highlight(const std::string &poiID, const libsumo::TraCIColor &col=libsumo::TraCIColor(255, 0, 0, 255), double size=-1, const int alphaMax=-1, const double duration=-1, const int type=0)
static double getWidth(const std::string &poiID)
Definition: libsumo/POI.cpp:81
static libsumo::TraCIPosition getPosition(const std::string &poiID, const bool includeZ=false)
Definition: libsumo/POI.cpp:75
static double getHeight(const std::string &poiID)
Definition: libsumo/POI.cpp:87
static void setWidth(const std::string &poiID, double width)
static double getAngle(const std::string &poiID)
Definition: libsumo/POI.cpp:93
POI()=delete
invalidated standard constructor
static PointOfInterest * getPoI(const std::string &id)
static void setAngle(const std::string &poiID, double angle)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: POI.h:98
static std::shared_ptr< VariableWrapper > makeWrapper()
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static std::string getType(const std::string &poiID)
Definition: libsumo/POI.cpp:63
static bool add(const std::string &poiID, double x, double y, const libsumo::TraCIColor &color, const std::string &poiType="", int layer=0, const std::string &imgFile="", double width=1, double height=1, double angle=0, const std::string &icon="")
static libsumo::TraCIColor getColor(const std::string &poiID)
Definition: libsumo/POI.cpp:69
static NamedRTree * myTree
Definition: POI.h:99
A RT-tree for efficient storing of SUMO's Named objects.
Definition: NamedRTree.h:61
A point-of-interest.
A list of positions.
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:338
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:337
A 2D or 3D-position, for 2D positions z == INVALID_DOUBLE_VALUE.
Definition: TraCIDefs.h:178