[geos-devel] Exposing PrecisionModel, GeometryPrecisionReducer in the C API
strk at keybit.net
Thu Oct 1 09:08:55 PDT 2015
On Thu, Oct 01, 2015 at 06:02:20PM +0200, Sandro Santilli wrote:
> Sandro, others:
> here's what I'm thinking to add as the single new signature
> to the C-API for GEOS-3.6.0, what do you think ?
> * Set the geometry's precision, optionally rounding all its
> * coordinates to the precision grid (if it changes).
> * @param gridSize size of the precision grid, or -1 for FLOATING
> * precision.
> * @param forceSnap specifies whether snapping to the precision grid
> * should be forced: -1 prevents snapping, which can
> * be used when the input is known to be already
> * rounded to the target grid; 0 only snaps if the
> * new precision grid is not equal or compatible with
> * the new precision grid; 1 always snaps.
> extern GEOSGeometry GEOS_DLL *GEOSGeom_setPrecision_r(
> GEOSContextHandle_t handle,
> double gridSize, int forceSnap);
> Of course it can only work if the memory management for
> GeometryFactory is automatic, as proposed in the PR
> (which might be dangerous for any existing C++ client out there).
Of course there must be a GEOSGeometry argument too:
const GEOSGeometry *g,
double gridSize, int forceSnap);
I'm not sure about returning a copy. One idea was, in the long run,
to also make GEOSGeometry objects automatically managed as per memory
lifetime, such thing would be easier by threating geometries as
immutable objects (and this is also the policy used in JTS); but
there's a known single function that is already not respecting that
immutability, which is GEOSNormalize.
More information about the geos-devel