Fixes plain old XML parsing.
This commit is contained in:
parent
e0f51dd5e9
commit
3edf4799d3
@ -65,7 +65,7 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( xmlStrEqual( currentName, ( const xmlChar* ) "node" ) == 1 ) {
|
if ( xmlStrEqual( currentName, ( const xmlChar* ) "node" ) == 1 ) {
|
||||||
_Node n = _ReadXMLNode( );
|
ImportNode n = _ReadXMLNode( );
|
||||||
/** Pass the unpacked node to the LUA call back **/
|
/** Pass the unpacked node to the LUA call back **/
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
try {
|
try {
|
||||||
@ -76,13 +76,17 @@ public:
|
|||||||
);
|
);
|
||||||
if(!(*nodeCallback)(n))
|
if(!(*nodeCallback)(n))
|
||||||
std::cerr << "[XMLParser] dense node not parsed" << std::endl;
|
std::cerr << "[XMLParser] dense node not parsed" << std::endl;
|
||||||
|
|
||||||
} catch (const luabind::error &er) {
|
} catch (const luabind::error &er) {
|
||||||
cerr << er.what() << endl;
|
cerr << er.what() << endl;
|
||||||
lua_State* Ler=er.state();
|
lua_State* Ler=er.state();
|
||||||
report_errors(Ler, -1);
|
report_errors(Ler, -1);
|
||||||
|
} catch (std::exception & e) {
|
||||||
|
ERR("LUA: " << e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (...) {
|
catch (...) {
|
||||||
ERR("Unknown error occurred during PBF dense node parsing!");
|
ERR("Unknown error occurred during XML dense node parsing!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,8 +244,8 @@ private:
|
|||||||
return way;
|
return way;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Node _ReadXMLNode( ) {
|
ImportNode _ReadXMLNode( ) {
|
||||||
_Node node;
|
ImportNode node;
|
||||||
|
|
||||||
xmlChar* attribute = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "lat" );
|
xmlChar* attribute = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "lat" );
|
||||||
if ( attribute != NULL ) {
|
if ( attribute != NULL ) {
|
||||||
@ -280,39 +284,17 @@ private:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool accessYes = false;
|
|
||||||
if ( xmlStrEqual( childName, ( const xmlChar* ) "tag" ) == 1 ) {
|
if ( xmlStrEqual( childName, ( const xmlChar* ) "tag" ) == 1 ) {
|
||||||
xmlChar* k = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "k" );
|
xmlChar* k = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "k" );
|
||||||
xmlChar* value = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "v" );
|
xmlChar* value = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "v" );
|
||||||
if ( k != NULL && value != NULL ) {
|
if ( k != NULL && value != NULL ) {
|
||||||
if ( xmlStrEqual( k, ( const xmlChar* ) "access" ) == 1 ) {
|
node.keyVals.Add(std::string( (char *) k ), std::string( (char *) value));
|
||||||
if ( xmlStrEqual( value, ( const xmlChar* ) "yes" ) == 1 ){
|
|
||||||
accessYes = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( xmlStrEqual( k, ( const xmlChar* ) "highway" ) == 1 ) {
|
|
||||||
if ( xmlStrEqual( value, ( const xmlChar* ) "traffic_signals" ) == 1 ){
|
|
||||||
node.trafficLight = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( xmlStrEqual( k, ( const xmlChar* ) "barrier" ) == 1 ) {
|
|
||||||
if (!accessYes && xmlStrEqual( value, ( const xmlChar* ) "" ) != 1 && xmlStrEqual( value, ( const xmlChar* ) "border_control" ) != 1 && xmlStrEqual( value, ( const xmlChar* ) "cattle_grid" ) != 1 && xmlStrEqual( value, ( const xmlChar* ) "toll_booth" ) != 1 && xmlStrEqual( value, ( const xmlChar* ) "no" ) != 1){
|
|
||||||
node.bollard = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( xmlStrEqual( k, ( const xmlChar* ) "highway" ) == 1 ) {
|
|
||||||
if ( xmlStrEqual( value, ( const xmlChar* ) "traffic_lights" ) == 1 ){
|
|
||||||
node.trafficLight = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( k != NULL )
|
if ( k != NULL )
|
||||||
xmlFree( k );
|
xmlFree( k );
|
||||||
if ( value != NULL )
|
if ( value != NULL )
|
||||||
xmlFree( value );
|
xmlFree( value );
|
||||||
}
|
}
|
||||||
if(accessYes)
|
|
||||||
node.bollard = false;
|
|
||||||
|
|
||||||
xmlFree( childName );
|
xmlFree( childName );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user