Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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, bool offsets=false)
 Builds a boundary from its string representation, reporting occurred 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 occurred 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 37 of file GeomConvHelper.h.

Member Function Documentation

◆ emitError()

void GeomConvHelper::emitError ( bool  report,
const std::string &  what,
const std::string &  objecttype,
const char *  objectid,
const std::string &  desc 
)
staticprivate

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 occurred at
[in]objectidThe name of the parsed object type the error occurred at
[out]descError description

Definition at line 110 of file GeomConvHelper.cpp.

References WRITE_ERROR.

Referenced by parseBoundaryReporting(), and parseShapeReporting().

Here is the caller graph for this function:

◆ parseBoundaryReporting()

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

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

It is assumed that the boundary is stored as a quadruple of double, 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
[in]offsetsWhether inverted values (i.e. xmin > xmax) shall be kept rather than corrected
Returns
The parsed boundary

Definition at line 79 of file GeomConvHelper.cpp.

References emitError(), StringTokenizer::next(), Boundary::setOffsets(), StringTokenizer::size(), and StringUtils::toDouble().

Referenced by main().

Here is the caller graph for this function:

◆ parseShapeReporting()

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 occurred errors.

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

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 37 of file GeomConvHelper.cpp.

References emitError(), StringTokenizer::hasNext(), StringTokenizer::next(), StringTokenizer::size(), and StringUtils::toDouble().

Referenced by NBEdgeCont::applyOptions(), and GNEAttributeCarrier::parse().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: