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());
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
static PositionVector makeRing(const double radius1, const double radius2, const Position ¢er, unsigned int nPoints)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
ShapeContainer & getShapeContainer()
Returns the shapes container.
const std::string & getID() const
Returns the id.
T get(const std::string &id) const
Retrieves an item.
void insertIDs(std::vector< std::string > &into) const
A RT-tree for efficient storing of SUMO's Named objects.
void Remove(const float a_min[2], const float a_max[2], Named *const &a_data)
Remove entry.
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
C++ TraCI client API implementation.
const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
void setHeight(double height)
set the image height of the POI
void setWidth(double width)
set the image width of the POI
double getHeight() const
Returns the image height of the POI.
double getWidth() const
Returns the image width of the POI.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
double y() const
Returns the y-position.
Storage for geometrical objects.
virtual bool removePOI(const std::string &id)
Removes a PoI 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.
virtual void movePOI(const std::string &id, const Position &pos)
Assigns a new position to the named PoI.
const POIs & getPOIs() const
Returns all pois.
static const bool DEFAULT_RELATIVEPATH
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
void setShapeType(const std::string &type)
Sets a new type.
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
void setShapeColor(const RGBColor &col)
Sets a new color.
double getShapeLayer() const
Returns the layer of the Shape.
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
static TraCIColor makeTraCIColor(const RGBColor &color)
static RGBColor makeRGBColor(const TraCIColor &color)
static bool remove(const std::string &poiID, int layer=0)
static void setPosition(const std::string &poiID, double x, double y)
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 void setHeight(const std::string &poiID, double height)
static std::string getImageFile(const std::string &poiID)
static SubscriptionResults mySubscriptionResults
static NamedRTree * getTree()
Returns a tree filled with PoI instances.
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setType(const std::string &poiID, const std::string &setType)
static void setColor(const std::string &poiID, const TraCIColor &color)
static void setImageFile(const std::string &poiID, const std::string &imageFile)
static double getWidth(const std::string &poiID)
static double getHeight(const std::string &poiID)
static void setWidth(const std::string &poiID, double width)
static double getAngle(const std::string &poiID)
static TraCIPosition getPosition(const std::string &poiID, const bool includeZ=false)
static PointOfInterest * getPoI(const std::string &id)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
static void setAngle(const std::string &poiID, double angle)
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)
static ContextSubscriptionResults myContextSubscriptionResults
static std::shared_ptr< VariableWrapper > makeWrapper()
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static std::string getType(const std::string &poiID)
static TraCIColor getColor(const std::string &poiID)
static NamedRTree * myTree
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)
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)
static bool exists(std::string polyID)
Checks if a polygon of the given name exists already in the simulation.
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
virtual bool wrapPosition(const std::string &objID, const int variable, const TraCIPosition &value)=0
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
virtual bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)=0
TRACI_CONST int VAR_IMAGEFILE
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_ANGLE
std::vector< TraCIPosition > TraCIPositionVector
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_POSITION
TRACI_CONST int VAR_WIDTH
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_HEIGHT
TRACI_CONST int VAR_POSITION3D
std::map< std::string, SubscriptionResults > ContextSubscriptionResults