Changeset 13191
- Timestamp:
- 12/02/07 10:12:23 (7 months ago)
- Files:
-
- sandbox/ajolma/swig/include/ColorEntry.i (modified) (1 diff)
- sandbox/ajolma/swig/include/ColorTable.i (modified) (1 diff)
- sandbox/ajolma/swig/include/GCP.i (modified) (3 diffs)
- sandbox/ajolma/swig/include/OGRGeometry.i (modified) (1 diff)
- sandbox/ajolma/swig/include/cpl.i (modified) (2 diffs)
- sandbox/ajolma/swig/include/cpl_headers.i (deleted)
- sandbox/ajolma/swig/include/exception.i (modified) (1 diff)
- sandbox/ajolma/swig/include/gdal.i (modified) (1 diff)
- sandbox/ajolma/swig/include/gdal_global.i (modified) (3 diffs)
- sandbox/ajolma/swig/include/gdal_headers.i (modified) (1 diff)
- sandbox/ajolma/swig/include/gdalconst.i (modified) (1 diff)
- sandbox/ajolma/swig/include/ogr.i (modified) (1 diff)
- sandbox/ajolma/swig/include/ogr_global.i (modified) (5 diffs)
- sandbox/ajolma/swig/include/osr.i (modified) (1 diff)
- sandbox/ajolma/swig/include/osr_global.i (modified) (1 diff)
- sandbox/ajolma/swig/include/osr_headers.i (modified) (1 diff)
- sandbox/ajolma/swig/include/perl/gdal_classes.i (modified) (2 diffs)
- sandbox/ajolma/swig/include/perl/gdal_enums.i (moved) (moved from sandbox/ajolma/swig/include/gdal_enums.i) (2 diffs)
- sandbox/ajolma/swig/include/perl/gdal_extensions.i (modified) (1 diff)
- sandbox/ajolma/swig/include/perl/gdal_init.i (modified) (1 diff)
- sandbox/ajolma/swig/include/perl/gdal_typemaps.i (modified) (3 diffs)
- sandbox/ajolma/swig/include/perl/ogr_classes.i (modified) (1 diff)
- sandbox/ajolma/swig/include/perl/ogr_enums.i (moved) (moved from sandbox/ajolma/swig/include/ogr_enums.i) (2 diffs)
- sandbox/ajolma/swig/include/perl/ogr_extensions.i (modified) (1 diff)
- sandbox/ajolma/swig/include/perl/osr_enums.i (moved) (moved from sandbox/ajolma/swig/include/osr_enums.i) (2 diffs)
- sandbox/ajolma/swig/include/perl/osr_renames.i (added)
- sandbox/ajolma/swig/perl/t/gdal.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/ajolma/swig/include/ColorEntry.i
r13189 r13191 1 %aaa2 1 %rename (ColorEntry) GDALColorEntry; 3 2 typedef struct sandbox/ajolma/swig/include/ColorTable.i
r13189 r13191 61 61 return GDALGetPaletteInterpretation(self); 62 62 } 63 64 #ifdef SWIGRUBY65 %rename (get_count) GetColorEntryCount;66 #else67 %rename (GetCount) GetColorEntryCount;68 #endif69 63 70 int GetCo lorEntryCount() {64 int GetCount() { 71 65 return GDALGetColorEntryCount(self); 72 66 } sandbox/ajolma/swig/include/GCP.i
r13189 r13191 11 11 %immutable; 12 12 13 GDAL_GCP( double x = 0.0, double y = 0.0, double z = 0.0,14 double pixel = 0 .0, double line = 0.0,15 const char *info = "", const char *id = "") {13 GDAL_GCP( double x, double y, double z = 0, 14 double pixel = 0, double line = 0, 15 const char *info = NULL, const char *id = NULL) { 16 16 GDAL_GCP *self = (GDAL_GCP*) CPLMalloc( sizeof( GDAL_GCP ) ); 17 17 self->dfGCPX = x; … … 37 37 }; /* GDAL_GCP */ 38 38 %inline %{ 39 40 GDAL_GCP *new_GDAL_GCP( double x, double y, double z, 41 double pixel, double line, 42 const char *info, const char *id) { 43 GDAL_GCP *self = (GDAL_GCP*) CPLMalloc( sizeof( GDAL_GCP ) ); 44 self->dfGCPX = x; 45 self->dfGCPY = y; 46 self->dfGCPZ = z; 47 self->dfGCPPixel = pixel; 48 self->dfGCPLine = line; 49 self->pszInfo = CPLStrdup( (info == 0) ? "" : info ); 50 self->pszId = CPLStrdup( (id==0)? "" : id ); 51 return self; 52 } 39 53 40 54 double GDAL_GCP_GCPX_get( GDAL_GCP *h ) { … … 85 99 } 86 100 87 88 89 /* Duplicate, but transposed names for C# because90 * the C# module outputs backwards names91 */92 double GDAL_GCP_get_GCPX( GDAL_GCP *h ) {93 return h->dfGCPX;94 }95 void GDAL_GCP_set_GCPX( GDAL_GCP *h, double val ) {96 h->dfGCPX = val;97 }98 double GDAL_GCP_get_GCPY( GDAL_GCP *h ) {99 return h->dfGCPY;100 }101 void GDAL_GCP_set_GCPY( GDAL_GCP *h, double val ) {102 h->dfGCPY = val;103 }104 double GDAL_GCP_get_GCPZ( GDAL_GCP *h ) {105 return h->dfGCPZ;106 }107 void GDAL_GCP_set_GCPZ( GDAL_GCP *h, double val ) {108 h->dfGCPZ = val;109 }110 double GDAL_GCP_get_GCPPixel( GDAL_GCP *h ) {111 return h->dfGCPPixel;112 }113 void GDAL_GCP_set_GCPPixel( GDAL_GCP *h, double val ) {114 h->dfGCPPixel = val;115 }116 double GDAL_GCP_get_GCPLine( GDAL_GCP *h ) {117 return h->dfGCPLine;118 }119 void GDAL_GCP_set_GCPLine( GDAL_GCP *h, double val ) {120 h->dfGCPLine = val;121 }122 const char * GDAL_GCP_get_Info( GDAL_GCP *h ) {123 return h->pszInfo;124 }125 void GDAL_GCP_set_Info( GDAL_GCP *h, const char * val ) {126 if ( h->pszInfo )127 CPLFree( h->pszInfo );128 h->pszInfo = CPLStrdup(val);129 }130 const char * GDAL_GCP_get_Id( GDAL_GCP *h ) {131 return h->pszId;132 }133 void GDAL_GCP_set_Id( GDAL_GCP *h, const char * val ) {134 if ( h->pszId )135 CPLFree( h->pszId );136 h->pszId = CPLStrdup(val);137 }138 139 101 %} //%inline 140 102 141 103 %apply (IF_FALSE_RETURN_NONE) { (FALSE_IS_ERR) }; 142 104 FALSE_IS_ERR GDALGCPsToGeoTransform( int nGCPs, GDAL_GCP const * pGCPs, 143 double argout[6], int bApproxOK = 1);105 double argout[6], int bApproxOK ); 144 106 %clear (FALSE_IS_ERR); sandbox/ajolma/swig/include/OGRGeometry.i
r13189 r13191 118 118 } 119 119 120 void GetPoint(int iPoint = 0, double argout[3] = NULL) {120 void GetPoint(int iPoint, double argout[3]) { 121 121 OGR_G_GetPoint( self, iPoint, argout+0, argout+1, argout+2 ); 122 122 } 123 123 124 void GetPoint_2D(int iPoint = 0, double argout[2] = NULL) {124 void GetPoint_2D(int iPoint, double argout[2]) { 125 125 OGR_G_GetPoint( self, iPoint, argout+0, argout+1, NULL ); 126 126 } sandbox/ajolma/swig/include/cpl.i
r13189 r13191 29 29 *****************************************************************************/ 30 30 31 32 #ifdef SWIGRUBY 33 %rename (push_error_handler) CPLPushErrorHandler; 34 %rename (pop_error_handler) CPLPopErrorHandler; 35 %rename (error_reset) CPLErrorReset; 36 %rename (get_last_error_no) CPLGetLastErrorNo; 37 %rename (get_last_error_type) CPLGetLastErrorType; 38 %rename (get_last_error_msg) CPLGetLastErrorMsg; 39 %rename (push_finder_location) CPLPushFinderLocation; 40 %rename (pop_finder_location) CPLPopFinderLocation; 41 %rename (finder_clean) CPLFinderClean; 42 %rename (find_file) CPLFindFile; 43 %rename (read_dir) VSIReadDir; 44 %rename (set_config_option) CPLSetConfigOption; 45 %rename (get_config_option) CPLGetConfigOption; 46 %rename (binary_to_hex) CPLBinaryToHex; 47 %rename (hex_to_binary) CPLHexToBinary; 48 #else 49 %rename (PushErrorHandler) CPLPushErrorHandler; 50 %rename (PopErrorHandler) CPLPopErrorHandler; 51 %rename (ErrorReset) CPLErrorReset; 52 %rename (GetLastErrorNo) CPLGetLastErrorNo; 53 %rename (GetLastErrorType) CPLGetLastErrorType; 54 %rename (GetLastErrorMsg) CPLGetLastErrorMsg; 55 %rename (PushFinderLocation) CPLPushFinderLocation; 56 %rename (PopFinderLocation) CPLPopFinderLocation; 57 %rename (FinderClean) CPLFinderClean; 58 %rename (FindFile) CPLFindFile; 59 %rename (ReadDir) VSIReadDir; 60 %rename (SetConfigOption) CPLSetConfigOption; 61 %rename (GetConfigOption) CPLGetConfigOption; 62 %rename (CPLBinaryToHex) CPLBinaryToHex; 63 %rename (CPLHexToBinary) CPLHexToBinary; 64 #endif 31 %include cpl_renames.i 65 32 66 33 void CPLPushErrorHandler( CPLErrorHandler ); … … 95 62 char *CPLBinaryToHex( int nBytes, const GByte *pabyData ); 96 63 GByte *CPLHexToBinary( const char *pszHex, int *pnBytes ); 97 sandbox/ajolma/swig/include/exception.i
r13189 r13191 32 32 *****************************************************************************/ 33 33 34 %inline %{ 35 void VeryQuiteErrorHandler(CPLErr eclass, int code, const char *msg ) { 36 /* If the error class is CE_Fatal, we want to have a message issued 37 because the CPL support code does an abort() before any exception 38 can be generated */ 39 if (eclass == CE_Fatal ) { 40 CPLDefaultErrorHandler(eclass, code, msg ); 41 } 42 } 43 44 void UseExceptions() { 45 CPLSetErrorHandler( (CPLErrorHandler) VeryQuiteErrorHandler ); 46 } 47 48 void DontUseExceptions() { 49 CPLSetErrorHandler( CPLDefaultErrorHandler ); 50 } 51 52 static char const * 53 OGRErrMessages( int rc ) { 54 switch( rc ) { 55 case OGRERR_NONE: 56 return "OGR Error: None"; 57 case OGRERR_NOT_ENOUGH_DATA: 58 return "OGR Error: Not enough data to deserialize"; 59 case OGRERR_NOT_ENOUGH_MEMORY: 60 return "OGR Error: Not enough memory"; 61 case OGRERR_UNSUPPORTED_GEOMETRY_TYPE: 62 return "OGR Error: Unsupported geometry type"; 63 case OGRERR_UNSUPPORTED_OPERATION: 64 return "OGR Error: Unsupported operation"; 65 case OGRERR_CORRUPT_DATA: 66 return "OGR Error: Corrupt data"; 67 case OGRERR_FAILURE: 68 return "OGR Error: General Error"; 69 case OGRERR_UNSUPPORTED_SRS: 70 return "OGR Error: Unsupported SRS"; 71 case OGRERR_INVALID_HANDLE: 72 return "OGR Error: Invalid handle"; 73 default: 74 return "OGR Error: Unknown"; 75 } 76 } 77 78 void Debug( const char *msg_class, const char *message ) { 79 CPLDebug( msg_class, message ); 80 } 81 void Error( CPLErr msg_class = CE_Failure, int err_code = 0, const char* msg = "error" ) { 82 CPLError( msg_class, err_code, msg ); 83 } 84 85 CPLErr PushErrorHandler( char const * pszCallbackName = "CPLQuietErrorHandler" ) { 86 CPLErrorHandler pfnHandler = NULL; 87 if( EQUAL(pszCallbackName,"CPLQuietErrorHandler") ) 88 pfnHandler = CPLQuietErrorHandler; 89 else if( EQUAL(pszCallbackName,"CPLDefaultErrorHandler") ) 90 pfnHandler = CPLDefaultErrorHandler; 91 else if( EQUAL(pszCallbackName,"CPLLoggingErrorHandler") ) 92 pfnHandler = CPLLoggingErrorHandler; 93 94 if ( pfnHandler == NULL ) 95 return CE_Fatal; 96 97 CPLPushErrorHandler( pfnHandler ); 98 99 return CE_None; 100 } 101 102 %} 103 34 104 %exception { 35 105 CPLErrorReset(); sandbox/ajolma/swig/include/gdal.i
r13189 r13191 29 29 *****************************************************************************/ 30 30 31 /* init is language specific */32 31 %include gdal_init.i 33 34 %feature ("compactdefaultargs");35 36 32 %include gdal_headers.i 37 %include cpl_headers.i38 33 %include gdal_enums.i 39 40 34 %include exception.i 41 42 /* typemaps are language specific */43 35 %include gdal_typemaps.i 44 45 36 %include cpl.i 46 47 /* renames are language specific */48 37 %include gdal_renames.i 49 50 38 %include gdal_global.i 51 52 /* which classes to use, is language specific */53 39 %include gdal_classes.i 54 55 %include Operations.i56 57 /* language specific extensions */58 40 %include gdal_extensions.i sandbox/ajolma/swig/include/gdal_global.i
r13189 r13191 1 const char *GDALVersionInfo( const char *request = "VERSION_NUM");1 const char *GDALVersionInfo( const char *request ); 2 2 3 3 void GDALAllRegister(); … … 21 21 const char *GDALGetPaletteInterpretationName( GDALPaletteInterp ); 22 22 23 const char *GDALDecToDMS( double, const char *, int = 2);23 const char *GDALDecToDMS( double, const char *, int ); 24 24 25 25 double GDALPackedDMSToDec( double ); … … 27 27 double GDALDecToPackedDMS( double ); 28 28 29 30 #if defined(SWIGCSHARP)31 %newobject CPLParseXMLString;32 #endif33 29 CPLXMLNode *CPLParseXMLString( char * ); 34 30 sandbox/ajolma/swig/include/gdal_headers.i
r13189 r13191 10 10 #include "gdal_alg.h" 11 11 #include "gdalwarper.h" 12 #include "ogr_core.h" 12 13 13 14 typedef void GDALMajorObjectShadow; sandbox/ajolma/swig/include/gdalconst.i
r13189 r13191 29 29 *****************************************************************************/ 30 30 31 #ifdef PERL_CPAN_NAMESPACE 32 %module "Geo::GDAL::Const" 33 #elif defined(SWIGCSHARP) 34 %module GdalConst 35 #else 36 %module gdalconst 37 #endif 38 39 #if defined(SWIGJAVA) 40 %include gdalconst_java.i 41 #endif 31 %include gdalconst_init.i 42 32 43 33 %{ sandbox/ajolma/swig/include/ogr.i
r13189 r13191 29 29 30 30 %include ogr_init.i 31 32 %feature("compactdefaultargs");33 %feature("autodoc");34 35 31 %include ogr_headers.i 36 %include cpl_headers.i37 32 %include ogr_enums.i 38 39 33 %include exception.i 40 41 /* typemaps are language specific */42 34 %include gdal_typemaps.i 43 44 35 %import osr.i 45 46 /* renames are language specific */47 36 %include ogr_renames.i 48 49 37 %include ogr_global.i 50 51 38 %include ogr_classes.i 52 53 /* language specific extensions */54 39 %include ogr_extensions.i sandbox/ajolma/swig/include/ogr_global.i
r13189 r13191 3 3 /* -------------------------------------------------------------------- */ 4 4 5 #ifndef SWIGJAVA6 5 %feature( "kwargs" ) CreateGeometryFromWkb; 6 #ifndef SWIGCSHARP 7 %apply (int nLen, char *pBuf ) { (int len, void *buffer_ptr)}; 8 #endif 7 9 %newobject CreateGeometryFromWkb; 8 #ifndef SWIGCSHARP9 %apply (int nLen, char *pBuf ) { (int len, char *bin_string)};10 #else11 %apply (void *buffer_ptr) {char *bin_string};12 #endif13 10 %inline %{ 14 OGRGeometryShadow* CreateGeometryFromWkb( int len, char *bin_string,11 OGRGeometryShadow* CreateGeometryFromWkb( int len, void *buffer_ptr, 15 12 OSRSpatialReferenceShadow *reference=NULL ) { 16 13 void *geom; 17 OGRErr err = OGR_G_CreateFromWkb( (unsigned char *) b in_string,14 OGRErr err = OGR_G_CreateFromWkb( (unsigned char *) buffer_ptr, 18 15 reference, 19 16 &geom, … … 27 24 28 25 %} 29 #endif30 26 #ifndef SWIGCSHARP 31 %clear (int len, char *bin_string); 32 #else 33 %clear (char *bin_string); 34 #endif 35 36 #ifdef SWIGJAVA 37 %newobject CreateGeometryFromWkb; 38 %feature("kwargs") CreateGeometryFromWkb; 39 %inline { 40 OGRGeometryShadow* CreateGeometryFromWkb(int nLen, unsigned char *pBuf, 41 OSRSpatialReferenceShadow *reference=NULL ) { 42 void *geom; 43 OGRErr err = OGR_G_CreateFromWkb((unsigned char*) pBuf, reference, &geom, nLen); 44 if (err != 0 ) { 45 CPLError(CE_Failure, err, "%s", OGRErrMessages(err)); 46 return NULL; 47 } 48 return (OGRGeometryShadow*) geom; 49 } 50 } 27 %clear (int len, void *buffer_ptr); 51 28 #endif 52 29 … … 111 88 %} 112 89 113 #ifndef GDAL_BINDINGS114 90 int OGRGetDriverCount(); 115 #endif116 91 117 92 int OGRGetOpenDSCount(); … … 160 135 %} 161 136 162 #ifndef GDAL_BINDINGS163 137 %inline %{ 164 138 OGRDriverShadow* GetDriverByName( char const *name ) { … … 170 144 } 171 145 %} 172 #endifsandbox/ajolma/swig/include/osr.i
r13189 r13191 29 29 30 30 %include osr_init.i 31 32 %feature("compactdefaultargs");33 34 31 %include osr_headers.i 35 %include cpl_headers.i36 32 %include osr_enums.i 37 38 33 %include exception.i 39 40 34 %include gdal_typemaps.i 41 35 %include osr_renames.i 42 36 %include osr_global.i 43 44 37 %include osr_classes.i 45 46 38 %include osr_extensions.i sandbox/ajolma/swig/include/osr_global.i
r13189 r13191 40 40 41 41 #if !defined(SWIGPYTHON) 42 %rename (GetProjectionMethods) OPTGetProjectionMethods;43 42 %apply (char **CSL) {(char **)}; 44 43 char **OPTGetProjectionMethods(); 45 44 %clear (char **); 46 45 47 %rename (GetProjectionMethodParameterList) OPTGetParameterList;48 46 %apply (char **CSL) {(char **)}; 49 47 char **OPTGetParameterList( char *method, char **username ); 50 48 %clear (char **); 51 49 52 %rename (GetProjectionMethodParamInfo) OPTGetParameterInfo;53 50 void OPTGetParameterInfo( char *method, char *param, char **usrname, 54 51 char **type, double *defaultval ); sandbox/ajolma/swig/include/osr_headers.i
r13189 r13191 5 5 #include "cpl_string.h" 6 6 #include "cpl_conv.h" 7 8 7 #include "ogr_srs_api.h" 8 #include "ogr_core.h" 9 9 10 10 typedef void OSRSpatialReferenceShadow; 11 11 typedef void OSRCoordinateTransformationShadow; 12 13 12 %} sandbox/ajolma/swig/include/perl/gdal_classes.i
r13189 r13191 1 %include XMLNode.i2 1 %include MajorObject.i 3 2 %include Driver.i … … 7 6 %include ColorTable.i 8 7 %include RasterAttributeTable.i 9 8 %include Operations.i sandbox/ajolma/swig/include/perl/gdal_enums.i
r13189 r13191 1 //************************************************************************2 //3 // Enums.4 //5 //************************************************************************6 7 #ifndef SWIGCSHARP8 1 typedef int CPLErr; 9 2 typedef int GDALPaletteInterp; … … 12 5 typedef int GDALDataType; 13 6 typedef int GDALResampleAlg; 14 #else15 /*! Pixel data types */16 %rename (DataType) GDALDataType;17 typedef enum {18 GDT_Unknown = 0,19 /*! Eight bit unsigned integer */ GDT_Byte = 1,20 /*! Sixteen bit unsigned integer */ GDT_UInt16 = 2,21 /*! Sixteen bit signed integer */ GDT_Int16 = 3,22 /*! Thirty two bit unsigned integer */ GDT_UInt32 = 4,23 /*! Thirty two bit signed integer */ GDT_Int32 = 5,24 /*! Thirty two bit floating point */ GDT_Float32 = 6,25 /*! Sixty four bit floating point */ GDT_Float64 = 7,26 /*! Complex Int16 */ GDT_CInt16 = 8,27 /*! Complex Int32 */ GDT_CInt32 = 9,28 /*! Complex Float32 */ GDT_CFloat32 = 10,29 /*! Complex Float64 */ GDT_CFloat64 = 11,30 GDT_TypeCount = 12 /* maximum type # + 1 */31 } GDALDataType;32 33 /*! Types of color interpretation for raster bands. */34 %rename (ColorInterp) GDALColorInterp;35 typedef enum36 {37 GCI_Undefined=0,38 /*! Greyscale */ GCI_GrayIndex=1,39 /*! Paletted (see associated color table) */ GCI_PaletteIndex=2,40 /*! Red band of RGBA image */ GCI_RedBand=3,41 /*! Green band of RGBA image */ GCI_GreenBand=4,42 /*! Blue band of RGBA image */ GCI_BlueBand=5,43 /*! Alpha (0=transparent, 255=opaque) */ GCI_AlphaBand=6,44 /*! Hue band of HLS image */ GCI_HueBand=7,45 /*! Saturation band of HLS image */ GCI_SaturationBand=8,46 /*! Lightness band of HLS image */ GCI_LightnessBand=9,47 /*! Cyan band of CMYK image */ GCI_CyanBand=10,48 /*! Magenta band of CMYK image */ GCI_MagentaBand=11,49 /*! Yellow band of CMYK image */ GCI_YellowBand=12,50 /*! Black band of CMLY image */ GCI_BlackBand=13,51 /*! Y Luminance */ GCI_YCbCr_YBand=14,52 /*! Cb Chroma */ GCI_YCbCr_CbBand=15,53 /*! Cr Chroma */ GCI_YCbCr_CrBand=16,54 /*! Max current value */ GCI_Max=1655 } GDALColorInterp;56 57 /*! Types of color interpretations for a GDALColorTable. */58 %rename (PaletteInterp) GDALPaletteInterp;59 typedef enum60 {61 /*! Grayscale (in GDALColorEntry.c1) */ GPI_Gray=0,62 /*! Red, Green, Blue and Alpha in (in c1, c2, c3 and c4) */ GPI_RGB=1,63 /*! Cyan, Magenta, Yellow and Black (in c1, c2, c3 and c4)*/ GPI_CMYK=2,64 /*! Hue, Lightness and Saturation (in c1, c2, and c3) */ GPI_HLS=365 } GDALPaletteInterp;66 67 /*! Flag indicating read/write, or read-only access to data. */68 %rename (Access) GDALAccess;69 typedef enum {70 /*! Read only (no update) access */ GA_ReadOnly = 0,71 /*! Read/write access. */ GA_Update = 172 } GDALAccess;73 74 /*! Read/Write flag for RasterIO() method */75 %rename (RWFlag) GDALRWFlag;76 typedef enum {77 /*! Read data */ GF_Read = 0,78 /*! Write data */ GF_Write = 179 } GDALRWFlag;80 81 /*! Warp Resampling Algorithm */82 %rename (ResampleAlg) GDALResampleAlg;83 typedef enum {84 /*! Nearest neighbour (select on one input pixel) */ GRA_NearestNeighbour=0,85 /*! Bilinear (2x2 kernel) */ GRA_Bilinear=1,86 /*! Cubic Convolution Approximation (4x4 kernel) */ GRA_Cubic=2,87 /*! Cubic B-Spline Approximation (4x4 kernel) */ GRA_CubicSpline=3,88 } GDALResampleAlg;89 90 typedef enum91 {92 CE_None = 0,93 CE_Log = 1,94 CE_Warning = 2,95 CE_Failure = 3,96 CE_Fatal = 497 } CPLErr;98 #endif99 sandbox/ajolma/swig/include/perl/gdal_extensions.i
r13189 r13191 529 529 int bUseNoData, double dfNoDataValue, 530 530 OGRLayerShadow *hLayer, int iIDField, int iElevField, 531 GDALProgressFunc callback = NULL,532 void* callback_data = NULL) {531 GDALProgressFunc callback, 532 void* callback_data) { 533 533 return GDALContourGenerate( self, dfContourInterval, dfContourBase, 534 534 nFixedLevelCount, padfFixedLevels, sandbox/ajolma/swig/include/perl/gdal_init.i
r13189 r13191 1 #ifdef PERL_CPAN_NAMESPACE 1 2 %module "Geo::GDAL" 3 #else 4 %module gdal 5 #endif 2 6 3 7 %init %{ sandbox/ajolma/swig/include/perl/gdal_typemaps.i
r13189 r13191 742 742 } 743 743 744 %typemap(arginit, noblock=1) ( void* callback_data =NULL)744 %typemap(arginit, noblock=1) ( void* callback_data ) 745 745 { 746 746 SavedEnv saved_env; … … 749 749 } 750 750 751 %typemap(in) (GDALProgressFunc callback = NULL)752 { 753 /* %typemap(in) (GDALProgressFunc callback = NULL) */751 %typemap(in) (GDALProgressFunc callback) 752 { 753 /* %typemap(in) (GDALProgressFunc callback) */ 754 754 if (SvOK($input)) { 755 755 saved_env.fct = (SV *)$input; … … 759 759 } 760 760 761 %typemap(in) (void* callback_data =NULL)762 { 763 /* %typemap(in) (void* callback_data =NULL) */761 %typemap(in) (void* callback_data) 762 { 763 /* %typemap(in) (void* callback_data) */ 764 764 if (SvOK($input)) 765 765 saved_env.data = (SV *)$input; sandbox/ajolma/swig/include/perl/ogr_classes.i
r13189 r13191 6 6 %include OGRFieldDefn.i 7 7 %include OGRGeometry.i 8 sandbox/ajolma/swig/include/perl/ogr_enums.i
r13189 r13191 1 /************************************************************************/2 /* Enumerated types */3 /************************************************************************/4 5 #ifndef SWIGCSHARP6 1 typedef int OGRwkbByteOrder; 7 2 typedef int OGRwkbGeometryType; 8 3 typedef int OGRFieldType; 9 4 typedef int OGRJustification; 10 #else11 %rename (wkbByteOrder) OGRwkbByteOrder;12 typedef enum13 {14 wkbXDR = 0, /* MSB/Sun/Motoroloa: Most Significant Byte First */15 wkbNDR = 1 /* LSB/Intel/Vax: Least Significant Byte First */16 } OGRwkbByteOrder;17 5 18 %rename (wkbGeometryType) OGRwkbGeometryType;19 typedef enum20 {21 wkbUnknown = 0, /* non-standard */22 wkbPoint = 1, /* rest are standard WKB type codes */23 wkbLineString = 2,24 wkbPolygon = 3,25 wkbMultiPoint = 4,26 wkbMultiLineString = 5,27 wkbMultiPolygon = 6,28 wkbGeometryCollection = 7,29 wkbNone = 100, /* non-standard, for pure attribute records */30 wkbLinearRing = 101, /* non-standard, just for createGeometry() */31 wkbPoint25D = -2147483647, /* 2.5D extensions as per 99-402 */32 wkbLineString25D = -2147483646,33 wkbPolygon25D = -2147483645,34 wkbMultiPoint25D = -2147483644,35 wkbMultiLineString25D = -2147483643,36 wkbMultiPolygon25D = -2147483642,37 wkbGeometryCollection25D = -214748364138 } OGRwkbGeometryType;39 40 %rename (FieldType) OGRFieldType;41 typedef enum42 {43 /** Simple 32bit integer */ OFTInteger = 0,44 /** List of 32bit integers */ OFTIntegerList = 1,45 /** Double Precision floating point */ OFTReal = 2,46 /** List of doubles */ OFTRealList = 3,47 /** String of ASCII chars */ OFTString = 4,48 /** Array of strings */ OFTStringList = 5,49 /** Double byte string (unsupported) */ OFTWideString = 6,50 /** List of wide strings (unsupported) */ OFTWideStringList = 7,51 /** Raw Binary data */ OFTBinary = 8,52 /** Date */ OFTDate = 9,53 /** Time */ OFTTime = 10,54 /** Date and Time */ OFTDateTime = 1155 } OGRFieldType;56 57 %rename (Justification) OGRJustification;58 typedef enum59 {60 OJUndefined = 0,61 OJLeft = 1,62 OJRight = 263 } OGRJustification;64 #endif65 66 #ifndef SWIGCSHARP67 6 %constant wkb25Bit = wkb25DBit; 68 7 %constant wkbUnknown = 0; … … 121 60 %constant char *ODrCCreateDataSource = "CreateDataSource"; 122 61 %constant char *ODrCDeleteDataSource = "DeleteDataSource"; 123 #else124 typedef int OGRErr;125 62 126 #define OGRERR_NONE 0 127 #define OGRERR_NOT_ENOUGH_DATA 1 /* not enough data to deserialize */ 128 #define OGRERR_NOT_ENOUGH_MEMORY 2 129 #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3 130 #define OGRERR_UNSUPPORTED_OPERATION 4 131 #define OGRERR_CORRUPT_DATA 5 132 #define OGRERR_FAILURE 6 133 #define OGRERR_UNSUPPORTED_SRS 7 134 135 #define wkb25DBit 0x80000000 136 #define ogrZMarker 0x21125711 137 138 #define OGRNullFID -1 139 #define OGRUnsetMarker -21121 140 141 #define OLCRandomRead "RandomRead" 142 #define OLCSequentialWrite "SequentialWrite" 143 #define OLCRandomWrite "RandomWrite" 144 #define OLCFastSpatialFilter "FastSpatialFilter" 145 #define OLCFastFeatureCount "FastFeatureCount" 146 #define OLCFastGetExtent "FastGetExtent" 147 #define OLCCreateField "CreateField" 148 #define OLCTransactions "Transactions" 149 #define OLCDeleteFeature "DeleteFeature" 150 #define OLCFastSetNextByIndex "FastSetNextByIndex" 151 152 #define ODsCCreateLayer "CreateLayer" 153 #define ODsCDeleteLayer "DeleteLayer" 154 155 #define ODrCCreateDataSource "CreateDataSource" 156 #define ODrCDeleteDataSource "DeleteDataSource" 157 #endif 63 %inline %{ 64 void OGRGeometryShadow_Move(OGRGeometryShadow *g, double dx, double dy, double dz) { 65 int n = OGR_G_GetGeometryCount(g); 66 if (n > 0) { 67 int i; 68 for (i = 0; i < n; i++) { 69 OGRGeometryShadow *g = (OGRGeometryShadow*)OGR_G_GetGeometryRef(g, i); 70 OGRGeometryShadow_Move(g, dx, dy, dz); 71 } 72 } else { 73 int i; 74 for (i = 0; i < OGR_G_GetPointCount(g); i++) { 75 double x = OGR_G_GetX(g, i); 76 double y = OGR_G_GetY(g, i); 77 double z = OGR_G_GetZ(g, i); 78 OGR_G_SetPoint(g, i, x+dx, y+dy, z+dz); 79 } 80 } 81 } 82 %} sandbox/ajolma/swig/include/perl/ogr_extensions.i
r13189 r13191 28 28 29 29 void Move(double dx, double dy, double dz = 0) { 30 int n = OGR_G_GetGeometryCount(self); 31 if (n > 0) { 32 int i; 33 for (i = 0; i < n; i++) { 34 OGRGeometryShadow *g = (OGRGeometryShadow*)OGR_G_GetGeometryRef(self, i); 35 OGRGeometryShadow_Move(g, dx, dy, dz); 36 } 37 } else { 38 int i; 39 for (i = 0; i < OGR_G_GetPointCount(self); i++) { 40 double x = OGR_G_GetX(self, i); 41 double y = OGR_G_GetY(self, i); 42 double z = OGR_G_GetZ(self, i); 43 OGR_G_SetPoint(self, i, x+dx, y+dy, z+dz); 44 } 45 } 30 OGRGeometryShadow_Move(self, dx, dy, dz); 46 31 } 47 32 sandbox/ajolma/swig/include/perl/osr_enums.i
r13189 r13191 1 typedef int OGRErr; 2 1 3 %constant char *SRS_PT_ALBERS_CONIC_EQUAL_AREA = SRS_PT_ALBERS_CONIC_EQUAL_AREA; 2 4 %constant char *SRS_PT_AZIMUTHAL_EQUIDISTANT = SRS_PT_AZIMUTHAL_EQUIDISTANT; … … 86 88 %constant double SRS_WGS84_SEMIMAJOR = SRS_WGS84_SEMIMAJOR; 87 89 %constant double SRS_WGS84_INVFLATTENING = SRS_WGS84_INVFLATTENING; 88 89 typedef int OGRErr;sandbox/ajolma/swig/perl/t/gdal.t
r13189 r13191 329 329 { 330 330 my @gcps = (); 331 push @gcps,new Geo::GDAL::GCP(1.1,2.2 );332 push @gcps,new Geo::GDAL::GCP(2.1,3.2 );331 push @gcps,new Geo::GDAL::GCP(1.1,2.2,0,0,0,undef,undef); 332 push @gcps,new Geo::GDAL::GCP(2.1,3.2,0,0,0,undef,undef); 333 333 my $po = "ho ho ho"; 334 334 $dataset->SetGCPs(\@gcps,$po);
