From 0e3b5f763ddc6fb317dff1fe5f05310d183c6250 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 14 Oct 2012 19:17:00 +0200 Subject: [PATCH] implementation of use_restrictions switch --- Extractor/PBFParser.h | 8 ++++++++ Extractor/XMLParser.h | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Extractor/PBFParser.h b/Extractor/PBFParser.h index bdbd057ad..28aa3f2a8 100644 --- a/Extractor/PBFParser.h +++ b/Extractor/PBFParser.h @@ -266,6 +266,14 @@ private: void parseRelation(_ThreadData * threadData) { const OSMPBF::PrimitiveGroup& group = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ); + + if(0 != luaL_dostring( myLuaState, "return use_restrictions\n")) { + ERR(lua_tostring(myLuaState,-1)<< " occured in scripting block"); + } + if (!lua_toboolean(myLuaState, -1)) { + return; + } + for(int i = 0; i < group.relations_size(); i++ ) { const OSMPBF::Relation& inputRelation = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ).relations(i); bool isRestriction = false; diff --git a/Extractor/XMLParser.h b/Extractor/XMLParser.h index eb1312680..b336441e1 100644 --- a/Extractor/XMLParser.h +++ b/Extractor/XMLParser.h @@ -53,6 +53,11 @@ public: return (xmlTextReaderRead( inputReader ) == 1); } bool Parse() { + if(0 != luaL_dostring( myLuaState, "return use_restrictions\n")) { + ERR(lua_tostring(myLuaState,-1)<< " occured in scripting block"); + } + bool useRestrictions = lua_toboolean(myLuaState, -1) != 0; + while ( xmlTextReaderRead( inputReader ) == 1 ) { const int type = xmlTextReaderNodeType( inputReader ); @@ -113,7 +118,7 @@ public: } if ( xmlStrEqual( currentName, ( const xmlChar* ) "relation" ) == 1 ) { _RawRestrictionContainer r = _ReadXMLRestriction(); - if(r.fromWay != UINT_MAX) { + if(useRestrictions && r.fromWay != UINT_MAX) { if(!(*restrictionCallback)(r)) { std::cerr << "[XMLParser] restriction not parsed" << std::endl; }