 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
52 p.second->deschedule();
66 double angle,
const std::string& imgFile,
bool relativePath,
67 const PositionVector& shape,
bool geo,
bool fill,
double lineWidth,
bool ignorePruning) {
68 return add(
new SUMOPolygon(
id, type, color, shape, geo, fill, lineWidth, layer, angle, imgFile, relativePath), ignorePruning);
76 const std::vector<double>& timeSpan,
77 const std::vector<double>& alphaSpan,
81 #ifdef DEBUG_DYNAMIC_SHAPES
82 std::cout << simtime <<
" ShapeContainer::addPolygonDynamics() called for polygon '" << polyID <<
"'" << std::endl;
87 #ifdef DEBUG_DYNAMIC_SHAPES
88 std::cout <<
" polygon '" << polyID <<
"' doesn't exist!" << std::endl;
100 if (trackedObject !=
nullptr) {
120 #ifdef DEBUG_DYNAMIC_SHAPES
121 std::cout <<
" Removing dynamics of polygon '" << polyID <<
"'" << std::endl;
123 const std::string& trackedObjID = d->second->getTrackedObjectID();
124 if (trackedObjID !=
"") {
128 assert(i->second.find(p) != i->second.end());
146 const std::string& lane,
double posOverLane,
double posLat,
double layer,
double angle,
147 const std::string& imgFile,
bool relativePath,
double width,
double height,
bool ignorePruning) {
148 return add(
new PointOfInterest(
id, type, color, pos, geo, lane, posOverLane, posLat, layer, angle, imgFile, relativePath, width, height), ignorePruning);
154 #ifdef DEBUG_DYNAMIC_SHAPES
155 std::cout <<
"ShapeContainer: Removing Polygon '" <<
id <<
"'" << std::endl;
172 static_cast<Position*
>(p)->set(pos);
210 j->second->deschedule();
230 std::string toRemove =
"";
232 if (toRemove !=
"") {
237 myHighlightPolygons.insert(std::make_pair(objectID, std::map<int, std::string>({std::make_pair(type, polygonID)})));
239 i->second.insert(std::make_pair(type, polygonID));
248 auto j = i->second.find(type);
249 if (j != i->second.end()) {
250 toRemove = j->second;
253 if (i->second.empty()) {
264 auto j = i->second.begin();
265 while (j != i->second.end()) {
266 if (j->second == p->
getID()) {
273 if (i->second.empty()) {
289 #ifdef DEBUG_DYNAMIC_SHAPES
290 std::cout <<
" Removing tracking polygons for object '" << objectID <<
"'" << std::endl;
292 while (!i->second.empty()) {
virtual void cleanupPolygonDynamics(const std::string &id)
Unschedules the removal and update commands of the given polygon.
Representation of a vehicle or person.
virtual void removeTrackers(std::string objectID)
Remove all tracking polygons for the given object.
virtual SUMOTime polygonDynamicsUpdate(SUMOTime t, PolygonDynamics *pd)
Regular update event for updating polygon dynamics.
std::map< std::string, PolygonDynamics * > myPolygonDynamics
stored PolygonDynamics
std::map< const std::string, std::set< const SUMOPolygon * > > myTrackingPolygons
Information about tracked objects.
virtual void movePOI(const std::string &id, const Position &pos)
Assigns a new position to the named PoI.
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
virtual bool add(SUMOPolygon *poly, bool ignorePruning=false)
add polygon
virtual bool removePolygonDynamics(const std::string &polyID)
Remove dynamics (animation / tracking) for the given polygon.
const std::string & getTrackedObjectID() const
virtual void reshapePolygon(const std::string &id, const PositionVector &shape)
Assigns a shape to the named polygon.
const std::string & getPolygonID() const
virtual ~ShapeContainer()
Destructor.
virtual void clearHighlight(const std::string &objectID, const int type, std::string &toRemove)
bool remove(const std::string &id, const bool del=true)
Removes an item.
std::map< const std::string, ParametrisedWrappingCommand< ShapeContainer, PolygonDynamics * > * > myPolygonUpdateCommands
Command pointers for scheduled polygon update. Maps PolyID->Command.
virtual PolygonDynamics * addPolygonDynamics(double simtime, std::string polyID, SUMOTrafficObject *trackedObject, const std::vector< double > &timeSpan, const std::vector< double > &alphaSpan, bool looped, bool rotate)
Adds dynamics (animation / tracking) to the given polygon.
A point in 2D or 3D with translation and scaling methods.
std::map< std::string, std::map< int, std::string > > myHighlightPolygons
maps objects to a map of highlight types to highlighting polygons
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)
Builds a polygon using the given values and adds it to the container.
virtual void registerHighlight(const std::string &objectID, const int type, const std::string &polygonID)
register highlight of the specified type if the given id
A wrapper for a Command function with parameter.
T get(const std::string &id) const
Retrieves an item.
virtual bool removePolygon(const std::string &id, bool useLock=true)
Removes a polygon from the container.
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)
Builds a POI using the given values and adds it to the container.
SUMOTime update(SUMOTime t)
Updates the polygon according to its timeSpan and follows the tracked object.
virtual bool removePOI(const std::string &id)
Removes a PoI from the container.
virtual void clearHighlights(const std::string &objectID, SUMOPolygon *p)
Clears all highlight information from the maps when the object leaves the net (Highlight polygons and...
ShapeContainer()
Constructor.
const std::string & getID() const
Returns the id.
Polygons myPolygons
stored Polygons
std::map< std::string, std::string > myHighlightedObjects
inverse map to myHighlightPolygons saves the highlighted object for each polygon
virtual void addPolygonUpdateCommand(std::string polyID, ParametrisedWrappingCommand< ShapeContainer, PolygonDynamics * > *cmd)
Register update command (for descheduling at removal)
bool add(const std::string &id, T item)
Adds an item.