[QGIS Commit] r15014 - in branches/raster-providers/src: core/raster providers/gdal

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jan 10 16:06:52 EST 2011


Author: rblazek
Date: 2011-01-10 13:06:52 -0800 (Mon, 10 Jan 2011)
New Revision: 15014

Modified:
   branches/raster-providers/src/core/raster/qgsrasterlayer.cpp
   branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp
Log:
callback left in raster layer

Modified: branches/raster-providers/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- branches/raster-providers/src/core/raster/qgsrasterlayer.cpp	2011-01-10 01:58:32 UTC (rev 15013)
+++ branches/raster-providers/src/core/raster/qgsrasterlayer.cpp	2011-01-10 21:06:52 UTC (rev 15014)
@@ -259,55 +259,9 @@
 typedef QgsDataProvider * classFactoryFunction_t( const QString * );
 
 
-//
-// global callback function
-//
-int CPL_STDCALL progressCallback( double dfComplete,
-                                  const char * pszMessage,
-                                  void * pProgressArg )
-{
-  static double dfLastComplete = -1.0;
 
-  QgsRasterLayer * mypLayer = ( QgsRasterLayer * ) pProgressArg;
 
-  if ( dfLastComplete > dfComplete )
-  {
-    if ( dfLastComplete >= 1.0 )
-      dfLastComplete = -1.0;
-    else
-      dfLastComplete = dfComplete;
-  }
 
-  if ( floor( dfLastComplete*10 ) != floor( dfComplete*10 ) )
-  {
-    int    nPercent = ( int ) floor( dfComplete * 100 );
-
-    if ( nPercent == 0 && pszMessage != NULL )
-    {
-      //fprintf( stdout, "%s:", pszMessage );
-    }
-
-    if ( nPercent == 100 )
-    {
-      //fprintf( stdout, "%d - done.\n", (int) floor(dfComplete*100) );
-      mypLayer->showProgress( 100 );
-    }
-    else
-    {
-      int myProgress = ( int ) floor( dfComplete * 100 );
-      //fprintf( stdout, "%d.", myProgress);
-      mypLayer->showProgress( myProgress );
-      //fflush( stdout );
-    }
-  }
-  dfLastComplete = dfComplete;
-
-  return true;
-}
-
-
-
-
 //////////////////////////////////////////////////////////
 //
 // Non Static Public methods

Modified: branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp
===================================================================
--- branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp	2011-01-10 01:58:32 UTC (rev 15013)
+++ branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp	2011-01-10 21:06:52 UTC (rev 15014)
@@ -50,6 +50,55 @@
 static QString PROVIDER_KEY = "gdal";
 static QString PROVIDER_DESCRIPTION = "GDAL provider";
 
+//
+// global callback function
+//
+int CPL_STDCALL progressCallback( double dfComplete,
+                                  const char * pszMessage,
+                                  void * pProgressArg )
+{
+  // TODO: add signals to providers
+  static double dfLastComplete = -1.0;
+
+
+  //QgsRasterLayer * mypLayer = ( QgsRasterLayer * ) pProgressArg;
+
+  if ( dfLastComplete > dfComplete )
+  {
+    if ( dfLastComplete >= 1.0 )
+      dfLastComplete = -1.0;
+    else
+      dfLastComplete = dfComplete;
+  }
+
+  if ( floor( dfLastComplete*10 ) != floor( dfComplete*10 ) )
+  {
+    int    nPercent = ( int ) floor( dfComplete * 100 );
+
+    if ( nPercent == 0 && pszMessage != NULL )
+    {
+      //fprintf( stdout, "%s:", pszMessage );
+    }
+
+    if ( nPercent == 100 )
+    {
+      fprintf( stdout, "%d - done.\n", (int) floor(dfComplete*100) );
+      //mypLayer->showProgress( 100 );
+    }
+    else
+    {
+      int myProgress = ( int ) floor( dfComplete * 100 );
+      fprintf( stdout, "%d.", myProgress);
+      //mypLayer->showProgress( myProgress );
+      fflush( stdout );
+    }
+  }
+  dfLastComplete = dfComplete;
+
+  return true;
+}
+
+
 QgsGdalProvider::QgsGdalProvider( QString const & uri )
     : QgsRasterDataProvider( uri ), mValid( true )
 {



More information about the QGIS-commit mailing list