[Gdal-dev] SWIG architecture

Collins, Benjamin collinsb at mitre.org
Thu Jun 29 12:46:46 EDT 2006


To the SWIG folks,

We were interested in using more OGR features to handle vector formats
from the SWIG'ed Java wrappers.  However, the currently exposed
interfaces do not include the necessary functions to get information
about polygons, etc; especially not in the natural way that such
information is available in the C++ API.
I thought I would see that would result from a more hands-off approach
to the SWIG *.i files.  I created a new ogr.i file with the
ogrsf_frmts.h file '%include'd along with some of the other main files.
(Later I had to modify this a little, but not in any important way.)  I
SWIG'ed this and got a full featured, more object oriented Java
interface than before.  I am able to essentially use the C++ API with a
straigt "transliteration."  Some language-specific typemaps could still
help, but this is not the essence of the experiment.

So my question is this:  why does the SWIG wrapper wrap the C-stlye
API.  Why not just go for the C++, get all the OO for free (esp w/
OGRGeometry)?
Also, why the use of *Shadow, etc?

I fully realize that there may be some caveat of SWIG keeping us from
this approach.

Thanks,
--
Ben Collins




More information about the Gdal-dev mailing list