SUMO - Simulation of Urban MObility
Polygon.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2017-2018 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 /****************************************************************************/
15 // C++ TraCI client API implementation
16 /****************************************************************************/
17 #ifndef SUMO_Polygon_H
18 #define SUMO_Polygon_H
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <vector>
28 #include <libsumo/TraCIDefs.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class NamedRTree;
36 class SUMOPolygon;
37 namespace libsumo {
38 class VariableWrapper;
39 }
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
45 namespace libsumo {
46 class Polygon {
47 public:
48  static std::vector<std::string> getIDList();
49  static int getIDCount();
50  static std::string getType(const std::string& polygonID);
51  static TraCIPositionVector getShape(const std::string& polygonID);
52  static TraCIColor getColor(const std::string& polygonID);
53  static bool getFilled(const std::string& polygonID);
54  static double getLineWidth(const std::string& polygonID);
55  static std::string getParameter(const std::string& polygonID, const std::string& key);
56  static void setType(const std::string& polygonID, const std::string& setType);
57  static void setShape(const std::string& polygonID, const TraCIPositionVector& shape);
58  static void setColor(const std::string& polygonID, const TraCIColor& c);
59  static void add(const std::string& polygonID, const TraCIPositionVector& shape, const TraCIColor& color, bool fill = false, double lineWidth = 1, const std::string& polygonType = "", int layer = 0);
60  static void remove(const std::string& polygonID, int layer = 0);
61 
62  static void setFilled(std::string polygonID, bool filled);
63  static void setLineWidth(std::string polygonID, double lineWidth);
64  static void setParameter(const std::string& polygonID, const std::string& key, const std::string& value);
65 
67 
71  static NamedRTree* getTree();
72 
77  static void storeShape(const std::string& id, PositionVector& shape);
78 
79  static std::shared_ptr<VariableWrapper> makeWrapper();
80 
81  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
82 
83 private:
84  static SUMOPolygon* getPolygon(const std::string& id);
85 
86 private:
89 
91  Polygon() = delete;
92 };
93 
94 
95 }
96 
97 
98 #endif //SUMO_Polygon_H
99 
100 /****************************************************************************/
static void setColor(const std::string &polygonID, const TraCIColor &c)
Definition: Polygon.cpp:110
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:199
static void setLineWidth(std::string polygonID, double lineWidth)
Definition: Polygon.cpp:143
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
static std::string getParameter(const std::string &polygonID, const std::string &key)
Definition: Polygon.cpp:88
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
Definition: Polygon.cpp:184
static SubscriptionResults mySubscriptionResults
Definition: Polygon.h:87
static void add(const std::string &polygonID, const TraCIPositionVector &shape, const TraCIColor &color, bool fill=false, double lineWidth=1, const std::string &polygonType="", int layer=0)
Definition: Polygon.cpp:116
A RT-tree for efficient storing of SUMO&#39;s Named objects.
Definition: NamedRTree.h:65
Polygon()=delete
invalidated standard constructor
static void setFilled(std::string polygonID, bool filled)
Definition: Polygon.cpp:137
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:200
static std::string getType(const std::string &polygonID)
Definition: Polygon.cpp:58
A list of positions.
static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with polygon instances.
Definition: Polygon.cpp:170
static TraCIPositionVector getShape(const std::string &polygonID)
Definition: Polygon.cpp:64
static void setShape(const std::string &polygonID, const TraCIPositionVector &shape)
Definition: Polygon.cpp:101
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Polygon.cpp:190
Definition: Edge.cpp:30
static std::vector< std::string > getIDList()
Definition: Polygon.cpp:43
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Polygon.cpp:196
static TraCIColor getColor(const std::string &polygonID)
Definition: Polygon.cpp:81
static bool getFilled(const std::string &polygonID)
Definition: Polygon.cpp:71
static SUMOPolygon * getPolygon(const std::string &id)
Definition: Polygon.cpp:150
static void setParameter(const std::string &polygonID, const std::string &key, const std::string &value)
Definition: Polygon.cpp:160
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Polygon.h:88
static int getIDCount()
Definition: Polygon.cpp:52
A list of positions.
static void setType(const std::string &polygonID, const std::string &setType)
Definition: Polygon.cpp:94
static double getLineWidth(const std::string &polygonID)
Definition: Polygon.cpp:76