Could you draw some requirements necessary to fulfill by an object
exposed to ruby?
I believe there should be no problem, if it won't break simplicity and
C-nature of the GEOS C API.

First, expose the coordinate class (I've removed extern and GEOS_DLL for readability):

 GEOSCoordinate  *GEOSCoordinate_create(double x, double y, double z);
 GEOSCoordinate  *GEOSCoordinate_clone(const GEOSCoordinate* s);
 void  GEOSCoordinate_destroy(GEOSCoordinate* s);

 char  GEOSCoordinate_equals(GEOSCoordinate* s);

 int  GEOSCoordinate_setX(GEOSCoordinate* s, double val);
 int  GEOSCoordinate_setY(GEOSCoordinate* s, double val);
 int  GEOSCoordinate_setZ(GEOSCoordinate* s, double val);

 int  GEOSCoordinate_getX(const GEOSCoordinate* s, double *val);
 int  GEOSCoordinate_getY(const GEOSCoordinate* s, double *val);
 int  GEOSCoordinate_getZ(const GEOSCoordinate* s, double *val);


Next, update coordinate sequence so that you can:

* Add a coordinate to a coordinate sequence. Right now there is no way to expand a coordinate sequence in the c api which is an extreme limitation.

* Add a getter to coordinate sequence "getCoordinate(size_t index)" that returns a coordiante

* Add a getter to point ("getCoordinate()") that returns its coordinate

* Add a method that lets you create a coordinate sequence from a coordinate (see next bullet).

* I'd like to change GEOSGeom_createPoint to take a coordinate, not a coordinate sequence. But that would break backward compatibility - so maybe a new API? Or maybe the constructor to create a coordinate sequence from a coordinate is good enough.

That should do the trick.

And while on the subject - exposing the envelope class would be helpful for working with boundings boxes. I find it nicer to work with than a polygon acting as a bounding box. Envelope provides niceties like minX, minY, expandBy, expandToInclude, etc.

Thanks,

Charlie


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
geos-devel mailing list
geos-devel@geos.refractions.net
http://geos.refractions.net/mailman/listinfo/geos-devel

Reply via email to