This is an automated email from the git hooks/post-receive script. sebastic pushed a commit to branch master in repository pprepair.
commit ad99fec7017f6d1926a2a3bf35e21553aa27093c Author: Bas Couwenberg <[email protected]> Date: Wed Mar 2 20:49:10 2016 +0100 Imported Upstream version 0.0~20151110-28dca91 --- IOWorker.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/IOWorker.cpp b/IOWorker.cpp index fac4f1c..037d307 100644 --- a/IOWorker.cpp +++ b/IOWorker.cpp @@ -27,17 +27,25 @@ IOWorker::IOWorker() { bool IOWorker::addToTriangulation(Triangulation &triangulation, TaggingVector &edgesToTag, const char *file, unsigned int schemaIndex) { // Open file +#if GDAL_VERSION_MAJOR < 2 OGRDataSource *dataSource = OGRSFDriverRegistrar::Open(file, false); +#else + GDALDataset *dataSource = (GDALDataset*) GDALOpenEx(file, GDAL_OF_READONLY, NULL, NULL, NULL); +#endif if (dataSource == NULL) { std::cerr << "Error: Could not open file." << std::endl; return false; } - char *name = new char[strlen(dataSource->GetName())+1]; - strcpy(name, dataSource->GetName()); + char *name = new char[strlen(file)+1]; + strcpy(name, file); fileNames.push_back(name); std::cout << "\tPath: " << name << std::endl; +#if GDAL_VERSION_MAJOR < 2 std::cout << "\tType: " << dataSource->GetDriver()->GetName() << std::endl; +#else + std::cout << "\tType: " << dataSource->GetDriverName() << std::endl; +#endif int numberOfLayers = dataSource->GetLayerCount(); std::cout << "\tLayers: " << numberOfLayers << std::endl; @@ -316,7 +324,11 @@ bool IOWorker::addToTriangulation(Triangulation &triangulation, TaggingVector &e } // Free OGR data source +#if GDAL_VERSION_MAJOR < 2 OGRDataSource::DestroyDataSource(dataSource); +#else + GDALClose(dataSource); +#endif return true; } @@ -1248,23 +1260,43 @@ bool IOWorker::exportPolygons(std::vector<std::pair<PolygonHandle *, Polygon> > // Prepare file const char *driverName = "ESRI Shapefile"; +#if GDAL_VERSION_MAJOR < 2 OGRSFDriver *driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driverName); +#else + 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(file, false); +#else + GDALDataset *dataSource = (GDALDataset*) GDALOpenEx(file, 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(file)!= 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 << "\tWriting file... " << std::endl; +#if GDAL_VERSION_MAJOR < 2 dataSource = driver->CreateDataSource(file, NULL); +#else + dataSource = driver->Create(file,0,0,0,GDT_Unknown,NULL); +#endif if (dataSource == NULL) { std::cout << "\tError: Could not create file." << std::endl; return false; @@ -1356,7 +1388,11 @@ bool IOWorker::exportPolygons(std::vector<std::pair<PolygonHandle *, Polygon> > } // Free OGR data source +#if GDAL_VERSION_MAJOR < 2 OGRDataSource::DestroyDataSource(dataSource); +#else + GDALClose(dataSource); +#endif return true; } @@ -1365,23 +1401,43 @@ bool IOWorker::exportTriangulation(Triangulation &t, const char *file, bool with // Prepare file const char *driverName = "ESRI Shapefile"; +#if GDAL_VERSION_MAJOR < 2 OGRSFDriver *driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driverName); +#else + GDALDriver *driver = GetGDALDriverManager()->GetDriverByName(driverName); +#endif if (driver == NULL) { std::cout << "Driver not found." << std::endl; return false; } - + +#if GDAL_VERSION_MAJOR < 2 OGRDataSource *dataSource = driver->Open(file, false); +#else + GDALDataset *dataSource = (GDALDataset*) GDALOpenEx(file, GDAL_OF_READONLY, NULL, NULL, NULL); +#endif if (dataSource != NULL) { std::cout << "Erasing current file..." << std::endl; +#if GDAL_VERSION_MAJOR < 2 if (driver->DeleteDataSource(dataSource->GetName())!= OGRERR_NONE) { +#else + if (driver->Delete(file)!= CE_None) { +#endif std::cout << "Couldn't erase current file." << std::endl; return false; +#if GDAL_VERSION_MAJOR < 2 } OGRDataSource::DestroyDataSource(dataSource); +#else + } GDALClose(dataSource); +#endif } std::cout << "Writing file... " << std::endl; +#if GDAL_VERSION_MAJOR < 2 dataSource = driver->CreateDataSource(file, NULL); +#else + dataSource = driver->Create(file,0,0,0,GDT_Unknown,NULL); +#endif if (dataSource == NULL) { std::cout << "Could not create file." << std::endl; return false; @@ -1496,7 +1552,11 @@ bool IOWorker::exportTriangulation(Triangulation &t, const char *file, bool with } // Free OGR data source +#if GDAL_VERSION_MAJOR < 2 OGRDataSource::DestroyDataSource(dataSource); +#else + GDALClose(dataSource); +#endif return true; } @@ -2073,4 +2133,4 @@ void IOWorker::insertTriangulationInfo(std::ostream &ostr, const Triangulation & "\tOverlaps: " << multipletags << " triangles (" << 100.0*multipletags/total << " %)" << std::endl; // Other info? -} \ No newline at end of file +} -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pprepair.git _______________________________________________ Pkg-grass-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

