Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2012-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 POI.h
15 : /// @author Daniel Krajzewicz
16 : /// @author Mario Krumnow
17 : /// @author Michael Behrisch
18 : /// @author Robert Hilbrich
19 : /// @date 30.05.2012
20 : ///
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 : // ===========================================================================
41 : /**
42 : * @class POI
43 : * @brief C++ TraCI client API implementation
44 : */
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 :
56 : LIBSUMO_ID_PARAMETER_API
57 0 : LIBSUMO_SUBSCRIPTION_API
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
76 : /** @brief Returns a tree filled with PoI instances
77 : * @return The rtree of PoIs
78 : */
79 : static NamedRTree* getTree();
80 : static void cleanup();
81 :
82 : /** @brief Saves the shape of the requested object in the given container
83 : * @param id The id of the poi to retrieve
84 : * @param shape The container to fill
85 : */
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:
97 : static SubscriptionResults mySubscriptionResults;
98 : static ContextSubscriptionResults myContextSubscriptionResults;
99 : static NamedRTree* myTree;
100 : #endif
101 : #endif
102 :
103 : /// @brief invalidated standard constructor
104 : POI() = delete;
105 : };
106 :
107 :
108 : }
|