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

Sandro Mani manisandro at gmail.com
Wed Jan 7 00:54:32 PST 2015


On 06.01.2015 13:34, Sandro Santilli wrote:
> On Mon, Jan 05, 2015 at 05:17:26PM +0100, Sandro Mani wrote:
>> On 23.12.2014 14:23, Sandro Mani wrote:
>>
>>> Following the initial discussion in ticket #713 [1], I'd like to
>>> discuss the exposing of PrecisionModel and
>>> GeometryPrecisionReducer methods in the C API.
>>> [1] http://trac.osgeo.org/geos/ticket/713
>>> [2] http://trac.osgeo.org/geos/wiki/GSoC/CAPI_PrecisionModel
>> Any comments on this? Should I move ahead and post a complete patch?
> I'm not very comfortable with forcing callers to take care of
> keeping a PrecisionModel object alive. As you noted it
> would be a good idea to just have GeometryFactory keep a copy
> of that. I'm actually not even sure this isn't the case already,
> should check.
GeometryFactory does make a copy of the PrecisionModel passed by the 
user, so it is not necessary to keep the copy around.
>
> If I recall correctly a previous proposal was to "downgrade" the
> precision model to an argument to the GeometryFactory constructor.
> What do you think ?
By this you mean not exposting the PrecisionModel at all, and instead 
doing something like this?:

/** Geometry Factory **/
typedef struct GEOSGeometryFactory_t GEOSGeometryFactory;

extern GEOSGeometryFactory* GEOSGeometryFactory_create(int SRID);
extern GEOSGeometryFactory* 
GEOSGeometryFactory_create_doublePrecision(int SRID);
extern GEOSGeometryFactory* 
GEOSGeometryFactory_create_singlePrecision(int SRID);
extern GEOSGeometryFactory* 
GEOSGeometryFactory_create_fixedPrecision(int SRID, double scale);
extern void GEOSGeometryFactory_destroy(GEOSGeometryFactory* factory);

I'm ok with that, it is actually cleaner.

Thanks,
Sandro



More information about the geos-devel mailing list