diff --git a/swig/include/Dataset.i b/swig/include/Dataset.i index fe4945f95f66..f7ddfbbdabbb 100644 --- a/swig/include/Dataset.i +++ b/swig/include/Dataset.i @@ -805,32 +805,12 @@ CPLErr AdviseRead( int xoff, int yoff, int xsize, int ysize, return GDALDatasetDeleteLayer(self, index); } - int GetLayerCount() { - return GDALDatasetGetLayerCount(self); - } - bool IsLayerPrivate( int index ) { return GDALDatasetIsLayerPrivate(self, index); } -#ifdef SWIGJAVA - OGRLayerShadow *GetLayerByIndex( int index ) { -#else - OGRLayerShadow *GetLayerByIndex( int index=0) { -#endif - OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetGetLayer(self, index); - return layer; - } - OGRLayerShadow *GetLayerByName( const char* layer_name) { - OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetGetLayerByName(self, layer_name); - return layer; - } - void ResetReading() - { - GDALDatasetResetReading( self ); - } #ifdef SWIGPYTHON %newobject GetNextFeature; @@ -890,6 +870,46 @@ CPLErr AdviseRead( int xoff, int yoff, int xsize, int ysize, #endif /* defined(SWIGPYTHON) || defined(SWIGJAVA) */ +#ifdef SWIGJAVA + OGRLayerShadow *GetLayerByIndex( int index ) { +#elif SWIGPYTHON + OGRLayerShadow *GetLayerByIndex( int index=0) { +#else + OGRLayerShadow *GetLayer( int index ) { +#endif + OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetGetLayer(self, index); + return layer; + } + + OGRLayerShadow *GetLayerByName(const char* layer_name) { + OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetGetLayerByName(self, layer_name); + return layer; + } + + void ResetReading() + { + GDALDatasetResetReading(self); + } + + int GetLayerCount() { + return GDALDatasetGetLayerCount(self); + } + +#ifdef SWIGCSHARP + + %newobject GetNextFeature; + OGRFeatureShadow *GetNextFeature( OGRLayerShadow** ppoBelongingLayer = NULL, + double* pdfProgressPct = NULL, + GDALProgressFunc callback = NULL, + void* callback_data=NULL ) + { + return GDALDatasetGetNextFeature( self, ppoBelongingLayer, pdfProgressPct, + callback, callback_data ); + } + + +#endif + OGRErr AbortSQL() { return GDALDatasetAbortSQL(self); } diff --git a/swig/include/csharp/gdal_csharp.i b/swig/include/csharp/gdal_csharp.i index 23b5abe76a98..39a4e0587662 100644 --- a/swig/include/csharp/gdal_csharp.i +++ b/swig/include/csharp/gdal_csharp.i @@ -86,6 +86,8 @@ typedef struct } GDALRasterIOExtraArg; DEFINE_EXTERNAL_CLASS(OGRLayerShadow, OSGeo.OGR.Layer) +DEFINE_EXTERNAL_CLASS(OGRFeatureShadow, OSGeo.OGR.Feature) + %define %rasterio_functions(GDALTYPE,CSTYPE) public CPLErr ReadRaster(int xOff, int yOff, int xSize, int ySize, CSTYPE[] buffer, int buf_xSize, int buf_ySize, int pixelSpace, int lineSpace) { diff --git a/swig/include/csharp/typemaps_csharp.i b/swig/include/csharp/typemaps_csharp.i index ef706e6de018..509db618aee4 100644 --- a/swig/include/csharp/typemaps_csharp.i +++ b/swig/include/csharp/typemaps_csharp.i @@ -599,3 +599,19 @@ OPTIONAL_POD(int, int); %typemap(imtype) (void* callback_data) "string" %typemap(cstype) (void* callback_data) "string" %typemap(csin) (void* callback_data) "$csinput" + + +/****************************************************************************** + * GDALGetNextFeature typemaps * + *****************************************************************************/ + +%apply (double *defaultval) {double* pdfProgressPct}; + +%typemap(imtype) (OGRLayerShadow **ppoBelongingLayer) "ref IntPtr" +%typemap(cstype) (OGRLayerShadow **ppoBelongingLayer) "ref IntPtr" +%typemap(csin) (OGRLayerShadow **ppoBelongingLayer) "ref $csinput" + +/****************************************************************************** + * GDALGetLayerByName typemaps * + *****************************************************************************/ +%apply ( const char *utf8_path ) { const char* layer_name };