42NamedRTree* POI::myTree(
nullptr);
48std::vector<std::string>
50 std::vector<std::string> ids;
58 return (
int)getIDList().size();
64 return getPoI(poiID)->getShapeType();
82 return getPoI(poiID)->getWidth();
88 return getPoI(poiID)->getHeight();
94 return getPoI(poiID)->getShapeNaviDegree();
100 return getPoI(poiID)->getShapeImgFile();
105POI::getParameter(
const std::string& poiID,
const std::string& key) {
106 return getPoI(poiID)->getParameter(key,
"");
115 getPoI(poiID)->setShapeType(poiType);
135 getPoI(poiID)->setWidth(width);
141 getPoI(poiID)->setHeight(height);
147 getPoI(poiID)->setShapeNaviDegree(angle);
153 getPoI(poiID)->setShapeImgFile(imageFile);
158POI::add(
const std::string& poiID,
double x,
double y,
const TraCIColor& color,
const std::string& poiType,
159 int layer,
const std::string& imgFile,
double width,
double height,
double angle,
const std::string& icon) {
162 Position(x, y),
false,
"", 0,
false, 0, icon, layer,
163 angle, imgFile, width, height);
164 if (ok &&
myTree !=
nullptr) {
166 const float cmin[2] = {(float)p->
x(), (float)p->
y()};
167 const float cmax[2] = {(float)p->
x(), (float)p->
y()};
168 myTree->Insert(cmin, cmax, p);
178 if (p !=
nullptr &&
myTree !=
nullptr) {
179 const float cmin[2] = {(float)p->
x(), (float)p->
y()};
180 const float cmax[2] = {(float)p->
x(), (float)p->
y()};
181 myTree->Remove(cmin, cmax, p);
188POI::highlight(
const std::string& poiID,
const TraCIColor& col,
double size,
const int alphaMax,
const double duration,
const int type) {
199 const unsigned int nPoints = 34;
203#ifdef DEBUG_DYNAMIC_SHAPES
204 std::cout <<
SIMTIME <<
" Vehicle::highlight() for vehicle '" << vehicleID <<
"'\n"
205 <<
" circle: " << circlePV << std::endl;
220 lyr += (type + 1) / 257.;
226 double maxAttack = 1.0;
227 std::vector<double> timeSpan;
229 timeSpan = {0,
MIN2(maxAttack, duration / 3.), 2.*duration / 3., duration};
232 std::vector<double> alphaSpan;
234 alphaSpan = {0., (double) alphaMax, ((
double) alphaMax) / 3., 0.};
242POI::setParameter(
const std::string& poiID,
const std::string& key,
const std::string&
value) {
255 if (sumoPoi ==
nullptr) {
256 throw TraCIException(
"POI '" +
id +
"' is not known");
267 for (
const auto& i : shapeCont.
getPOIs()) {
268 const float cmin[2] = {(float)i.second->x(), (float)i.second->y()};
269 const float cmax[2] = {(float)i.second->x(), (float)i.second->y()};
270 myTree->Insert(cmin, cmax, i.second);
285 shape.push_back(*
getPoI(
id));
289std::shared_ptr<VariableWrapper>
299 return wrapper->wrapStringList(objID, variable, getIDList());
301 return wrapper->wrapInt(objID, variable, getIDCount());
303 return wrapper->wrapString(objID, variable,
getType(objID));
305 return wrapper->wrapColor(objID, variable,
getColor(objID));
307 return wrapper->wrapPosition(objID, variable,
getPosition(objID));
309 return wrapper->wrapPosition(objID, variable,
getPosition(objID,
true));
311 return wrapper->wrapDouble(objID, variable,
getWidth(objID));
313 return wrapper->wrapDouble(objID, variable,
getHeight(objID));
315 return wrapper->wrapDouble(objID, variable,
getAngle(objID));
317 return wrapper->wrapString(objID, variable,
getImageFile(objID));
320 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
323 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
const std::string invalid_return< std::string >::value
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
static PositionVector makeRing(const double radius1, const double radius2, const Position ¢er, unsigned int nPoints)
static bool remove(const std::string &poiID, int layer=0)
static void setPosition(const std::string &poiID, double x, double y)
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.
static void setColor(const std::string &poiID, const libsumo::TraCIColor &color)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setType(const std::string &poiID, const std::string &poiType)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static void setImageFile(const std::string &poiID, const std::string &imageFile)
static void highlight(const std::string &poiID, const libsumo::TraCIColor &col=libsumo::TraCIColor(255, 0, 0, 255), double size=-1, const int alphaMax=-1, const double duration=-1, const int type=0)
static double getWidth(const std::string &poiID)
static libsumo::TraCIPosition getPosition(const std::string &poiID, const bool includeZ=false)
static double getHeight(const std::string &poiID)
static void setWidth(const std::string &poiID, double width)
static double getAngle(const std::string &poiID)
static PointOfInterest * getPoI(const std::string &id)
static void setAngle(const std::string &poiID, double angle)
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 bool add(const std::string &poiID, double x, double y, const libsumo::TraCIColor &color, const std::string &poiType="", int layer=0, const std::string &imgFile="", double width=1, double height=1, double angle=0, const std::string &icon="")
static libsumo::TraCIColor getColor(const std::string &poiID)
static NamedRTree * myTree
static void addDynamics(const std::string &polygonID, const std::string &trackedObjectID="", 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 libsumo::TraCIPositionVector &shape, const libsumo::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.
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.
C++ TraCI client API implementation.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
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 void movePOI(const std::string &id, const Position &pos)
Assigns a new position to the named PoI.
const POIs & getPOIs() const
Returns all pois.
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, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
double getShapeLayer() const
Returns the layer 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)
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_IMAGEFILE
TRACI_CONST int TRACI_ID_LIST
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_ANGLE
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_POSITION
TRACI_CONST int VAR_WIDTH
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_HEIGHT
TRACI_CONST int VAR_POSITION3D
TRACI_CONST int VAR_PARAMETER_WITH_KEY