libosmscout  0.1
osmscout::TypeConfig Class Referencefinal

#include <TypeConfig.h>

Public Member Functions

uint8_t GetAreaTypeIdBits () const
 
uint8_t GetAreaTypeIdBytes () const
 
TypeInfoRef GetAreaTypeInfo (TypeId id) const
 Returns the type definition for the given type id. More...
 
const std::vector< TypeInfoRef > & GetAreaTypes () const
 Returns an array of the (ignore=false) area types available. More...
 
FeatureRef GetFeature (const std::string &name) const
 Return the feature with the given name or an invalid reference if no feature with the given name is registered. More...
 
const std::vector< FeatureRef > & GetFeatures () const
 Return all features registered. More...
 
TypeId GetMaxTypeId () const
 Return the highest used type id. More...
 
TypeInfoRef GetNodeType (const TagMap &tagMap) const
 Return a node type (or an invalid reference if no type got detected) based on the given map of tag and tag values. More...
 
uint8_t GetNodeTypeIdBytes () const
 
TypeInfoRef GetNodeTypeInfo (TypeId id) const
 Returns the type definition for the given type id. More...
 
const std::vector< TypeInfoRef > & GetNodeTypes () const
 Returns an array of the (ignore=false) node types available. More...
 
TypeInfoRef GetRelationType (const TagMap &tagMap) const
 Return a relation type (or an invalid reference if no type got detected) based on the given map of tag and tag values. More...
 
uint8_t GetRouteTypeIdBytes () const
 
TypeInfoRef GetRouteTypeInfo (TypeId id) const
 Returns the type definition for the given type id. More...
 
const std::vector< TypeInfoRef > & GetRouteTypes () const
 Returns an array of the (ignore=false) route types available. More...
 
TagId GetTagId (const char *name) const
 Methods for dealing with tags. More...
 
TagId GetTagId (const std::string &name) const
 
TagRegistryGetTagRegistry ()
 
const TagRegistryGetTagRegistry () const
 
size_t GetTypeCount () const
 Returns the number of types available. More...
 
TypeInfoRef GetTypeInfo (const std::string &name) const
 Returns the type definition for the given type name. More...
 
TypeInfoRef GetTypeInfo (size_t index) const
 Returns the type definition for the given type id. More...
 
const std::vector< TypeInfoRef > & GetTypes () const
 Return an array of the types available. More...
 
bool GetWayAreaType (const TagMap &tagMap, TypeInfoRef &wayType, TypeInfoRef &areaType) const
 Return a way/area type (or an invalid reference if no type got detected) based on the given map of tag and tag values. More...
 
uint8_t GetWayTypeIdBytes () const
 
TypeInfoRef GetWayTypeInfo (TypeId id) const
 Returns the type definition for the given type id. More...
 
const std::vector< TypeInfoRef > & GetWayTypes () const
 Returns an array of (ignore=false) the way types available. More...
 
bool LoadFromDataFile (const std::string &directory)
 Loads the type configuration from the given binary data file. More...
 
bool LoadFromOSTFile (const std::string &filename)
 Methods for loading/storing of type information from/to files. More...
 
void RegisterFeature (const FeatureRef &feature)
 Methods for dealing with features. More...
 
void RegisterMaxSpeedAlias (const std::string &alias, uint8_t maxSpeed)
 Methods for dealing with mappings for surfaces and surface grades. More...
 
void RegisterSurfaceToGradeMapping (const std::string &surface, size_t grade)
 Methods for dealing with mappings for surfaces and surface grades. More...
 
TypeInfoRef RegisterType (const TypeInfoRef &typeInfo)
 Methods for dealing with types. More...
 
bool StoreToDataFile (const std::string &directory) const
 Store the part of the TypeConfig information to a data file, which is necessary to review later on when reading and evaluation an import. More...
 
 TypeConfig ()
 
 ~TypeConfig ()
 

Public Attributes

TagId tagArea
 
