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

sebastic pushed a commit to branch master
in repository pktools.

commit be958361513c3ff0390e3e30e34b31959baa32e3
Author: Bas Couwenberg <sebas...@xs4all.nl>
Date:   Fri Nov 6 16:53:31 2015 +0100

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

diff --git a/debian/changelog b/debian/changelog
index 4428c64..c3abf5c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ pktools (2.6.4-4) UNRELEASED; urgency=medium
   * Update Vcs-Browser URL to use HTTPS.
   * Add libgsl-dev as preferred build dependency,
     keep libgsl0-dev as alternative for backports.
+  * Add patch to support GDAL 2.0.
 
  -- Bas Couwenberg <sebas...@debian.org>  Wed, 21 Oct 2015 23:14:34 +0200
 
diff --git a/debian/patches/gdal-2.0.patch b/debian/patches/gdal-2.0.patch
new file mode 100644
index 0000000..934aedb
--- /dev/null
+++ b/debian/patches/gdal-2.0.patch
@@ -0,0 +1,202 @@
+Description: Add support for GDAL 2.0.
+Author: Bas Couwenberg <sebas...@debian.org>
+Bug: https://savannah.nongnu.org/bugs/?46270
+Bug-Debian: http://bugs.debian.org/802631
+Forwarded: https://savannah.nongnu.org/bugs/?46270#comment3
+
+--- a/src/imageclasses/ImgReaderOgr.h
++++ b/src/imageclasses/ImgReaderOgr.h
+@@ -73,8 +73,13 @@ public:
+   //  int getLayer(int layer=0) const;
+   int getFields(std::vector<std::string>& fields, int layer=0) const;
+   int getFields(std::vector<OGRFieldDefn*>& fields, int layer=0) const;
++#if GDAL_VERSION_MAJOR < 2
+   OGRDataSource* getDataSource(void) {return m_datasource;};
+   OGRSFDriver* getDriver(void) const {return m_datasource->GetDriver();};
++#else
++  GDALDataset* getDataSource(void) {return m_datasource;};
++  GDALDriver* getDriver(void) const {return m_datasource->GetDriver();};
++#endif
+   int getLayerCount(void) const {return m_datasource->GetLayerCount();};
+ //   OGRLayer *executeSql(const std::string& output,const std::string& 
sqlStatement, OGRGeometry* spatialFilter=NULL);
+   template<typename T> int readSql(Vector2d<T>& data, const OGRFieldType& 
fieldType, std::vector<std::string>& fields, const std::string& sqlStatement, 
OGRGeometry* spatialFilter=NULL, int layer=0, bool pos=false, bool 
verbose=false);
+@@ -90,7 +95,11 @@ protected:
+   void setCodec(void);
+ 
+   std::string m_filename;
++#if GDAL_VERSION_MAJOR < 2
+   OGRDataSource *m_datasource;
++#else
++  GDALDataset *m_datasource;
++#endif
+   char m_fs;
+ };
+ 
+--- a/src/imageclasses/ImgReaderOgr.cc
++++ b/src/imageclasses/ImgReaderOgr.cc
+@@ -48,15 +48,26 @@ void ImgReaderOgr::open(const std::strin
+ //---------------------------------------------------------------------------
+ void ImgReaderOgr::close(void)
+ {
++#if GDAL_VERSION_MAJOR < 2
+   OGRDataSource::DestroyDataSource(m_datasource);
++#else
++  GDALClose(m_datasource);
++#endif
+ }
+ 
+ //---------------------------------------------------------------------------
+ void ImgReaderOgr::setCodec(void){
++#if GDAL_VERSION_MAJOR < 2
+   //register the drivers
+   OGRRegisterAll();
+   //open the input OGR datasource. Datasources can be files, RDBMSes, 
directories full of files, or even remote web services depending on the driver 
being used. However, the datasource name is always a single string.
+   m_datasource = OGRSFDriverRegistrar::Open(m_filename.c_str(), 
FALSE);//FAlSE: do not update
++#else
++  //register the drivers
++  GDALAllRegister();
++  //open the input OGR datasource. Datasources can be files, RDBMSes, 
directories full of files, or even remote web services depending on the driver 
being used. However, the datasource name is always a single string.
++  m_datasource = (GDALDataset*) GDALOpenEx(m_filename.c_str(), 
GDAL_OF_READONLY, NULL, NULL, NULL);
++#endif
+   if( m_datasource == NULL ){
+     std::string errorString="Open failed";
+     throw(errorString);
+--- a/src/imageclasses/ImgWriterOgr.h
++++ b/src/imageclasses/ImgWriterOgr.h
+@@ -62,17 +62,30 @@ public:
+   OGRErr createFeature(OGRFeature* theFeature, int layer=0);
+   int getFieldCount(int layer=0) const;
+   int getFeatureCount(int layer=0) const;
++#if GDAL_VERSION_MAJOR < 2
+   OGRDataSource* getDataSource(void) {return m_datasource;};
+   OGRSFDriver* getDriver(void) const {return m_datasource->GetDriver();};
++#else
++  GDALDataset* getDataSource(void) {return m_datasource;};
++  GDALDriver* getDriver(void) const {return m_datasource->GetDriver();};
++#endif
+ 
+ protected:
+   void setCodec(const std::string& imageType);
++#if GDAL_VERSION_MAJOR < 2
+   void setCodec(OGRSFDriver *poDriver);
++#else
++  void setCodec(GDALDriver *poDriver);
++#endif
+   
+ //   OGRLayer* getLayer(int layer=0);
+     
+   std::string m_filename;
++#if GDAL_VERSION_MAJOR < 2
+   OGRDataSource *m_datasource;
++#else
++  GDALDataset *m_datasource;
++#endif
+ //   vector<OGRLayer*> m_layers;
+ };
+ 
+--- a/src/imageclasses/ImgWriterOgr.cc
++++ b/src/imageclasses/ImgWriterOgr.cc
+@@ -125,31 +125,58 @@ void ImgWriterOgr::open(const std::strin
+ //---------------------------------------------------------------------------
+ void ImgWriterOgr::close(void)
+ {
++#if GDAL_VERSION_MAJOR < 2
+   OGRDataSource::DestroyDataSource(m_datasource);
++#else
++  GDALClose(m_datasource);
++#endif
+ }
+ 
+ //---------------------------------------------------------------------------
+ void ImgWriterOgr::setCodec(const std::string& imageType){
++#if GDAL_VERSION_MAJOR < 2
+   //register the drivers
+   OGRRegisterAll();
+   //fetch the OGR file driver
+   OGRSFDriver *poDriver;
+   poDriver = 
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(imageType.c_str());
++#else
++  //register the drivers
++  GDALAllRegister();
++  GDALDriver *poDriver;
++  poDriver = GetGDALDriverManager()->GetDriverByName(imageType.c_str());
++#endif
+   if( poDriver == NULL ){
+     std::string errorString="FileOpenError";
+     throw(errorString);
+   }
++#if GDAL_VERSION_MAJOR < 2
+   m_datasource = OGRSFDriverRegistrar::Open( m_filename.c_str(), TRUE );
++#else
++  m_datasource = (GDALDataset*) GDALOpenEx(m_filename.c_str(), 
GDAL_OF_UPDATE, NULL, NULL, NULL);
++#endif
+   if( m_datasource == NULL ){
++#if GDAL_VERSION_MAJOR < 2
+     m_datasource = OGRSFDriverRegistrar::Open( m_filename.c_str(), FALSE );
++#else
++    m_datasource = (GDALDataset*) GDALOpenEx(m_filename.c_str(), 
GDAL_OF_READONLY, NULL, NULL, NULL);
++#endif
+     if ( m_datasource != NULL){// we can only open in not update mode
+       std::string errorString="Update mode not supported, delete output 
dataset first";
+       throw(errorString);
++#if GDAL_VERSION_MAJOR < 2
+       OGRDataSource::DestroyDataSource(m_datasource);
++#else
++      GDALClose(m_datasource);
++#endif
+       m_datasource = NULL;
+     }
+     else //create the data source
++#if GDAL_VERSION_MAJOR < 2
+       m_datasource=poDriver->CreateDataSource(m_filename.c_str(),NULL);
++#else
++      
m_datasource=poDriver->Create(m_filename.c_str(),0,0,0,GDT_Unknown,NULL);
++#endif
+   }
+   else{//datasets exists, always overwrite all layers (no update append for 
now)
+     int nLayerCount = m_datasource->GetLayerCount();
+@@ -166,23 +193,44 @@ void ImgWriterOgr::setCodec(const std::s
+   }
+ }
+ 
++#if GDAL_VERSION_MAJOR < 2
+ void ImgWriterOgr::setCodec(OGRSFDriver *poDriver){
+   OGRRegisterAll();
++#else
++void ImgWriterOgr::setCodec(GDALDriver *poDriver){
++  GDALAllRegister();
++#endif
+   if( poDriver == NULL ){
+     std::string errorString="FileOpenError";
+     throw(errorString);
+   }
++#if GDAL_VERSION_MAJOR < 2
+   m_datasource = OGRSFDriverRegistrar::Open( m_filename.c_str(), TRUE );
++#else
++  m_datasource = (GDALDataset*) GDALOpenEx(m_filename.c_str(), 
GDAL_OF_UPDATE, NULL, NULL, NULL);
++#endif
+   if( m_datasource == NULL ){
++#if GDAL_VERSION_MAJOR < 2
+     m_datasource = OGRSFDriverRegistrar::Open( m_filename.c_str(), FALSE );
++#else
++    m_datasource = (GDALDataset*) GDALOpenEx(m_filename.c_str(), 
GDAL_OF_READONLY, NULL, NULL, NULL);
++#endif
+     if ( m_datasource != NULL){// we can only open in not update mode
+       std::string errorString="Update mode not supported, delete output 
dataset first";
+       throw(errorString);
++#if GDAL_VERSION_MAJOR < 2
+       OGRDataSource::DestroyDataSource(m_datasource);
++#else
++      GDALClose(m_datasource);
++#endif
+       m_datasource = NULL;
+     }
+     else //create the data source
++#if GDAL_VERSION_MAJOR < 2
+       m_datasource=poDriver->CreateDataSource(m_filename.c_str(),NULL);
++#else
++      
m_datasource=poDriver->Create(m_filename.c_str(),0,0,0,GDT_Unknown,NULL);
++#endif
+   }
+   else{//datasets exists, always overwrite all layers (no update append for 
now)
+     int nLayerCount = m_datasource->GetLayerCount();
diff --git a/debian/patches/series b/debian/patches/series
index e9e0975..aa36bf1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 automake-subdir-objects.patch
+gdal-2.0.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/pktools.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