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.org/sumo
3 // Copyright (C) 2012-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 /****************************************************************************/
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& setType);
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, const std::string& poiType = "", int layer = 0, const std::string& imgFile = "", double width = 1, double height = 1, double angle = 0);
67  static bool remove(const std::string& poiID, int layer = 0);
68  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);
69 
70 
71 #ifndef LIBTRACI
72 #ifndef SWIG
76  static NamedRTree* getTree();
77  static void cleanup();
78 
83  static void storeShape(const std::string& id, PositionVector& shape);
84 
85  static std::shared_ptr<VariableWrapper> makeWrapper();
86 
87  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
88 
89 private:
90  static PointOfInterest* getPoI(const std::string& id);
91 
92 
93 private:
96  static NamedRTree* myTree;
97 #endif
98 #endif
99 
101  POI() = delete;
102 };
103 
104 
105 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:108
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:56
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)
static SubscriptionResults mySubscriptionResults
Definition: POI.h:94
static NamedRTree * getTree()
Returns a tree filled with PoI instances.
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setType(const std::string &poiID, const std::string &setType)
static void setColor(const std::string &poiID, const libsumo::TraCIColor &color)
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:82
static libsumo::TraCIPosition getPosition(const std::string &poiID, const bool includeZ=false)
Definition: libsumo/POI.cpp:76
static double getHeight(const std::string &poiID)
Definition: libsumo/POI.cpp:88
static void setWidth(const std::string &poiID, double width)
static double getAngle(const std::string &poiID)
Definition: libsumo/POI.cpp:94
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:95
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:64
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)
static libsumo::TraCIColor getColor(const std::string &poiID)
Definition: libsumo/POI.cpp:70
static NamedRTree * myTree
Definition: POI.h:96
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:279
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:278
A 3D-position.
Definition: TraCIDefs.h:164