Ticket #1234 (new enhancement)

Opened 2 years ago

Proposal: add Get[XY]Start() methods to GDALRasterBlock

Reported by: danmitchell@mail.utexas.edu Assigned to: warmerdam
Priority: highest Milestone:
Component: default Version: unspecified
Severity: minor Keywords:
Cc:

Description

I'm developing an application that operates on rasters at the block level and it would be very convenient if each GDALRasterBlock could return its starting pixel. This information can obviously be calculated and stored apart from the block (as I'm currently doing), but it would be nice if each block took care of this itself. If no one objects, I'd appreciate changes similar to the following.

--- gdal_priv.h	2006-05-24 17:25:33.000000000 -0500
+++ gdal_priv.h	2006-07-11 20:31:37.000000000 -0500
@@ -355,6 +355,9 @@
        
     int                 nXSize;
     int                 nYSize;
+
+    int                 nXStart;
+    int                 nYStart;
     
     void                *pData;
 
@@ -382,6 +385,8 @@
     int         GetYOff() { return nYOff; }
     int         GetXSize() { return nXSize; }
     int         GetYSize() { return nYSize; }
+    int         GetXStart() { return nXStart; }
+    int         GetYStart() { return nYStart; }
     int         GetDirty() { return bDirty; }
     int         GetLockCount() { return nLockCount; }
 
--- gdalrasterblock.cpp	2006-02-07 13:07:08.000000000 -0600
+++ gdalrasterblock.cpp	2006-07-11 20:32:35.000000000 -0500
@@ -262,6 +262,9 @@
 
     nXOff = nXOffIn;
     nYOff = nYOffIn;
+
+    nXStart = nXOff * nXSize;
+    nYStart = nYOff * nYSize;
 }
 
 /************************************************************************/

D.