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 std::string getParameter(const std::string& polygonID, const std::string& paramName);
55  static void setType(const std::string& polygonID, const std::string& setType);
56  static void setShape(const std::string& polygonID, const TraCIPositionVector& shape);
57  static void setColor(const std::string& polygonID, const TraCIColor& c);
58  static void add(const std::string& polygonID, const TraCIPositionVector& shape, const TraCIColor& color, bool fill = false, const std::string& polygonType = "", int layer = 0);
59  static void remove(const std::string& polygonID, int layer = 0);
60 
61  static void setFilled(std::string polygonID, bool filled);
62  static void setParameter(std::string& name, std::string& value, std::string& string);
63 
65 
69  static NamedRTree* getTree();
70 
75  static void storeShape(const std::string& id, PositionVector& shape);
76 
77  static std::shared_ptr<VariableWrapper> makeWrapper();
78 
79  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
80 
81 private:
82  static SUMOPolygon* getPolygon(const std::string& id);
83 
84 private:
87 
89  Polygon() = delete;
90 };
91 
92 
93 }
94 
95 
96 #endif //SUMO_Polygon_H
97 
98 /****************************************************************************/
static void setColor(const std::string &polygonID, const TraCIColor &c)
Definition: Polygon.cpp:106
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:199
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
Definition: Polygon.cpp:174
static SubscriptionResults mySubscriptionResults
Definition: Polygon.h:85
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:133
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:200
static void add(const std::string &polygonID, const TraCIPositionVector &shape, const TraCIColor &color, bool fill=false, const std::string &polygonType="", int layer=0)
Definition: Polygon.cpp:112
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:160
static std::string getParameter(const std::string &polygonID, const std::string &paramName)
Definition: Polygon.cpp:84
static TraCIPositionVector getShape(const std::string &polygonID)
Definition: Polygon.cpp:64
static void setShape(const std::string &polygonID, const TraCIPositionVector &shape)
Definition: Polygon.cpp:97
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Polygon.cpp:180
Definition: Edge.cpp:30
static void setParameter(std::string &name, std::string &value, std::string &string)
Definition: Polygon.cpp:150
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:186
static TraCIColor getColor(const std::string &polygonID)
Definition: Polygon.cpp:77
static bool getFilled(const std::string &polygonID)
Definition: Polygon.cpp:71
static SUMOPolygon * getPolygon(const std::string &id)
Definition: Polygon.cpp:140
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Polygon.h:86
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:90