Browse Source

wx.iscatt: make it work in latlong locations

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@59133 15284696-431f-4ddb-bdfa-cd5b030d7da7
Štěpán Turek 11 years ago
parent
commit
6b7244144c
2 changed files with 16 additions and 4 deletions
  1. 15 3
      lib/imagery/iclass_perimeter.c
  2. 1 1
      lib/imagery/iscatt_core.c

+ 15 - 3
lib/imagery/iclass_perimeter.c

@@ -176,9 +176,21 @@ int make_perimeter(struct line_pnts *points, IClass_perimeter * perimeter,
     for (i = 0; i < count; i++) {
 	G_debug(5, "iclass_make_perimeter(): points: x: %f y: %f",
 		points->x[i], points->y[i]);
-	tmp_points[i].y = Rast_northing_to_row(points->y[i], band_region);
-	tmp_points[i].x = Rast_easting_to_col(points->x[i], band_region);
-    }
+
+    /* This functions are no longer used because of the different behaviour 
+       of Rast_easting_to_col depending whether location is LL or not. 
+       It makes problem  in  interactive scatter plot tool, 
+       which defines its own coordinates systems for the plots and 
+       therefore it requires the function to work always in same way 
+       without hidden dependency on location type.
+
+	  tmp_points[i].y = Rast_northing_to_row(points->y[i], band_region);
+	  tmp_points[i].x = Rast_easting_to_col(points->x[i], band_region);
+   */
+
+   tmp_points[i].y = (band_region->north - points->y[i]) / band_region->ns_res;
+   tmp_points[i].x = (points->x[i] - band_region->west) / band_region->ew_res;
+    }   
 
     /* find first edge which is not horizontal */
 

+ 1 - 1
lib/imagery/iscatt_core.c

@@ -962,7 +962,7 @@ int I_rasterize(double *polygon, int pol_n_pts, unsigned char val,
 	Vect_append_point(pol, polygon[i * 2], polygon[i * 2 + 1], 0.0);
     }
 
-    Rast_set_window(rast_region);
+    //Rast_set_window(rast_region);
 
     make_perimeter(pol, &perimeter, rast_region);
     for (i = 1; i < perimeter.npoints; i += 2) {