[geos-devel] Proposal to add Coordinate class to c api
Charlie Savage
cfis at savagexi.com
Wed Aug 29 15:00:52 EDT 2007
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20070829/3eb9601a/smime.bin
More information about the geos-devel
mailing list