TagId tagDataPolygon
 
TagId tagJunction
 
TagId tagNatural
 
TagId tagRestriction
 
TagId tagType
 
TypeInfoRef typeInfoCoastline
 Internal type for coastlines. More...
 
TypeInfoRef typeInfoIgnore
 
TypeInfoRef typeInfoOSMSubTileBorder
 Internal type for OSM tile borders. More...
 
TypeInfoRef typeInfoOSMTileBorder
 Internal type for OSM tile borders. More...
 
TypeInfoRef typeInfoTileCoast
 Internal type for ground tiles of type "coast". More...
 
TypeInfoRef typeInfoTileLand
 Internal type for ground tiles of type "land". More...
 
TypeInfoRef typeInfoTileSea
 Internal type for ground tiles of type "sea". More...
 
TypeInfoRef typeInfoTileUnknown
 Internal type for ground tiles of type "unknown". More...
 

Static Public Attributes

static const char * FILE_TYPES_DAT ="types.dat"
 
static const uint32_t MAX_FORMAT_VERSION = FILE_FORMAT_VERSION
 
static const uint32_t MIN_FORMAT_VERSION = FILE_FORMAT_VERSION
 

Detailed Description

The TypeConfig class holds information about object types defined by a db instance.

Constructor & Destructor Documentation

◆ TypeConfig()

◆ ~TypeConfig()

osmscout::TypeConfig::~TypeConfig ( )

Member Function Documentation

◆ GetAreaTypeIdBits()

uint8_t osmscout::TypeConfig::GetAreaTypeIdBits ( ) const
inline

◆ GetAreaTypeIdBytes()

◆ GetAreaTypeInfo()

TypeInfoRef osmscout::TypeConfig::GetAreaTypeInfo ( TypeId  id) const
inline

Returns the type definition for the given type id.

References osmscout::typeIgnore.

Referenced by osmscout::Area::Read(), osmscout::Area::ReadImport(), and osmscout::Area::ReadOptimized().

◆ GetAreaTypes()

const std::vector<TypeInfoRef>& osmscout::TypeConfig::GetAreaTypes ( ) const
inline

Returns an array of the (ignore=false) area types available.

◆ GetFeature()

◆ GetFeatures()

const std::vector<FeatureRef>& osmscout::TypeConfig::GetFeatures ( ) const
inline

Return all features registered.

Referenced by StoreToDataFile().

◆ GetMaxTypeId()

TypeId osmscout::TypeConfig::GetMaxTypeId ( ) const

Return the highest used type id.

◆ GetNodeType()

TypeInfoRef osmscout::TypeConfig::GetNodeType ( const TagMap tagMap) const

Return a node type (or an invalid reference if no type got detected) based on the given map of tag and tag values.

The method iterates over all node type definitions, evaluates their conditions and returns the first matching type.

References typeInfoIgnore, and osmscout::TypeInfo::typeNode.

◆ GetNodeTypeIdBytes()

uint8_t osmscout::TypeConfig::GetNodeTypeIdBytes ( ) const
inline

◆ GetNodeTypeInfo()

TypeInfoRef osmscout::TypeConfig::GetNodeTypeInfo ( TypeId  id) const
inline

Returns the type definition for the given type id.

References osmscout::typeIgnore.

Referenced by osmscout::Node::Read().

◆ GetNodeTypes()

const std::vector<TypeInfoRef>& osmscout::TypeConfig::GetNodeTypes ( ) const
inline

Returns an array of the (ignore=false) node types available.

◆ GetRelationType()

TypeInfoRef osmscout::TypeConfig::GetRelationType ( const TagMap tagMap) const

Return a relation type (or an invalid reference if no type got detected) based on the given map of tag and tag values.

The method iterates over all relation type definitions, evaluates their conditions and returns the first matching type.

References tagType, osmscout::TypeInfo::typeArea, typeInfoIgnore, and osmscout::TypeInfo::typeRelation.

◆ GetRouteTypeIdBytes()

uint8_t osmscout::TypeConfig::GetRouteTypeIdBytes ( ) const
inline

◆ GetRouteTypeInfo()

TypeInfoRef osmscout::TypeConfig::GetRouteTypeInfo ( TypeId  id) const
inline

Returns the type definition for the given type id.

References osmscout::typeIgnore.

Referenced by osmscout::Route::Read().

◆ GetRouteTypes()

const std::vector<TypeInfoRef>& osmscout::TypeConfig::GetRouteTypes ( ) const
inline

Returns an array of the (ignore=false) route types available.

◆ GetTagId() [1/2]

TagId osmscout::TypeConfig::GetTagId ( const char *  name) const
inline

Methods for dealing with tags.

References osmscout::TagRegistry::GetTagId().

◆ GetTagId() [2/2]

TagId osmscout::TypeConfig::GetTagId ( const std::string &  name) const
inline

◆ GetTagRegistry() [1/2]

TagRegistry& osmscout::TypeConfig::GetTagRegistry ( )
inline

◆ GetTagRegistry() [2/2]

◆ GetTypeCount()

◆ GetTypeInfo() [1/2]

TypeInfoRef osmscout::TypeConfig::GetTypeInfo ( const std::string &  name) const

Returns the type definition for the given type name.

If there is no type definition for the given name and invalid reference is returned.

◆ GetTypeInfo() [2/2]

TypeInfoRef osmscout::TypeConfig::GetTypeInfo ( size_t  index) const
inline

◆ GetTypes()

◆ GetWayAreaType()

bool osmscout::TypeConfig::GetWayAreaType ( const TagMap tagMap,
TypeInfoRef wayType,
TypeInfoRef areaType 
) const

Return a way/area type (or an invalid reference if no type got detected) based on the given map of tag and tag values.

The method iterates over all way/area type definitions, evaluates their conditions and returns the first matching type.

References osmscout::TypeInfo::typeArea, typeInfoIgnore, and osmscout::TypeInfo::typeWay.

◆ GetWayTypeIdBytes()

uint8_t osmscout::TypeConfig::GetWayTypeIdBytes ( ) const
inline

◆ GetWayTypeInfo()

TypeInfoRef osmscout::TypeConfig::GetWayTypeInfo ( TypeId  id) const
inline

Returns the type definition for the given type id.

References osmscout::typeIgnore.

Referenced by osmscout::Way::Read(), and osmscout::Way::ReadOptimized().

◆ GetWayTypes()

const std::vector<TypeInfoRef>& osmscout::TypeConfig::GetWayTypes ( ) const
inline

Returns an array of (ignore=false) the way types available.

◆ LoadFromDataFile()

bool osmscout::TypeConfig::LoadFromDataFile ( const std::string &  directory)

◆ LoadFromOSTFile()

bool osmscout::TypeConfig::LoadFromOSTFile ( const std::string &  filename)

Methods for loading/storing of type information from/to files.

Loads the type configuration from the given *.ost file.

Note: Make sure that you load from a OST file only onto a freshly initialized TypeConfig instance.

Parameters
filenameFull filename including path of the OST file
Returns
True, if there were no errors, else false

References osmscout::Log::Error(), osmscout::ost::Parser::errors, osmscout::IOException::GetDescription(), osmscout::GetFileSize(), osmscout::ost::Errors::hasErrors, osmscout::log, and osmscout::ost::Parser::Parse().

Referenced by osmscout::ost::Parser::IMPORT().

◆ RegisterFeature()

void osmscout::TypeConfig::RegisterFeature ( const FeatureRef feature)

Methods for dealing with features.

A feature is a attribute set based on parsed tags. Features can get assigned to a type.

Referenced by TypeConfig().

◆ RegisterMaxSpeedAlias()

void osmscout::TypeConfig::RegisterMaxSpeedAlias ( const std::string &  alias,
uint8_t  maxSpeed 
)
inline

