Parser for osm-xml-data.
More...
|
void | parseEntities (eaglexml::xml_node<> *osmRoot) |
| parses the osm-root element and creates given objects More...
|
|
void | parseBounds (eaglexml::xml_node<> *node) |
| parses the bound entity More...
|
|
void | parseNode (eaglexml::xml_node<> *node) |
| parses a node entity More...
|
|
void | parseWay (eaglexml::xml_node<> *way) |
| parses the way entity More...
|
|
void | parseRelation (eaglexml::xml_node<> *relation) |
| parses the relation entity More...
|
|
template<typename Target > |
void | parseProperties (eaglexml::xml_node<> *firstProp, DataMap< CachedString, CachedString > *tagMap, std::vector< NodeId > *nodeRefIds, DataMap< NodeId, CachedString > *nodeRoleMap, std::vector< WayId > *wayRefIds, DataMap< WayId, CachedString > *wayRoleMap) |
| parses properties of an osm-object More...
|
|
template<typename T > |
void | extractAttributeFromNode (const string &attrname, eaglexml::xml_node<> *node, T *dest) |
| Extracts the value of a specified xml-attribute from a given node. More...
|
|
template<typename IdType > |
IdType | resolveOsmId (OsmIdType osmId, const boost::unordered_map< OsmIdType, IdType > &table) |
| Resolves a osm id into an internal id. More...
|
|
virtual void | on_fetch (unsigned int chars_left, unsigned int need, node_type *active_node) |
|
virtual void | on_buffer_resize () |
|
virtual void | on_segment_read () |
|
virtual void | on_read_begin (unsigned int segments) |
|
Parser for osm-xml-data.
This parser will parse xml files and extract nodes ways and relations
Definition at line 52 of file importer.cpp.
Type, where osm ids stored in.
Definition at line 64 of file importer.cpp.
Importer::OsmXmlParser::OsmXmlParser |
( |
bool |
ignoreUnknownEntities, |
|
|
const FloatRect & |
bounds = { -nl::max(), -nl::max(), nl::max(), nl::max() } |
|
) |
| |
|
inline |
Creates a new parser and sets default settings.
Definition at line 71 of file importer.cpp.
template<typename T >
void Importer::OsmXmlParser::extractAttributeFromNode |
( |
const string & |
attrname, |
|
|
eaglexml::xml_node<> * |
node, |
|
|
T * |
dest |
|
) |
| |
|
inlineprivate |
Extracts the value of a specified xml-attribute from a given node.
Returns it in a wanted type. Throws if the attribute is missing or has a bad format.
- Parameters
-
attrname | the name of the attribute |
node | the node containing the attribute |
dest | destination to copy the extracted value |
Definition at line 426 of file importer.cpp.
std::size_t Importer::OsmXmlParser::getNumberOfClippedNodes |
( |
| ) |
const |
|
inline |
Returns the number of clipped nodes.
- Returns
- number of clipped nodes
Definition at line 181 of file importer.cpp.
shared_ptr< std::vector<Node> > Importer::OsmXmlParser::getParsedNodes |
( |
| ) |
const |
|
inline |
Returns a vector with parsed nodes.
- Returns
- parsed nodes
Definition at line 148 of file importer.cpp.
shared_ptr< std::vector<Relation> > Importer::OsmXmlParser::getParsedRelations |
( |
| ) |
const |
|
inline |
Returns a vector with parsed relations.
- Returns
- parsed relations
Definition at line 170 of file importer.cpp.
shared_ptr< std::vector<Way> > Importer::OsmXmlParser::getParsedWays |
( |
| ) |
const |
|
inline |
Returns a vector with parsed ways.
- Returns
- parsed ways
Definition at line 159 of file importer.cpp.
virtual void Importer::OsmXmlParser::on_buffer_resize |
( |
| ) |
|
|
inlineprivatevirtual |
virtual void Importer::OsmXmlParser::on_fetch |
( |
unsigned int |
chars_left, |
|
|
unsigned int |
need, |
|
|
node_type * |
active_node |
|
) |
| |
|
inlineprivatevirtual |
virtual void Importer::OsmXmlParser::on_read_begin |
( |
unsigned int |
segments | ) |
|
|
inlineprivatevirtual |
virtual void Importer::OsmXmlParser::on_segment_read |
( |
| ) |
|
|
inlineprivatevirtual |
void Importer::OsmXmlParser::parse |
( |
const path & |
xml_file | ) |
|
|
inline |
Will parse a given xml file.
This method will try to open the given file. osm data is expected to be found. nodes, ways and relations will be extracted and saved. They can be accessed through getParsedNodes, getParsedWays, getParsedRelations. Additionally a mapping from osm id to an internal id will be created for nodes and ways.
- Parameters
-
xml_file | A path to a file containing the osm data. |
- Exceptions
-
Definition at line 93 of file importer.cpp.
void Importer::OsmXmlParser::parseBounds |
( |
eaglexml::xml_node<> * |
node | ) |
|
|
inlineprivate |
parses the bound entity
- Parameters
-
node | xml-node for the entity |
Definition at line 229 of file importer.cpp.
void Importer::OsmXmlParser::parseEntities |
( |
eaglexml::xml_node<> * |
osmRoot | ) |
|
|
inlineprivate |
parses the osm-root element and creates given objects
- Parameters
-
osm_root | osm-xml root node |
Definition at line 192 of file importer.cpp.
void Importer::OsmXmlParser::parseNode |
( |
eaglexml::xml_node<> * |
node | ) |
|
|
inlineprivate |
parses a node entity
- Parameters
-
node | xml-node for the entity |
Definition at line 243 of file importer.cpp.
template<typename Target >
parses properties of an osm-object
Starts with the first and goes through all property xml-nodes. Depending on the Target, specified, the nodes will be examined and data will be extracted.
- Template Parameters
-
Target | The geoobject-type for which the properties should be examined. Must be one of the following: Node, Way, Relation |
- Parameters
-
firstProp | first xml-property-node |
tagMap | map, where tags are saved |
nodeRefIds | list, where references to nodes are saved |
nodeRoleMap | map, where roles of nodes are saved |
wayRefIds | list, where references to ways are saved |
wayRoleMap | map, where roles of ways are saved |
Targets to be set
Definition at line 334 of file importer.cpp.
void Importer::OsmXmlParser::parseRelation |
( |
eaglexml::xml_node<> * |
relation | ) |
|
|
inlineprivate |
parses the relation entity
- Parameters
-
node | xml-node for the entity |
Definition at line 295 of file importer.cpp.
void Importer::OsmXmlParser::parseWay |
( |
eaglexml::xml_node<> * |
way | ) |
|
|
inlineprivate |
parses the way entity
- Parameters
-
node | xml-node for the entity |
Definition at line 270 of file importer.cpp.
template<typename IdType >
IdType Importer::OsmXmlParser::resolveOsmId |
( |
OsmIdType |
osmId, |
|
|
const boost::unordered_map< OsmIdType, IdType > & |
table |
|
) |
| |
|
inlineprivate |
Resolves a osm id into an internal id.
Can only take care of objects already parsed.
- Parameters
-
osmId | to be resolved |
table | containing the id mapping |
- Returns
- the resolved internal id
- Exceptions
-
if | the id can not be resolved. |
Definition at line 457 of file importer.cpp.
std::uintmax_t Importer::OsmXmlParser::alreadyRead |
|
private |
Bytes already read from the xml file.
Definition at line 516 of file importer.cpp.
std::unordered_set<OsmIdType> Importer::OsmXmlParser::clippedNodes |
|
private |
const FloatRect Importer::OsmXmlParser::clippingBounds |
|
private |
Specifies the rectangular area in which the nodes are kept.
If a node lies outside of this area it is not added to the data!
Definition at line 492 of file importer.cpp.
std::uintmax_t Importer::OsmXmlParser::fileSize |
|
private |
Size of the xml file in bytes.
Definition at line 513 of file importer.cpp.
bool Importer::OsmXmlParser::ignoreUnknownEntities |
|
private |
Specifies weather the parser should ignore unknown entities.
If this is false and an unknown entity appears an exception will be thrown
Definition at line 488 of file importer.cpp.
boost::unordered_map<OsmIdType, NodeId> Importer::OsmXmlParser::nodeIdMapping |
|
private |
Mapping from osm ids to internal ids for nodes.
Definition at line 495 of file importer.cpp.
shared_ptr< std::vector<Node> > Importer::OsmXmlParser::nodes |
|
private |
bool Importer::OsmXmlParser::outputIgnoreBounds |
|
private |
bool Importer::OsmXmlParser::outputIgnoreRelation |
|
private |
Booleans for some output, which should only appear once.
Definition at line 522 of file importer.cpp.
const int Importer::OsmXmlParser::parser_flags |
|
static |
Initial value:= eaglexml::parse_no_data_nodes
| eaglexml::parse_normalize_whitespace
| eaglexml::parse_trim_whitespace
| eaglexml::parse_validate_closing_tags
| eaglexml::parse_default
flags for parsing the xml file
Definition at line 57 of file importer.cpp.
shared_ptr< std::vector<Relation> > Importer::OsmXmlParser::relations |
|
private |
List to be filled with relations.
Definition at line 510 of file importer.cpp.
unsigned int Importer::OsmXmlParser::segmentSize |
|
private |
Number of bytes read by one read operation.
Definition at line 519 of file importer.cpp.
boost::unordered_map<OsmIdType, WayId> Importer::OsmXmlParser::wayIdMapping |
|
private |
Mapping from osm ids to internal ids for ways.
Definition at line 498 of file importer.cpp.
shared_ptr< std::vector<Way> > Importer::OsmXmlParser::ways |
|
private |
The documentation for this class was generated from the following file: