1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    POI.h
11 /// @author  Daniel Krajzewicz
12 /// @author  Mario Krumnow
13 /// @author  Michael Behrisch
14 /// @author  Robert Hilbrich
15 /// @date    30.05.2012
16 /// @version $Id$
17 ///
18 // C++ TraCI client API implementation
19 /****************************************************************************/
20 #ifndef POI_h
21 #define POI_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <vector>
30 #include <libsumo/TraCIDefs.h>
31 #include <utils/shapes/Shape.h>
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class NamedRTree;
38 class PointOfInterest;
39 class PositionVector;
40 namespace libsumo {
41 class VariableWrapper;
42 }
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
48 /**
49  * @class POI
50  * @brief C++ TraCI client API implementation
51  */
52 namespace libsumo {
53 class POI {
54 public:
55     static std::vector<std::string> getIDList();
56     static int getIDCount();
57     static std::string getType(const std::string& poiID);
58     static TraCIPosition getPosition(const std::string& poiID, const bool includeZ = false);
59     static TraCIColor getColor(const std::string& poiID);
60     static double getWidth(const std::string& poiID);
61     static double getHeight(const std::string& poiID);
62     static double getAngle(const std::string& poiID);
63     static std::string getImageFile(const std::string& poiID);
64     static std::string getParameter(const std::string& poiID, const std::string& key);
65 
66     static void setType(const std::string& poiID, const std::string& setType);
67     static void setColor(const std::string& poiID, const TraCIColor& c);
68     static void setPosition(const std::string& poiID, double x, double y);
69     static void setWidth(const std::string& poiID, double width);
70     static void setHeight(const std::string& poiID, double height);
71     static void setAngle(const std::string& poiID, double angle);
72     static void setImageFile(const std::string& poiID, const std::string& imageFile);
73     static bool add(const std::string& poiID, double x, double y, const TraCIColor& color, const std::string& poiType = "", int layer = 0, const std::string& imgFile = Shape::DEFAULT_IMG_FILE, double width = Shape::DEFAULT_IMG_WIDTH, double height = Shape::DEFAULT_IMG_HEIGHT, double angle = Shape::DEFAULT_ANGLE);
74     static bool remove(const std::string& poiID, int layer = 0);
75     static void highlight(const std::string& poiID, const TraCIColor& col, double size, const int alphaMax, const double duration, const int type);
76 
77     static void setParameter(const std::string& poiID, const std::string& key, const std::string& value);
78 
79     LIBSUMO_SUBSCRIPTION_API
80 
81     /** @brief Returns a tree filled with PoI instances
82      *  @return The rtree of PoIs
83      */
84     static NamedRTree* getTree();
85 
86     /** @brief Saves the shape of the requested object in the given container
87     *  @param id The id of the poi to retrieve
88     *  @param shape The container to fill
89     */
90     static void storeShape(const std::string& id, PositionVector& shape);
91 
92     static std::shared_ptr<VariableWrapper> makeWrapper();
93 
94     static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
95 
96 private:
97     static PointOfInterest* getPoI(const std::string& id);
98 
99 private:
100     static SubscriptionResults mySubscriptionResults;
101     static ContextSubscriptionResults myContextSubscriptionResults;
102 
103     /// @brief invalidated standard constructor
104     POI() = delete;
105 };
106 
107 
108 }
109 
110 
111 #endif
112 
113 /****************************************************************************/
114