@@ -444,7 +444,6 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
444
444
int width = right - left + 1 ;
445
445
int height = bottom - top + 1 ;
446
446
447
-
448
447
int srcLeft = 0 ; // source raster x offset
449
448
int srcTop = 0 ; // source raster x offset
450
449
int srcBottom = ySize () - 1 ;
@@ -521,7 +520,7 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
521
520
QgsDebugMsg ( QString ( " tmpXMin = %1 tmpYMax = %2 tmpWidth = %3 tmpHeight = %4" ).arg ( tmpXMin ).arg ( tmpYMax ).arg ( tmpWidth ).arg ( tmpHeight ) );
522
521
523
522
// Allocate temporary block
524
- char *tmpBlock = ( char * )malloc ( dataSize * tmpWidth * tmpHeight );
523
+ char *tmpBlock = ( char * )QgsMalloc ( dataSize * tmpWidth * tmpHeight );
525
524
if ( ! tmpBlock )
526
525
{
527
526
QgsDebugMsg ( QString ( " Coudn't allocate temporary buffer of %1 bytes" ).arg ( dataSize * tmpWidth * tmpHeight ) );
@@ -540,7 +539,7 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
540
539
{
541
540
QgsLogger::warning ( " RasterIO error: " + QString::fromUtf8 ( CPLGetLastErrorMsg () ) );
542
541
QgsDebugMsg ( " RasterIO error: " + QString::fromUtf8 ( CPLGetLastErrorMsg () ) );
543
- free ( tmpBlock );
542
+ QgsFree ( tmpBlock );
544
543
return ;
545
544
}
546
545
@@ -569,7 +568,7 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
569
568
}
570
569
}
571
570
572
- free ( tmpBlock );
571
+ QgsFree ( tmpBlock );
573
572
QgsDebugMsg ( QString ( " resample time (ms): %1" ).arg ( time.elapsed () ) );
574
573
575
574
return ;
@@ -830,11 +829,7 @@ int QgsGdalProvider::ySize() const { return mHeight; }
830
829
831
830
QMap<int , QVariant> QgsGdalProvider::identify ( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
832
831
{
833
- Q_UNUSED ( theFormat );
834
- Q_UNUSED ( theExtent );
835
- Q_UNUSED ( theWidth );
836
- Q_UNUSED ( theHeight );
837
- QgsDebugMsg ( QString ( " thePoint = %1 %2" ).arg ( thePoint.x () ).arg ( thePoint.y () ) );
832
+ QgsDebugMsg ( QString ( " thePoint = %1 %2" ).arg ( thePoint.x (), 0 , ' g' , 10 ).arg ( thePoint.y (), 0 , ' g' , 10 ) );
838
833
839
834
QMap<int , QVariant> results;
840
835
@@ -853,17 +848,23 @@ QMap<int, QVariant> QgsGdalProvider::identify( const QgsPoint & thePoint, Identi
853
848
QgsRectangle myExtent = theExtent;
854
849
if ( myExtent.isEmpty () ) myExtent = extent ();
855
850
851
+ QgsDebugMsg ( " myExtent = " + myExtent.toString () );
852
+
856
853
if ( theWidth == 0 ) theWidth = xSize ();
857
854
if ( theHeight == 0 ) theHeight = ySize ();
858
855
856
+ QgsDebugMsg ( QString ( " theWidth = %1 theHeight = %2" ).arg ( theWidth ).arg ( theHeight ) );
857
+
859
858
// Calculate the row / column where the point falls
860
859
double xres = ( myExtent.width () ) / theWidth;
861
860
double yres = ( myExtent.height () ) / theHeight;
862
861
863
- // Offset, not the cell index -> flor
862
+ // Offset, not the cell index -> floor
864
863
int col = ( int ) floor (( thePoint.x () - myExtent.xMinimum () ) / xres );
865
864
int row = ( int ) floor (( myExtent.yMaximum () - thePoint.y () ) / yres );
866
865
866
+ QgsDebugMsg ( QString ( " row = %1 col = %2" ).arg ( row ).arg ( col ) );
867
+
867
868
// QgsDebugMsg( "row = " + QString::number( row ) + " col = " + QString::number( col ) );
868
869
869
870
int r = 0 ;
0 commit comments