[QGIS Commit] r11187 - in trunk/qgis/src: app core/raster

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jul 27 20:30:35 EDT 2009


Author: ersts
Date: 2009-07-27 20:30:34 -0400 (Mon, 27 Jul 2009)
New Revision: 11187

Modified:
   trunk/qgis/src/app/qgsrasterlayerproperties.cpp
   trunk/qgis/src/core/raster/qgsrasterlayer.cpp
Log:
-Applied patch supplied by rouault to allow building internal pyramids jpeg compression if libtiff 4.0 or greater is available
-Closes ticket #1357

Modified: trunk/qgis/src/app/qgsrasterlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsrasterlayerproperties.cpp	2009-07-27 19:54:56 UTC (rev 11186)
+++ trunk/qgis/src/app/qgsrasterlayerproperties.cpp	2009-07-28 00:30:34 UTC (rev 11187)
@@ -1572,7 +1572,7 @@
     else if ( res == "ERROR_JPEG_COMPRESSION" )
     {
       QMessageBox::warning( this, tr( "Building pyramids failed." ),
-                            tr( "Building internal pyramid overviews is not supported on raster layers with JPEG compression." ) );
+                            tr( "Building internal pyramid overviews is not supported on raster layers with JPEG compression and your current libtiff library." ) );
     }
     else if ( res == "ERROR_VIRTUAL" )
     {

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2009-07-27 19:54:56 UTC (rev 11186)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2009-07-28 00:30:34 UTC (rev 11187)
@@ -1014,11 +1014,20 @@
 
   if ( theTryInternalFlag )
   {
-    QString myCompressionType = QString( GDALGetMetadataItem( mGdalDataset, "COMPRESSION", "IMAGE_STRUCTURE" ) );
-    if ( "JPEG" == myCompressionType )
+    // libtiff < 4.0 has a bug that prevents safe building of overviews on JPEG compressed files
+    // we detect libtiff < 4.0 by checking that BIGTIFF is not in the creation options of the GTiff driver
+    // see https://trac.osgeo.org/qgis/ticket/1357
+    const char* pszGTiffCreationOptions =
+      GDALGetMetadataItem( GDALGetDriverByName( "GTiff" ), GDAL_DMD_CREATIONOPTIONLIST, "" );
+    if ( strstr( pszGTiffCreationOptions, "BIGTIFF" ) == NULL )
     {
-      return "ERROR_JPEG_COMPRESSION";
+      QString myCompressionType = QString( GDALGetMetadataItem( mGdalDataset, "COMPRESSION", "IMAGE_STRUCTURE" ) );
+      if ( "JPEG" == myCompressionType )
+      {
+        return "ERROR_JPEG_COMPRESSION";
+      }
     }
+
     //close the gdal dataset and reopen it in read / write mode
     GDALClose( mGdalDataset );
     mGdalBaseDataset = GDALOpen( QFile::encodeName( mDataSource ).constData(), GA_Update );
@@ -1501,7 +1510,7 @@
 
     emit statusChanged( tr( "Retrieving using %1" ).arg( mProviderKey ) );
 
-    mDataProvider->setDpi(rendererContext.rasterScaleFactor() * 25.4 * rendererContext.scaleFactor());
+    mDataProvider->setDpi( rendererContext.rasterScaleFactor() * 25.4 * rendererContext.scaleFactor() );
 
     QImage* image =
       mDataProvider->draw(



More information about the QGIS-commit mailing list