51 p.second->deschedule();
65 double angle,
const std::string& imgFile,
bool relativePath,
66 const PositionVector& shape,
bool geo,
bool fill,
double lineWidth,
bool ignorePruning,
67 const std::string& name) {
68 return add(
new SUMOPolygon(
id, type, color, shape, geo, fill, lineWidth, layer, angle, imgFile, relativePath, name), 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,
bool friendlyPos,
double posLat,
const std::string& icon,
double layer,
147 double angle,
const std::string& imgFile,
bool relativePath,
double width,
double height,
bool ignorePruning) {
148 return add(
new PointOfInterest(
id, type, color, pos, geo, lane, posOverLane, friendlyPos, posLat, icon, 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);
208 item.second->deschedule();
217 j->second->deschedule();
237 std::string toRemove =
"";
239 if (toRemove !=
"") {
244 myHighlightPolygons.insert(std::make_pair(objectID, std::map<int, std::string>({std::make_pair(type, polygonID)})));
246 i->second.insert(std::make_pair(type, polygonID));
255 auto j = i->second.find(type);
256 if (j != i->second.end()) {
257 toRemove = j->second;
260 if (i->second.empty()) {
271 auto j = i->second.begin();
272 while (j != i->second.end()) {
273 if (j->second == p->
getID()) {
280 if (i->second.empty()) {
296#ifdef DEBUG_DYNAMIC_SHAPES
297 std::cout <<
" Removing tracking polygons for object '" << objectID <<
"'" << std::endl;
299 while (!i->second.empty()) {
const std::string & getID() const
Returns the id.
T get(const std::string &id) const
Retrieves an item.
bool remove(const std::string &id, const bool del=true)
Removes an item.
bool add(const std::string &id, T item)
Adds an item.
A wrapper for a Command function with parameter.
const std::string & getTrackedObjectID() const
SUMOTime update(SUMOTime t)
Updates the polygon according to its timeSpan and follows the tracked object.
const std::string & getPolygonID() const
A point in 2D or 3D with translation and scaling methods.
virtual void setShape(const PositionVector &shape)
Sets the shape of the polygon.
Representation of a vehicle, person, or container.
virtual bool removePolygonDynamics(const std::string &polyID)
Remove dynamics (animation / tracking) for the given polygon.
virtual void clearHighlight(const std::string &objectID, const int type, std::string &toRemove)
virtual void cleanupPolygonDynamics(const std::string &id)
Unschedules the removal and update commands of the given polygon.
virtual bool removePOI(const std::string &id)
Removes a PoI from the container.
virtual SUMOTime polygonDynamicsUpdate(SUMOTime t, PolygonDynamics *pd)
Regular update event for updating polygon dynamics.
virtual void reshapePolygon(const std::string &id, const PositionVector &shape)
Assigns a shape to the named polygon.
std::map< std::string, std::map< int, std::string > > myHighlightPolygons
maps objects to a map of highlight types to highlighting polygons
std::map< std::string, PolygonDynamics * > myPolygonDynamics
stored PolygonDynamics
virtual bool removePolygon(const std::string &id, bool useLock=true)
Removes a polygon from the container.
virtual void removeTrackers(std::string objectID)
Remove all tracking polygons for the given object.
virtual void movePOI(const std::string &id, const Position &pos)
Assigns a new position to the named PoI.
std::map< const std::string, ParametrisedWrappingCommand< ShapeContainer, PolygonDynamics * > * > myPolygonUpdateCommands
Command pointers for scheduled polygon update. Maps PolyID->Command.
virtual ~ShapeContainer()
Destructor.
std::map< std::string, std::string > myHighlightedObjects
inverse map to myHighlightPolygons saves the highlighted object for each polygon
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, const std::string &name=Shape::DEFAULT_NAME)
Builds a polygon using the given values and adds it to the container.
std::map< const std::string, std::set< const SUMOPolygon * > > myTrackingPolygons
Information about tracked objects.
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.
ShapeContainer()
Constructor.
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, bool friendlyPos, double posLat, const std::string &icon, 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.
virtual void addPolygonUpdateCommand(std::string polyID, ParametrisedWrappingCommand< ShapeContainer, PolygonDynamics * > *cmd)
Register update command (for descheduling at removal)
virtual bool add(SUMOPolygon *poly, bool ignorePruning=false)
add polygon
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...
virtual void registerHighlight(const std::string &objectID, const int type, const std::string &polygonID)
register highlight of the specified type if the given id
void clearState()
Remove all dynamics before quick-loading state.
Polygons myPolygons
stored Polygons