libosmscout
0.1
|
#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 |
TagRegistry & | GetTagRegistry () |
const TagRegistry & | GetTagRegistry () 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) |
Loads the type configuration from the given *.ost file. 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 () | |
Static Public Member Functions | |
static uint32_t | GetDatabaseFileFormatVersion (const std::string &directory) |
Methods for loading/storing of type information from/to files. More... | |
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 |
The TypeConfig class holds information about object types defined by a db instance.
osmscout::TypeConfig::TypeConfig | ( | ) |
References osmscout::Log::Debug(), osmscout::TagRegistry::GetTagId(), osmscout::log, RegisterFeature(), RegisterType(), tagArea, tagDataPolygon, osmscout::tagIgnore, tagJunction, tagNatural, tagRestriction, tagType, typeInfoCoastline, typeInfoIgnore, typeInfoOSMSubTileBorder, typeInfoOSMTileBorder, typeInfoTileCoast, typeInfoTileLand, typeInfoTileSea, and typeInfoTileUnknown.
osmscout::TypeConfig::~TypeConfig | ( | ) |
References osmscout::Log::Debug(), and osmscout::log.
|
inline |
|
inline |
|
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().
|
inline |
Returns an array of the (ignore=false) area types available.
|
static |
Methods for loading/storing of type information from/to files.
Returns the file format version of the given database (scanning the "types.dat" file in the given directory) or an IOException.
directory |
References osmscout::AppendFileToDir(), osmscout::FileScanner::Close(), osmscout::FileScanner::CloseFailsafe(), osmscout::FileScanner::Open(), osmscout::FileScanner::ReadUInt32(), and osmscout::FileScanner::Sequential.
Referenced by osmscout::Database::GetDatabaseFileFormatVersion().
FeatureRef osmscout::TypeConfig::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.
Referenced by osmscout::DynamicFeatureLabelReader::DynamicFeatureLabelReader(), osmscout::ost::Parser::FEATURE(), osmscout::FeatureLabelReader< F, V >::FeatureLabelReader(), osmscout::FeatureReader< F >::FeatureReader(), osmscout::FeatureValueReader< NameFeature, NameFeatureValue >::FeatureValueReader(), LoadFromDataFile(), and osmscout::ost::Parser::TYPEFEATURE().
|
inline |
Return all features registered.
Referenced by StoreToDataFile().
TypeId osmscout::TypeConfig::GetMaxTypeId | ( | ) | const |
Return the highest used type id.
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.
|
inline |
Referenced by osmscout::Node::Read(), and osmscout::Node::Write().
|
inline |
Returns the type definition for the given type id.
References osmscout::typeIgnore.
Referenced by osmscout::Node::Read().
|
inline |
Returns an array of the (ignore=false) node types available.
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.
|
inline |
Referenced by osmscout::Route::Read(), and osmscout::Route::Write().
|
inline |
Returns the type definition for the given type id.
References osmscout::typeIgnore.
Referenced by osmscout::Route::Read().
|
inline |
Returns an array of the (ignore=false) route types available.
|
inline |
Methods for dealing with tags.
References osmscout::TagRegistry::GetTagId().
|
inline |
References osmscout::TagRegistry::GetTagId().
|
inline |
|
inline |
Referenced by osmscout::ost::Parser::TAGEQUALSCOND(), osmscout::ost::Parser::TAGEXISTSCOND(), osmscout::ost::Parser::TAGGREATERCOND(), osmscout::ost::Parser::TAGGREATEREQUALCOND(), osmscout::ost::Parser::TAGISINCOND(), osmscout::ost::Parser::TAGLESSCOND(), osmscout::ost::Parser::TAGLESSEQUALCOND(), and osmscout::ost::Parser::TAGNOTEQUALSCOND().
|
inline |
Returns the number of types available.
The index of a type is guaranteed to be in the interval [0..GetTypeCount()[
Referenced by osmscout::TypeInfoSet::Adapt(), osmscout::DynamicFeatureLabelReader::DynamicFeatureLabelReader(), osmscout::DynamicFeatureReader::DynamicFeatureReader(), osmscout::FeatureLabelReader< F, V >::FeatureLabelReader(), osmscout::FeatureReader< F >::FeatureReader(), osmscout::FeatureValueReader< NameFeature, NameFeatureValue >::FeatureValueReader(), osmscout::TypeDistributionDataFile::Load(), osmscout::SortInConditionals(), and osmscout::TypeInfoSet::TypeInfoSet().
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.
|
inline |
Returns the type definition for the given type id.
Referenced by osmscout::ObjectVariantData::Read(), osmscout::PTRoute::Read(), osmscout::OverlayArea::toArea(), osmscout::OverlayNode::toNode(), and osmscout::OverlayWay::toWay().
|
inline |
Return an array of the types available.
Referenced by osmscout::CalculateUsedTypes(), osmscout::DynamicFeatureLabelReader::DynamicFeatureLabelReader(), osmscout::DynamicFeatureReader::DynamicFeatureReader(), osmscout::FeatureLabelReader< F, V >::FeatureLabelReader(), osmscout::FeatureReader< F >::FeatureReader(), osmscout::FeatureValueReader< NameFeature, NameFeatureValue >::FeatureValueReader(), osmscout::TypeDistributionDataFile::Load(), osmscout::SortInConditionals(), and StoreToDataFile().
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.
|
inline |
|
inline |
Returns the type definition for the given type id.
References osmscout::typeIgnore.
Referenced by osmscout::Way::Read(), and osmscout::Way::ReadOptimized().
|
inline |
Returns an array of (ignore=false) the way types available.
bool osmscout::TypeConfig::LoadFromDataFile | ( | const std::string & | directory | ) |
Loads the type configuration from the given binary data file.
Note: Make sure that you load from file only onto a freshly initialized TypeConfig instance.
directory | Full path excluding the actual filename of the data file (filename is always "types.dat") |
References osmscout::AppendFileToDir(), osmscout::FileScanner::Close(), osmscout::FileScanner::CloseFailsafe(), osmscout::Log::Debug(), osmscout::Log::Error(), osmscout::FILE_FORMAT_VERSION, osmscout::IOException::GetDescription(), GetFeature(), osmscout::FileScanner::GetFilename(), osmscout::log, osmscout::FileScanner::Open(), osmscout::TypeInfo::Read(), osmscout::FileScanner::ReadString(), osmscout::FileScanner::ReadUInt32(), osmscout::FileScanner::ReadUInt32Number(), RegisterType(), osmscout::StopClock::ResultString(), osmscout::FileScanner::Sequential, and osmscout::StopClock::Stop().
bool osmscout::TypeConfig::LoadFromOSTFile | ( | const std::string & | filename | ) |
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.
filename | Full filename including path of the OST file |
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().
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().
|
inline |
Methods for dealing with mappings for surfaces and surface grades.
References osmscout::TagRegistry::RegisterMaxSpeedAlias().
Referenced by osmscout::ost::Parser::MAXSPEED().
|
inline |
Methods for dealing with mappings for surfaces and surface grades.
References osmscout::TagRegistry::RegisterSurfaceToGradeMapping().
Referenced by osmscout::ost::Parser::GRADE().
TypeInfoRef osmscout::TypeConfig::RegisterType | ( | const TypeInfoRef & | typeInfo | ) |
Methods for dealing with types.
References osmscout::BitsNeededToEncodeNumber(), osmscout::BytesNeededToEncodeNumber(), osmscout::TunnelFeature::NAME, osmscout::BridgeFeature::NAME, osmscout::EmbankmentFeature::NAME, osmscout::RoundaboutFeature::NAME, osmscout::WidthFeature::NAME, osmscout::LayerFeature::NAME, osmscout::GradeFeature::NAME, osmscout::MaxSpeedFeature::NAME, osmscout::NameFeature::NAME, osmscout::WebsiteFeature::NAME, osmscout::OpeningHoursFeature::NAME, osmscout::PostalCodeFeature::NAME, osmscout::PhoneFeature::NAME, osmscout::AddressFeature::NAME, osmscout::LocationFeature::NAME, osmscout::AccessRestrictedFeature::NAME, osmscout::LanesFeature::NAME, and osmscout::AccessFeature::NAME.
Referenced by LoadFromDataFile(), osmscout::ost::Parser::TYPE(), and TypeConfig().
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.
directory | Directory the data file should be written to |
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().
|
static |
|
static |
Referenced by osmscout::AvailableMapsModel::reload().
|
static |
Referenced by osmscout::AvailableMapsModel::reload().
TagId osmscout::TypeConfig::tagArea |
Referenced by TypeConfig().
TagId osmscout::TypeConfig::tagDataPolygon |
Referenced by TypeConfig().
TagId osmscout::TypeConfig::tagJunction |
Referenced by TypeConfig().
TagId osmscout::TypeConfig::tagNatural |
Referenced by TypeConfig().
TagId osmscout::TypeConfig::tagRestriction |
Referenced by TypeConfig().
TagId osmscout::TypeConfig::tagType |
Referenced by GetRelationType(), and TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoCoastline |
Internal type for coastlines.
Referenced by TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoIgnore |
Referenced by GetNodeType(), GetRelationType(), GetWayAreaType(), and TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoOSMSubTileBorder |
Internal type for OSM tile borders.
Referenced by TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoOSMTileBorder |
Internal type for OSM tile borders.
Referenced by TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoTileCoast |
Internal type for ground tiles of type "coast".
Referenced by TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoTileLand |
Internal type for ground tiles of type "land".
Referenced by TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoTileSea |
Internal type for ground tiles of type "sea".
Referenced by TypeConfig().
TypeInfoRef osmscout::TypeConfig::typeInfoTileUnknown |
Internal type for ground tiles of type "unknown".
Referenced by TypeConfig().