47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
57 myShapeContainer(sc) {}
87 const SUMOReal INVALID_POSITION(-1000000);
109 if (x == INVALID_POSITION || y == INVALID_POSITION) {
115 if (lat == INVALID_POSITION || lon == INVALID_POSITION) {
116 WRITE_ERROR(
"Either (x,y), (lon,lat) or (lane,pos) must be specified for poi '" +
id +
"'.");
119 WRITE_ERROR(
"(lon, lat) is specified for poi '" +
id +
"' but no geo-conversion is specified for the network.");
147 for (
int i = 0; i < (int) shape.size(); i++) {
156 if (shape.size() != 0) {
158 WRITE_WARNING(
"Skipping redefinition of polygon '" +
id +
"'.");
167 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
169 WRITE_MESSAGE(
"Loading of shapes from " + *fileIt +
" failed.");
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
ShapeHandler(const std::string &file, ShapeContainer &sc)
Constructor.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation. ...
void addPoly(const SUMOSAXAttributes &attrs)
adds a polygon
static const std::string DEFAULT_IMG_FILE
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Storage for geometrical objects.
SAX-handler base for SUMO-files.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
static const std::string DEFAULT_TYPE
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define WRITE_WARNING(msg)
The XML-Handler for network loading.
static const SUMOReal DEFAULT_ANGLE
const std::string & getFileName() const
returns the current file name
Encapsulated SAX-Attributes.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
static const SUMOReal DEFAULT_IMG_HEIGHT
A point in 2D or 3D with translation and scaling methods.
virtual bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, SUMOReal layer, SUMOReal angle, const std::string &imgFile, const Position &pos, SUMOReal width, SUMOReal height)
Builds a POI using the given values and adds it to the container.
virtual Position getLanePos(const std::string &poiID, const std::string &laneID, SUMOReal lanePos)=0
get position for a given laneID
static const SUMOReal DEFAULT_LAYER
virtual ~ShapeHandler()
Destructor.
static const RGBColor RED
virtual bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, SUMOReal layer, SUMOReal angle, const std::string &imgFile, const PositionVector &shape, bool fill)
Builds a polygon using the given values and adds it to the container.
void set(SUMOReal x, SUMOReal y)
ShapeContainer & myShapeContainer
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
#define WRITE_MESSAGE(msg)
void addPOI(const SUMOSAXAttributes &attrs)
adds a polygon
static const SUMOReal DEFAULT_IMG_WIDTH