47 #ifdef CHECK_MEMORY_LEAKS 49 #endif // CHECK_MEMORY_LEAKS 57 myPrefix(
""), myDefaultColor(
RGBColor::RED), myDefaultLayer(), myDefaultFill(false) {}
74 addPOI(attrs,
false,
false);
89 const SUMOReal INVALID_POSITION(-1000000);
112 if (lat == INVALID_POSITION || lon == INVALID_POSITION) {
115 x = INVALID_POSITION;
119 if (x == INVALID_POSITION || y == INVALID_POSITION) {
125 if (lat == INVALID_POSITION || lon == INVALID_POSITION) {
126 WRITE_ERROR(
"Either (x, y), (lon, lat) or (lane, pos) must be specified for PoI '" +
id +
"'.");
129 WRITE_ERROR(
"(lon, lat) is specified for PoI '" +
id +
"' but no geo-conversion is specified for the network.");
140 WRITE_ERROR(
"Unable to project coordinates for PoI '" +
id +
"'.");
145 if (!
myShapeContainer.
addPOI(
id, type, color, layer, angle, imgFile, pos, width, height, ignorePruning)) {
166 for (
int i = 0; i < (int)shape.size(); i++) {
174 WRITE_WARNING(
"Unable to project coordinates for polygon '" +
id +
"'.");
184 WRITE_ERROR(
"Polygon '" +
id +
"' already exists.");
192 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
194 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.
static const std::string DEFAULT_IMG_FILE
SUMOReal myDefaultLayer
The default layer to use.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
const std::string & getFileName() const
returns the current file name
bool x2cartesian(Position &from, bool includeInBoundary=true)
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
Storage for geometrical objects.
RGBColor myDefaultColor
The default color to use.
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
std::string myPrefix
The prefix to use.
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
static methods for processing the coordinates conversion for the current net
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, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
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.
void addPOI(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a POI
bool myDefaultFill
Information whether polygons should be filled.
virtual Position getLanePos(const std::string &poiID, const std::string &laneID, SUMOReal lanePos)=0
get position for a given laneID
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, bool ignorePruning=false)
Builds a polygon using the given values and adds it to the container.
void addPoly(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a polygon
static const SUMOReal DEFAULT_LAYER
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.
virtual ~ShapeHandler()
Destructor.
void setDefaults(const std::string &prefix, const RGBColor &color, const SUMOReal layer, const bool fill=false)
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...
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation. ...
#define WRITE_MESSAGE(msg)
static const SUMOReal DEFAULT_IMG_WIDTH