[GRASS5] GDAL-GRASS driver: reset region

Radim Blazek blazek at itc.it
Fri May 6 12:59:00 EDT 2005


Hi Frank,

attached is a small patch for GRASS driver in GDAL.

The problem was that GRASSRasterBand::ResetReading was checking only the 
new region against the old one but not the current region.

Radim
-------------- next part --------------
--- grass57dataset.cpp.orig	Mon Dec 13 18:28:43 2004
+++ grass57dataset.cpp	Fri May  6 18:54:39 2005
@@ -420,6 +420,23 @@
 	G_copy((void *) &sOpenWindow, (void *) sNewWindow, sizeof(struct Cell_head));
 	
     }
+    else
+    {
+	/* The windows are identical, check current window */
+	struct Cell_head sCurrentWindow;
+	
+	G_get_window ( &sCurrentWindow );
+
+    	if ( sNewWindow->north  != sCurrentWindow.north  || sNewWindow->south  != sCurrentWindow.south ||
+	     sNewWindow->east   != sCurrentWindow.east   || sNewWindow->west   != sCurrentWindow.west ||
+	     sNewWindow->ew_res != sCurrentWindow.ew_res || sNewWindow->ns_res != sCurrentWindow.ns_res ||
+	     sNewWindow->rows   != sCurrentWindow.rows   || sNewWindow->cols   != sCurrentWindow.cols
+	    )
+	{
+	    /* Reset window */
+	    G_set_window( sNewWindow );
+	}
+    }
 
     return CE_None;
 }


More information about the grass-dev mailing list