[Gdal-dev] Re: Minor changes to gdal_java.i
Andrea Aime
aaime at openplans.org
Fri Apr 6 04:48:14 EDT 2007
Simone Gannecchini ha scritto:
> Hi all,
> I am attaching a very minor patch for the gdal_java.i swig file that me and
> Daniele would really like to have accepted.
> If you look at it here below, you'll see that it simply allows to write and
> read without going through each single raster band.
>
> It should provide a nice optimization in case you work tile by tile since it
> reduces the number JNI calls to read/write data by the number of #bands.
>
> Index: C:/work/VC++/gdal/swig/include/java/gdal_java.i
> ===================================================================
> --- C:/work/VC++/gdal/swig/include/java/gdal_java.i (revision 11187)
> +++ C:/work/VC++/gdal/swig/include/java/gdal_java.i (working copy)
> +%extend GDALDatasetShadow {
> + CPLErr ReadRaster_Direct( int xoff, int yoff, int xsize, int ysize,
> + int buf_xsize, int buf_ysize,
> + GDALDataType buf_type, int bands, void *buf)
> +{
> +
> +
> + return GDALDatasetRasterIO( self, GF_Read, xoff, yoff, xsize, ysize,
> + buf, buf_xsize, buf_ysize,
> + buf_type, bands, 0,0,0,0);
> +
> +}
> +
> +
> + CPLErr WriteRaster_Direct( int xoff, int yoff, int xsize, int ysize,
> + int buf_xsize, int buf_ysize,
> + GDALDataType buf_type, int bands, void *buf)
> +{
> +
> + return GDALDatasetRasterIO( self, GF_Write, xoff, yoff, xsize, ysize,
> + buf, buf_xsize, buf_ysize,
> + buf_type, bands, 0,0,0,0);
> +
> +}
> +
> +} /* extend */
> +
> +
> %include typemaps_java.i
Change looks good, I see the advantage, I'm just wondering if this is
general enough to push it one level up, where every language can use it.
I mean, I don't see anything java specific there?
> We have other optimizations that we are working on for accessing large
> raster in java on Tile base but for the moment they are not stable enough
> (wonder if we'll have have time to make them stable though :-) )
Well, it may be nice to discuss their design, aim, and implementation.
There are lots of skilled people here, someone may have ideas on how to
stabilize them, whatever that means :-)
Cheers
Andrea
More information about the Gdal-dev
mailing list