Boost logo

Geometry :

Subject: [ggl] WKT empty
From: Mateusz Loskot (mateusz)
Date: 2009-06-13 13:55:25


Bruno Lalande wrote:
> Hi,
>
>> OGC SFS defines "is empty" operation on geometry.
>> For container geometries, it is easy to implement, though for point
>> geometry...it's not.
>> Possible options:
>> - point class stores boolean indicator set during construction and
>> modification
>> - if for coordinate_type numeric_limits::has_quiet_NaN() is true,
>> we could set coordinates of empty point to NaN and "is empty" check
>> could rely on that.
>
> Given the many different kinds of points the library must handle
> (unmodifiable legacy points don't have place for an extra boolean, C
> arrays don't either, etc...), the first option seems difficult to
> implement. And given that has_quiet_Nan() might return false, the
> second one doesn't do the trick in all cases.

Bruno, yes, I completely agree with you.

> Wouldn't it be better to let the user define how an empty coordinate
> should be represented? After all, GGL is already very traits-driven.
> So maybe having set_empty() / is_empty() functions in the point traits
> could do the trick? The user can then define it as a NaN, or have a
> dedicated boolean in his point, or anything else...

This seems to be very reasonable solution.
We could provide some guidelines for OGC-oriented users how to
instrument their point types with support of this feature.

Cheers,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

Geometry list run by mateusz at loskot.net