[geos-devel] Exposing PrecisionModel, GeometryPrecisionReducer in the C API

Sandro Santilli strk at keybit.net
Thu Oct 1 09:58:54 PDT 2015


On Thu, Oct 01, 2015 at 06:51:44PM +0200, Sandro Mani wrote:
> 
> 
> On 01.10.2015 18:47, Sandro Santilli wrote:
> >Cleaned up proposal. No copying, using 0 for FLOATING and returning
> >previous precision.
> >
> >   /**
> >    * 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 0 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.
> >    * @retuns -1 on exception, previous size of precision grid otherwise.
> >    *
> >    */
> >   extern int GEOS_DLL *GEOSGeom_setPrecision_r(
> >                                          GEOSContextHandle_t handle,
> >                                          GEOSGeometry *g,
> >                                          double gridSize, int forceSnap);
> >
> >I guess one might want a _getPrecision too...
>
> I like the in-place approach. So as far as my needs go, this would
> be perfectly adequate. (And about the generic GEOS_setPrecision,
> looks like too much trouble).

Great, I'll be pushing an implementation of that to the same PR
with the automatic memory management for GeometryFactory (which
seems an indispensable part of this) tomorrow, stay tuned for
tests your side !

--strk;


More information about the geos-devel mailing list