[Gdal-dev] Ready to commit first batch of swig-java changes

Tamas Szekeres szekerest at gmail.com
Sun Mar 18 18:36:57 EDT 2007


2007/3/18, Andrea Aime <aaime at openplans.org>:
> >> I had to perform a bit of changes in both the functions returning wkb,
> >> and the geometry construction ones that do take wkb as an input.
> >> The outcome is not a fully clean extension as I hoped, because
> >> the geometry constructor calls a static function that should
> >> be defined before it. Anyways, the patch is attached for anyone
> >> to review. I do believe a similar patch would be needed for c#
> >> to handle geometry creation from wkb, too.
> >>
> >
> > Would you describe this issue in more detail? I think those static
> > functions have already been declared in ogr_api.h.
>
> Sure. The Geometry construction from WKB uses a static function,
> CreateGeometryFromWkt( char **val,
> OSRSpatialReferenceShadow *reference=NULL ), and I have to redefine
> both. Now, I would have liked to put both in an ogr_java_extend.i much
> like the c# extensions.
> Unfortunately, doing so does not work, because SWIG reorders the
> declarations, and puts the ogr geometry shadow constructor among
> the other geometry shadow methods, leaving the static function
> I added after it. The c++ compiler at that point complains that
> I cannot call the static one, because it's declared after.
>
> As a result, I had to mix the java specific code in ogr.i, so that
> I can preserve the right order.
>

I have no problem about this approach. You can commit these changes
and you may refine the solution if needed in the future. I suspect
there's no need to reimplement those functions since the
implementation is the same and only some of the types at the formal
parameter list have been changed. I guess these parameter types can
surely be altered by java specific typemaps.

I'll see what to do for the C# binding to make these functions work.
Do you have some test samples for checking these functions in action?

Best regards,

Tamas



More information about the Gdal-dev mailing list