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-2020 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 /****************************************************************************/
20 // Storage for geometrical objects extended by mutexes
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <fx.h>
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class SUMORTree;
33 class Position;
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
45 public:
48 
49 
51  virtual ~GUIShapeContainer();
52 
67  virtual bool addPolygon(const std::string& id, const std::string& type, const RGBColor& color, double layer,
68  double angle, const std::string& imgFile, bool relativePath, const PositionVector& shape, bool geo,
69  bool fill, double lineWidth, bool ignorePruning = false) override;
70 
73  PolygonDynamics* addPolygonDynamics(double simtime,
74  std::string polyID,
75  SUMOTrafficObject* trackedObject,
76  const std::vector<double>& timeSpan,
77  const std::vector<double>& alphaSpan,
78  bool looped,
79  bool rotate) override;
80 
84 
102  virtual bool addPOI(const std::string& id, const std::string& type, const RGBColor& color, const Position& pos, bool geo,
103  const std::string& lane, double posOverLane, double posLat, double layer, double angle,
104  const std::string& imgFile, bool relativePath, double width, double height, bool ignorePruning = false) override;
105 
106 
107 
112  virtual bool removePolygon(const std::string& id, bool useLock = true) override;
113 
114 
119  virtual bool removePOI(const std::string& id) override;
120 
121 
122 
127  virtual void movePOI(const std::string& id, const Position& pos) override;
128 
129 
134  virtual void reshapePolygon(const std::string& id, const PositionVector& shape) override;
135 
136 
137 
139  std::vector<GUIGlID> getPOIIds() const;
141  std::vector<GUIGlID> getPolygonIDs() const;
142 
143 
145  myAllowReplacement = true;
146  }
147 
148 private:
150  mutable FXMutex myLock;
151 
154 
155 
158 };
long long int SUMOTime
Definition: SUMOTime.h:31
Storage for geometrical objects extended by mutexes.
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.
virtual void movePOI(const std::string &id, const Position &pos) override
Assigns a new position to the named PoI.
virtual bool removePOI(const std::string &id) override
Removes a PoI from the container.
SUMORTree & myVis
The RTree structure to add and remove visualization elements.
virtual ~GUIShapeContainer()
Destructor.
SUMOTime polygonDynamicsUpdate(SUMOTime t, PolygonDynamics *pd) override
Update PolygonDynamics,.
std::vector< GUIGlID > getPOIIds() const
Returns the gl-ids of all pois.
std::vector< GUIGlID > getPolygonIDs() const
Returns the gl-ids of all polygons.
virtual bool removePolygon(const std::string &id, bool useLock=true) override
Removes a polygon from the container.
FXMutex myLock
The mutex for adding/removing operations.
GUIShapeContainer(SUMORTree &vis)
Constructor.
bool myAllowReplacement
whether existing ids shall be replaced
virtual void reshapePolygon(const std::string &id, const PositionVector &shape) override
Assigns a shape to the named polygon.
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.
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,.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A list of positions.
A RT-tree for efficient storing of SUMO's GL-objects.
Definition: SUMORTree.h:66
Representation of a vehicle, person, or container.
Storage for geometrical objects.