SUMO - Simulation of Urban MObility
GeomConvHelper Class Reference

#include <GeomConvHelper.h>

Static Public Member Functions

static Boundary parseBoundaryReporting (const std::string &def, const std::string &objecttype, const char *objectid, bool &ok, bool report=true)
 Builds a boundary from its string representation, reporting occured errors.
static PositionVector parseShapeReporting (const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
 Builds a PositionVector from a string representation, reporting occured errors.

Static Private Member Functions

static void emitError (bool report, const std::string &what, const std::string &objecttype, const char *objectid, const std::string &desc)
 Writes an error message into the MessageHandler.

Detailed Description

This class holds some helping functions for the parsing of geometries

Definition at line 47 of file GeomConvHelper.h.


Member Function Documentation

void GeomConvHelper::emitError ( bool  report,
const std::string &  what,
const std::string &  objecttype,
const char *  objectid,
const std::string &  desc 
) [static, private]

Writes an error message into the MessageHandler.

Parameters:
[in]reportWhether errors shall be written to msg handler's error instance
[in]whatName of the parsed object ("Shape", or "Boundary")
[in]objecttypeThe name of the parsed object type the error occured at
[in]objectidThe name of the parsed object type the error occured at
[out]descError description

Definition at line 117 of file GeomConvHelper.cpp.

References WRITE_ERROR.

Referenced by parseBoundaryReporting(), and parseShapeReporting().

Boundary GeomConvHelper::parseBoundaryReporting ( const std::string &  def,
const std::string &  objecttype,
const char *  objectid,
bool ok,
bool  report = true 
) [static]

Builds a boundary from its string representation, reporting occured errors.

It is assumed that the boundary is stored as a quadruple of SUMOReal, divided by ','.

Parameters:
[in]defThe boundary definition to parse
[in]objecttypeThe name of the parsed object type; used for error message generation
[in]objectidThe name of the parsed object; used for error message generation
[out]okWhether the value could be read
[in]reportWhether errors shall be written to msg handler's error instance
Returns:
The parsed boundary

Definition at line 92 of file GeomConvHelper.cpp.

References emitError(), StringTokenizer::next(), StringTokenizer::size(), and SUMOReal.

Referenced by NIImporter_SUMO::loadLocation(), main(), PCNetProjectionLoader::myStartElement(), and NLHandler::setLocation().

PositionVector GeomConvHelper::parseShapeReporting ( const std::string &  shpdef,
const std::string &  objecttype,
const char *  objectid,
bool ok,
bool  allowEmpty,
bool  report = true 
) [static]

Builds a PositionVector from a string representation, reporting occured errors.

It is assumed, the vector is stored as "x,y[ x,y]*" where x and y are SUMOReals.

Parameters:
[in]shpdefThe shape definition to parse
[in]objecttypeThe name of the parsed object type; used for error message generation
[in]objectidThe name of the parsed object; used for error message generation
[out]okWhether the value could be read
[in]allowEmptyWhether an empty shape definition is valid
[in]reportWhether errors shall be written to msg handler's error instance
Returns:
The parsed position vector

Definition at line 50 of file GeomConvHelper.cpp.

References emitError(), StringTokenizer::hasNext(), StringTokenizer::next(), PositionVector::push_back(), and SUMOReal.

Referenced by NIImporter_SUMO::addEdge(), NIImporter_SUMO::addJunction(), NIImporter_SUMO::addLane(), NLHandler::addLane(), NLHandler::addPoly(), NIImporter_SUMO::loadLocation(), PCLoaderXML::myCharacters(), PCNetProjectionLoader::myStartElement(), NLHandler::openJunction(), NLHandler::setLocation(), and NIXMLEdgesHandler::tryGetShape().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines