[postgis-devel] Re: [geos-devel] CoordSeq ADT and fine-grained ctors for C-API (was: GEOS C API Suggestions)

strk at refractions.net strk at refractions.net
Mon Oct 24 06:31:19 PDT 2005


I've updated the GEOS C-api to avoid GEOSCoordSeq and GEOSGeom 
object copies in constructors and inspectors.
Ownership policy is documented in the geos_c.h header.
Postgis connector has been updated to reflect new policy.

--strk;

On Fri, Oct 21, 2005 at 12:01:30PM -0400, Frank Warmerdam wrote:
> On 10/21/05, strk at refractions.net <strk at refractions.net> wrote:
> > About performance and isolation, do we really want
> > all the copies to happen ?
> >
> > Consider a multipolygon construction, you'll have copies:
> >         - of CoordSeq objects of the shell and each hole
> >           at each of the corresponding object construction/copy
> >         - of shell and hole geometry for each polygon
> >           construction/copy
> >         - of each polygon geometry at collection construction
> > In practice it would take 3 copies of each involved CoordinateSequence.
> >
> > I'm thinking about making constructors take ownership of argument,
> > and extractors (GetGeometryN, getExteriorRing, getCoordSeq..) return
> > resources owned by the argument object...
> >
> > These changes would also allow changing any Ordinate value
> > of any Geometry ...
> >
> >         GEOSGeom g1 = GEOSGetGeometryN(g, 2);
> >         GEOSGeom hole3 = GEOSGetInteriorRingN(g1, 3);
> >         GEOSCoordSeq s = GEOSGetCoordSeq(hole3);
> >         GEOSCoordSeq_setX(s, 4);
> >
> > What do you think, is the advantage worth the danger ?
> 
> Strk,
> 
> If one of the rationales for the direct construction and query
> support is to provide a "fastest" method of converting to and
> from GEOS Geometries, then I think that avoiding copying
> would be wise.  I don't immediately intend to use the new
> api entries so it doesn't matter so much to me, but if we convert
> mapserver to use the GEOS C API then it speed would be an
> issue.
> 
> I would say that the advantage is worth the danger, but the
> rules about internal references and taking of ownership need
> to be made clear in the docs.
> 
> Best regards,
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel



More information about the postgis-devel mailing list