[138937] trunk/dports/graphics/OpenSceneGraph

vince at macports.org vince at macports.org
Fri Jul 24 02:21:07 PDT 2015


Revision: 138937
          https://trac.macports.org/changeset/138937
Author:   vince at macports.org
Date:     2015-07-24 02:21:07 -0700 (Fri, 24 Jul 2015)
Log Message:
-----------
OpenSceneGraph: commit a patch to deal with an API change in GDAL

Modified Paths:
--------------
    trunk/dports/graphics/OpenSceneGraph/Portfile

Added Paths:
-----------
    trunk/dports/graphics/OpenSceneGraph/files/patch-ReaderWriterOGR_cpp.diff

Modified: trunk/dports/graphics/OpenSceneGraph/Portfile
===================================================================
--- trunk/dports/graphics/OpenSceneGraph/Portfile	2015-07-23 21:12:16 UTC (rev 138936)
+++ trunk/dports/graphics/OpenSceneGraph/Portfile	2015-07-24 09:21:07 UTC (rev 138937)
@@ -26,7 +26,9 @@
 checksums               rmd160  cd9f806613b7617083a2f9202f7ad33733980f63 \
                         sha256  d9ae72263d0191855b0f804d93c586d489f119aca0499292acc09bb0fa0b3e6d
 
-patchfiles              patch-CMakeLists.txt.diff
+# Remove the last line when bumping to 3.2.2
+patchfiles              patch-CMakeLists.txt.diff \
+                        patch-ReaderWriterOGR_cpp.diff 
 
 depends_build-append    port:pkgconfig
 

Added: trunk/dports/graphics/OpenSceneGraph/files/patch-ReaderWriterOGR_cpp.diff
===================================================================
--- trunk/dports/graphics/OpenSceneGraph/files/patch-ReaderWriterOGR_cpp.diff	                        (rev 0)
+++ trunk/dports/graphics/OpenSceneGraph/files/patch-ReaderWriterOGR_cpp.diff	2015-07-24 09:21:07 UTC (rev 138937)
@@ -0,0 +1,49 @@
+--- src/osgPlugins/ogr/ReaderWriterOGR.cpp.old	2012-03-21 18:36:20.000000000 +0100
++++ src/osgPlugins/ogr/ReaderWriterOGR.cpp	2015-07-24 11:06:14.000000000 +0200
+@@ -134,11 +134,20 @@
+ 
+     virtual ReadResult readFile(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
+     {
++#if GDAL_VERSION_MAJOR<2
+         if (OGRSFDriverRegistrar::GetRegistrar()->GetDriverCount() == 0)
+             OGRRegisterAll();
+ 
+         // Try to open data source
+         OGRDataSource* file = OGRSFDriverRegistrar::Open(fileName.c_str());
++#else
++        if (GDALGetDriverCount() == 0)
++            GDALAllRegister();
++
++        // Try to open data source
++        GDALDataset* file  = (GDALDataset*) GDALOpenEx( fileName.c_str(), GDAL_OF_VECTOR, NULL, NULL, NULL );        
++#endif
++        
+         if (!file)
+             return 0;
+ 
+@@ -156,6 +165,7 @@
+ 
+         osg::Group* group = new osg::Group;
+ 
++#if GDAL_VERSION_MAJOR<2        
+         for (int i = 0; i < file->GetLayerCount(); i++)
+         {
+             osg::Group* node = readLayer(file->GetLayer(i), file->GetName(), useRandomColorByFeature, addGroupPerFeature);
+@@ -163,6 +173,17 @@
+                 group->addChild( node );
+         }
+         OGRDataSource::DestroyDataSource( file );
++#else
++        for (int i = 0; i < GDALDatasetGetLayerCount(file); i++)
++        {
++            OGRLayer* layer = (OGRLayer *)GDALDatasetGetLayer(file, i); 
++            osg::Group* node = readLayer(layer, layer->GetName(), useRandomColorByFeature, addGroupPerFeature);
++            if (node)
++                group->addChild( node );
++        }
++        GDALClose( file );
++#endif        
++        
+         return group;
+     }
+ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150724/9fb862f7/attachment-0001.html>


More information about the macports-changes mailing list