Methods for dealing with mappings for surfaces and surface grades.

References osmscout::TagRegistry::RegisterMaxSpeedAlias().

Referenced by osmscout::ost::Parser::MAXSPEED().

◆ RegisterSurfaceToGradeMapping()

void osmscout::TypeConfig::RegisterSurfaceToGradeMapping ( const std::string &  surface,
size_t  grade 
)
inline

Methods for dealing with mappings for surfaces and surface grades.

References osmscout::TagRegistry::RegisterSurfaceToGradeMapping().

Referenced by osmscout::ost::Parser::GRADE().

◆ RegisterType()

◆ StoreToDataFile()

bool osmscout::TypeConfig::StoreToDataFile ( const std::string &  directory) const

Store the part of the TypeConfig information to a data file, which is necessary to review later on when reading and evaluation an import.

Parameters
directoryDirectory the data file should be written to
Returns
True, if there were no errors, else false

References osmscout::AppendFileToDir(), osmscout::FileWriter::Close(), osmscout::FileWriter::CloseFailsafe(), osmscout::Log::Error(), osmscout::FILE_FORMAT_VERSION, osmscout::IOException::GetDescription(), GetFeatures(), GetTypes(), osmscout::log, osmscout::FileWriter::Open(), osmscout::FileWriter::Write(), and osmscout::FileWriter::WriteNumber().

Member Data Documentation

◆ FILE_TYPES_DAT

const char * osmscout::TypeConfig::FILE_TYPES_DAT ="types.dat"
static

◆ MAX_FORMAT_VERSION

const uint32_t osmscout::TypeConfig::MAX_FORMAT_VERSION = FILE_FORMAT_VERSION
static

◆ MIN_FORMAT_VERSION

const uint32_t osmscout::TypeConfig::MIN_FORMAT_VERSION = FILE_FORMAT_VERSION
static

◆ tagArea

TagId osmscout::TypeConfig::tagArea

Referenced by TypeConfig().

◆ tagDataPolygon

TagId osmscout::TypeConfig::tagDataPolygon

Referenced by TypeConfig().

◆ tagJunction

TagId osmscout::TypeConfig::tagJunction

Referenced by TypeConfig().

◆ tagNatural

TagId osmscout::TypeConfig::tagNatural

Referenced by TypeConfig().

◆ tagRestriction

TagId osmscout::TypeConfig::tagRestriction

Referenced by TypeConfig().

◆ tagType

TagId osmscout::TypeConfig::tagType

Referenced by GetRelationType(), and TypeConfig().

◆ typeInfoCoastline

TypeInfoRef osmscout::TypeConfig::typeInfoCoastline

Internal type for coastlines.

Referenced by TypeConfig().

◆ typeInfoIgnore

TypeInfoRef osmscout::TypeConfig::typeInfoIgnore

◆ typeInfoOSMSubTileBorder

TypeInfoRef osmscout::TypeConfig::typeInfoOSMSubTileBorder

Internal type for OSM tile borders.

Referenced by TypeConfig().

◆ typeInfoOSMTileBorder

TypeInfoRef osmscout::TypeConfig::typeInfoOSMTileBorder

Internal type for OSM tile borders.

Referenced by TypeConfig().

◆ typeInfoTileCoast

TypeInfoRef osmscout::TypeConfig::typeInfoTileCoast

Internal type for ground tiles of type "coast".

Referenced by TypeConfig().

◆ typeInfoTileLand

TypeInfoRef osmscout::TypeConfig::typeInfoTileLand

Internal type for ground tiles of type "land".

Referenced by TypeConfig().

◆ typeInfoTileSea

TypeInfoRef osmscout::TypeConfig::typeInfoTileSea

Internal type for ground tiles of type "sea".

Referenced by TypeConfig().

◆ typeInfoTileUnknown

TypeInfoRef osmscout::TypeConfig::typeInfoTileUnknown

Internal type for ground tiles of type "unknown".

Referenced by TypeConfig().


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