Changeset 775 for trunk/zoo-project/zoo-services
- Timestamp:
- Jun 14, 2016, 11:17:20 AM (9 years ago)
- Location:
- trunk/zoo-project/zoo-services/cgal
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-services/cgal/cgal_service.c
r469 r775 29 29 VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmpm->value,strlen(tmpm->value),FALSE); 30 30 VSIFCloseL(ifile); 31 #if GDAL_VERSION_MAJOR >= 2 32 GDALDataset *ipoDS = 33 (GDALDataset*) GDALOpenEx( filename, 34 GDAL_OF_READONLY | GDAL_OF_VECTOR, 35 NULL, NULL, NULL ); 36 #else 31 37 OGRDataSource* ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE); 38 #endif 32 39 if( ipoDS == NULL ) 33 40 { 41 #if GDAL_VERSION_MAJOR >= 2 42 GDALDriverManager* poR=GetGDALDriverManager(); 43 #else 34 44 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 45 #endif 35 46 36 47 fprintf( stderr, "FAILURE:\n" … … 40 51 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 41 52 { 42 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 53 #if GDAL_VERSION_MAJOR >= 2 54 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 55 #else 56 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 57 #endif 43 58 } 44 59 char tmp[1024]; -
trunk/zoo-project/zoo-services/cgal/delaunay.c
r546 r775 50 50 /* Try opening the output datasource as an existing, writable */ 51 51 /* -------------------------------------------------------------------- */ 52 OGRDataSource *poODS; 53 52 #if GDAL_VERSION_MAJOR >= 2 53 GDALDataset *poODS; 54 GDALDriverManager* poR=GetGDALDriverManager(); 55 GDALDriver *poDriver = NULL; 56 #else 57 OGRDataSource *poODS; 54 58 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 55 59 OGRSFDriver *poDriver = NULL; 60 #endif 56 61 int iDriver; 57 58 62 map *tmpMap=getMapFromMaps(outputs,"Result","mimeType"); 59 63 const char *oDriver; … … 70 74 { 71 75 #ifdef DEBUG 76 #if GDAL_VERSION_MAJOR >= 2 77 fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetDescription()); 78 #else 72 79 fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName()); 73 80 #endif 74 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver) ) 81 #endif 82 if( EQUAL( 83 #if GDAL_VERSION_MAJOR >= 2 84 poR->GetDriver(iDriver)->GetDescription() 85 #else 86 poR->GetDriver(iDriver)->GetName() 87 #endif 88 , 89 oDriver) ) 75 90 { 76 91 poDriver = poR->GetDriver(iDriver); … … 86 101 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 87 102 { 103 #if GDAL_VERSION_MAJOR >= 2 104 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 105 #else 88 106 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 107 #endif 89 108 } 90 109 … … 94 113 } 95 114 96 if( !poDriver->TestCapability( ODrCCreateDataSource ) ){ 97 char emessage[1024]; 98 sprintf( emessage, "%s driver does not support data source creation.\n", 99 "json" ); 100 setMapInMaps(conf,"lenv","message",emessage); 101 return SERVICE_FAILED; 102 } 115 #if GDAL_VERSION_MAJOR >=2 116 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 117 #else 118 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 119 #endif 120 { 121 char emessage[1024]; 122 sprintf( emessage, "%s driver does not support data source creation.\n", 123 "json" ); 124 setMapInMaps(conf,"lenv","message",emessage); 125 return SERVICE_FAILED; 126 } 103 127 104 128 /* -------------------------------------------------------------------- */ … … 108 132 char **papszDSCO=NULL; 109 133 sprintf(pszDestDataSource,"/vsimem/result_%d",getpid()); 134 #if GDAL_VERSION_MAJOR >=2 135 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 136 #else 110 137 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 138 #endif 111 139 if( poODS == NULL ){ 112 140 char emessage[1024]; -
trunk/zoo-project/zoo-services/cgal/voronoi.c
r546 r775 67 67 /* Try opening the output datasource as an existing, writable */ 68 68 /* -------------------------------------------------------------------- */ 69 OGRDataSource *poODS; 70 69 #if GDAL_VERSION_MAJOR >= 2 70 GDALDataset *poODS; 71 GDALDriverManager* poR=GetGDALDriverManager(); 72 GDALDriver *poDriver = NULL; 73 #else 74 OGRDataSource *poODS; 71 75 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 72 76 OGRSFDriver *poDriver = NULL; 77 #endif 73 78 int iDriver; 74 75 79 map* tmpMap=getMapFromMaps(outputs,"Result","mimeType"); 76 80 const char *oDriver; … … 87 91 { 88 92 #ifdef DEBUG 93 #if GDAL_VERSION_MAJOR >= 2 94 fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetDescription()); 95 #else 89 96 fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName()); 90 97 #endif 91 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver) ) 98 #endif 99 if( EQUAL( 100 #if GDAL_VERSION_MAJOR >= 2 101 poR->GetDriver(iDriver)->GetDescription() 102 #else 103 poR->GetDriver(iDriver)->GetName() 104 #endif 105 , 106 oDriver) ) 92 107 { 93 108 poDriver = poR->GetDriver(iDriver); … … 103 118 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 104 119 { 120 #if GDAL_VERSION_MAJOR >= 2 121 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 122 #else 105 123 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 124 #endif 106 125 } 107 126 … … 111 130 } 112 131 113 if( !poDriver->TestCapability( ODrCCreateDataSource ) ){ 114 char emessage[1024]; 115 sprintf( emessage, "%s driver does not support data source creation.\n", 116 "json" ); 117 setMapInMaps(conf,"lenv","message",emessage); 118 return SERVICE_FAILED; 119 } 132 #if GDAL_VERSION_MAJOR >=2 133 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 134 #else 135 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 136 #endif 137 { 138 char emessage[1024]; 139 sprintf( emessage, "%s driver does not support data source creation.\n", 140 "json" ); 141 setMapInMaps(conf,"lenv","message",emessage); 142 return SERVICE_FAILED; 143 } 120 144 121 145 /* -------------------------------------------------------------------- */ … … 126 150 char **papszDSCO=NULL; 127 151 sprintf(pszDestDataSource,"/vsimem/result_%d.json",tpath->value,getpid()); 152 #if GDAL_VERSION_MAJOR >=2 153 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 154 #else 128 155 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 156 #endif 129 157 if( poODS == NULL ){ 130 158 char emessage[1024];
Note: See TracChangeset
for help on using the changeset viewer.