소스 검색

d.vect.thematic: fix overlap tests

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@70641 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 8 년 전
부모
커밋
5243dd28c1
2개의 변경된 파일22개의 추가작업 그리고 23개의 파일을 삭제
  1. 2 4
      display/d.vect.thematic/area.c
  2. 20 19
      display/d.vect.thematic/main.c

+ 2 - 4
display/d.vect.thematic/area.c

@@ -52,10 +52,8 @@ int dareatheme(struct Map_info *Map, struct cat_list *Clist,
 
 	    if (window->proj != PROJECTION_LL)
 		continue;
-	    else {		/* out of bounds for -180 to 180, try 0 to 360 as well */
-		if (box.N < window->south || box.S > window->north)
-		    continue;
-		if (box.E + 360 < window->west || box.W + 360 > window->east)
+	    else {
+		if (!G_window_overlap(window, box.N, box.S, box.E, box.W))
 		    continue;
 	    }
 	}

+ 20 - 19
display/d.vect.thematic/main.c

@@ -461,20 +461,21 @@ int main(int argc, char **argv)
 	if (verbose)
 	    G_message(_("Plotting ..."));
 
+	overlap = 1;
 	Vect_get_map_box(&Map, &box);
+	if (window.proj != PROJECTION_LL) {
+	    overlap =
+		G_window_percentage_overlap(&window, box.N, box.S,
+		                            box.E, box.W);
+	    G_debug(1, "overlap = %f \n", overlap);
+	}
 
-	if (window.north < box.S || window.south > box.N ||
-	    window.east < box.W ||
-	    window.west > G_adjust_easting(box.E, &window)) {
+	if (overlap == 0) {
 	    G_message(_("The bounding box of the map is outside the current region, "
 		       "nothing drawn."));
 	    stat = 0;
 	}
 	else {
-	    overlap =
-		G_window_percentage_overlap(&window, box.N, box.S, box.E,
-					    box.W);
-	    G_debug(1, "overlap = %f \n", overlap);
 	    if (overlap < 1)
 		Vect_set_constraint_region(&Map, window.north, window.south,
 					   window.east, window.west,
@@ -483,18 +484,18 @@ int main(int argc, char **argv)
 	    /* default line width */
 	    D_line_width(default_width);
 
-        if (Vect_get_num_primitives(&Map, GV_BOUNDARY) > 0)
-	    stat =
-		dareatheme(&Map, Clist, &cvarr, breakpoints, nbreaks, colors,
-			   has_color ? &bcolor : NULL, chcat, &window,
-			   default_width);
-
-        else if ((Vect_get_num_primitives(&Map, GV_POINT) > 0) ||
-                 (Vect_get_num_primitives(&Map, GV_LINE) > 0)){
-            stat = display_lines(&Map, Clist, chcat, icon_opt->answer, size,
-                   default_width, &cvarr, breakpoints, nbreaks, colors,
-                   has_color ? &bcolor : NULL);
-        }
+	    if (Vect_get_num_primitives(&Map, GV_BOUNDARY) > 0)
+		stat =
+		    dareatheme(&Map, Clist, &cvarr, breakpoints, nbreaks, colors,
+			       has_color ? &bcolor : NULL, chcat, &window,
+			       default_width);
+
+	    else if ((Vect_get_num_primitives(&Map, GV_POINT) > 0) ||
+		     (Vect_get_num_primitives(&Map, GV_LINE) > 0)){
+		stat = display_lines(&Map, Clist, chcat, icon_opt->answer, size,
+		       default_width, &cvarr, breakpoints, nbreaks, colors,
+		       has_color ? &bcolor : NULL);
+	    }
 
 
 	    /* reset line width: Do we need to get line width from display