42 std::vector<std::string>
44 std::vector<std::string> ids;
120 if (!shapeCont.
addPolygon(polygonID, polygonType, col, (
double)layer,
Shape::DEFAULT_ANGLE,
Shape::DEFAULT_IMG_FILE,
Shape::DEFAULT_RELATIVEPATH, pShape,
false, fill, lineWidth)) {
121 throw TraCIException(
"Could not add polygon '" + polygonID +
"'");
131 throw TraCIException(
"Could not remove polygon '" + polygonID +
"'");
174 Boundary b = i.second->getShape().getBoxBoundary();
175 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
176 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
177 t->
Insert(cmin, cmax, i.second);
189 std::shared_ptr<VariableWrapper>
static void setColor(const std::string &polygonID, const TraCIColor &c)
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}}
double ymin() const
Returns minimum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
static void setLineWidth(std::string polygonID, double lineWidth)
static std::string getParameter(const std::string &polygonID, const std::string &key)
static PositionVector makePositionVector(const TraCIPositionVector &vector)
static TraCIColor makeTraCIColor(const RGBColor &color)
static const std::string DEFAULT_IMG_FILE
void setLineWidth(double lineWidth)
void setShapeColor(const RGBColor &col)
Sets a new color.
const Polygons & getPolygons() const
Returns all polygons.
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static SubscriptionResults mySubscriptionResults
static void add(const std::string &polygonID, const TraCIPositionVector &shape, const TraCIColor &color, bool fill=false, double lineWidth=1, const std::string &polygonType="", int layer=0)
void setShapeType(const std::string &type)
Sets a new type.
T get(const std::string &id) const
Retrieves an item.
A RT-tree for efficient storing of SUMO's Named objects.
static void setFilled(std::string polygonID, bool filled)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const PositionVector & getShape() const
Returns whether the shape of the polygon.
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Storage for geometrical objects.
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
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)
Builds a polygon using the given values and adds it to the container.
void insertIDs(std::vector< std::string > &into) const
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
double getLineWidth() const
Returns whether the polygon is filled.
A class that stores a 2D geometrical boundary.
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
static std::string getType(const std::string &polygonID)
static RGBColor makeRGBColor(const TraCIColor &color)
virtual bool removePolygon(const std::string &id)
Removes a polygon from the container.
ShapeContainer & getShapeContainer()
Returns the shapes container.
static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with polygon instances.
const RGBColor & getShapeColor() const
Returns the color of the Shape.
static const bool DEFAULT_RELATIVEPATH
static void remove(const std::string &polygonID, int layer=0)
static TraCIPositionVector getShape(const std::string &polygonID)
static void setShape(const std::string &polygonID, const TraCIPositionVector &shape)
double xmin() const
Returns minimum x-coordinate.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
bool getFill() const
Returns whether the polygon is filled.
virtual void reshapePolygon(const std::string &id, const PositionVector &shape)
Assigns a shape to the named polygon.
static std::shared_ptr< VariableWrapper > makeWrapper()
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
static std::vector< std::string > getIDList()
virtual bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)=0
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
static TraCIColor getColor(const std::string &polygonID)
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static bool getFilled(const std::string &polygonID)
static SUMOPolygon * getPolygon(const std::string &id)
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
static void setParameter(const std::string &polygonID, const std::string &key, const std::string &value)
double ymax() const
Returns maximum y-coordinate.
static ContextSubscriptionResults myContextSubscriptionResults
void setFill(bool fill)
Sets whether the polygon shall be filled.
static const double DEFAULT_ANGLE
static void setType(const std::string &polygonID, const std::string &setType)
static double getLineWidth(const std::string &polygonID)