create an geometry_empty when input WKB has x and y set to NaN

e.g `\x0101000000000000000000f87f000000000000f87f => mapnil::geometry::geometry_empty`
This commit is contained in:
artemp 2016-03-16 14:52:42 +01:00
parent d5eb6c8ddf
commit db9b3f46af

View file

@ -124,8 +124,12 @@ public:
switch (type)
{
case wkbPoint:
geom = read_point();
{
auto pt = read_point();
if (!std::isnan(pt.x) && !std::isnan(pt.y))
geom = std::move(pt);
break;
}
case wkbLineString:
geom = read_linestring();
break;
@ -146,11 +150,19 @@ public:
break;
case wkbPointZ:
case wkbPointM:
geom = read_point<true>();
{
auto pt = read_point<true>();
if (!std::isnan(pt.x) && !std::isnan(pt.y))
geom = std::move(pt);
break;
}
case wkbPointZM:
geom = read_point<true,true>();
{
auto pt = read_point<true,true>();
if (!std::isnan(pt.x) && !std::isnan(pt.y))
geom = std::move(pt);
break;
}
case wkbLineStringZ:
case wkbLineStringM:
geom = read_linestring<true>();