1 /******************************************************************************
2  * $Id: gdal_csharp_extend.i 3f9a7a2d72587eebb6c6e84ca7e45e14a3abd9da 2017-08-18 19:31:25Z Tamas Szekeres $
3  *
4  * Name:     gdal_csharp_extend.i
5  * Project:  GDAL CSharp Interface
6  * Purpose:  C# specific GDAL extensions
7  * Author:   Tamas Szekeres, szekerest@gmail.com
8  *
9  ******************************************************************************
10  * Copyright (c) 2007, Tamas Szekeres
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  *****************************************************************************/
30 
31 
32 /******************************************************************************
33  * GDAL raster R/W support                                                    *
34  *****************************************************************************/
35 
36 %extend GDALRasterBandShadow
37 {
38 	%apply (void *buffer_ptr) {void *buffer};
ReadRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int pixelSpace,int lineSpace)39 	CPLErr ReadRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
40                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
41                           int pixelSpace, int lineSpace) {
42        return GDALRasterIO( self, GF_Read, xOff, yOff, xSize, ySize,
43 		        buffer, buf_xSize, buf_ySize, buf_type, pixelSpace, lineSpace );
44     }
WriteRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int pixelSpace,int lineSpace)45     CPLErr WriteRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
46                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
47                           int pixelSpace, int lineSpace) {
48        return GDALRasterIO( self, GF_Write, xOff, yOff, xSize, ySize,
49 		        buffer, buf_xSize, buf_ySize, buf_type, pixelSpace, lineSpace );
50     }
ReadRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int pixelSpace,int lineSpace,GDALRasterIOExtraArg * extraArg)51     CPLErr ReadRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
52                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
53                           int pixelSpace, int lineSpace, GDALRasterIOExtraArg* extraArg) {
54        return GDALRasterIOEx( self, GF_Read, xOff, yOff, xSize, ySize,
55 		        buffer, buf_xSize, buf_ySize, buf_type, pixelSpace, lineSpace, extraArg );
56     }
WriteRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int pixelSpace,int lineSpace,GDALRasterIOExtraArg * extraArg)57     CPLErr WriteRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
58                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
59                           int pixelSpace, int lineSpace, GDALRasterIOExtraArg* extraArg) {
60        return GDALRasterIOEx( self, GF_Write, xOff, yOff, xSize, ySize,
61 		        buffer, buf_xSize, buf_ySize, buf_type, pixelSpace, lineSpace, extraArg );
62     }
63     %clear void *buffer;
64 }
65 
66 %extend GDALDatasetShadow
67 {
68 	%apply (void *buffer_ptr) {void *buffer};
69 	%apply (int argin[ANY]) {int *bandMap};
ReadRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int bandCount,int * bandMap,int pixelSpace,int lineSpace,int bandSpace)70 	CPLErr ReadRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
71                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
72                           int bandCount, int* bandMap, int pixelSpace, int lineSpace, int bandSpace) {
73        return GDALDatasetRasterIO( self, GF_Read, xOff, yOff, xSize, ySize,
74 		        buffer, buf_xSize, buf_ySize, buf_type, bandCount,
75 		        bandMap, pixelSpace, lineSpace, bandSpace);
76     }
WriteRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int bandCount,int * bandMap,int pixelSpace,int lineSpace,int bandSpace)77     CPLErr WriteRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
78                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
79                           int bandCount, int* bandMap, int pixelSpace, int lineSpace, int bandSpace) {
80        return GDALDatasetRasterIO( self, GF_Write, xOff, yOff, xSize, ySize,
81 		        buffer, buf_xSize, buf_ySize, buf_type, bandCount,
82 		        bandMap, pixelSpace, lineSpace, bandSpace);
83     }
ReadRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int bandCount,int * bandMap,int pixelSpace,int lineSpace,int bandSpace,GDALRasterIOExtraArg * extraArg)84     CPLErr ReadRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
85                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
86                           int bandCount, int* bandMap, int pixelSpace, int lineSpace, int bandSpace,
87 						  GDALRasterIOExtraArg* extraArg) {
88        return GDALDatasetRasterIOEx( self, GF_Read, xOff, yOff, xSize, ySize,
89 		        buffer, buf_xSize, buf_ySize, buf_type, bandCount,
90 		        bandMap, pixelSpace, lineSpace, bandSpace, extraArg);
91     }
WriteRaster(int xOff,int yOff,int xSize,int ySize,void * buffer,int buf_xSize,int buf_ySize,GDALDataType buf_type,int bandCount,int * bandMap,int pixelSpace,int lineSpace,int bandSpace,GDALRasterIOExtraArg * extraArg)92     CPLErr WriteRaster(int xOff, int yOff, int xSize, int ySize, void* buffer,
93                           int buf_xSize, int buf_ySize, GDALDataType buf_type,
94                           int bandCount, int* bandMap, int pixelSpace, int lineSpace, int bandSpace,
95 						  GDALRasterIOExtraArg* extraArg) {
96        return GDALDatasetRasterIOEx( self, GF_Write, xOff, yOff, xSize, ySize,
97 		        buffer, buf_xSize, buf_ySize, buf_type, bandCount,
98 		        bandMap, pixelSpace, lineSpace, bandSpace, extraArg);
99     }
100     %clear void *buffer;
101     %clear int* bandMap;
102 
103     %apply (void *buffer_ptr) {const GDAL_GCP* __GetGCPs};
__GetGCPs()104     const GDAL_GCP* __GetGCPs( ) {
105       return GDALGetGCPs( self );
106     }
107     %clear const GDAL_GCP* __GetGCPs;
108 
__SetGCPs(int nGCPs,GDAL_GCP const * pGCPs,const char * pszGCPProjection)109     CPLErr __SetGCPs( int nGCPs, GDAL_GCP const *pGCPs, const char *pszGCPProjection ) {
110         return GDALSetGCPs( self, nGCPs, pGCPs, pszGCPProjection );
111     }
112     IMPLEMENT_ARRAY_MARSHALER(GDAL_GCP)
113 }
114 
115 IMPLEMENT_ARRAY_MARSHALER_STATIC(GDAL_GCP)
116 
117 
118 
119