From ba423f0955316adc3face0a8bf7e24078b7afec8 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 25 Mar 2015 15:52:12 +0100 Subject: [PATCH] wkt parser/genrator - handle POINT EMPTY by constructing geometry::geometry_empty --- include/mapnik/wkt/wkt_generator_grammar_impl.hpp | 5 ++++- include/mapnik/wkt/wkt_grammar_impl.hpp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/mapnik/wkt/wkt_generator_grammar_impl.hpp b/include/mapnik/wkt/wkt_generator_grammar_impl.hpp index bcbebc473..cbd98b7fc 100644 --- a/include/mapnik/wkt/wkt_generator_grammar_impl.hpp +++ b/include/mapnik/wkt/wkt_generator_grammar_impl.hpp @@ -54,7 +54,7 @@ wkt_generator_grammar::wkt_generator_grammar() geometry_dispatch = eps[_a = geometry_type(_val)] << (&uint_(geometry::geometry_types::Point)[_1 = _a] - << (point | empty[_1 = _a])) + << point) | (&uint_(geometry::geometry_types::LineString)[_1 = _a] << (linestring | empty[_1 = _a])) @@ -73,6 +73,9 @@ wkt_generator_grammar::wkt_generator_grammar() | (&uint_(geometry::geometry_types::GeometryCollection)[_1 = _a] << (geometry_collection | empty[_1 = _a])) + | + (&uint_(geometry::geometry_types::Unknown)[_1 = _a] + << lit("POINT EMPTY")) // special case for geometry_empty as mapnik::geometry::point can't be empty ; point = lit("POINT(") << point_coord << lit(")") diff --git a/include/mapnik/wkt/wkt_grammar_impl.hpp b/include/mapnik/wkt/wkt_grammar_impl.hpp index 736c7e588..62e377317 100644 --- a/include/mapnik/wkt/wkt_grammar_impl.hpp +++ b/include/mapnik/wkt/wkt_grammar_impl.hpp @@ -57,11 +57,13 @@ wkt_grammar::wkt_grammar() ; // ::= point - point_tagged_text = no_case[lit("POINT")] >> point_text[assign(_r1,_1)] + point_tagged_text = no_case[lit("POINT")] + >> (point_text[assign(_r1,_1)] | empty_set[assign(_r1,construct())]) ; // ::= | point_text = (lit("(") >> point >> lit(')')) - | empty_set + //| empty_set - we're catching 'POINT EMPTY' case in point_tagged_text rule ^^ by creating geometry_empty + // because our geometry::point can't be empty ; // ::= linestring