This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository prepair.

commit e1c8e5755a4118c7b03aeaf7bc93d9084b955bca
Author: Bas Couwenberg <sebas...@xs4all.nl>
Date:   Fri Nov 6 23:46:20 2015 +0100

    Add patch to support GDAL 2.0.
---
 debian/changelog              |  1 +
 debian/patches/gdal-2.0.patch | 81 +++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series         |  1 +
 3 files changed, 83 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 471c119..f724ba3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 prepair (0.7-4) UNRELEASED; urgency=medium
 
   * Add build dependency on libcgal-qt5-dev for libCGAL_Qt5.so.
+  * Add patch to support GDAL 2.0.
 
  -- Bas Couwenberg <sebas...@debian.org>  Fri, 06 Nov 2015 23:46:14 +0100
 
diff --git a/debian/patches/gdal-2.0.patch b/debian/patches/gdal-2.0.patch
new file mode 100644
index 0000000..d51a821
--- /dev/null
+++ b/debian/patches/gdal-2.0.patch
@@ -0,0 +1,81 @@
+Description: Add support for GDAL 2.0.
+Author: Bas Couwenberg <sebas...@debian.org>
+Bug: https://github.com/tudelft3d/prepair/issues/22
+Bug-Debian: https://bugs.debian.org/802497
+Forwarded: https://github.com/tudelft3d/prepair/pull/23
+
+--- a/PolygonRepair.cpp
++++ b/PolygonRepair.cpp
+@@ -305,22 +305,44 @@ double PolygonRepair::computeRobustness(
+ 
+ bool PolygonRepair::saveToShp(OGRGeometry* geometry, const char *fileName) {
+   const char *driverName = "ESRI Shapefile";
++#if GDAL_VERSION_MAJOR < 2
+   OGRRegisterAll();
+       OGRSFDriver *driver = 
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driverName);
++#else
++  GDALAllRegister();
++      GDALDriver *driver = 
GetGDALDriverManager()->GetDriverByName(driverName);
++#endif
+       if (driver == NULL) {
+               std::cout << "\tError: OGR Shapefile driver not found." << 
std::endl;
+               return false;
+       }
++
++#if GDAL_VERSION_MAJOR < 2
+       OGRDataSource *dataSource = driver->Open(fileName, false);
++#else
++      GDALDataset *dataSource = (GDALDataset*) GDALOpenEx(fileName, 
GDAL_OF_READONLY, NULL, NULL, NULL);
++#endif
+       if (dataSource != NULL) {
+               std::cout << "\tOverwriting file..." << std::endl;
++#if GDAL_VERSION_MAJOR < 2
+               if (driver->DeleteDataSource(dataSource->GetName())!= 
OGRERR_NONE) {
++#else
++              if (driver->Delete(fileName)!= CE_None) {
++#endif
+                       std::cout << "\tError: Couldn't erase file with same 
name." << std::endl;
+                       return false;
++#if GDAL_VERSION_MAJOR < 2
+               } OGRDataSource::DestroyDataSource(dataSource);
++#else
++              } GDALClose(dataSource);
++#endif
+       }
+       std::cout << "\tCreating " << fileName << std::endl;
++#if GDAL_VERSION_MAJOR < 2
+       dataSource = driver->CreateDataSource(fileName, NULL);
++#else
++      dataSource = driver->Create(fileName,0,0,0,GDT_Unknown,NULL);
++#endif
+       if (dataSource == NULL) {
+               std::cout << "\tError: Could not create file." << std::endl;
+               return false;
+@@ -337,7 +359,11 @@ bool PolygonRepair::saveToShp(OGRGeometr
+     std::cout << "\tError: Could not create feature." << std::endl;
+   }
+   OGRFeature::DestroyFeature(feature);
++#if GDAL_VERSION_MAJOR < 2
+   OGRDataSource::DestroyDataSource(dataSource);
++#else
++  GDALClose(dataSource);
++#endif
+   return true;
+ }
+ 
+--- a/prepair.cpp
++++ b/prepair.cpp
+@@ -112,8 +112,13 @@ int main (int argc, const char * argv[])
+     
+     //-- reading from a ogr dataset (most supported: shp, geojson, gml, etc)
+     else if (strcmp(argv[argNum], "--ogr") == 0) {
++#if GDAL_VERSION_MAJOR < 2
+       OGRRegisterAll();
+       OGRDataSource *dataSource = OGRSFDriverRegistrar::Open(argv[argNum+1], 
false);
++#else
++      GDALAllRegister();
++      GDALDataset *dataSource = (GDALDataset*) GDALOpenEx(argv[argNum+1], 
GDAL_OF_READONLY, NULL, NULL, NULL);
++#endif
+       ++argNum;
+       if (dataSource == NULL) {
+         std::cerr << "Error: Could not open file." << std::endl;
diff --git a/debian/patches/series b/debian/patches/series
index 986dc66..69f0466 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 readme-example-paths.patch
 0001-Also-list-the-shpOut-option-in-the-usage-information.patch
+gdal-2.0.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/prepair.git

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to