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

Sandro Santilli strk at keybit.net
Thu Jan 8 03:37:52 PST 2015


On Wed, Jan 07, 2015 at 04:48:24PM +0100, Sandro Mani wrote:
> 
> On 07.01.2015 15:25, Sandro Santilli wrote:
> >On Wed, Jan 07, 2015 at 02:05:59PM +0100, Sandro Mani wrote:
> >
> >>Okay. So back to your point about hiding the GeometryFactory, I'd
> >>say no since otherwise one is limited to one precision model per
> >>context?
> >Yes, but there's no limit on the number of contexts you can hold in
> >a thread. Also nobody would prevent you from switching precision model
> >of the current context. The only problem would be, again, management
> >of GeometryFactory objects that are no more used.
> 
> So this would mean an API like:
> 
> /** Create context handle **/
> extern GEOSContextHandle_t GEOS_DLL initGEOS_r(GEOSMessageHandler
> notice_function, GEOSMessageHandler error_function);
> extern GEOSContextHandle_t GEOS_DLL
> initGEOS_r_fixedPrecision(GEOSMessageHandler notice_function,
> GEOSMessageHandler error_function, double scale);

I don't think it's needed to create a context with non-default
factory, given we have methods to change it later.

> /** Set context handle precision model **/
> void GEOSContextHandle_t
> GEOSContext_setPrecisionDouble(GEOSContextHandle_t* handle);
> void GEOSContextHandle_t
> GEOSContext_setPrecisionFixed(GEOSContextHandle_t* handle, double
> scale);

Yes.

> /** Precision reducer **/
> extern GEOSGeometryPrecisionReducer* GEOSGeometryPrecisionReducer_create();
> extern GEOSGeometry*
> GEOSGeometryPrecisionReducer_reduce(GEOSGeometryPrecisionReducer*
> reducer, GEOSGeometry* geometry);
> extern void
> GEOSGeometryPrecisionReducer_destroy(GEOSGeometryPrecisionReducer*
> reducer);

Or, just calling GEOSGeom_clone() after setting context precision
to fixed ?

> The changes needed for reference counting are somewhat invasive IMO.

True. And I'm not sure it can be done w/out touching the C++ API
either.

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the geos-devel mailing list