[QGIS Commit] r15337 - in branches/raster-providers/src: core providers/wms

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Mar 5 04:59:06 EST 2011


Author: rblazek
Date: 2011-03-05 01:59:06 -0800 (Sat, 05 Mar 2011)
New Revision: 15337

Modified:
   branches/raster-providers/src/core/qgsrasterdataprovider.cpp
   branches/raster-providers/src/core/qgsrasterdataprovider.h
   branches/raster-providers/src/core/qgsrasterprojector.cpp
   branches/raster-providers/src/providers/wms/qgswmsprovider.cpp
   branches/raster-providers/src/providers/wms/qgswmsprovider.h
Log:
wms fix

Modified: branches/raster-providers/src/core/qgsrasterdataprovider.cpp
===================================================================
--- branches/raster-providers/src/core/qgsrasterdataprovider.cpp	2011-03-05 09:53:27 UTC (rev 15336)
+++ branches/raster-providers/src/core/qgsrasterdataprovider.cpp	2011-03-05 09:59:06 UTC (rev 15337)
@@ -36,8 +36,17 @@
   QTime time;
   time.start();
 
-  QgsRasterProjector myProjector = QgsRasterProjector ( theSrcCRS, theDestCRS, viewExtent, height, width, extent().width()/xSize(),  extent().height()/ySize() );
+  double mMaxSrcXRes = 0;
+  double mMaxSrcYRes = 0;
+  
+  if ( capabilities() & QgsRasterDataProvider::ExactResolution ) 
+  {
+    mMaxSrcXRes = extent().width()/xSize();
+    mMaxSrcYRes = extent().height()/ySize();
+  }
 
+  QgsRasterProjector myProjector = QgsRasterProjector ( theSrcCRS, theDestCRS, viewExtent, height, width, mMaxSrcXRes, mMaxSrcYRes );
+
   QgsDebugMsg( QString( "create projector time  (ms): %1" ).arg( time.elapsed() ) );
 
   // TODO: init data by nulls

Modified: branches/raster-providers/src/core/qgsrasterdataprovider.h
===================================================================
--- branches/raster-providers/src/core/qgsrasterdataprovider.h	2011-03-05 09:53:27 UTC (rev 15336)
+++ branches/raster-providers/src/core/qgsrasterdataprovider.h	2011-03-05 09:59:06 UTC (rev 15337)
@@ -58,10 +58,11 @@
       NoCapabilities =          0,
       Identify =                1,
       ExactMinimumMaximum =     1 << 1,
-      EstimatedMinimumMaximum = 1 << 2,
-      BuildPyramids =           1 << 3,
-      Histogram =               1 << 4,
-      Size =                    1 << 5  // has fixed source type
+      ExactResolution =         1 << 2,
+      EstimatedMinimumMaximum = 1 << 3,
+      BuildPyramids =           1 << 4,
+      Histogram =               1 << 5,
+      Size =                    1 << 6  // has fixed source type
     };
 
     // This is modified copy of GDALDataType

Modified: branches/raster-providers/src/core/qgsrasterprojector.cpp
===================================================================
--- branches/raster-providers/src/core/qgsrasterprojector.cpp	2011-03-05 09:53:27 UTC (rev 15336)
+++ branches/raster-providers/src/core/qgsrasterprojector.cpp	2011-03-05 09:59:06 UTC (rev 15337)
@@ -161,6 +161,7 @@
   // For now, we take cell sizes projected to source but not to source axes
   double myDestColsPerMatrixCell = mDestCols / mCPCols;
   double myDestRowsPerMatrixCell = mDestRows / mCPRows;
+  QgsDebugMsg( QString("myDestColsPerMatrixCell = %1 myDestRowsPerMatrixCell = %2" ).arg ( myDestColsPerMatrixCell ).arg( myDestRowsPerMatrixCell ) );
 
   double myMinSize = DBL_MAX;
   
@@ -170,9 +171,11 @@
       QgsPoint myPointB = mCPMatrix[i][j+1];
       QgsPoint myPointC = mCPMatrix[i+1][j];
       double mySize = sqrt(myPointA.sqrDist( myPointB )) / myDestColsPerMatrixCell; 
