wkt parser/genrator - handle POINT EMPTY by constructing geometry::geometry_empty

This commit is contained in:
artemp 2015-03-25 15:52:12 +01:00
parent dc6f1924fa
commit ba423f0955
2 changed files with 8 additions and 3 deletions

View file

@ -54,7 +54,7 @@ wkt_generator_grammar<OutputIterator, Geometry>::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<OutputIterator, Geometry>::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(")")

View file

@ -57,11 +57,13 @@ wkt_grammar<Iterator>::wkt_grammar()
;
// <point tagged text> ::= point <point text>
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<geometry::geometry_empty>())])
;
// <point text> ::= <empty set> | <left paren> <point> <right paren>
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 tagged text> ::= linestring <linestring text>