SUMO - Simulation of Urban MObility
PCTypeMap Class Reference

A storage for type mappings. More...

#include <PCTypeMap.h>

Collaboration diagram for PCTypeMap:
Collaboration graph

Data Structures

struct  TypeDef
 A single definition of values that shall be used for a given type. More...
 

Public Member Functions

bool add (const std::string &id, const std::string &newid, const std::string &color, const std::string &prefix, double layer, bool discard, bool allowFill)
 Adds a type definition. More...
 
const TypeDefget (const std::string &id)
 Returns a type definition. More...
 
const TypeDefgetDefault ()
 get the default type according to the given options More...
 
bool has (const std::string &id)
 Returns the information whether the named type is known. More...
 
 PCTypeMap (const OptionsCont &oc)
 Constructor. The default type is constructed based on the given options. More...
 
 ~PCTypeMap ()
 Destructor. More...
 

Protected Attributes

TypeDef myDefaultType
 
std::map< std::string, TypeDefmyTypes
 A map of type names to type definitions. More...
 

Detailed Description

A storage for type mappings.

This class holds the mappings between names of read polygon/poi types and the values (color, new type name etc.) that shall be assigned to them.

Definition at line 45 of file PCTypeMap.h.

Constructor & Destructor Documentation

◆ PCTypeMap()

◆ ~PCTypeMap()

PCTypeMap::~PCTypeMap ( )

Destructor.

Definition at line 45 of file PCTypeMap.cpp.

Member Function Documentation

◆ add()

bool PCTypeMap::add ( const std::string &  id,
const std::string &  newid,
const std::string &  color,
const std::string &  prefix,
double  layer,
bool  discard,
bool  allowFill 
)

Adds a type definition.

Parameters
[in]idThe original id of the type
[in]newidThe new id (name) of the type
[in]colorThe color to set for imported objects of this type
[in]prefixThe prefix to prepend to the read names of this type's objects
[in]layerThe layer number to set for this type's objects
[in]discardWhether objects of this type shall be discarded
[in]allowFillWhether objects of this type may be filled
Returns
Whether the type could been added (was not known before)

Definition at line 49 of file PCTypeMap.cpp.

References PCTypeMap::TypeDef::allowFill, PCTypeMap::TypeDef::color, PCTypeMap::TypeDef::discard, has(), PCTypeMap::TypeDef::id, PCTypeMap::TypeDef::layer, myTypes, RGBColor::parseColor(), and PCTypeMap::TypeDef::prefix.

Referenced by PCTypeDefHandler::myStartElement().

◆ get()

const PCTypeMap::TypeDef & PCTypeMap::get ( const std::string &  id)

Returns a type definition.

This type definition MUST have been added otherwise the further process is undefined.

Parameters
[in]idThe id of the type to get the definitions of
Returns
Definition of the named type

Definition at line 68 of file PCTypeMap.cpp.

References myTypes.

Referenced by PCLoaderVisum::load(), PCLoaderOSM::loadIfSet(), PCLoaderDlrNavteq::loadPOIFile(), PCLoaderDlrNavteq::loadPolyFile(), and PCLoaderXML::myStartElement().

◆ getDefault()

const TypeDef& PCTypeMap::getDefault ( )
inline

get the default type according to the given options

Definition at line 108 of file PCTypeMap.h.

References myDefaultType.

Referenced by PCLoaderOSM::loadIfSet().

◆ has()

bool PCTypeMap::has ( const std::string &  id)

Returns the information whether the named type is known.

Parameters
[in]idThe id of the type
Returns
Whether a definition of the named type was added before

Definition at line 74 of file PCTypeMap.cpp.

References myTypes.

Referenced by add(), PCLoaderVisum::load(), PCLoaderOSM::loadIfSet(), PCLoaderDlrNavteq::loadPOIFile(), PCLoaderDlrNavteq::loadPolyFile(), and PCLoaderXML::myStartElement().

Field Documentation

◆ myDefaultType

TypeDef PCTypeMap::myDefaultType
protected

Definition at line 116 of file PCTypeMap.h.

Referenced by getDefault(), and PCTypeMap().

◆ myTypes

std::map<std::string, TypeDef> PCTypeMap::myTypes
protected

A map of type names to type definitions.

Definition at line 114 of file PCTypeMap.h.

Referenced by add(), get(), and has().


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