diff --git a/include/mapnik/json/extract_bounding_box_grammar.hpp b/include/mapnik/json/extract_bounding_box_grammar.hpp index 406d26fb2..2e33cee38 100644 --- a/include/mapnik/json/extract_bounding_box_grammar.hpp +++ b/include/mapnik/json/extract_bounding_box_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2014 Artem Pavlenko + * Copyright (C) 2015 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -44,7 +44,6 @@ namespace mapnik { namespace json { struct empty {}; using position = std::tuple; -//using positions = std::vector; using boxes = std::vector>>; namespace qi = boost::spirit::qi; @@ -87,11 +86,9 @@ struct offset_impl { using result_type = std::size_t; template - std::size_t operator() (T0 const& begin, T1 const& range) const + std::size_t operator() (T0 const& begin, T1 const& itr) const { - //std::cerr << std::distance(range.begin(),range.end()) << std::endl; - //std::cerr << std::string(range.begin(),range.end()) << std::endl; - return std::distance(begin, range.begin()); + return std::distance(begin, itr); } }; @@ -101,8 +98,8 @@ struct extract_bounding_box_grammar : { extract_bounding_box_grammar(); qi::rule start; - qi::rule>, void(boxes&), space_type> features; - qi::rule const&), space_type> feature; + qi::rule, void(boxes&), space_type> features; + qi::rule feature; qi::rule bounding_box; qi::rule>, box2d(), space_type> coords; qi::rule(), space_type> pos; diff --git a/include/mapnik/json/extract_bounding_box_grammar_impl.hpp b/include/mapnik/json/extract_bounding_box_grammar_impl.hpp index 494fa73f0..4b0c63b36 100644 --- a/include/mapnik/json/extract_bounding_box_grammar_impl.hpp +++ b/include/mapnik/json/extract_bounding_box_grammar_impl.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2014 Artem Pavlenko + * Copyright (C) 2015 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -59,28 +59,21 @@ extract_bounding_box_grammar::extract_bounding_box_gramm using qi::on_error; using qi::skip; using qi::lexeme; - using qi::raw; using boost::phoenix::push_back; using boost::spirit::repository::qi::seek; using boost::spirit::repository::qi::iter_pos; start = features(_r1) ; - - //features = iter_pos[_a = _1] >> *(iter_pos[_b = _1] >> seek[lexeme[skip[lit('{') >> lit("\"type\"") >> ":" >> "\"Feature\""]]] - // >> feature(_r1, _a, _b)) - // ; - - features = iter_pos[_a = _1] >> -(lit('{') >> -lit("\"type\"") >> lit(':') >> lit("\"FeatureCollection\"") - >> lit(',') >> lit("\"features\"") >> lit(':')) - >> lit('[') >> *(raw[seek[lexeme[skip[iter_pos > lit('{') > lit("\"type\"") > lit(':') > lit("\"Feature\"")]]]] [_b = _1] - > feature(_r1, _a, _b)) + features = iter_pos[_a = _1] >> -(lit('{') >> -lit("\"type\"") + >> lit(':') >> lit("\"FeatureCollection\"") + >> lit(',') >> lit("\"features\"") + >> lit(':')) + >> lit('[') >> *(seek[lexeme[skip[iter_pos[_b = _1] >> lit('{') >> lit("\"type\"") >> lit(':') >> lit("\"Feature\"")]]] + >> feature(_r1, _a, _b)) ; - //features = iter_pos[_a = _1] >> seek[lexeme[skip[lit("\"type\"") >> lit(':') >> " ]]] - // >> iter_pos[_b = _1] >> *(lit(':') >> feature(_r1, _a, _b) | seek["\"type\""] >> iter_pos[_b = _1]) - // ; - feature = /*lit("\"Feature\"") >> */bounding_box(_r1, offset(_r2, _r3)) + feature = bounding_box(_r1, offset(_r2, _r3)) ; bounding_box = seek["\"coordinates\""] >> lit(':') >> coords[push_box(_r1, _r2, _1)] ;