diff --git a/include/mapnik/json/extract_bounding_box_grammar.hpp b/include/mapnik/json/extract_bounding_box_grammar.hpp index 906e7126d..601511e1c 100644 --- a/include/mapnik/json/extract_bounding_box_grammar.hpp +++ b/include/mapnik/json/extract_bounding_box_grammar.hpp @@ -51,7 +51,7 @@ struct extract_bounding_box_grammar : qi::rule, void(boxes_type&), space_type> features; qi::rule, void(boxes_type&, Iterator const&), space_type> feature; qi::rule, box_type(), space_type> coords; - qi::rule(), space_type> pos; + qi::rule pos; qi::rule ring; qi::rule rings; qi::rule rings_array; diff --git a/include/mapnik/json/extract_bounding_box_grammar_impl.hpp b/include/mapnik/json/extract_bounding_box_grammar_impl.hpp index bdc1b98b2..a43192aae 100644 --- a/include/mapnik/json/extract_bounding_box_grammar_impl.hpp +++ b/include/mapnik/json/extract_bounding_box_grammar_impl.hpp @@ -42,18 +42,15 @@ struct calculate_bounding_box_impl template result_type operator() (T0 & bbox, T1 const& pos) const { - if (pos) + typename T0::value_type x = pos.x; + typename T0::value_type y = pos.y; + if (!bbox.valid()) { - typename T0::value_type x = pos->x; - typename T0::value_type y = pos->y; - if (!bbox.valid()) - { - bbox.init(x, y); - } - else - { - bbox.expand_to_include(x, y); - } + bbox.init(x, y); + } + else + { + bbox.expand_to_include(x, y); } } }; @@ -132,16 +129,16 @@ extract_bounding_box_grammar::extract_bounding_bo >> lit(':') >> (rings_array(_a) | rings (_a) | ring(_a) | pos[calculate_bounding_box(_a,_1)])[_val = _a] ; - pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']') + pos = lit('[') > double_ > lit(',') > double_ > omit[*(lit(',') > double_)] > lit(']') ; - ring = lit('[') >> pos[calculate_bounding_box(_r1,_1)] % lit(',') > lit(']') + ring = lit('[') >> -(pos[calculate_bounding_box(_r1,_1)] % lit(',')) >> lit(']') ; - rings = lit('[') >> ring(_r1) % lit(',') > lit(']') + rings = lit('[') >> (ring(_r1) % lit(',') > lit(']')) ; - rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']') + rings_array = lit('[') >> (rings(_r1) % lit(',') > lit(']')) ; coords.name("Coordinates"); diff --git a/include/mapnik/json/positions_grammar.hpp b/include/mapnik/json/positions_grammar.hpp index 6984300f9..a09f4e24f 100644 --- a/include/mapnik/json/positions_grammar.hpp +++ b/include/mapnik/json/positions_grammar.hpp @@ -44,7 +44,7 @@ struct positions_grammar : { positions_grammar(ErrorHandler & error_handler); qi::rule coords; - qi::rule(), space_type> pos; + qi::rule pos; qi::rule ring; qi::rule(), space_type> rings; qi::rule >(), space_type> rings_array; diff --git a/include/mapnik/json/positions_grammar_impl.hpp b/include/mapnik/json/positions_grammar_impl.hpp index 65f2a93c0..94bfe6a56 100644 --- a/include/mapnik/json/positions_grammar_impl.hpp +++ b/include/mapnik/json/positions_grammar_impl.hpp @@ -41,7 +41,7 @@ struct set_position_impl template result_type operator() (T0 & coords, T1 const& pos) const { - if (pos) coords = *pos; + coords = pos; } }; @@ -51,7 +51,7 @@ struct push_position_impl template result_type operator() (T0 & coords, T1 const& pos) const { - if (pos) coords.emplace_back(*pos); + coords.emplace_back(pos); } }; @@ -75,13 +75,13 @@ positions_grammar::positions_grammar(ErrorHandler & erro coords = rings_array[_val = _1] | rings [_val = _1] | ring[_val = _1] | pos[set_position(_val,_1)] ; - pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']') + pos = lit('[') > double_ > lit(',') > double_ > omit[*(lit(',') > double_)] > lit(']') ; - ring = lit('[') >> pos[push_position(_val,_1)] % lit(',') > lit(']') + ring = lit('[') >> -(pos[push_position(_val,_1)] % lit(',')) >> lit(']') ; - rings = lit('[') >> ring % lit(',') > lit(']') + rings = lit('[') >> (ring % lit(',') > lit(']')) ; - rings_array = lit('[') >> rings % lit(',') > lit(']') + rings_array = lit('[') >> (rings % lit(',') > lit(']')) ; coords.name("Coordinates"); pos.name("Position");