From: Olivier C. <fra...@us...> - 2002-04-24 15:41:21
|
Update of /cvsroot/xastir/xastir/src In directory usw-pr-cvs1:/tmp/cvs-serv13730 Modified Files: maps.c Log Message: Added equator and central meridian drawing as a black line when a grid is asked for. Teasing for utm grid drawing. Index: maps.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/maps.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** maps.c 24 Apr 2002 08:06:13 -0000 1.37 --- maps.c 24 Apr 2002 15:41:16 -0000 1.38 *************** *** 249,264 **** long xx, yy, xx1, yy1; /* Set the line width in the GC */ (void)XSetLineAttributes (XtDisplay (w), gc, 1, LineOnOffDash, CapButt,JoinMiter); (void)XSetForeground (XtDisplay (w), gc, colors[0x08]); ! //printf("scale_x: %lu\n", scale_x); ! if (scale_x < GRID_MORE) ! grid_place = 1; ! else ! grid_place = 10; - if (long_lat_grid) { for (place = 180; place >= 0; place -= grid_place) { xastir_snprintf(place_str, sizeof(place_str), "%03d00.00W", place); --- 249,270 ---- long xx, yy, xx1, yy1; + if (!long_lat_grid) + return; + /* Set the line width in the GC */ (void)XSetLineAttributes (XtDisplay (w), gc, 1, LineOnOffDash, CapButt,JoinMiter); (void)XSetForeground (XtDisplay (w), gc, colors[0x08]); ! if (0 /*coordinate_system == USE_UTM*/) { ! // Not yet, just teasing... ;-) ! } ! else { // Not UTM coordinate system, draw some lat/long lines ! //printf("scale_x: %lu\n", scale_x); ! if (scale_x < GRID_MORE) ! grid_place = 1; ! else ! grid_place = 10; for (place = 180; place >= 0; place -= grid_place) { xastir_snprintf(place_str, sizeof(place_str), "%03d00.00W", place); *************** *** 297,301 **** /*printf("Place %s\n",place_str); */ yy1 = yy = ((convert_lat_s2l (place_str) - y_lat_offset) / scale_y); - if (yy > 0 && yy < screen_height) { xx = (convert_lon_s2l ("18000.00W") - x_long_offset) / scale_x; --- 303,306 ---- *************** *** 314,318 **** /*printf("Place %s\n",place_str); */ yy1 = yy = ((convert_lat_s2l (place_str) - y_lat_offset) / scale_y); - if (yy > 0 && yy < screen_height) { xx = (convert_lon_s2l ("18000.00W") - x_long_offset) / scale_x; --- 319,322 ---- *************** *** 327,330 **** --- 331,365 ---- } } + } + + // Draw equator and central meridian with solid black lines + (void)XSetLineAttributes(XtDisplay(w), gc, 1, LineSolid, CapButt,JoinMiter); + (void)XSetForeground(XtDisplay(w), gc, colors[0x08]); + + xastir_snprintf(place_str, sizeof(place_str), "%03d00.00W", 0); + xx1 = xx = ((convert_lon_s2l(place_str) - x_long_offset) / scale_x); + if (xx > 0 && xx < screen_width) { + yy = (convert_lat_s2l("9000.00N") - y_lat_offset) / scale_y; + yy1 = (convert_lat_s2l("9000.00S") - y_lat_offset) / scale_y; + if (yy < 0) + yy = 0; + + if (yy1 > screen_height) + yy1 = screen_height; + + (void)XDrawLine(XtDisplay(w), pixmap_final, gc, xx, yy, xx1, yy1); + } + xastir_snprintf(place_str, sizeof(place_str), "%02d00.00N", 0); + yy1 = yy = ((convert_lat_s2l(place_str) - y_lat_offset) / scale_y); + if (yy > 0 && yy < screen_height) { + xx = (convert_lon_s2l("18000.00W") - x_long_offset) / scale_x; + xx1 = (convert_lon_s2l("18000.00E") - x_long_offset) / scale_x; + if (xx < 0) + xx = 0; + + if (xx1 > screen_width) + xx1 = screen_width; + + (void)XDrawLine(XtDisplay(w), pixmap_final, gc, xx, yy, xx1, yy1); } } |