 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
49 std::vector<std::string>
51 std::vector<std::string> ids;
157 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) {
159 return shapeCont.
addPOI(poiID, poiType,
Helper::makeRGBColor(color),
Position(x, y),
false,
"", 0, 0, (
double)layer,
176 POI::highlight(
const std::string& poiID,
const TraCIColor& col,
double size,
const int alphaMax,
const double duration,
const int type) {
181 Position* center = dynamic_cast<Position*>(poi);
187 const unsigned int nPoints = 34;
191 #ifdef DEBUG_DYNAMIC_SHAPES
192 std::cout <<
SIMTIME <<
" Vehicle::highlight() for vehicle '" << vehicleID <<
"'\n"
193 <<
" circle: " << circlePV << std::endl;
208 lyr += (type + 1) / 257.;
214 double maxAttack = 1.0;
215 std::vector<double> timeSpan;
217 timeSpan = {0,
MIN2(maxAttack, duration / 3.), 2.*duration / 3., duration};
220 std::vector<double> alphaSpan;
222 alphaSpan = {0., (double) alphaMax, ((
double) alphaMax) / 3., 0.};
243 if (sumoPoi ==
nullptr) {
254 for (
const auto& i : shapeCont.
getPOIs()) {
255 const float cmin[2] = {(float)i.second->x(), (float)i.second->y()};
256 const float cmax[2] = {(float)i.second->x(), (float)i.second->y()};
257 t->
Insert(cmin, cmax, i.second);
265 shape.push_back(*
getPoI(
id));
269 std::shared_ptr<VariableWrapper>
void setShapeType(const std::string &type)
Sets a new type.
static std::vector< std::string > getIDList()
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)
TRACI_CONST int VAR_POSITION
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
static TraCIColor makeTraCIColor(const RGBColor &color)
void insertIDs(std::vector< std::string > &into) const
static double getWidth(const std::string &poiID)
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
static TraCIPosition getPosition(const std::string &poiID, const bool includeZ=false)
ShapeContainer & getShapeContainer()
Returns the shapes container.
TRACI_CONST int VAR_COLOR
virtual void movePOI(const std::string &id, const Position &pos)
Assigns a new position to the named PoI.
static RGBColor makeRGBColor(const TraCIColor &color)
double getHeight() const
Returns the image height of the POI.
TRACI_CONST int VAR_WIDTH
Storage for geometrical objects.
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
static double getHeight(const std::string &poiID)
static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with PoI instances.
virtual bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)=0
static std::shared_ptr< VariableWrapper > makeWrapper()
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static PositionVector makeRing(const double radius1, const double radius2, const Position ¢er, unsigned int nPoints)
static void setHeight(const std::string &poiID, double height)
static void setPosition(const std::string &poiID, double x, double y)
static void setAngle(const std::string &poiID, double angle)
static const bool DEFAULT_RELATIVEPATH
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
static std::string getImageFile(const std::string &poiID)
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)
TRACI_CONST int VAR_ANGLE
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
double getShapeLayer() const
Returns the layer of the Shape.
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
static LIBSUMO_SUBSCRIPTION_API 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)
void setWidth(double width)
set the image width of the POI
static std::string getType(const std::string &poiID)
static void setType(const std::string &poiID, const std::string &setType)
void setHeight(double height)
set the image height of the POI
A point in 2D or 3D with translation and scaling methods.
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
TRACI_CONST int TRACI_ID_LIST
static PointOfInterest * getPoI(const std::string &id)
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
static double getAngle(const std::string &poiID)
static void setWidth(const std::string &poiID, double width)
const POIs & getPOIs() const
Returns all pois.
static SubscriptionResults mySubscriptionResults
static TraCIColor getColor(const std::string &poiID)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const std::string &poiID, const TraCIColor &c)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static bool exists(std::string polyID)
Checks if a polygon of the given name exists already in the simulation.
static std::string getParameter(const std::string &poiID, const std::string &key)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static void setImageFile(const std::string &poiID, const std::string &imageFile)
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
T get(const std::string &id) const
Retrieves an item.
TRACI_CONST int VAR_POSITION3D
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
A RT-tree for efficient storing of SUMO's Named objects.
double getWidth() const
Returns the image width of the POI.
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.
void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
virtual bool removePOI(const std::string &id)
Removes a PoI from the container.
virtual bool wrapPosition(const std::string &objID, const int variable, const TraCIPosition &value)=0
TRACI_CONST int VAR_IMAGEFILE
const std::string & getID() const
Returns the id.
static void highlight(const std::string &poiID, const TraCIColor &col, double size, const int alphaMax, const double duration, const int type)
static void setParameter(const std::string &poiID, const std::string &key, const std::string &value)
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
void setShapeColor(const RGBColor &col)
Sets a new color.
static ContextSubscriptionResults myContextSubscriptionResults
static bool remove(const std::string &poiID, int layer=0)