Eclipse SUMO - Simulation of Urban MObility
GUIShapeContainer.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2009-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 /****************************************************************************/
16 // Storage for geometrical objects extended by mutexes
17 /****************************************************************************/
18 #ifndef GUIShapeContainer_h
19 #define GUIShapeContainer_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <fx.h>
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class SUMORTree;
35 class Position;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
47 public:
50 
51 
53  virtual ~GUIShapeContainer();
54 
69  virtual bool addPolygon(const std::string& id, const std::string& type, const RGBColor& color, double layer,
70  double angle, const std::string& imgFile, bool relativePath, const PositionVector& shape, bool geo,
71  bool fill, double lineWidth, bool ignorePruning = false) override;
72 
75  PolygonDynamics* addPolygonDynamics(double simtime,
76  std::string polyID,
77  SUMOTrafficObject* trackedObject,
78  const std::vector<double>& timeSpan,
79  const std::vector<double>& alphaSpan,
80  bool looped,
81  bool rotate) override;
82 
86 
104  virtual bool addPOI(const std::string& id, const std::string& type, const RGBColor& color, const Position& pos, bool geo,
105  const std::string& lane, double posOverLane, double posLat, double layer, double angle,
106  const std::string& imgFile, bool relativePath, double width, double height, bool ignorePruning = false) override;
107 
108 
109 
114  virtual bool removePolygon(const std::string& id, bool useLock = true) override;
115 
116 
121  virtual bool removePOI(const std::string& id) override;
122 
123 
124 
129  virtual void movePOI(const std::string& id, const Position& pos) override;
130 
131 
136  virtual void reshapePolygon(const std::string& id, const PositionVector& shape) override;
137 
138 
139 
141  std::vector<GUIGlID> getPOIIds() const;
143  std::vector<GUIGlID> getPolygonIDs() const;
144 
145 
147  myAllowReplacement = true;
148  }
149 
150 private:
152  mutable FXMutex myLock;
153 
156 
157 
160 };
161 
162 
163 #endif
164 
165 /****************************************************************************/
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
GUIGlObject.h
GUIShapeContainer::myLock
FXMutex myLock
The mutex for adding/removing operations.
Definition: GUIShapeContainer.h:152
GUIShapeContainer::myVis
SUMORTree & myVis
The RTree structure to add and remove visualization elements.
Definition: GUIShapeContainer.h:155
GUIShapeContainer::movePOI
virtual void movePOI(const std::string &id, const Position &pos) override
Assigns a new position to the named PoI.
Definition: GUIShapeContainer.cpp:153
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
ShapeContainer
Storage for geometrical objects.
Definition: ShapeContainer.h:49
GUIShapeContainer::polygonDynamicsUpdate
SUMOTime polygonDynamicsUpdate(SUMOTime t, PolygonDynamics *pd) override
Update PolygonDynamics,.
Definition: GUIShapeContainer.cpp:109
GUIShapeContainer::removePOI
virtual bool removePOI(const std::string &id) override
Removes a PoI from the container.
Definition: GUIShapeContainer.cpp:141
GUIShapeContainer::addPolygon
virtual bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, bool relativePath, const PositionVector &shape, bool geo, bool fill, double lineWidth, bool ignorePruning=false) override
Builds a polygon using the given values and adds it to the container.
Definition: GUIShapeContainer.cpp:69
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIShapeContainer
Storage for geometrical objects extended by mutexes.
Definition: GUIShapeContainer.h:46
GUIShapeContainer::~GUIShapeContainer
virtual ~GUIShapeContainer()
Destructor.
Definition: GUIShapeContainer.cpp:42
SUMORTree
A RT-tree for efficient storing of SUMO's GL-objects.
Definition: SUMORTree.h:68
RGBColor
Definition: RGBColor.h:39
GUIShapeContainer::removePolygon
virtual bool removePolygon(const std::string &id, bool useLock=true) override
Removes a polygon from the container.
Definition: GUIShapeContainer.cpp:124
GUIShapeContainer::addPOI
virtual bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, const std::string &lane, double posOverLane, double posLat, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool ignorePruning=false) override
Builds a POI using the given values and adds it to the container.
Definition: GUIShapeContainer.cpp:46
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUIShapeContainer::getPolygonIDs
std::vector< GUIGlID > getPolygonIDs() const
Returns the gl-ids of all polygons.
Definition: GUIShapeContainer.cpp:189
GUIShapeContainer::reshapePolygon
virtual void reshapePolygon(const std::string &id, const PositionVector &shape) override
Assigns a shape to the named polygon.
Definition: GUIShapeContainer.cpp:165
GUIShapeContainer::addPolygonDynamics
PolygonDynamics * addPolygonDynamics(double simtime, std::string polyID, SUMOTrafficObject *trackedObject, const std::vector< double > &timeSpan, const std::vector< double > &alphaSpan, bool looped, bool rotate) override
Adds dynamics to the given Polygon,.
Definition: GUIShapeContainer.cpp:93
GUIShapeContainer::getPOIIds
std::vector< GUIGlID > getPOIIds() const
Returns the gl-ids of all pois.
Definition: GUIShapeContainer.cpp:178
PolygonDynamics
Definition: PolygonDynamics.h:29
config.h
ShapeContainer.h
GUIShapeContainer::allowReplacement
void allowReplacement()
Definition: GUIShapeContainer.h:146
GUIShapeContainer::GUIShapeContainer
GUIShapeContainer(SUMORTree &vis)
Constructor.
Definition: GUIShapeContainer.cpp:36
GUIShapeContainer::myAllowReplacement
bool myAllowReplacement
whether existing ids shall be replaced
Definition: GUIShapeContainer.h:159