53 myPrefix(
""), myDefaultColor(
RGBColor::RED), myDefaultLayer(), myDefaultFill(false) {}
70 addPOI(attrs,
false,
false);
108 if (lat == INVALID_POSITION || lon == INVALID_POSITION) {
115 if (x == INVALID_POSITION || y == INVALID_POSITION) {
121 if (lat == INVALID_POSITION || lon == INVALID_POSITION) {
122 WRITE_ERROR(
"Either (x, y), (lon, lat) or (lane, pos) must be specified for PoI '" +
id +
"'.");
125 WRITE_ERROR(
"(lon, lat) is specified for PoI '" +
id +
"' but no geo-conversion is specified for the network.");
136 WRITE_ERROR(
"Unable to project coordinates for PoI '" +
id +
"'.");
141 if (!
myShapeContainer.
addPOI(
id, type, color, layer, angle, imgFile, pos, width, height, ignorePruning)) {
162 for (
int i = 0; i < (int)shape.size(); i++) {
170 WRITE_WARNING(
"Unable to project coordinates for polygon '" +
id +
"'.");
180 WRITE_ERROR(
"Polygon '" +
id +
"' already exists.");
188 for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
190 WRITE_MESSAGE(
"Loading of shapes from " + *fileIt +
" failed.");
double myDefaultLayer
The default layer to use.
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
void setDefaults(const std::string &prefix, const RGBColor &color, const double layer, const bool fill=false)
virtual Position getLanePos(const std::string &poiID, const std::string &laneID, double lanePos)=0
get position for a given laneID
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.
static const double DEFAULT_IMG_HEIGHT
Storage for geometrical objects.
begin/end of the description of a polygon
RGBColor myDefaultColor
The default color to use.
void set(double x, double y)
set positions x and y
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 methods for processing the coordinates conversion for the current net
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.
A point in 2D or 3D with translation and scaling methods.
virtual bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, double layer, double 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 addPOI(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a POI
bool myDefaultFill
Information whether polygons should be filled.
edge: the shape in xml-definition
void addPoly(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a polygon
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.
ShapeContainer & myShapeContainer
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
static const double DEFAULT_IMG_WIDTH
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation. ...
virtual bool addPOI(const std::string &id, const std::string &type, const RGBColor &color, double layer, double angle, const std::string &imgFile, const Position &pos, double width, double height, bool ignorePruning=false)
Builds a POI using the given values and adds it to the container.
#define WRITE_MESSAGE(msg)
static const double DEFAULT_ANGLE
begin/end of the description of a polygon
static const double DEFAULT_LAYER