+      QgsDebugMsg( QString("mySize = %1" ).arg ( mySize ) );
       if ( mySize < myMinSize ) { myMinSize = mySize; }
 
       mySize = sqrt(myPointA.sqrDist( myPointC )) / myDestRowsPerMatrixCell;
+      QgsDebugMsg( QString("mySize = %1" ).arg ( mySize ) );
       if ( mySize < myMinSize ) { myMinSize = mySize; }
     }
   }
@@ -181,13 +184,16 @@
   // TODO: find the best coefficient 
   myMinSize *= 0.5; 
 
+  QgsDebugMsg( QString("mMaxSrcXRes = %1 mMaxSrcYRes = %2" ).arg ( mMaxSrcXRes ).arg( mMaxSrcYRes ) );
+  // mMaxSrcXRes, mMaxSrcYRes may be 0 - no limit (WMS)
   double myMinXSize = mMaxSrcXRes > myMinSize ? mMaxSrcXRes : myMinSize;
   double myMinYSize = mMaxSrcYRes > myMinSize ? mMaxSrcYRes : myMinSize;
+  QgsDebugMsg( QString("myMinXSize = %1 myMinYSize = %2" ).arg ( myMinXSize ).arg( myMinYSize ) );
   QgsDebugMsg( QString("mSrcExtent.width = %1 mSrcExtent.height = %2" ).arg ( mSrcExtent.width() ).arg( mSrcExtent.height() ) );
   mSrcRows = (int) ceil ( mSrcExtent.height() / myMinYSize );
   mSrcCols = (int) ceil ( mSrcExtent.width() / myMinXSize );
 
-  QgsDebugMsg( QString("mSrcRows = %1 theSrcCols = %2").arg(mSrcRows).arg(mSrcCols) );
+  QgsDebugMsg( QString("mSrcRows = %1 mSrcCols = %2").arg(mSrcRows).arg(mSrcCols) );
 }
 
 

Modified: branches/raster-providers/src/providers/wms/qgswmsprovider.cpp
===================================================================
--- branches/raster-providers/src/providers/wms/qgswmsprovider.cpp	2011-03-05 09:53:27 UTC (rev 15336)
+++ branches/raster-providers/src/providers/wms/qgswmsprovider.cpp	2011-03-05 09:59:06 UTC (rev 15337)
@@ -686,7 +686,8 @@
   return cachedImage;
 }
 
-void QgsWmsProvider::readBlock( int bandNo, QgsRectangle  const & viewExtent, int pixelWidth, int pixelHeight, QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, void *block )
+//void QgsWmsProvider::readBlock( int bandNo, QgsRectangle  const & viewExtent, int pixelWidth, int pixelHeight, QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, void *block )
+void QgsWmsProvider::readBlock( int bandNo, QgsRectangle  const & viewExtent, int pixelWidth, int pixelHeight, void *block )
 {
   QgsDebugMsg( "Entered" );
   // TODO: optimize to avoid writing to QImage

Modified: branches/raster-providers/src/providers/wms/qgswmsprovider.h
===================================================================
--- branches/raster-providers/src/providers/wms/qgswmsprovider.h	2011-03-05 09:53:27 UTC (rev 15336)
+++ branches/raster-providers/src/providers/wms/qgswmsprovider.h	2011-03-05 09:59:06 UTC (rev 15337)
@@ -460,7 +460,8 @@
      */
     QImage *draw( QgsRectangle const &  viewExtent, int pixelWidth, int pixelHeight );
 
-    void readBlock( int bandNo, QgsRectangle  const & viewExtent, int width, int height, QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, void *data );
+    void readBlock( int bandNo, QgsRectangle  const & viewExtent, int width, int height, void *data );
+    //void readBlock( int bandNo, QgsRectangle  const & viewExtent, int width, int height, QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, void *data );
 
 
     /** Return the extent for this data layer



More information about the QGIS-commit mailing list