[GRASS-SVN] r71506 - grass-addons/grass7/raster/r.spread.sod

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 25 08:26:57 PDT 2017


Author: wenzeslaus
Date: 2017-09-25 08:26:57 -0700 (Mon, 25 Sep 2017)
New Revision: 71506

Modified:
   grass-addons/grass7/raster/r.spread.sod/Img.cpp
Log:
r.spread.sod: GDAL support only in ifdefs

Modified: grass-addons/grass7/raster/r.spread.sod/Img.cpp
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/Img.cpp	2017-09-25 02:17:49 UTC (rev 71505)
+++ grass-addons/grass7/raster/r.spread.sod/Img.cpp	2017-09-25 15:26:57 UTC (rev 71506)
@@ -15,6 +15,10 @@
  */
 
 
+// define to support NetCDF format directly
+// (requires linking to netcdf_c++)
+// #define SOD_GDAL_SUPPORT
+
 #include "Img.h"
 
 extern "C" {
@@ -23,8 +27,10 @@
 #include <grass/raster.h>
 }
 
+#ifdef SOD_GDAL_SUPPORT
 #include <gdal/gdal.h>
 #include <gdal/gdal_priv.h>
+#endif
 
 #include <algorithm>
 
@@ -92,6 +98,7 @@
 
 Img::Img(const char *fileName)
 {
+#ifdef SOD_GDAL_SUPPORT
     GDALDataset *dataset;
     GDALRasterBand *dataBand;
 
@@ -126,6 +133,9 @@
                                      + CPLGetLastErrorMsg());
         GDALClose((GDALDatasetH) dataset);
     }
+#else
+    throw std::runtime_error("GDAL support not available");
+#endif
 }
 
 
@@ -356,6 +366,7 @@
 // information from the known (input) file
 void Img::toGdal(const char *name, const char *ref_name)
 {
+#ifdef SOD_GDAL_SUPPORT
     const char *format = "GTiff";
 
     GDALAllRegister();
@@ -386,4 +397,7 @@
     GDALClose((GDALDatasetH) outDataset);
     GDALClose((GDALDatasetH) inputDataset);
     CSLDestroy(papszOptions);
+#else
+    throw std::runtime_error("GDAL support not available");
+#endif
 }



More information about the grass-commit mailing list