Ignore:
Timestamp:
Jun 14, 2016, 11:17:20 AM (8 years ago)
Author:
djay
Message:

Add GDAL 2 support to the cgal services. Updadte otb support to build against OTB 5.4.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-services/cgal/voronoi.c

    r546 r775  
    6767    /*      Try opening the output datasource as an existing, writable      */
    6868    /* -------------------------------------------------------------------- */
    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;   
    7175    OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();
    7276    OGRSFDriver          *poDriver = NULL;
     77#endif
    7378    int                  iDriver;
    74 
    7579    map* tmpMap=getMapFromMaps(outputs,"Result","mimeType");
    7680    const char *oDriver;
     
    8791      {
    8892#ifdef DEBUG
     93#if GDAL_VERSION_MAJOR >= 2
     94        fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetDescription());
     95#else
    8996        fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName());
    9097#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) )
    92107          {
    93108            poDriver = poR->GetDriver(iDriver);
     
    103118        for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ )
    104119          {
     120#if GDAL_VERSION_MAJOR >= 2
     121            sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() );
     122#else
    105123            sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
     124#endif
    106125          }
    107126
     
    111130      }
    112131
    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      }
    120144
    121145    /* -------------------------------------------------------------------- */
     
    126150    char **papszDSCO=NULL;
    127151    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
    128155    poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO );
     156#endif
    129157    if( poODS == NULL ){
    130158      char emessage[1024];     
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png