[gdal-dev] Callbacks for next-gen Python bindings
Ari Jolma
ari.jolma at tkk.fi
Mon Nov 26 10:01:34 EST 2007
Howard Butler kirjoitti:
> All,
>
> I have just committed rudimentary typemaps and support code for Python
> function callbacks and the generic GDAL TermProgress methods in the
> next-gen interface files. This was one of the last major pieces of
> missing functionality that existed in the old-gen bindings that was
> preventing us from porting over a number of scripts in ./pymod.
>
> Additionally, I have created a new interface file, Operations.i, and
> placed GDAL raster operations like ComputeMedianCutPCT, DitherRGB2PCT,
> and ReprojectImage in this file to de-bulk gdal.i, which was getting a
> little bit bloated after adding in the new methods.
>
> I would like to request making a change to Driver.CreateCopy. It is
> currently missing arguments for callback and callback_data, which
> existed in the old-gen bindings. I propose adding them and having
> them default to NULL as is currently done. Does anyone foresee an
> issue with doing so?
I added a support and test for this type of callback into the Perl
bindings. The callback is a Perl subroutine.
In writing the callbacks the problem was that Swig does not seem to
support input typemaps with more than one effective parameters. I would
need to manage the interplay because the pointer to the Perl subroutine
is carried by the callback data. I could not find a way to write the
typemap without hard coding the serial number of one of the parameters
(callback_data). This is partially due to them being optional. If they
were not, I could trust that the callback_data typemap really sets the
callback_data parameter.
So, I would favor having them required and add an extra (Perl) layer...
Hm, In fact I think I can add an extra layer anyway, which adds them and
then I could trust that the callback_data is really set as it should be.
Howard, now that I'm talking to you, I think the "%typemap(out) char
**options" has a bug in the Python bindings as it had one in the Perl
one. It discards the last option.
Ari
>
> Howard
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka / Geoinformation and positioning
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma
More information about the gdal-dev
mailing list