Jelajahi Sumber

r.slope.aspect fix #3860

fix window alignment to input raster
Markus Metz 6 tahun lalu
induk
melakukan
7e1e79702a
1 mengubah file dengan 6 tambahan dan 3 penghapusan
  1. 6 3
      raster/r.slope.aspect/main.c

+ 6 - 3
raster/r.slope.aspect/main.c

@@ -373,12 +373,17 @@ int main(int argc, char *argv[])
 		      parm.dxx->key, parm.dyy->key, parm.dxy->key);
 		      parm.dxx->key, parm.dyy->key, parm.dxy->key);
     }
     }
 
 
+    G_get_window(&window);
+
     /* set the window from the header for the elevation file */
     /* set the window from the header for the elevation file */
     if (!flag.a->answer) {
     if (!flag.a->answer) {
-	G_get_window(&window);
 	Rast_get_cellhd(elev_name, "", &cellhd);
 	Rast_get_cellhd(elev_name, "", &cellhd);
 	Rast_align_window(&window, &cellhd);
 	Rast_align_window(&window, &cellhd);
 	Rast_set_window(&window);
 	Rast_set_window(&window);
+	/* probably not needed, just to make sure
+	 * G_get_window() and Rast_get_window()
+	 * return the same */
+	G_set_window(&window);
     }
     }
 
 
     if (strcmp(parm.out_precision->answer, "DCELL") == 0)
     if (strcmp(parm.out_precision->answer, "DCELL") == 0)
@@ -395,8 +400,6 @@ int main(int argc, char *argv[])
        out_type is type of map being created */
        out_type is type of map being created */
     /* ? why not use Rast_map_type() then ? */
     /* ? why not use Rast_map_type() then ? */
 
 
-    G_get_set_window(&window);
-
     nrows = Rast_window_rows();
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
     ncols = Rast_window_cols();