48 std::vector<std::string>
50 std::vector<std::string> ids;
59 return (
int)getIDList().size();
106 POI::getParameter(
const std::string& poiID,
const std::string& key) {
159 POI::add(
const std::string& poiID,
double x,
double y,
const TraCIColor& color,
const std::string& poiType,
int layer,
const std::string& imgFile,
double width,
double height,
double angle) {
161 bool ok = shapeCont.
addPOI(poiID, poiType,
163 Position(x, y),
false,
"", 0, 0, (
double)layer,
169 if (ok &&
myTree !=
nullptr) {
171 const float cmin[2] = {(float)p->
x(), (float)p->
y()};
172 const float cmax[2] = {(float)p->
x(), (float)p->
y()};
183 if (p !=
nullptr &&
myTree !=
nullptr) {
184 const float cmin[2] = {(float)p->
x(), (float)p->
y()};
185 const float cmax[2] = {(float)p->
x(), (float)p->
y()};
193 POI::highlight(
const std::string& poiID,
const TraCIColor& col,
double size,
const int alphaMax,
const double duration,
const int type) {
204 const unsigned int nPoints = 34;
208 #ifdef DEBUG_DYNAMIC_SHAPES 209 std::cout <<
SIMTIME <<
" Vehicle::highlight() for vehicle '" << vehicleID <<
"'\n" 210 <<
" circle: " << circlePV << std::endl;
225 lyr += (type + 1) / 257.;
231 double maxAttack = 1.0;
232 std::vector<double> timeSpan;
234 timeSpan = {0,
MIN2(maxAttack, duration / 3.), 2.*duration / 3., duration};
237 std::vector<double> alphaSpan;
239 alphaSpan = {0., (double) alphaMax, ((
double) alphaMax) / 3., 0.};
247 POI::setParameter(
const std::string& poiID,
const std::string& key,
const std::string& value) {
260 if (sumoPoi ==
nullptr) {
272 for (
const auto& i : shapeCont.
getPOIs()) {
273 const float cmin[2] = {(float)i.second->x(), (float)i.second->y()};
274 const float cmax[2] = {(float)i.second->x(), (float)i.second->y()};
290 shape.push_back(*
getPoI(
id));
294 std::shared_ptr<VariableWrapper>
306 return wrapper->
wrapInt(objID, variable, getIDCount());
static void setAngle(const std::string &poiID, double angle)
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
static void highlight(const std::string &poiID, const TraCIColor &col=TraCIColor(255, 0, 0, 255), double size=-1, const int alphaMax=-1, const double duration=-1, const int type=0)
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
static TraCIColor makeTraCIColor(const RGBColor &color)
static NamedRTree * getTree()
Returns a tree filled with PoI instances.
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
TRACI_CONST int VAR_COLOR
static bool remove(const std::string &poiID, int layer=0)
TRACI_CONST int VAR_WIDTH
static void setColor(const std::string &poiID, const TraCIColor &color)
void setShapeColor(const RGBColor &col)
Sets a new color.
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
void setShapeType(const std::string &type)
Sets a new type.
double y() const
Returns the y-position.
T get(const std::string &id) const
Retrieves an item.
static PositionVector makeRing(const double radius1, const double radius2, const Position ¢er, unsigned int nPoints)
const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
static void setHeight(const std::string &poiID, double height)
A RT-tree for efficient storing of SUMO's Named objects.
double x() const
Returns the x-position.
TRACI_CONST int VAR_POSITION
static void setWidth(const std::string &poiID, double width)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Storage for geometrical objects.
TRACI_CONST int VAR_ANGLE
static NamedRTree * myTree
const std::string & getID() const
Returns the id.
double getHeight() const
Returns the image height of the POI.
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
static double getHeight(const std::string &poiID)
static double getAngle(const std::string &poiID)
void insertIDs(std::vector< std::string > &into) const
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
static std::shared_ptr< VariableWrapper > makeWrapper()
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
static bool exists(std::string polyID)
Checks if a polygon of the given name exists already in the simulation.
static RGBColor makeRGBColor(const TraCIColor &color)
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
TRACI_CONST int TRACI_ID_LIST
void Remove(const float a_min[2], const float a_max[2], Named *const &a_data)
Remove entry.
static double getWidth(const std::string &poiID)
virtual void movePOI(const std::string &id, const Position &pos)
Assigns a new position to the named PoI.
static void addHighlightPolygon(const std::string &objectID, const int type, const std::string &polygonID, const TraCIPositionVector &shape, const TraCIColor &color, bool fill, const std::string &polygonType, int layer, double lineWidth)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
ShapeContainer & getShapeContainer()
Returns the shapes container.
static std::string getImageFile(const std::string &poiID)
A point in 2D or 3D with translation and scaling methods.
virtual bool removePOI(const std::string &id)
Removes a PoI from the container.
static bool add(const std::string &poiID, double x, double y, const TraCIColor &color, const std::string &poiType="", int layer=0, const std::string &imgFile=Shape::DEFAULT_IMG_FILE, double width=Shape::DEFAULT_IMG_WIDTH, double height=Shape::DEFAULT_IMG_HEIGHT, double angle=Shape::DEFAULT_ANGLE)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
static void setImageFile(const std::string &poiID, const std::string &imageFile)
static const bool DEFAULT_RELATIVEPATH
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.
static SubscriptionResults mySubscriptionResults
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setType(const std::string &poiID, const std::string &setType)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
TRACI_CONST int VAR_POSITION3D
double getShapeLayer() const
Returns the layer of the Shape.
double getWidth() const
Returns the image width of the POI.
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
virtual bool wrapPosition(const std::string &objID, const int variable, const TraCIPosition &value)=0
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
void setHeight(double height)
set the image height of the POI
virtual bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)=0
void setWidth(double width)
set the image width of the POI
static ContextSubscriptionResults myContextSubscriptionResults
static TraCIPosition getPosition(const std::string &poiID, const bool includeZ=false)
TRACI_CONST int VAR_IMAGEFILE
static std::string getType(const std::string &poiID)
static PointOfInterest * getPoI(const std::string &id)
TRACI_CONST int VAR_HEIGHT
static void addDynamics(const std::string &polygonID, const std::string &trackedID="", const std::vector< double > &timeSpan=std::vector< double >(), const std::vector< double > &alphaSpan=std::vector< double >(), bool looped=false, bool rotate=true)
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
static TraCIColor getColor(const std::string &poiID)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static void setPosition(const std::string &poiID, double x, double y)
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
const POIs & getPOIs() const
Returns all pois.