[GRASS-SVN] r32650 - in grass/trunk: display/d.barscale
display/d.colortable display/d.extract display/d.geodesic
display/d.graph display/d.grid display/d.his
display/d.histogram display/d.info display/d.labels
display/d.legend display/d.linegraph display/d.path
display/d.rast display/d.rast.arrow display/d.rast.num
display/d.rgb display/d.rhumbline display/d.text.new
display/d.thematic.area display/d.vect display/d.vect.chart
display/d.what.vect imagery/i.class
imagery/i.ortho.photo/photo.2image
imagery/i.ortho.photo/photo.2target imagery/i.points
imagery/i.vpoints include lib/cairodriver lib/display
lib/driver lib/gis lib/htmldriver lib/pngdriver lib/psdriver
lib/raster raster/wildfire/r.spread vector/v.digit
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 9 03:05:29 EDT 2008
Author: glynn
Date: 2008-08-09 03:05:29 -0400 (Sat, 09 Aug 2008)
New Revision: 32650
Added:
grass/trunk/lib/display/icon.c
Removed:
grass/trunk/display/d.what.vect/flash.c
grass/trunk/lib/display/draw.c
grass/trunk/lib/gis/icon.c
Modified:
grass/trunk/display/d.barscale/draw_scale.c
grass/trunk/display/d.barscale/main.c
grass/trunk/display/d.colortable/main.c
grass/trunk/display/d.extract/extract.c
grass/trunk/display/d.geodesic/plot.c
grass/trunk/display/d.graph/allocation.c
grass/trunk/display/d.graph/do_graph.c
grass/trunk/display/d.graph/local_proto.h
grass/trunk/display/d.graph/main.c
grass/trunk/display/d.graph/options.h
grass/trunk/display/d.grid/plot.c
grass/trunk/display/d.grid/plotborder.c
grass/trunk/display/d.his/main.c
grass/trunk/display/d.histogram/bar.c
grass/trunk/display/d.histogram/draw_slice.c
grass/trunk/display/d.histogram/main.c
grass/trunk/display/d.histogram/pie.c
grass/trunk/display/d.info/main.c
grass/trunk/display/d.labels/do_labels.c
grass/trunk/display/d.labels/main.c
grass/trunk/display/d.legend/main.c
grass/trunk/display/d.linegraph/linegraph.c
grass/trunk/display/d.path/main.c
grass/trunk/display/d.path/select.c
grass/trunk/display/d.rast.arrow/arrow.c
grass/trunk/display/d.rast.num/number.c
grass/trunk/display/d.rast/display.c
grass/trunk/display/d.rgb/main.c
grass/trunk/display/d.rhumbline/plot.c
grass/trunk/display/d.text.new/main.c
grass/trunk/display/d.thematic.area/main.c
grass/trunk/display/d.thematic.area/plot.h
grass/trunk/display/d.thematic.area/plot1.c
grass/trunk/display/d.vect.chart/bar.c
grass/trunk/display/d.vect.chart/main.c
grass/trunk/display/d.vect.chart/pie.c
grass/trunk/display/d.vect/attr.c
grass/trunk/display/d.vect/dir.c
grass/trunk/display/d.vect/label.c
grass/trunk/display/d.vect/main.c
grass/trunk/display/d.vect/plot.h
grass/trunk/display/d.vect/plot1.c
grass/trunk/display/d.vect/topo.c
grass/trunk/display/d.vect/zcoor.c
grass/trunk/imagery/i.class/graphics.c
grass/trunk/imagery/i.ortho.photo/photo.2image/dot.c
grass/trunk/imagery/i.ortho.photo/photo.2image/graphics.c
grass/trunk/imagery/i.ortho.photo/photo.2target/dot.c
grass/trunk/imagery/i.ortho.photo/photo.2target/graphics.c
grass/trunk/imagery/i.points/dot.c
grass/trunk/imagery/i.points/graphics.c
grass/trunk/imagery/i.vpoints/dot.c
grass/trunk/imagery/i.vpoints/graphics.c
grass/trunk/imagery/i.vpoints/plot.c
grass/trunk/imagery/i.vpoints/setup.c
grass/trunk/include/display.h
grass/trunk/include/gisdefs.h
grass/trunk/include/raster.h
grass/trunk/lib/cairodriver/Box.c
grass/trunk/lib/cairodriver/Draw_line.c
grass/trunk/lib/cairodriver/Draw_point.c
grass/trunk/lib/cairodriver/Graph.c
grass/trunk/lib/cairodriver/Line_width.c
grass/trunk/lib/cairodriver/Poly.c
grass/trunk/lib/cairodriver/Raster.c
grass/trunk/lib/cairodriver/Set_window.c
grass/trunk/lib/cairodriver/cairodriver.h
grass/trunk/lib/display/cnversions.c
grass/trunk/lib/display/draw2.c
grass/trunk/lib/display/raster.c
grass/trunk/lib/display/setup.c
grass/trunk/lib/display/symbol.c
grass/trunk/lib/display/window.c
grass/trunk/lib/driver/Box.c
grass/trunk/lib/driver/Cont.c
grass/trunk/lib/driver/Draw.c
grass/trunk/lib/driver/Erase.c
grass/trunk/lib/driver/Get_t_box.c
grass/trunk/lib/driver/Graph.c
grass/trunk/lib/driver/Line_width.c
grass/trunk/lib/driver/Move.c
grass/trunk/lib/driver/Polydots.c
grass/trunk/lib/driver/Polygon.c
grass/trunk/lib/driver/Polyline.c
grass/trunk/lib/driver/Raster.c
grass/trunk/lib/driver/Returns.c
grass/trunk/lib/driver/Set_window.c
grass/trunk/lib/driver/Text_size.c
grass/trunk/lib/driver/driver.h
grass/trunk/lib/driver/driverlib.h
grass/trunk/lib/driver/init.c
grass/trunk/lib/driver/text2.c
grass/trunk/lib/driver/text3.c
grass/trunk/lib/htmldriver/Graph_Clse.c
grass/trunk/lib/htmldriver/Graph_Set.c
grass/trunk/lib/htmldriver/Polygon.c
grass/trunk/lib/htmldriver/htmlmap.h
grass/trunk/lib/pngdriver/Box.c
grass/trunk/lib/pngdriver/Draw_line.c
grass/trunk/lib/pngdriver/Draw_point.c
grass/trunk/lib/pngdriver/Graph_set.c
grass/trunk/lib/pngdriver/Line_width.c
grass/trunk/lib/pngdriver/Raster.c
grass/trunk/lib/pngdriver/Set_window.c
grass/trunk/lib/pngdriver/pngdriver.h
grass/trunk/lib/psdriver/Box.c
grass/trunk/lib/psdriver/Draw_line.c
grass/trunk/lib/psdriver/Draw_point.c
grass/trunk/lib/psdriver/Graph_set.c
grass/trunk/lib/psdriver/Line_width.c
grass/trunk/lib/psdriver/Polygon.c
grass/trunk/lib/psdriver/Polyline.c
grass/trunk/lib/psdriver/Raster.c
grass/trunk/lib/psdriver/Set_window.c
grass/trunk/lib/psdriver/psdriver.h
grass/trunk/lib/raster/raster.c
grass/trunk/raster/wildfire/r.spread/display.c
grass/trunk/vector/v.digit/display.c
grass/trunk/vector/v.digit/driver.c
grass/trunk/vector/v.digit/proto.h
Log:
Display architecture update, part 1
Use floating-point coordinates
Avoid using G_plot_* for display
Drivers don't need argc/argv
Miscellaneous clean-up
Modified: grass/trunk/display/d.barscale/draw_scale.c
===================================================================
--- grass/trunk/display/d.barscale/draw_scale.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.barscale/draw_scale.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -65,11 +65,11 @@
double line_len;
int incr;
int x_pos, y_pos;
- int t, b, l, r;
+ double t, b, l, r;
int pt, pb, pl, pr;
int i;
int size;
- int xarr[5], yarr[5];
+ double xarr[5], yarr[5];
double seg_len;
const struct scale *scales = all_scales[use_feet];
Modified: grass/trunk/display/d.barscale/main.c
===================================================================
--- grass/trunk/display/d.barscale/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.barscale/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -42,7 +42,7 @@
int main(int argc, char **argv)
{
struct Cell_head window;
- int t, b, l, r;
+ double t, b, l, r;
struct GModule *module;
struct Option *opt1, *opt2, *opt3;
struct Flag *feet, *top, *linescale, *northarrow, *scalebar;
Modified: grass/trunk/display/d.colortable/main.c
===================================================================
--- grass/trunk/display/d.colortable/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.colortable/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -51,10 +51,10 @@
int atcol;
int atline;
int count;
- int t, b, l, r;
+ double t, b, l, r;
int fp, new_colr;
- int x_box[5];
- int y_box[5];
+ double x_box[5];
+ double y_box[5];
struct GModule *module;
struct Option *opt1, *opt2, *opt3, *opt4;
Modified: grass/trunk/display/d.extract/extract.c
===================================================================
--- grass/trunk/display/d.extract/extract.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.extract/extract.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -143,12 +143,12 @@
type = Vect_read_line(Map, Points, NULL, line);
if (type & GV_POINTS)
- G_plot_icon(Points->x[0], Points->y[0], G_ICON_CROSS, 0.0, msize);
+ D_plot_icon(Points->x[0], Points->y[0], G_ICON_CROSS, 0.0, msize);
else
- for (j = 0; j < Points->n_points - 1; j++)
- G_plot_line(Points->x[j], Points->y[j], Points->x[j + 1],
- Points->y[j + 1]);
-
+ for (j = 0; j < Points->n_points - 1; j++) {
+ D_move(Points->x[j], Points->y[j]);
+ D_cont(Points->x[j + 1], Points->y[j + 1]);
+ }
}
R_flush();
Modified: grass/trunk/display/d.geodesic/plot.c
===================================================================
--- grass/trunk/display/d.geodesic/plot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.geodesic/plot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -23,9 +23,7 @@
D_setup(0);
/* set D clip window */
- D_set_clip_window((int)D_get_d_north(),
- (int)D_get_d_south(),
- (int)D_get_d_west(), (int)D_get_d_east());
+ D_clip_to_display();
/* setup the G plot to use the D routines */
G_setup_plot(D_get_d_north(),
@@ -81,7 +79,7 @@
static int cont(int x, int y)
{
- if (D_cont_abs(x, y)) { /* clipped */
+ if (D_cont_abs_clip(x, y)) { /* clipped */
change_range = 1;
}
else { /* keep track of left,right x for lines drawn in window */
@@ -104,7 +102,7 @@
static int move(int x, int y)
{
- D_move_abs(x, y);
+ D_move_abs_clip(x, y);
return 0;
}
Modified: grass/trunk/display/d.graph/allocation.c
===================================================================
--- grass/trunk/display/d.graph/allocation.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.graph/allocation.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,37 +1,11 @@
#include <grass/gis.h>
-char *falloc(int nelem, int elsize)
+void *falloc(int nelem, int elsize)
{
- char *ptr;
-
- ptr = G_calloc(nelem, elsize);
-
- if (!ptr)
- G_fatal_error("ERROR: no more memory available");
-
- return (ptr);
+ return G_calloc(nelem, elsize);
}
-char *frealloc(char *oldptr, int nelem, int elsize, int oldnelem)
+void *frealloc(void *oldptr, int nelem, int elsize)
{
- char *ptr;
-
- ptr = G_calloc(nelem, elsize);
- if (!ptr)
- G_fatal_error("ERROR: no more memory available");
-
- {
- register char *a;
- register char *b;
- register int n;
-
- n = oldnelem * elsize;
- a = ptr;
- b = oldptr;
- while (n--)
- *a++ = *b++;
- }
-
- G_free(oldptr);
- return (ptr);
+ return G_realloc(oldptr, nelem * elsize);
}
Modified: grass/trunk/display/d.graph/do_graph.c
===================================================================
--- grass/trunk/display/d.graph/do_graph.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.graph/do_graph.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -12,8 +12,8 @@
#define CHUNK 128
static int coors_allocated = 0;
-static int *xarray;
-static int *yarray;
+static double *xarray;
+static double *yarray;
static float xincr;
static float yincr;
@@ -39,9 +39,9 @@
int set_text_size(void)
{
if (hsize >= 0. && vsize >= 0. && hsize <= 100. && vsize <= 100.) {
- R_text_size((int)(hsize * xincr), (int)(vsize * yincr));
- G_debug(3, "text size initialized to [%d,%d] pixels",
- (int)(hsize * xincr), (int)(vsize * yincr));
+ R_text_size(hsize * xincr, vsize * yincr);
+ G_debug(3, "text size initialized to [%.1f,%.1f]",
+ hsize * xincr, vsize * yincr);
}
return (0);
}
@@ -63,13 +63,12 @@
yper > D_get_u_north() )
return(-1);
*/
- R_cont_abs((int)(D_u_to_d_col(xper) + 0.5),
- (int)(D_u_to_d_row(yper) + 0.5));
+ R_cont_abs(D_u_to_d_col(xper), D_u_to_d_row(yper));
}
else {
if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
return (-1);
- R_cont_abs(l + (int)(xper * xincr), b - (int)(yper * yincr));
+ R_cont_abs(l + xper * xincr, b - yper * yincr);
}
return (0);
@@ -85,12 +84,11 @@
}
if (mapunits)
- R_move_abs((int)(D_u_to_d_col(xper) + 0.5),
- (int)(D_u_to_d_row(yper) + 0.5));
+ R_move_abs(D_u_to_d_col(xper), D_u_to_d_row(yper));
else {
if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
return (-1);
- R_move_abs(l + (int)(xper * xincr), b - (int)(yper * yincr));
+ R_move_abs(l + xper * xincr, b - yper * yincr);
}
return (0);
@@ -130,15 +128,15 @@
int do_linewidth(char *buff)
{
- int width; /* in pixels */
+ double width;
- if (1 != sscanf(buff, "%*s %d", &width)) {
+ if (1 != sscanf(buff, "%*s %lf", &width)) {
G_warning(_("Problem parsing command [%s]"), buff);
return (-1);
}
D_line_width(width);
- G_debug(3, "line width set to %d pixels", width);
+ G_debug(3, "line width set to %.1f", width);
return (0);
}
@@ -149,7 +147,6 @@
int num;
char origcmd[64];
float xper, yper;
- char *fgets();
int to_return;
sscanf(buff, "%s", origcmd);
@@ -179,12 +176,12 @@
check_alloc(num + 1);
if (mapunits) {
- xarray[num] = (int)(D_u_to_d_col(xper) + 0.5);
- yarray[num] = (int)(D_u_to_d_row(yper) + 0.5);
+ xarray[num] = D_u_to_d_col(xper);
+ yarray[num] = D_u_to_d_row(yper);
}
else {
- xarray[num] = l + (int)(xper * xincr);
- yarray[num] = b - (int)(yper * yincr);
+ xarray[num] = l + xper * xincr;
+ yarray[num] = b - yper * yincr;
}
num++;
@@ -221,9 +218,9 @@
if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
return (-1);
- R_text_size((int)(xper * xincr), (int)(yper * yincr));
- G_debug(3, "text size set to [%d,%d] pixels",
- (int)(xper * xincr), (int)(yper * yincr));
+ R_text_size(xper * xincr, yper * yincr);
+ G_debug(3, "text size set to [%.1f,%.1f]",
+ xper * xincr, yper * yincr);
return (0);
}
@@ -266,14 +263,12 @@
to_alloc += CHUNK;
if (coors_allocated == 0) {
- xarray = (int *)falloc(to_alloc, sizeof(int));
- yarray = (int *)falloc(to_alloc, sizeof(int));
+ xarray = falloc(to_alloc, sizeof(double));
+ yarray = falloc(to_alloc, sizeof(double));
}
else {
- xarray = (int *)frealloc((char *)xarray,
- to_alloc, sizeof(int), coors_allocated);
- yarray = (int *)frealloc((char *)yarray,
- to_alloc, sizeof(int), coors_allocated);
+ xarray = frealloc(xarray, to_alloc, sizeof(double));
+ yarray = frealloc(yarray, to_alloc, sizeof(double));
}
coors_allocated = to_alloc;
@@ -285,17 +280,17 @@
{
double xper, yper;
char type;
- int size;
- int ix, iy;
+ double size;
+ double ix, iy;
- if (4 != sscanf(buff, "%*s %c %d %lf %lf", &type, &size, &xper, &yper)) {
+ if (4 != sscanf(buff, "%*s %c %lf %lf %lf", &type, &size, &xper, &yper)) {
G_warning(_("Problem parsing command [%s]"), buff);
return (-1);
}
if (mapunits) {
- ix = (int)(D_u_to_d_col(xper) + 0.5);
- iy = (int)(D_u_to_d_row(yper) + 0.5);
+ ix = D_u_to_d_col(xper);
+ iy = D_u_to_d_row(yper);
/* size in map units too? currently in percentage.
use "size * D_get_u_to_d_yconv()" to convert? */
}
@@ -303,8 +298,8 @@
if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
return (-1);
- ix = l + (int)(xper * xincr);
- iy = b - (int)(yper * yincr);
+ ix = l + xper * xincr;
+ iy = b - yper * yincr;
}
switch (type & 0177) {
@@ -335,8 +330,8 @@
int do_symbol(char *buff)
{
double xper, yper;
- int size;
- int ix, iy;
+ double size;
+ double ix, iy;
char *symb_name;
SYMBOL *Symb;
char *line_color_str, *fill_color_str;
@@ -358,23 +353,23 @@
strcpy(fill_color_str, "grey");
if (sscanf
- (buff, "%*s %s %d %lf %lf %s %s", symb_name, &size, &xper, &yper,
+ (buff, "%*s %s %lf %lf %lf %s %s", symb_name, &size, &xper, &yper,
line_color_str, fill_color_str) < 4) {
G_warning(_("Problem parsing command [%s]"), buff);
return (-1);
}
if (mapunits) {
- ix = (int)(D_u_to_d_col(xper) + 0.5);
- iy = (int)(D_u_to_d_row(yper) + 0.5);
+ ix = D_u_to_d_col(xper);
+ iy = D_u_to_d_row(yper);
/* consider size in map units too? maybe as percentage of display?
perhaps use "size * D_get_u_to_d_yconv()" to convert */
}
else {
if (xper < 0. || yper < 0. || xper > 100. || yper > 100.)
return (-1);
- ix = l + (int)(xper * xincr);
- iy = b - (int)(yper * yincr);
+ ix = l + xper * xincr;
+ iy = b - yper * yincr;
}
/* parse line color */
Modified: grass/trunk/display/d.graph/local_proto.h
===================================================================
--- grass/trunk/display/d.graph/local_proto.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.graph/local_proto.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,6 +1,6 @@
/* allocation.c */
-char *falloc(int, int);
-char *frealloc(char *, int, int, int);
+void *falloc(int, int);
+void *frealloc(void *, int, int);
/* do_graph.c */
int set_graph_stuff(void);
Modified: grass/trunk/display/d.graph/main.c
===================================================================
--- grass/trunk/display/d.graph/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.graph/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -35,10 +35,15 @@
#include <grass/raster.h>
#include <grass/glocale.h>
-#define MAIN
#include "options.h"
#include "local_proto.h"
+float hsize;
+float vsize;
+double t, b, l, r;
+int mapunits;
+FILE *infile;
+
int main(int argc, char **argv)
{
struct GModule *module;
Modified: grass/trunk/display/d.graph/options.h
===================================================================
--- grass/trunk/display/d.graph/options.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.graph/options.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,11 +1,6 @@
-#ifdef MAIN
-#define EXTERN
-#else
-#define EXTERN extern
-#endif
-EXTERN float hsize;
-EXTERN float vsize;
-EXTERN int t, b, l, r;
-EXTERN int mapunits;
-EXTERN FILE *infile;
+extern float hsize;
+extern float vsize;
+extern double t, b, l, r;
+extern int mapunits;
+extern FILE *infile;
Modified: grass/trunk/display/d.grid/plot.c
===================================================================
--- grass/trunk/display/d.grid/plot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.grid/plot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -27,10 +27,7 @@
window.south = window.south + row_dist;
window.east = window.east - colm_dist;
- G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
- D_get_d_east(), D_move_abs, D_cont_abs);
-
/* Draw vertical grids */
if (window.west > east)
x = ceil((window.west - east) / grid_size) * grid_size + east;
@@ -41,7 +38,7 @@
if (mark_type == MARK_GRID) {
D_raster_use_color(gcolor);
- G_plot_line(x, window.north, x, window.south);
+ D_line(x, window.north, x, window.south);
}
if (do_text) {
@@ -83,9 +80,9 @@
while (y <= window.north) {
if (mark_type == MARK_GRID) {
D_raster_use_color(gcolor);
- G_plot_line(window.east, y, e1, y);
- G_plot_line(e1, y, e2, y);
- G_plot_line(e2, y, window.west, y);
+ D_line(window.east, y, e1, y);
+ D_line(e1, y, e2, y);
+ D_line(e2, y, window.west, y);
}
if (do_text) {
@@ -170,10 +167,7 @@
G_debug(3, "REGION BOUNDS N=%f S=%f E=%f W=%f", north, south, east, west);
- G_setup_plot(D_get_d_north(), D_get_d_south(),
- D_get_d_west(), D_get_d_east(), D_move_abs, D_cont_abs);
-
/* Lines of Latitude */
g = floor(north / size) * size;
e1 = east;
@@ -205,7 +199,7 @@
start_coord = n1;
font_angle = get_heading((e1 - e2), (n1 - n2));
}
- G_plot_line(e1, n1, e2, n2);
+ D_line(e1, n1, e2, n2);
}
if (do_text) {
@@ -258,7 +252,7 @@
start_coord = e1;
}
- G_plot_line(e1, n1, e2, n2);
+ D_line(e1, n1, e2, n2);
}
if (do_text) {
/* Set text color */
Modified: grass/trunk/display/d.grid/plotborder.c
===================================================================
--- grass/trunk/display/d.grid/plotborder.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.grid/plotborder.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -17,9 +17,6 @@
window.south = window.south + row_dist;
window.east = window.east - colm_dist;
- G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
- D_get_d_east(), D_move_abs, D_cont_abs);
-
steps = grid_size / 10.; /* tick marks number */
shortmark = 180.; /* tick marks length */
middlemark = 90.;
@@ -28,12 +25,12 @@
/* plot boundary lines: */
/* horizontal : */
- G_plot_line(window.west, window.south, window.east, window.south);
- G_plot_line(window.west, window.north, window.east, window.north);
+ D_line(window.west, window.south, window.east, window.south);
+ D_line(window.west, window.north, window.east, window.north);
/* vertical : */
- G_plot_line(window.west, window.south, window.west, window.north);
- G_plot_line(window.east, window.south, window.east, window.north);
+ D_line(window.west, window.south, window.west, window.north);
+ D_line(window.east, window.south, window.east, window.north);
/* Draw vertical border marks */
if (window.west < east)
@@ -45,31 +42,16 @@
loop = 0;
for (i = 0; i <= grid_size; i = i + steps) {
if (loop == 0) {
- G_plot_line(x + i,
- window.south + (window.north -
- window.south) / longmark, x + i,
- window.south);
- G_plot_line(x + i, window.north, x + i,
- window.north - (window.north -
- window.south) / longmark);
+ D_line(x + i, window.south + (window.north - window.south) / longmark, x + i, window.south);
+ D_line(x + i, window.north, x + i, window.north - (window.north - window.south) / longmark);
}
if (loop == 5) {
- G_plot_line(x + i,
- window.south + (window.north -
- window.south) / middlemark, x + i,
- window.south);
- G_plot_line(x + i, window.north, x + i,
- window.north - (window.north -
- window.south) / middlemark);
+ D_line(x + i,window.south + (window.north - window.south) / middlemark, x + i, window.south);
+ D_line(x + i, window.north, x + i, window.north - (window.north - window.south) / middlemark);
}
else {
- G_plot_line(x + i,
- window.south + (window.north -
- window.south) / shortmark, x + i,
- window.south);
- G_plot_line(x + i, window.north, x + i,
- window.north - (window.north -
- window.south) / shortmark);
+ D_line(x + i, window.south + (window.north - window.south) / shortmark, x + i, window.south);
+ D_line(x + i, window.north, x + i, window.north - (window.north - window.south) / shortmark);
}
loop++;
}
@@ -87,28 +69,16 @@
loop = 0;
for (i = 0; i <= grid_size; i = i + steps) {
if (loop == 0) {
- G_plot_line(window.west, y + i,
- window.west + (window.east -
- window.west) / longmark, y + i);
- G_plot_line(window.east -
- (window.east - window.west) / longmark, y + i,
- window.east, y + i);
+ D_line(window.west, y + i, window.west + (window.east - window.west) / longmark, y + i);
+ D_line(window.east - (window.east - window.west) / longmark, y + i, window.east, y + i);
}
if (loop == 5) {
- G_plot_line(window.west, y + i,
- window.west + (window.east -
- window.west) / middlemark, y + i);
- G_plot_line(window.east -
- (window.east - window.west) / middlemark, y + i,
- window.east, y + i);
+ D_line(window.west, y + i, window.west + (window.east - window.west) / middlemark, y + i);
+ D_line(window.east - (window.east - window.west) / middlemark, y + i, window.east, y + i);
}
else {
- G_plot_line(window.west, y + i,
- window.west + (window.east -
- window.west) / shortmark, y + i);
- G_plot_line(window.east -
- (window.east - window.west) / shortmark, y + i,
- window.east, y + i);
+ D_line(window.west, y + i, window.west + (window.east - window.west) / shortmark, y + i);
+ D_line(window.east - (window.east - window.west) / shortmark, y + i, window.east, y + i);
}
loop++;
}
Modified: grass/trunk/display/d.his/main.c
===================================================================
--- grass/trunk/display/d.his/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.his/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -54,7 +54,7 @@
struct GModule *module;
struct Option *opt_h, *opt_i, *opt_s, *brighten;
struct Flag *nulldraw;
- int t, b, l, r;
+ double t, b, l, r;
double bright_mult;
Modified: grass/trunk/display/d.histogram/bar.c
===================================================================
--- grass/trunk/display/d.histogram/bar.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.histogram/bar.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -52,12 +52,12 @@
long int tic_every; /* spacing, in units of category value, of tics */
long int tic_unit;
- int t, b, l, r;
- int tt, tb, tl, tr;
- int x_line[3]; /* for border of histogram */
- int y_line[3];
- int x_box[5]; /* for histogram bar coordinates */
- int y_box[5];
+ double t, b, l, r;
+ double tt, tb, tl, tr;
+ double x_line[3]; /* for border of histogram */
+ double y_line[3];
+ double x_box[5]; /* for histogram bar coordinates */
+ double y_box[5];
double height, width;
double xscale; /* scaling factors */
double yscale;
@@ -74,10 +74,10 @@
/* create axis lines, to be drawn later */
height = b - t;
width = r - l;
- x_line[0] = x_line[1] = l + (int)(ORIGIN_X * width);
- x_line[2] = l + (int)(XAXIS_END * width);
- y_line[0] = b - (int)(YAXIS_END * height);
- y_line[1] = y_line[2] = b - (int)(ORIGIN_Y * height);
+ x_line[0] = x_line[1] = l + (ORIGIN_X * width);
+ x_line[2] = l + (XAXIS_END * width);
+ y_line[0] = b - (YAXIS_END * height);
+ y_line[1] = y_line[2] = b - (ORIGIN_Y * height);
/* figure scaling factors and offsets */
num_cats = dist_stats->maxcat - dist_stats->mincat + 1;
@@ -86,8 +86,8 @@
num_cats++;
dist_stats->mincat--;
}
- xscale = ((double)(x_line[2] - x_line[1]) / ((double)num_cats));
- yscale = ((double)(y_line[1] - y_line[0])) / dist_stats->maxstat;
+ xscale = ((x_line[2] - x_line[1]) / ((double)num_cats));
+ yscale = ((y_line[1] - y_line[0])) / dist_stats->maxstat;
if (num_cats >= x_line[2] - x_line[1])
xoffset = (long int)x_line[1];
else
@@ -164,7 +164,7 @@
draw = YES;
G_set_c_null_value(&bar_color, 1);
bar_height =
- (int)(yoffset - yscale * (double)dist_stats->null_stat);
+ (yoffset - yscale * (double)dist_stats->null_stat);
}
}
else if (ptr->cat == i) { /* AH-HA!! found the stat */
@@ -173,7 +173,7 @@
else {
draw = YES;
bar_color = ptr->cat;
- bar_height = (int)(yoffset - yscale * (double)ptr->stat);
+ bar_height = (yoffset - yscale * (double)ptr->stat);
}
if (ptr->next != NULL)
ptr = ptr->next;
@@ -189,7 +189,7 @@
else {
draw = YES;
bar_color = ptr->cat;
- bar_height = (int)(yoffset - yscale * (double)ptr->stat);
+ bar_height = (yoffset - yscale * (double)ptr->stat);
}
if (ptr->next != NULL)
ptr = ptr->next;
@@ -287,8 +287,8 @@
xoffset + (i - dist_stats->mincat) * xscale;
y_box[0] = yoffset;
y_box[1] = bar_height;
- R_move_abs((int)x_box[0], (int)y_box[0]);
- R_cont_abs((int)x_box[1], (int)y_box[1]);
+ R_move_abs(x_box[0], y_box[0]);
+ R_cont_abs(x_box[1], y_box[1]);
}
}
@@ -301,10 +301,9 @@
&& !(nodata && i == dist_stats->mincat + 1)) {
/* draw a numbered tic-mark */
D_raster_use_color(color);
- R_move_abs((int)
- (xoffset + (i - dist_stats->mincat) * xscale -
- 0.5 * xscale), (int)(b - ORIGIN_Y * (b - t)));
- R_cont_rel((int)0, (int)(BIG_TIC * (b - t)));
+ R_move_abs(xoffset + (i - dist_stats->mincat) * xscale - 0.5 * xscale,
+ b - ORIGIN_Y * (b - t));
+ R_cont_rel(0, BIG_TIC * (b - t));
if (nodata && i == dist_stats->mincat)
sprintf(txt, "null");
else if (is_fp) {
@@ -325,19 +324,16 @@
R_text_size(text_width, text_height);
R_get_text_box(txt, &tt, &tb, &tl, &tr);
}
- R_move_abs((int)
- (xoffset + (i - dist_stats->mincat) * xscale -
- 0.5 * xscale - (tr - tl) / 2),
- (int)(b - XNUMS_Y * (b - t)));
+ R_move_abs(xoffset + (i - dist_stats->mincat) * xscale - 0.5 * xscale - (tr - tl) / 2,
+ b - XNUMS_Y * (b - t));
R_text(txt);
}
else if (rem(i, tic_unit) == (float)0) {
/* draw a tic-mark */
D_raster_use_color(color);
- R_move_abs((int)
- (xoffset + (i - dist_stats->mincat) * xscale -
- 0.5 * xscale), (int)(b - ORIGIN_Y * (b - t)));
- R_cont_rel((int)0, (int)(SMALL_TIC * (b - t)));
+ R_move_abs(xoffset + (i - dist_stats->mincat) * xscale - 0.5 * xscale,
+ b - ORIGIN_Y * (b - t));
+ R_cont_rel(0, SMALL_TIC * (b - t));
}
}
@@ -350,8 +346,8 @@
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
R_get_text_box(xlabel, &tt, &tb, &tl, &tr);
- R_move_abs((int)(l + (r - l) / 2 - (tr - tl) / 2),
- (int)(b - LABEL_1 * (b - t)));
+ R_move_abs(l + (r - l) / 2 - (tr - tl) / 2,
+ b - LABEL_1 * (b - t));
D_raster_use_color(color);
R_text(xlabel);
@@ -383,8 +379,8 @@
for (i = stat_start; i <= stat_finis; i += tic_unit) {
if (rem(i, tic_every) == (float)0) {
/* draw a tic-mark */
- R_move_abs((int)x_line[0], (int)(yoffset - yscale * i));
- R_cont_rel((int)(-(r - l) * BIG_TIC), (int)0);
+ R_move_abs(x_line[0], yoffset - yscale * i);
+ R_cont_rel((-(r - l) * BIG_TIC), 0);
/* draw a tic-mark number */
sprintf(txt, "%d", (int)(i / tic_unit));
@@ -398,14 +394,14 @@
R_text_size(text_width, text_height);
R_get_text_box(txt, &tt, &tb, &tl, &tr);
}
- R_move_abs((int)(l + (r - l) * YNUMS_X - (tr - tl) / 2),
- (int)(yoffset - (yscale * i + 0.5 * (tt - tb))));
+ R_move_abs(l + (r - l) * YNUMS_X - (tr - tl) / 2,
+ yoffset - (yscale * i + 0.5 * (tt - tb)));
R_text(txt);
}
else if (rem(i, tic_unit) == (float)0) {
/* draw a tic-mark */
- R_move_abs((int)x_line[0], (int)(yoffset - yscale * i));
- R_cont_rel((int)(-(r - l) * SMALL_TIC), (int)0);
+ R_move_abs(x_line[0], yoffset - yscale * i);
+ R_cont_rel(-(r - l) * SMALL_TIC, 0);
}
}
@@ -427,8 +423,8 @@
text_width = (r - l) * TEXT_WIDTH;
R_text_size(text_width, text_height);
R_get_text_box(ylabel, &tt, &tb, &tl, &tr);
- R_move_abs((int)(l + (r - l) / 2 - (tr - tl) / 2),
- (int)(b - LABEL_2 * (b - t)));
+ R_move_abs(l + (r - l) / 2 - (tr - tl) / 2,
+ b - LABEL_2 * (b - t));
D_raster_use_color(color);
R_text(ylabel);
Modified: grass/trunk/display/d.histogram/draw_slice.c
===================================================================
--- grass/trunk/display/d.histogram/draw_slice.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.histogram/draw_slice.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -9,10 +9,10 @@
double a1, double a2 /* in degrees */
)
{
- int tt, tb, tr, tl;
+ double tt, tb, tr, tl;
int height, width;
- int yoffset, xoffset;
- int x[1000], y[1000];
+ double yoffset, xoffset;
+ double x[1000], y[1000];
int lx, ly;
int i = 1;
char txt[512];
@@ -29,8 +29,8 @@
while (a2 / arc_incr > 998)
arc_incr *= 2;
- x[0] = (int)((double)xoffset + cx * (double)width);
- y[0] = (int)((double)yoffset - cy * (double)height);
+ x[0] = (xoffset + cx * width);
+ y[0] = (yoffset - cy * height);
arc = a1;
if (fill_flag && fill_color1 != fill_color2) {
@@ -73,8 +73,7 @@
if (a2 > 15.0) {
/* draw a label */
arc = a1 + a2 / 2;
- sprintf(txt, "%2.0f%s", (double)(a2 / (double)360.0) * (double)100.0,
- percent);
+ sprintf(txt, "%2.0f%s", (a2 / 360.0) * 100.0, percent);
R_get_text_box(txt, &tt, &tb, &tl, &tr);
lx = x[0] + (r + 0.03) * (width) * cos(arc / 57.296) - (tr - tl) / 2;
ly = y[0] - (r + 0.03) * (height) * sin(arc / 57.296) + (tb - tt) / 2;
Modified: grass/trunk/display/d.histogram/main.c
===================================================================
--- grass/trunk/display/d.histogram/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.histogram/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -51,8 +51,8 @@
struct Colors pcolors;
int bgcolor;
char title[512];
- int tt, tb, tl, tr;
- int t, b, l, r;
+ double tt, tb, tl, tr;
+ double t, b, l, r;
int quiet;
struct GModule *module;
struct Option *opt1;
@@ -196,8 +196,8 @@
text_width = (r - l) * 0.05 * 0.50;
R_text_size(text_width, text_height);
R_get_text_box(title, &tt, &tb, &tl, &tr);
- R_move_abs((int)(l + (r - l) / 2 - (tr - tl) / 2),
- (int)(t + (b - t) * 0.07));
+ R_move_abs(l + (r - l) / 2 - (tr - tl) / 2,
+ t + (b - t) * 0.07);
D_raster_use_color(color);
R_text(title);
Modified: grass/trunk/display/d.histogram/pie.c
===================================================================
--- grass/trunk/display/d.histogram/pie.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.histogram/pie.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -56,12 +56,12 @@
long int num_cats;
long int tic_every; /* spacing, in units of category value, of tics */
long int tic_unit;
- int t, b, l, r;
- int tt, tb, tl, tr;
- int x_line[5]; /* for border of histogram */
- int y_line[5];
- int x_box[6]; /* for histogram bar coordinates */
- int y_box[6];
+ double t, b, l, r;
+ double tt, tb, tl, tr;
+ double x_line[5]; /* for border of histogram */
+ double y_line[5];
+ double x_box[6]; /* for histogram bar coordinates */
+ double y_box[6];
double height, width;
double xscale; /* scaling factors */
double yscale;
Modified: grass/trunk/display/d.info/main.c
===================================================================
--- grass/trunk/display/d.info/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.info/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -23,7 +23,7 @@
{
struct GModule *module;
struct Flag *rflag, *dflag, *cflag, *fflag, *bflag, *gflag;
- int l, r, t, b;
+ double t, b, l, r;
struct Cell_head window;
G_gisinit(argv[0]);
@@ -80,17 +80,17 @@
}
if (rflag->answer)
- fprintf(stdout, "rectangle: %d %d %d %d\n", l, r, t, b);
+ fprintf(stdout, "rectangle: %f %f %f %f\n", l, r, t, b);
if (dflag->answer)
- fprintf(stdout, "dimensions: %d %d\n", r - l, b - t);
+ fprintf(stdout, "dimensions: %f %f\n", r - l, b - t);
if (cflag->answer)
fprintf(stdout, "colors: %d\n", R_get_num_colors());
if (fflag->answer) {
D_get_screen_window(&t, &b, &l, &r);
- fprintf(stdout, "frame: %d %d %d %d\n", l, r, t, b);
+ fprintf(stdout, "frame: %f %f %f %f\n", l, r, t, b);
}
if (bflag->answer) {
@@ -107,7 +107,7 @@
t = D_get_d_north();
b = D_get_d_south();
- fprintf(stdout, "region: %d %d %d %d\n", l, r, t, b);
+ fprintf(stdout, "region: %f %f %f %f\n", l, r, t, b);
}
if (gflag->answer) {
Modified: grass/trunk/display/d.labels/do_labels.c
===================================================================
--- grass/trunk/display/d.labels/do_labels.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.labels/do_labels.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -167,19 +167,19 @@
char line[256];
char *lptr, *tptr;
double line_size;
- int text_size;
- int X, Y, Y0;
- int T, B, L, R;
- int t, b, l, r;
- int xarr[5];
- int yarr[5];
- int Xoffset, Yoffset; /* in XY plane */
- int X_just_offset, Y_just_offset; /* in rotated label plane */
- int ll_x, ll_y, ul_x, ul_y, lr_x, lr_y, ur_x, ur_y, text_x, text_y;
+ double text_size;
+ double X, Y, Y0;
+ double T, B, L, R;
+ double t, b, l, r;
+ double xarr[5];
+ double yarr[5];
+ double Xoffset, Yoffset; /* in XY plane */
+ double X_just_offset, Y_just_offset; /* in rotated label plane */
+ double ll_x, ll_y, ul_x, ul_y, lr_x, lr_y, ur_x, ur_y, text_x, text_y;
G_debug(3, "Doing '%s'", text);
- X = (int)(D_u_to_d_col(east));
- Y0 = (int)(D_u_to_d_row(north));
+ X = D_u_to_d_col(east);
+ Y0 = D_u_to_d_row(north);
/* Set font */
R_font(font);
@@ -286,15 +286,15 @@
ll_y = lr_y = B + Y_just_offset;
ll_x = ul_x = L + X_just_offset;
lr_x = ur_x = R + X_just_offset;
- G_rotate_around_point_int(X, Y0, &ll_x, &ll_y, -1 * rotation);
- G_rotate_around_point_int(X, Y0, &ul_x, &ul_y, -1 * rotation);
- G_rotate_around_point_int(X, Y0, &ur_x, &ur_y, -1 * rotation);
- G_rotate_around_point_int(X, Y0, &lr_x, &lr_y, -1 * rotation);
+ G_rotate_around_point(X, Y0, &ll_x, &ll_y, -1 * rotation);
+ G_rotate_around_point(X, Y0, &ul_x, &ul_y, -1 * rotation);
+ G_rotate_around_point(X, Y0, &ur_x, &ur_y, -1 * rotation);
+ G_rotate_around_point(X, Y0, &lr_x, &lr_y, -1 * rotation);
/* rotate lower starting corner of text */
text_x = X + X_just_offset;
text_y = Y + Y_just_offset;
- G_rotate_around_point_int(X, Y0, &text_x, &text_y, -1 * rotation);
+ G_rotate_around_point(X, Y0, &text_x, &text_y, -1 * rotation);
/* define rotated bounding box */
xarr[0] = ll_x + Xoffset;
@@ -370,7 +370,7 @@
(north - (line_size * 1.2) - ((i - 1) * line_size)));
text_x = X + X_just_offset; /* reset after G_rotate_around_point_int() */
text_y = Y + Y_just_offset;
- G_rotate_around_point_int(X, Y0, &text_x, &text_y, -1 * rotation);
+ G_rotate_around_point(X, Y0, &text_x, &text_y, -1 * rotation);
for (j = 1; j <= highlight_width; j++) {
/* smear it around. probably a better way (knight's move? rand?) */
@@ -427,7 +427,7 @@
(north - (line_size * 1.2) - ((i - 1) * line_size)));
text_x = X + X_just_offset; /* reset after G_rotate_around_point_int() */
text_y = Y + Y_just_offset;
- G_rotate_around_point_int(X, Y0, &text_x, &text_y, -1 * rotation);
+ G_rotate_around_point(X, Y0, &text_x, &text_y, -1 * rotation);
R_move_abs(text_x + Xoffset, text_y + Yoffset);
R_text(line);
Modified: grass/trunk/display/d.labels/main.c
===================================================================
--- grass/trunk/display/d.labels/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.labels/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -31,7 +31,7 @@
char *mapset;
double minreg, maxreg, reg, dx, dy;
FILE *infile;
- int t, b, l, r;
+ double t, b, l, r;
struct Option *opt1;
struct Option *maxreg_opt, *minreg_opt;
struct Flag *horiz_flag;
Modified: grass/trunk/display/d.legend/main.c
===================================================================
--- grass/trunk/display/d.legend/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.legend/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -50,12 +50,12 @@
int i, j, k;
int lines, steps;
int new_colr, fp;
- int t, b, l, r;
+ double t, b, l, r;
int hide_catnum, hide_catstr, hide_nodata, do_smooth;
char *cstr;
int white;
- int x_box[5];
- int y_box[5];
+ double x_box[5];
+ double y_box[5];
struct Categories cats;
struct Colors colors;
struct GModule *module;
Modified: grass/trunk/display/d.linegraph/linegraph.c
===================================================================
--- grass/trunk/display/d.linegraph/linegraph.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.linegraph/linegraph.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -63,13 +63,13 @@
int title_color;
int num_y_files;
int tic_unit;
- int t, b, l, r;
- int tt, tb, tl, tr;
+ double t, b, l, r;
+ double tt, tb, tl, tr;
int prev_x, prev_y[11];
int new_x, new_y[11];
int line;
- int x_line[3];
- int y_line[3];
+ double x_line[3];
+ double y_line[3];
int err;
struct in_file
Modified: grass/trunk/display/d.path/main.c
===================================================================
--- grass/trunk/display/d.path/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.path/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -191,9 +191,6 @@
D_setup(0);
- G_setup_plot(D_get_d_north(), D_get_d_south(),
- D_get_d_west(), D_get_d_east(), D_move_abs, D_cont_abs);
-
Vect_net_build_graph(&Map, type, afield, nfield, afcol->answer,
abcol->answer, ncol->answer, geo, 0);
Modified: grass/trunk/display/d.path/select.c
===================================================================
--- grass/trunk/display/d.path/select.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.path/select.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -32,8 +32,10 @@
D_line_width(2);
for (i = from; i < to - 1; i++)
- G_plot_line(Points->x[i], Points->y[i], Points->x[i + 1],
- Points->y[i + 1]);
+ {
+ D_move(Points->x[i], Points->y[i]);
+ D_cont(Points->x[i + 1], Points->y[i + 1]);
+ }
if (be_bold)
R_line_width(0);
@@ -95,7 +97,7 @@
fy = start_y;
}
R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
- G_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
+ D_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
end_node = Vect_find_node(Map, end_x, end_y, 0.0, maxdist, 0);
@@ -112,7 +114,7 @@
ty = end_y;
}
R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
- G_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
+ D_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
G_debug(2, "find path %f %f -> %f %f", fx, fy, tx, ty);
Modified: grass/trunk/display/d.rast/display.c
===================================================================
--- grass/trunk/display/d.rast/display.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.rast/display.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -51,7 +51,7 @@
int cellfile;
void *xarray;
int cur_A_row;
- int t, b, l, r;
+ double t, b, l, r;
int ncols, nrows;
ncols = G_window_cols();
Modified: grass/trunk/display/d.rast.arrow/arrow.c
===================================================================
--- grass/trunk/display/d.rast.arrow/arrow.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.rast.arrow/arrow.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -72,7 +72,7 @@
extern double D_ew, D_ns;
extern int D_x, D_y;
struct Cell_head window;
- int t, b, l, r;
+ double t, b, l, r;
RASTER_MAP_TYPE raster_type, mag_raster_type = -1;
int layer_fd;
void *raster_row, *ptr;
Modified: grass/trunk/display/d.rast.num/number.c
===================================================================
--- grass/trunk/display/d.rast.num/number.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.rast.num/number.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -67,7 +67,7 @@
int R, G, B;
int layer_fd;
int nrows, ncols, row, col;
- int t, b, l, r;
+ double t, b, l, r;
int digits;
struct Cell_head window;
struct Colors colors;
@@ -242,17 +242,17 @@
/* Draw vertical grids */
U_start = U_east;
for (U_x = U_start; U_x >= U_west; U_x -= ew_res) {
- D_x = (int)((U_x - U_west) * U_to_D_xconv + D_west);
- R_move_abs(D_x, (int)D_south);
- R_cont_abs(D_x, (int)D_north);
+ D_x = (U_x - U_west) * U_to_D_xconv + D_west;
+ R_move_abs(D_x, D_south);
+ R_cont_abs(D_x, D_north);
}
/* Draw horizontal grids */
U_start = U_north;
for (U_y = U_start; U_y >= U_south; U_y -= ns_res) {
- D_y = (int)((U_south - U_y) * U_to_D_yconv + D_south);
- R_move_abs((int)D_west, D_y);
- R_cont_abs((int)D_east, D_y);
+ D_y = (U_south - U_y) * U_to_D_yconv + D_south;
+ R_move_abs(D_west, D_y);
+ R_cont_abs(D_east, D_y);
}
}
@@ -303,13 +303,13 @@
extern double D_ew, D_ns;
extern int D_x, D_y;
int len, text_size, rite;
- int tt, tb, tl, tr;
- char *itoa(), no[10];
+ double tt, tb, tl, tr;
+ char no[32];
double dots_per_line, factor = 0.8;
DCELL dcell = number;
CELL cell = (int)number;
- R_set_window(D_y, D_y + (int)(D_ns * 0.9), D_x, D_x + (int)(D_ew * 0.9));
+ R_set_window(D_y, D_y + D_ns * 0.9, D_x, D_x + D_ew * 0.9);
/* maybe ugly, but works */
if (map_type == CELL_TYPE) {
@@ -327,12 +327,12 @@
len = strlen(no);
dots_per_line = factor * D_ns;
- text_size = (int)(factor * (float)dots_per_line);
+ text_size = factor * dots_per_line;
rite = text_size * len;
while (rite > D_ew) {
factor = factor - 0.01;
- text_size = (int)(factor * (float)dots_per_line);
+ text_size = factor * dots_per_line;
rite = text_size * len;
}
@@ -343,8 +343,7 @@
R_move_abs(D_x+(int)(D_ew*0.1),D_y+(int)(D_ns*0.5)) ;
R_move_abs(D_x,D_y+(int)(dots_per_line - 1)) ;
*/
- R_move_abs((int)(D_x + ((float)D_ew / 2) - ((float)(tr - tl) / 2)),
- (int)(D_y + D_ns * 0.7));
+ R_move_abs(D_x + D_ew / 2 - (tr - tl) / 2, D_y + D_ns * 0.7);
R_text(no);
return 0;
Modified: grass/trunk/display/d.rgb/main.c
===================================================================
--- grass/trunk/display/d.rgb/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.rgb/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -45,7 +45,7 @@
struct Cell_head window;
struct GModule *module;
struct Flag *flag_o;
- int t, b, l, r;
+ double t, b, l, r;
int i;
G_gisinit(argv[0]);
Modified: grass/trunk/display/d.rhumbline/plot.c
===================================================================
--- grass/trunk/display/d.rhumbline/plot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.rhumbline/plot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -20,9 +20,7 @@
D_setup(0);
/* set D clip window */
- D_set_clip_window((int)D_get_d_north(),
- (int)D_get_d_south(),
- (int)D_get_d_west(), (int)D_get_d_east());
+ D_clip_to_display();
/* setup the G plot to use the D routines */
G_setup_plot(D_get_d_north(),
@@ -58,7 +56,7 @@
static int cont(int x, int y)
{
- if (D_cont_abs(x, y)) { /* clipped */
+ if (D_cont_abs_clip(x, y)) { /* clipped */
change_range = 1;
}
else { /* keep track of left,right x for lines drawn in window */
@@ -81,7 +79,7 @@
static int move(int x, int y)
{
- D_move_abs(x, y);
+ D_move_abs_clip(x, y);
return 0;
}
Modified: grass/trunk/display/d.text.new/main.c
===================================================================
--- grass/trunk/display/d.text.new/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.text.new/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -67,13 +67,13 @@
struct rectinfo
{
- int t, b, l, r;
+ double t, b, l, r;
};
static void set_color(char *);
-static int get_coordinates(int *, int *, double *, double *,
+static int get_coordinates(double *, double *, double *, double *,
struct rectinfo, char **, char, char);
-static void draw_text(char *, int *, int *, int, char *, double, char);
+static void draw_text(char *, double *, double *, double, char *, double, char);
int main(int argc, char **argv)
{
@@ -105,8 +105,8 @@
/* options and flags */
char *text;
- int size;
- int x, y;
+ double size;
+ double x, y;
int line;
double rotation;
char align[3];
@@ -125,9 +125,9 @@
int first_text;
int linefeed;
int set_l;
- int orig_x, orig_y;
- int prev_x, prev_y;
- int set_x, set_y;
+ double orig_x, orig_y;
+ double prev_x, prev_y;
+ double set_x, set_y;
double east, north;
/* initialize the GIS calls */
@@ -296,14 +296,12 @@
R_set_window(win.t, win.b, win.l, win.r);
if (flag.s->answer)
- size = (int)atof(opt.size->answer);
+ size = atof(opt.size->answer);
else
#ifdef BACKWARD_COMPATIBILITY
- size =
- (int)(atof(opt.size->answer) / 100.0 * (win.b - win.t) /
- linespacing);
+ size = atof(opt.size->answer) / 100.0 * (win.b - win.t) / linespacing;
#else
- size = (int)(atof(opt.size->answer) / 100.0 * (win.b - win.t));
+ size = atof(opt.size->answer) / 100.0 * (win.b - win.t);
#endif
set_color(opt.color->answer);
@@ -319,18 +317,18 @@
orig_y = y;
}
else {
- x = win.l + (int)(size * linespacing + 0.5) - size; /* d.text: +5 */
- y = win.t + line * (int)(size * linespacing + 0.5);
+ x = win.l + (size * linespacing + 0.5) - size; /* d.text: +5 */
+ y = win.t + line * (size * linespacing + 0.5);
}
prev_x = x;
prev_y = y;
R_text_size(size, size);
- R_text_rotation((float)(rotation * 180.0 / M_PI));
+ R_text_rotation(rotation * 180.0 / M_PI);
if (text) {
- int x2, y2;
+ double x2, y2;
x2 = x;
y2 = y;
@@ -400,11 +398,11 @@
d = atof(buf_ptr);
if (buf_ptr[buf_len - 1] != 'p')
#ifdef BACKWARD_COMPATIBILITY
- d *= (double)(win.b - win.t) / 100.0 / linespacing;
+ d *= (win.b - win.t) / 100.0 / linespacing;
#else
- d *= (double)(win.b - win.t) / 100.0;
+ d *= (win.b - win.t) / 100.0;
#endif
- size = (int)d + (i ? size : 0);
+ size = d + (i ? size : 0);
R_text_size(size, size);
break;
case 'B':
@@ -427,7 +425,7 @@
rotation = fmod(d, 2.0 * M_PI);
if (rotation < 0.0)
rotation += 2.0 * M_PI;
- R_text_rotation((float)(rotation * 180.0 / M_PI));
+ R_text_rotation(rotation * 180.0 / M_PI);
break;
case 'I':
/* linespacing */
@@ -443,11 +441,11 @@
d = atof(buf_ptr);
if (buf_ptr[buf_len - 1] == '%')
/* percentage */
- d *= (double)(win.r - win.l) / 100.0;
+ d *= (win.r - win.l) / 100.0;
else if (buf_ptr[buf_len - 1] != 'p')
/* column */
d = (d - 1) * size * linespacing + 0.5;
- x = prev_x = (int)d + (i ? x : orig_x);
+ x = prev_x = d + (i ? x : orig_x);
break;
case 'Y':
/* y */
@@ -459,11 +457,11 @@
d = atof(buf_ptr);
if (buf_ptr[buf_len - 1] == '%')
/* percentage */
- d = win.b - d * (double)(win.b - win.t) / 100.0;
+ d = win.b - d * (win.b - win.t) / 100.0;
else if (buf_ptr[buf_len - 1] != 'p')
/* row */
d *= size * linespacing + 0.5;
- y = prev_y = (int)d + (i ? y : orig_y);
+ y = prev_y = d + (i ? y : orig_y);
break;
case 'L':
/* linefeed */
@@ -476,10 +474,10 @@
i = 1;
d = atof(buf_ptr);
if (buf_ptr[buf_len - 1] == '%')
- d *= (double)(win.r - win.l) / 100.0;
+ d *= (win.r - win.l) / 100.0;
else if (buf_ptr[buf_len - 1] != 'p')
d = D_u_to_d_col(d);
- x = prev_x = orig_x = (int)d + (i ? orig_x : win.l);
+ x = prev_x = orig_x = d + (i ? orig_x : win.l);
break;
case 'N':
i = 0;
@@ -487,10 +485,10 @@
i = 1;
d = atof(buf_ptr);
if (buf_ptr[buf_len - 1] == '%')
- d *= (double)(win.b - win.t) / 100.0;
+ d *= (win.b - win.t) / 100.0;
else if (buf_ptr[buf_len - 1] != 'p')
d = D_u_to_d_row(d);
- y = prev_y = orig_y = (int)d + (i ? orig_y : win.t);
+ y = prev_y = orig_y = d + (i ? orig_y : win.t);
break;
}
}
@@ -503,11 +501,11 @@
/* if x is not given, increment x */
if (!set_x)
x = prev_x +
- (int)((size * linespacing + 0.5) * sin(rotation));
+ (size * linespacing + 0.5) * sin(rotation);
/* if y is not given, increment y */
if (!set_y)
y = prev_y +
- (int)((size * linespacing + 0.5) * cos(rotation));
+ (size * linespacing + 0.5) * cos(rotation);
prev_x = x;
prev_y = y;
}
@@ -554,7 +552,7 @@
}
static int
-get_coordinates(int *x, int *y, double *east, double *north,
+get_coordinates(double *x, double *y, double *east, double *north,
struct rectinfo win, char **at, char pixel,
char geocoor)
{
@@ -566,18 +564,18 @@
if (pixel) {
*x = e + win.l;
*y = n + win.t;
- e = D_d_to_u_col((double)*x);
- n = D_d_to_u_row((double)*y);
+ e = D_d_to_u_col(*x);
+ n = D_d_to_u_row(*y);
}
else if (geocoor) {
- *x = (int)D_u_to_d_col(e);
- *y = (int)D_u_to_d_row(n);
+ *x = D_u_to_d_col(e);
+ *y = D_u_to_d_row(n);
}
else {
- *x = win.l + (int)((win.r - win.l) * e / 100.0);
- *y = win.t + (int)((win.b - win.t) * (100.0 - n) / 100.0);
- e = D_d_to_u_col((double)*x);
- n = D_d_to_u_row((double)*y);
+ *x = win.l + (win.r - win.l) * e / 100.0;
+ *y = win.t + (win.b - win.t) * (100.0 - n) / 100.0;
+ e = D_d_to_u_col(*x);
+ n = D_d_to_u_row(*y);
}
}
else
@@ -591,11 +589,11 @@
return 0;
}
-static void draw_text(char *text, int *x, int *y, int size, char *align,
+static void draw_text(char *text, double *x, double *y, double size, char *align,
double rotation, char bold)
{
- int w, h;
- int t, b, l, r;
+ double w, h;
+ double t, b, l, r;
double c, s;
/* TODO: get text dimension */
@@ -607,7 +605,7 @@
R_get_text_box(text, &t, &b, &l, &r);
if (rotation != 0.0)
- R_text_rotation((float)(rotation * 180.0 / M_PI));
+ R_text_rotation(rotation * 180.0 / M_PI);
w = r - l;
h = b - t;
if (w > 0)
@@ -662,8 +660,8 @@
R_text(text);
}
- *x += (int)(w * c);
- *y -= (int)(w * s);
+ *x += w * c;
+ *y -= w * s;
return;
}
Modified: grass/trunk/display/d.thematic.area/main.c
===================================================================
--- grass/trunk/display/d.thematic.area/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.thematic.area/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -157,9 +157,7 @@
render_opt->options = "g,r,d,c,l";
render_opt->description = _("Rendering method for filled polygons");
render_opt->descriptions =
- _("g;use the libgis render functions (features: clipping);"
- "r;use the raster graphics library functions (features: polylines);"
- "d;use the display library basic functions (features: polylines);"
+ _("d;use the display library basic functions (features: polylines);"
"c;use the display library clipping functions (features: clipping);"
"l;use the display library culling functions (features: culling, polylines)");
@@ -189,20 +187,15 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- if (G_strcasecmp(render_opt->answer, "g") == 0)
- render = RENDER_GPP;
- else if (G_strcasecmp(render_opt->answer, "r") == 0)
- render = RENDER_RPA;
- else if (G_strcasecmp(render_opt->answer, "d") == 0)
+ if (G_strcasecmp(render_opt->answer, "d") == 0)
render = RENDER_DP;
else if (G_strcasecmp(render_opt->answer, "c") == 0)
render = RENDER_DPC;
else if (G_strcasecmp(render_opt->answer, "l") == 0)
render = RENDER_DPL;
else
- render = RENDER_GPP;
+ G_fatal_error(_("Invalid rendering method <%s>"), render_opt->answer);
-
if (G_verbose() > G_verbose_std())
verbose = TRUE;
@@ -413,9 +406,6 @@
D_setup(0);
- G_setup_plot(D_get_d_north(), D_get_d_south(),
- D_get_d_west(), D_get_d_east(), D_move_abs, D_cont_abs);
-
if (verbose)
G_message(_("Plotting ..."));
Modified: grass/trunk/display/d.thematic.area/plot.h
===================================================================
--- grass/trunk/display/d.thematic.area/plot.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.thematic.area/plot.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -15,8 +15,6 @@
#define DISP_ATTR 0x10
#define DISP_ZCOOR 0x20
-#define RENDER_GPP 0
-#define RENDER_RPA 1
#define RENDER_DP 2
#define RENDER_DPC 3
#define RENDER_DPL 4
Modified: grass/trunk/display/d.thematic.area/plot1.c
===================================================================
--- grass/trunk/display/d.thematic.area/plot1.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.thematic.area/plot1.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -35,46 +35,14 @@
{0, 139, 139} /* 16: dark cyan */
};
-/*local functions */
-static void local_plot_poly(double *xf, double *yf, int n, int type);
-
/*global render switch */
int render;
/* *************************************************************** */
-/* function to plot polygons and polylines ***************** */
-/* the parameter type switches render mode ***************** */
-/* *************************************************************** */
-static void local_plot_poly(double *xf, double *yf, int n, int type)
-{
- static int *xi, *yi;
- static int nalloc;
- int i;
-
- if (nalloc < n) {
- nalloc = n;
- xi = G_realloc(xi, nalloc * sizeof(int));
- yi = G_realloc(yi, nalloc * sizeof(int));
- }
-
- for (i = 0; i < n; i++) {
- xi[i] = (int)floor(0.5 + D_u_to_d_col(xf[i]));
- yi[i] = (int)floor(0.5 + D_u_to_d_row(yf[i]));
- }
-
- if (type == RENDER_POLYGON)
- R_polygon_abs(xi, yi, n);
- else
- R_polyline_abs(xi, yi, n);
-}
-
-/* *************************************************************** */
/* function to use different render methods for polylines ******** */
/* *************************************************************** */
void plot_polyline(double *xf, double *yf, int n)
{
- int i;
-
switch (render) {
case RENDER_DP:
D_polyline(xf, yf, n);
@@ -85,14 +53,6 @@
case RENDER_DPL:
D_polyline_cull(xf, yf, n);
break;
- case RENDER_RPA:
- local_plot_poly(xf, yf, n, RENDER_POLYLINE);
- break;
- case RENDER_GPP:
- default:
- for (i = 1; i < n; i++)
- G_plot_line(xf[i - 1], yf[i - 1], xf[i], yf[i]);
- break;
}
}
@@ -102,9 +62,6 @@
void plot_polygon(double *xf, double *yf, int n)
{
switch (render) {
- case RENDER_GPP:
- G_plot_polygon(xf, yf, n);
- break;
case RENDER_DP:
D_polygon(xf, yf, n);
break;
@@ -114,12 +71,6 @@
case RENDER_DPL:
D_polygon_cull(xf, yf, n);
break;
- case RENDER_RPA:
- local_plot_poly(xf, yf, n, RENDER_POLYGON);
- break;
- default:
- G_plot_polygon(xf, yf, n);
- break;
}
}
@@ -460,7 +411,8 @@
if (!(color || fcolor || custom_rgb))
continue;
- G_plot_where_xy(x[0], y[0], &x0, &y0);
+ x0 = D_u_to_d_col(x[0]);
+ y0 = D_u_to_d_row(y[0]);
/* skip if the point is outside of the display window */
/* xy<0 tests make it go ever-so-slightly faster */
Modified: grass/trunk/display/d.vect/attr.c
===================================================================
--- grass/trunk/display/d.vect/attr.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/attr.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -14,7 +14,9 @@
double xl, yl;
struct line_pnts *Points;
struct line_cats *Cats;
- int X, Y, T, B, L, R, Xoffset, Yoffset, xarr[5], yarr[5];
+ int X, Y, Xoffset, Yoffset;
+ double xarr[5], yarr[5];
+ double T, B, L, R;
int cat;
char buf[2000];
struct field_info *fi;
Modified: grass/trunk/display/d.vect/dir.c
===================================================================
--- grass/trunk/display/d.vect/dir.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/dir.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -64,15 +64,15 @@
Vect_point_on_line(Points, len * 0.25, &x, &y, NULL, &angle, NULL);
G_debug(3, "plot direction: %f, %f", x, y);
- G_plot_icon(x, y, G_ICON_ARROW, angle, msize);
+ D_plot_icon(x, y, G_ICON_ARROW, angle, msize);
Vect_point_on_line(Points, len * 0.5, &x, &y, NULL, &angle, NULL);
G_debug(3, "plot direction: %f, %f", x, y);
- G_plot_icon(x, y, G_ICON_ARROW, angle, msize);
+ D_plot_icon(x, y, G_ICON_ARROW, angle, msize);
Vect_point_on_line(Points, len * 0.75, &x, &y, NULL, &angle, NULL);
G_debug(3, "plot direction: %f, %f", x, y);
- G_plot_icon(x, y, G_ICON_ARROW, angle, msize);
+ D_plot_icon(x, y, G_ICON_ARROW, angle, msize);
}
Modified: grass/trunk/display/d.vect/label.c
===================================================================
--- grass/trunk/display/d.vect/label.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/label.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -12,7 +12,9 @@
double xl, yl;
struct line_pnts *Points;
struct line_cats *Cats;
- int X, Y, T, B, L, R, Xoffset, Yoffset, xarr[5], yarr[5];
+ int X, Y, Xoffset, Yoffset;
+ double xarr[5], yarr[5];
+ double T, B, L, R;
int cat;
char text[100];
Modified: grass/trunk/display/d.vect/main.c
===================================================================
--- grass/trunk/display/d.vect/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -328,13 +328,11 @@
render_opt->type = TYPE_STRING;
render_opt->required = NO;
render_opt->multiple = NO;
- render_opt->answer = "c";
- render_opt->options = "g,r,d,c,l";
+ render_opt->answer = "l";
+ render_opt->options = "d,c,l";
render_opt->description = _("Rendering method for filled polygons");
render_opt->descriptions =
- _("g;use the libgis render functions (features: clipping);"
- "r;use the raster graphics library functions (features: polylines);"
- "d;use the display library basic functions (features: polylines);"
+ _("d;use the display library basic functions (features: polylines);"
"c;use the display library clipping functions (features: clipping);"
"l;use the display library culling functions (features: culling, polylines)");
@@ -371,18 +369,14 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- if (G_strcasecmp(render_opt->answer, "g") == 0)
- render = RENDER_GPP;
- else if (G_strcasecmp(render_opt->answer, "r") == 0)
- render = RENDER_RPA;
- else if (G_strcasecmp(render_opt->answer, "d") == 0)
+ if (G_strcasecmp(render_opt->answer, "d") == 0)
render = RENDER_DP;
else if (G_strcasecmp(render_opt->answer, "c") == 0)
render = RENDER_DPC;
else if (G_strcasecmp(render_opt->answer, "l") == 0)
render = RENDER_DPL;
else
- render = RENDER_GPP;
+ G_fatal_error(_("Invalid rendering method <%s>"), render_opt->answer);
/* please remove -v flag before GRASS 7 released */
if (verbose_flag->answer) {
@@ -628,9 +622,6 @@
D_setup(0);
- G_setup_plot(D_get_d_north(), D_get_d_south(),
- D_get_d_west(), D_get_d_east(), D_move_abs, D_cont_abs);
-
if (verbose)
G_message(_("Plotting ..."));
Modified: grass/trunk/display/d.vect/plot.h
===================================================================
--- grass/trunk/display/d.vect/plot.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/plot.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -34,8 +34,6 @@
#define DISP_ATTR 0x10
#define DISP_ZCOOR 0x20
-#define RENDER_GPP 0
-#define RENDER_RPA 1
#define RENDER_DP 2
#define RENDER_DPC 3
#define RENDER_DPL 4
Modified: grass/trunk/display/d.vect/plot1.c
===================================================================
--- grass/trunk/display/d.vect/plot1.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/plot1.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -35,46 +35,14 @@
{0, 139, 139} /* 16: dark cyan */
};
-/*local functions */
-static void local_plot_poly(double *xf, double *yf, int n, int type);
-
/*global render switch */
int render;
/* *************************************************************** */
-/* function to plot polygons and polylines ***************** */
-/* the parameter type switches render mode ***************** */
-/* *************************************************************** */
-static void local_plot_poly(double *xf, double *yf, int n, int type)
-{
- static int *xi, *yi;
- static int nalloc;
- int i;
-
- if (nalloc < n) {
- nalloc = n;
- xi = G_realloc(xi, nalloc * sizeof(int));
- yi = G_realloc(yi, nalloc * sizeof(int));
- }
-
- for (i = 0; i < n; i++) {
- xi[i] = (int)floor(0.5 + D_u_to_d_col(xf[i]));
- yi[i] = (int)floor(0.5 + D_u_to_d_row(yf[i]));
- }
-
- if (type == RENDER_POLYGON)
- R_polygon_abs(xi, yi, n);
- else
- R_polyline_abs(xi, yi, n);
-}
-
-/* *************************************************************** */
/* function to use different render methods for polylines ******** */
/* *************************************************************** */
void plot_polyline(double *xf, double *yf, int n)
{
- int i;
-
switch (render) {
case RENDER_DP:
D_polyline(xf, yf, n);
@@ -85,14 +53,6 @@
case RENDER_DPL:
D_polyline_cull(xf, yf, n);
break;
- case RENDER_RPA:
- local_plot_poly(xf, yf, n, RENDER_POLYLINE);
- break;
- case RENDER_GPP:
- default:
- for (i = 1; i < n; i++)
- G_plot_line(xf[i - 1], yf[i - 1], xf[i], yf[i]);
- break;
}
}
@@ -102,9 +62,6 @@
void plot_polygon(double *xf, double *yf, int n)
{
switch (render) {
- case RENDER_GPP:
- G_plot_polygon(xf, yf, n);
- break;
case RENDER_DP:
D_polygon(xf, yf, n);
break;
@@ -114,12 +71,6 @@
case RENDER_DPL:
D_polygon_cull(xf, yf, n);
break;
- case RENDER_RPA:
- local_plot_poly(xf, yf, n, RENDER_POLYGON);
- break;
- default:
- G_plot_polygon(xf, yf, n);
- break;
}
}
@@ -138,7 +89,7 @@
struct line_pnts *Points, *PPoints;
struct line_cats *Cats;
double msize;
- int x0, y0;
+ double x0, y0;
struct field_info *fi = NULL;
dbDriver *driver = NULL;
@@ -479,7 +430,8 @@
if (!(color || fcolor || custom_rgb))
continue;
- G_plot_where_xy(x[0], y[0], &x0, &y0);
+ x0 = D_u_to_d_col(x[0]);
+ y0 = D_u_to_d_row(y[0]);
/* skip if the point is outside of the display window */
/* xy<0 tests make it go ever-so-slightly faster */
Modified: grass/trunk/display/d.vect/topo.c
===================================================================
--- grass/trunk/display/d.vect/topo.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/topo.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -11,7 +11,7 @@
double xl, yl;
struct line_pnts *Points;
struct line_cats *Cats;
- int X, Y, T, B, L, R, Xoffset, Yoffset, xarr[5], yarr[5];
+ double X, Y, T, B, L, R, Xoffset, Yoffset, xarr[5], yarr[5];
char text[50];
G_debug(1, "display topo:");
@@ -51,19 +51,19 @@
if ((ltype & GV_POINTS) || Points->n_points == 1)
/* point/centroid or line/boundary with one coor */
{
- X = (int)(D_u_to_d_col(Points->x[0]));
- Y = (int)(D_u_to_d_row(Points->y[0]));
+ X = D_u_to_d_col(Points->x[0]);
+ Y = D_u_to_d_row(Points->y[0]);
}
else if (Points->n_points == 2) { /* line with two coors */
xl = (Points->x[0] + Points->x[1]) / 2;
yl = (Points->y[0] + Points->y[1]) / 2;
- X = (int)(D_u_to_d_col(xl));
- Y = (int)(D_u_to_d_row(yl));
+ X = D_u_to_d_col(xl);
+ Y = D_u_to_d_row(yl);
}
else {
i = Points->n_points / 2;
- X = (int)(D_u_to_d_col(Points->x[i]));
- Y = (int)(D_u_to_d_row(Points->y[i]));
+ X = D_u_to_d_col(Points->x[i]);
+ Y = D_u_to_d_row(Points->y[i]);
}
X = X + 0.5 * lattr->size;
@@ -124,8 +124,8 @@
Vect_get_node_coor(Map, el, &xl, &yl, NULL);
G_debug(3, "node = %d", el);
- X = (int)(D_u_to_d_col(xl));
- Y = (int)(D_u_to_d_row(yl));
+ X = D_u_to_d_col(xl);
+ Y = D_u_to_d_row(yl);
X = X + 0.5 * lattr->size;
Y = Y + 1.5 * lattr->size;
@@ -176,7 +176,7 @@
R_move_abs(X + Xoffset, Y + Yoffset);
R_text(text);
- G_plot_icon(xl, yl, G_ICON_BOX, 0, 10);
+ D_plot_icon(xl, yl, G_ICON_BOX, 0, 10);
}
Vect_destroy_line_struct(Points);
Modified: grass/trunk/display/d.vect/zcoor.c
===================================================================
--- grass/trunk/display/d.vect/zcoor.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect/zcoor.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -12,7 +12,7 @@
double xl, yl, zl;
struct line_pnts *Points;
struct line_cats *Cats;
- int X, Y, T, B, L, R, Xoffset, Yoffset, xarr[5], yarr[5];
+ double X, Y, T, B, L, R, Xoffset, Yoffset, xarr[5], yarr[5];
char text[50];
G_debug(1, "display zcoor:");
@@ -39,8 +39,8 @@
Vect_get_node_coor(Map, el, &xl, &yl, &zl);
G_debug(3, "node = %d", el);
- X = (int)(D_u_to_d_col(xl));
- Y = (int)(D_u_to_d_row(yl));
+ X = D_u_to_d_col(xl);
+ Y = D_u_to_d_row(yl);
X = X + 0.5 * lattr->size;
Y = Y + 1.5 * lattr->size;
Modified: grass/trunk/display/d.vect.chart/bar.c
===================================================================
--- grass/trunk/display/d.vect.chart/bar.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect.chart/bar.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -60,10 +60,9 @@
/* the outline color : default is black */
R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
- for (j = 1; j < max_Points->n_points; j++) {
- G_plot_line(max_Points->x[j], max_Points->y[j],
- max_Points->x[j - 1], max_Points->y[j - 1]);
- }
+ D_move(max_Points->x[j], max_Points->y[j]);
+ for (j = 1; j < max_Points->n_points; j++)
+ D_cont(max_Points->x[j], max_Points->y[j]);
}
}
@@ -84,10 +83,9 @@
}
R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
- for (j = 1; j < Points->n_points; j++) {
- G_plot_line(Points->x[j], Points->y[j], Points->x[j - 1],
- Points->y[j - 1]);
- }
+ D_move(Points->x[0], Points->y[0]);
+ for (j = 1; j < Points->n_points; j++)
+ D_cont(Points->x[j], Points->y[j]);
}
/* tidy up */
Modified: grass/trunk/display/d.vect.chart/main.c
===================================================================
--- grass/trunk/display/d.vect.chart/main.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect.chart/main.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -271,9 +271,6 @@
D_setup(0);
- G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
- D_get_d_east(), D_move_abs, D_cont_abs);
-
ret = plot(ctype, &Map, type, field,
columns_opt->answer, ncols,
sizecol_opt->answer, size, scale,
Modified: grass/trunk/display/d.vect.chart/pie.c
===================================================================
--- grass/trunk/display/d.vect.chart/pie.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.vect.chart/pie.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -58,10 +58,9 @@
}
R_RGB_color(ocolor->r, ocolor->g, ocolor->b);
- for (j = 1; j < Points->n_points; j++) {
- G_plot_line(Points->x[j], Points->y[j], Points->x[j - 1],
- Points->y[j - 1]);
- }
+ D_move(Points->x[0], Points->y[0]);
+ for (j = 1; j < Points->n_points; j++)
+ D_cont(Points->x[j], Points->y[j]);
}
Vect_destroy_line_struct(Points);
Deleted: grass/trunk/display/d.what.vect/flash.c
===================================================================
--- grass/trunk/display/d.what.vect/flash.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/display/d.what.vect/flash.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,82 +0,0 @@
-/* flash.c
- - to draw areas and lines in toggled color just to be redrawn
- in the calling routine back to the previous color
- making quick 'flash' --alex, nov/02
- */
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include <grass/Vect.h>
-#include "what.h"
-
-void
-flash_area(struct Map_info *Map, plus_t area, struct line_pnts *Points,
- int flash_colr)
-{
- struct line_pnts *Points_i;
-
- int i, j, isle, n_isles, n_points;
- double xl, yl;
-
- Points_i = Vect_new_line_struct();
-
- /* fill */
- Vect_get_area_points(Map, area, Points);
-
- n_points = Points->n_points;
- xl = Points->x[n_points - 1];
- yl = Points->y[n_points - 1];
- n_isles = Vect_get_area_num_isles(Map, area);
- for (i = 0; i < n_isles; i++) {
- isle = Vect_get_area_isle(Map, area, i);
- Vect_get_isle_points(Map, isle, Points_i);
- Vect_append_points(Points, Points_i, GV_FORWARD);
- Vect_append_point(Points, xl, yl, 0); /* ??? */
- }
-
- R_standard_color(flash_colr);
- G_plot_polygon(Points->x, Points->y, Points->n_points);
-
- /* boundary */
- Vect_get_area_points(Map, area, Points);
-
- for (i = 0; i < Points->n_points - 1; i++) {
- G_plot_line(Points->x[i], Points->y[i], Points->x[i + 1],
- Points->y[i + 1]);
- }
- for (i = 0; i < n_isles; i++) {
- isle = Vect_get_area_isle(Map, area, i);
- Vect_get_isle_points(Map, isle, Points);
- for (j = 0; j < Points->n_points - 1; j++) {
- G_plot_line(Points->x[j], Points->y[j], Points->x[j + 1],
- Points->y[j + 1]);
- }
- }
-
- Vect_destroy_line_struct(Points_i);
- R_flush();
-
-
-}
-
-void
-flash_line(struct Map_info *Map, plus_t line, struct line_pnts *Points,
- int flash_colr)
-{
- double *x, *y;
- int j, np;
-
- np = Points->n_points;
- x = Points->x;
- y = Points->y;
-
- R_standard_color(flash_colr);
-
- for (j = 1; j < np; j++) {
-
- G_plot_line(x[0], y[0], x[1], y[1]);
- x++;
- y++;
- }
- R_flush();
-}
Modified: grass/trunk/imagery/i.class/graphics.c
===================================================================
--- grass/trunk/imagery/i.class/graphics.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.class/graphics.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -91,7 +91,7 @@
int Text_width(char *text)
{
- int top, bottom, left, right;
+ double top, bottom, left, right;
R_get_text_box(text, &top, &bottom, &left, &right);
Modified: grass/trunk/imagery/i.ortho.photo/photo.2image/dot.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.2image/dot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.ortho.photo/photo.2image/dot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -3,7 +3,7 @@
int dot(int x, int y)
{
- int vx[5], vy[5];
+ double vx[5], vy[5];
vx[0] = x;
vy[0] = y - dotsize;
Modified: grass/trunk/imagery/i.ortho.photo/photo.2image/graphics.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.2image/graphics.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.ortho.photo/photo.2image/graphics.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -89,7 +89,7 @@
int Text_width(char *text)
{
- int top, bottom, left, right;
+ double top, bottom, left, right;
R_get_text_box(text, &top, &bottom, &left, &right);
Modified: grass/trunk/imagery/i.ortho.photo/photo.2target/dot.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.2target/dot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.ortho.photo/photo.2target/dot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -3,7 +3,7 @@
int dot(int x, int y)
{
- int vx[5], vy[5];
+ double vx[5], vy[5];
vx[0] = x;
vy[0] = y - dotsize;
Modified: grass/trunk/imagery/i.ortho.photo/photo.2target/graphics.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.2target/graphics.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.ortho.photo/photo.2target/graphics.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -96,7 +96,7 @@
int Text_width(char *text)
{
- int top, bottom, left, right;
+ double top, bottom, left, right;
R_get_text_box(text, &top, &bottom, &left, &right);
Modified: grass/trunk/imagery/i.points/dot.c
===================================================================
--- grass/trunk/imagery/i.points/dot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.points/dot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -2,7 +2,7 @@
#include <grass/raster.h>
int dot(int x, int y)
{
- int vx[5], vy[5];
+ double vx[5], vy[5];
vx[0] = x;
vy[0] = y - dotsize;
Modified: grass/trunk/imagery/i.points/graphics.c
===================================================================
--- grass/trunk/imagery/i.points/graphics.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.points/graphics.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -94,7 +94,7 @@
int Text_width(char *text)
{
- int top, bottom, left, right;
+ double top, bottom, left, right;
R_get_text_box(text, &top, &bottom, &left, &right);
Modified: grass/trunk/imagery/i.vpoints/dot.c
===================================================================
--- grass/trunk/imagery/i.vpoints/dot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.vpoints/dot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -3,7 +3,7 @@
int dot(int x, int y)
{
- int vx[5], vy[5];
+ double vx[5], vy[5];
vx[0] = x;
vy[0] = y - dotsize;
Modified: grass/trunk/imagery/i.vpoints/graphics.c
===================================================================
--- grass/trunk/imagery/i.vpoints/graphics.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.vpoints/graphics.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -81,7 +81,7 @@
int Text_width(char *text)
{
- int top, bottom, left, right;
+ double top, bottom, left, right;
R_get_text_box(text, &top, &bottom, &left, &right);
Modified: grass/trunk/imagery/i.vpoints/plot.c
===================================================================
--- grass/trunk/imagery/i.vpoints/plot.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.vpoints/plot.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -14,8 +14,6 @@
int plot(char *name, char *mapset, struct line_pnts *Points)
{
- double *x, *y;
- int i, np;
int line, nlines, ltype;
struct Cell_head window;
struct Map_info P_map;
@@ -33,9 +31,6 @@
G_get_set_window(&window);
- G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
- D_get_d_east(), D_move_abs, D_cont_abs);
-
nlines = Vect_get_num_lines(&P_map);
/* set line and fill color for vector point symbols */
@@ -72,16 +67,7 @@
if (ltype & GV_LINES) { /* GV_ plural: both lines and boundaries */
-
- np = Points->n_points;
- x = Points->x;
- y = Points->y;
-
- for (i = 1; i < np; i++) {
- G_plot_line(x[0], y[0], x[1], y[1]);
- x++;
- y++;
- }
+ D_polyline(Points->x, Points->y, Points->n_points);
}
}
@@ -115,9 +101,6 @@
G_get_set_window(&window);
- G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
- D_get_d_east(), D_move_abs, D_cont_abs);
-
nlines = Vect_get_num_lines(&P_map);
/* set line and fill color for vector point symbols */
@@ -157,21 +140,16 @@
D_symbol(Symb, ix, iy, linecolor_rgb, fillcolor_rgb);
}
-
if (ltype & GV_LINES) { /* GV_ plural: both lines and boundaries */
np = Points->n_points;
x = Points->x;
y = Points->y;
- CRS_georef(x[0], y[0], &x[0], &y[0], E, N, trans_order);
+ for (i = 1; i < np; i++)
+ CRS_georef(x[i], y[i], &x[i], &y[i], E, N, trans_order);
- for (i = 1; i < np; i++) {
- CRS_georef(x[1], y[1], &x[1], &y[1], E, N, trans_order);
- G_plot_line(x[0], y[0], x[1], y[1]);
- x++;
- y++;
- }
+ D_polyline(x, y, np);
}
}
Modified: grass/trunk/imagery/i.vpoints/setup.c
===================================================================
--- grass/trunk/imagery/i.vpoints/setup.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/imagery/i.vpoints/setup.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -28,7 +28,7 @@
int dsp_setup(int blank, struct Cell_head *cellhead)
{
char name[128];
- int t, b, l, r;
+ double t, b, l, r;
if (D_get_cur_wind(name)) {
t = R_screen_top();
@@ -54,8 +54,7 @@
}
}
- if (D_check_map_window(cellhead))
- G_fatal_error("Setting graphics coordinates");
+ D_check_map_window(cellhead);
if (G_set_window(cellhead) < 0)
G_fatal_error("Invalid graphics window coordinates");
@@ -64,7 +63,7 @@
if (D_do_conversions(cellhead, t, b, l, r))
G_fatal_error("Error calculating graphics window conversions");
- D_set_clip_window(t, b, l, r);
+ D_set_clip(t, b, l, r);
/* set text clipping, for good measure */
R_set_window(t, b, l, r);
Modified: grass/trunk/include/display.h
===================================================================
--- grass/trunk/include/display.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/include/display.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -5,7 +5,7 @@
#include <grass/symbol.h>
/* cnversions.c */
-int D_do_conversions(const struct Cell_head *, int, int, int, int);
+int D_do_conversions(const struct Cell_head *, double, double, double, double);
int D_is_lat_lon(void);
double D_get_u_to_d_xconv(void);
double D_get_u_to_d_yconv(void);
@@ -35,25 +35,22 @@
double D_get_ew_resolution(void);
void D_get_u(double[2][2]);
void D_get_a(int[2][2]);
-void D_get_d(int[2][2]);
+void D_get_d(double[2][2]);
/* color_list.c */
char *D_color_list(void);
-/* draw.c */
-int D_set_clip_window(int, int, int, int);
-int D_set_clip_window_to_map_window(void);
-int D_set_clip_window_to_screen_window(void);
-int D_cont_abs(int, int);
-int D_cont_rel(int, int);
-int D_move_abs(int, int);
-int D_move_rel(int, int);
-
/* draw2.c */
void D_set_clip(double, double, double, double);
void D_clip_to_map(void);
+void D_clip_to_display(void);
+void D_clip_to_screen(void);
void D_move_clip(double, double);
int D_cont_clip(double, double);
+int D_line_clip(double, double, double, double);
+void D_move_abs_clip(double, double);
+int D_cont_abs_clip(double, double);
+int D_line_abs_clip(double, double, double, double);
void D_polydots_clip(const double *, const double *, int);
void D_polyline_cull(const double *, const double *, int);
void D_polyline_clip(const double *, const double *, int);
@@ -62,27 +59,31 @@
void D_box_clip(double, double, double, double);
void D_move(double, double);
void D_cont(double, double);
+void D_line(double, double, double, double);
void D_polydots(const double *, const double *, int);
void D_polyline(const double *, const double *, int);
void D_polygon(const double *, const double *, int);
void D_box(double, double, double, double);
void D_line_width(double);
+void D_move_abs(double, double);
+void D_cont_abs(double, double);
+void D_line_abs(double, double, double, double);
+/* icon.c */
+void D_plot_icon(double, double, int, double, double);
+
/* list.c */
void D_clear_window(void);
void D_set_erase_color(const char *);
void D_get_erase_color(char *);
-/* popup.c */
-int D_popup(int, int, int, int, int, int, char *[]);
-
/* raster.c */
int D_draw_raster(int, const void *, struct Colors *, RASTER_MAP_TYPE);
int D_draw_d_raster(int, const DCELL *, struct Colors *);
int D_draw_f_raster(int, const FCELL *, struct Colors *);
int D_draw_c_raster(int, const CELL *, struct Colors *);
int D_draw_cell(int, const CELL *, struct Colors *);
-int D_cell_draw_setup(int, int, int, int);
+int D_cell_draw_setup(double, double, double, double);
int D_draw_raster_RGB(int, const void *, const void *, const void *,
struct Colors *, struct Colors *, struct Colors *,
RASTER_MAP_TYPE, RASTER_MAP_TYPE, RASTER_MAP_TYPE);
@@ -100,9 +101,9 @@
int D_setup(int);
/* symbol.c */
-void D_symbol(const SYMBOL *, int, int, const RGBA_Color *,
+void D_symbol(const SYMBOL *, double, double, const RGBA_Color *,
const RGBA_Color *);
-void D_symbol2(const SYMBOL *, int, int, const RGBA_Color *,
+void D_symbol2(const SYMBOL *, double, double, const RGBA_Color *,
const RGBA_Color *);
/* tran_colr.c */
@@ -114,12 +115,12 @@
int D_color_number_to_RGB(int, int *, int *, int *);
/* window.c */
-void D_new_window(char *, int, int, int, int);
-void D_new_window_percent(char *, float, float, float, float);
+void D_new_window(char *, double, double, double, double);
+void D_new_window_percent(char *, double, double, double, double);
void D_show_window(int);
-int D_get_screen_window(int *, int *, int *, int *);
+int D_get_screen_window(double *, double *, double *, double *);
void D_check_map_window(struct Cell_head *);
-void D_reset_screen_window(int, int, int, int);
+void D_reset_screen_window(double, double, double, double);
void D_remove_window(void);
void D_erase_window(void);
void D_erase(const char *);
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/include/gisdefs.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -904,7 +904,6 @@
int G_plot_polygon(const double *, const double *, int);
int G_plot_area(double *const *, double *const *, int *, int);
int G_plot_fx(double (*)(double), double, double);
-int G_plot_icon(double, double, int, double, double);
/* pole_in_poly.c */
int G_pole_in_polygon(const double *, const double *, int);
Modified: grass/trunk/include/raster.h
===================================================================
--- grass/trunk/include/raster.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/include/raster.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -5,43 +5,44 @@
int R_open_driver(void);
void R_close_driver(void);
-int R_screen_left(void);
-int R_screen_rite(void);
-int R_screen_bot(void);
-int R_screen_top(void);
+double R_screen_left(void);
+double R_screen_rite(void);
+double R_screen_bot(void);
+double R_screen_top(void);
+
int R_get_num_colors(void);
void R_standard_color(int);
-void R_RGB_color(unsigned char, unsigned char, unsigned char);
+void R_RGB_color(int, int, int);
-void R_line_width(int);
+void R_line_width(double);
void R_erase(void);
-void R_move_abs(int, int);
-void R_move_rel(int, int);
-void R_cont_abs(int, int);
-void R_cont_rel(int, int);
-void R_polydots_abs(const int *, const int *, int);
-void R_polydots_rel(const int *, const int *, int);
-void R_polyline_abs(const int *, const int *, int);
-void R_polyline_rel(const int *, const int *, int);
-void R_polygon_abs(const int *, const int *, int);
-void R_polygon_rel(const int *, const int *, int);
-void R_box_abs(int, int, int, int);
-void R_box_rel(int, int);
+void R_move_abs(double, double);
+void R_move_rel(double, double);
+void R_cont_abs(double, double);
+void R_cont_rel(double, double);
+void R_polydots_abs(const double *, const double *, int);
+void R_polydots_rel(const double *, const double *, int);
+void R_polyline_abs(const double *, const double *, int);
+void R_polyline_rel(const double *, const double *, int);
+void R_polygon_abs(const double *, const double *, int);
+void R_polygon_rel(const double *, const double *, int);
+void R_box_abs(double, double, double, double);
+void R_box_rel(double, double);
-void R_text_size(int, int);
-void R_text_rotation(float);
-void R_set_window(int, int, int, int);
+void R_text_size(double, double);
+void R_text_rotation(double);
+void R_set_window(double, double, double, double);
void R_text(const char *);
-void R_get_text_box(const char *, int *, int *, int *, int *);
+void R_get_text_box(const char *, double *, double *, double *, double *);
void R_font(const char *);
void R_charset(const char *);
void R_font_list(char ***, int *);
void R_font_info(char ***, int *);
-void R_begin_scaled_raster(int, int[2][2], int[2][2]);
+void R_begin_scaled_raster(int, int[2][2], double[2][2]);
int R_scaled_raster(int, int,
const unsigned char *,
const unsigned char *,
Modified: grass/trunk/lib/cairodriver/Box.c
===================================================================
--- grass/trunk/lib/cairodriver/Box.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Box.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -2,12 +2,11 @@
/* Box_abs: Draw a (filled) rectangle */
-void Cairo_Box(int x1, int y1, int x2, int y2)
+void Cairo_Box(double x1, double y1, double x2, double y2)
{
- G_debug(3, "Cairo_Box_abs %d %d %d %d\n", x1, y1, x2, y2);
+ G_debug(3, "Cairo_Box %f %f %f %f\n", x1, y1, x2, y2);
- cairo_rectangle(cairo, (double)x1, (double)y1, (double)x2 - x1,
- (double)y2 - y1);
+ cairo_rectangle(cairo, x1, y1, x2 - x1, y2 - y1);
cairo_fill(cairo);
modified = 1;
}
Modified: grass/trunk/lib/cairodriver/Draw_line.c
===================================================================
--- grass/trunk/lib/cairodriver/Draw_line.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Draw_line.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,8 +1,8 @@
#include "cairodriver.h"
-void Cairo_draw_line(int x1, int y1, int x2, int y2)
+void Cairo_draw_line(double x1, double y1, double x2, double y2)
{
- G_debug(3, "Cairo_draw_line: %d %d %d %d", x1, y1, x2, y2);
+ G_debug(3, "Cairo_draw_line: %f %f %f %f", x1, y1, x2, y2);
if (x1 == x2 && y1 == y2) {
/* don't draw degenerate lines */
Modified: grass/trunk/lib/cairodriver/Draw_point.c
===================================================================
--- grass/trunk/lib/cairodriver/Draw_point.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Draw_point.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -3,12 +3,13 @@
#define POINTSIZE 1.0
#define HALFPOINTSIZE (0.5*POINTSIZE)
-void Cairo_draw_point(int x, int y)
+void Cairo_draw_point(double x, double y)
{
- G_debug(3, "Cairo_draw_point: %d %d", x, y);
+ G_debug(3, "Cairo_draw_point: %f %f", x, y);
- cairo_rectangle(cairo, (double)x - HALFPOINTSIZE,
- (double)y - HALFPOINTSIZE, POINTSIZE, POINTSIZE);
+ cairo_rectangle(cairo,
+ x - HALFPOINTSIZE, y - HALFPOINTSIZE,
+ POINTSIZE, POINTSIZE);
cairo_fill(cairo);
modified = 1;
}
Modified: grass/trunk/lib/cairodriver/Graph.c
===================================================================
--- grass/trunk/lib/cairodriver/Graph.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Graph.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -192,7 +192,7 @@
return 0;
}
-int Cairo_Graph_set(int argc, char **argv)
+int Cairo_Graph_set(void)
{
char *p;
Modified: grass/trunk/lib/cairodriver/Line_width.c
===================================================================
--- grass/trunk/lib/cairodriver/Line_width.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Line_width.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -6,13 +6,13 @@
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-static int previous_width = -1;
+static double previous_width = -1;
-void Cairo_Line_width(int width)
+void Cairo_Line_width(double width)
{
- G_debug(1, "Cairo_Line_width: %d", width);
+ G_debug(1, "Cairo_Line_width: %f", width);
width = MAX(MIN_WIDTH, width);
if (width != previous_width)
- cairo_set_line_width(cairo, (double)width);
+ cairo_set_line_width(cairo, width);
}
Modified: grass/trunk/lib/cairodriver/Poly.c
===================================================================
--- grass/trunk/lib/cairodriver/Poly.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Poly.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,6 +1,6 @@
#include "cairodriver.h"
-void do_polygon(const int *xarray, const int *yarray, int count)
+void do_polygon(const double *xarray, const double *yarray, int count)
{
int i;
@@ -9,14 +9,14 @@
cairo_line_to(cairo, xarray[i], yarray[i]);
}
-void Cairo_Polygon(const int *xarray, const int *yarray, int count)
+void Cairo_Polygon(const double *xarray, const double *yarray, int count)
{
G_debug(3, "Cairo_Polygon (%d points)", count);
do_polygon(xarray, yarray, count);
cairo_fill(cairo);
}
-void Cairo_Polyline(const int *xarray, const int *yarray, int count)
+void Cairo_Polyline(const double *xarray, const double *yarray, int count)
{
G_debug(3, "Cairo_Polyline (%d points)", count);
do_polygon(xarray, yarray, count);
Modified: grass/trunk/lib/cairodriver/Raster.c
===================================================================
--- grass/trunk/lib/cairodriver/Raster.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Raster.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "cairodriver.h"
static int src_t, src_b, src_l, src_r, src_w, src_h;
-static int dst_t, dst_b, dst_l, dst_r, dst_w, dst_h;
+static double dst_t, dst_b, dst_l, dst_r, dst_w, dst_h;
static cairo_surface_t *src_surf;
static unsigned char *src_data;
@@ -9,11 +9,12 @@
static int masked;
-void Cairo_begin_scaled_raster(int mask, int s[2][2], int d[2][2])
+void Cairo_begin_scaled_raster(int mask, int s[2][2], double d[2][2])
{
- G_debug(1, "Cairo_begin_scaled_raster: %d %d %d %d %d %d %d %d %d",
- mask, s[0][0], s[0][1], s[1][0], s[1][1], d[0][0], d[0][1],
- d[1][0], d[1][1]);
+ G_debug(1, "Cairo_begin_scaled_raster: %d, %d %d %d %d, %f %f %f %f",
+ mask,
+ s[0][0], s[0][1], s[1][0], s[1][1],
+ d[0][0], d[0][1], d[1][0], d[1][1]);
masked = mask;
@@ -35,7 +36,7 @@
dst_w = dst_r - dst_l;
dst_h = dst_b - dst_t;
- G_debug(1, " src (TBLR): %d %d %d %d, dst (TBLR) %d %d %d %d",
+ G_debug(1, " src (TBLR): %d %d %d %d, dst (TBLR) %f %f %f %f",
src_t, src_b, src_l, src_r, dst_t, dst_b, dst_l, dst_r);
/* create source surface */
@@ -77,8 +78,7 @@
/* paint source surface onto dstination (scaled) */
cairo_save(cairo);
cairo_translate(cairo, dst_l, dst_t);
- cairo_scale(cairo, (double)dst_w / (double)src_w,
- (double)dst_h / (double)src_h);
+ cairo_scale(cairo, dst_w / src_w, dst_h / src_h);
cairo_set_source_surface(cairo, src_surf, 0, 0);
cairo_paint(cairo);
cairo_restore(cairo);
Modified: grass/trunk/lib/cairodriver/Set_window.c
===================================================================
--- grass/trunk/lib/cairodriver/Set_window.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/Set_window.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,11 +1,10 @@
#include "cairodriver.h"
-void Cairo_Set_window(int t, int b, int l, int r)
+void Cairo_Set_window(double t, double b, double l, double r)
{
- G_debug(1, "Cairo_Set_window: %d %d %d %d", t, b, l, r);
+ G_debug(1, "Cairo_Set_window: %f %f %f %f", t, b, l, r);
cairo_reset_clip(cairo);
- cairo_rectangle(cairo, (double)l, (double)t, (double)r - l,
- (double)b - t);
+ cairo_rectangle(cairo, l, t, r - l, b - t);
cairo_clip(cairo);
}
Modified: grass/trunk/lib/cairodriver/cairodriver.h
===================================================================
--- grass/trunk/lib/cairodriver/cairodriver.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/cairodriver/cairodriver.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -37,7 +37,7 @@
extern int file_type;
extern int width, height, stride;
extern unsigned char *grid;
-extern int clip_left, clip_right, clip_top, clip_bottom;
+extern double clip_left, clip_right, clip_top, clip_bottom;
extern int auto_write;
extern double bgcolor_r, bgcolor_g, bgcolor_b, bgcolor_a;
extern int modified;
@@ -47,24 +47,24 @@
extern const struct driver *Cairo_Driver(void);
extern void Cairo_Client_Close(void);
-extern int Cairo_Graph_set(int, char **);
+extern int Cairo_Graph_set(void);
extern void Cairo_Graph_close(void);
-extern void Cairo_Box(int, int, int, int);
-extern void Cairo_Set_window(int, int, int, int);
-extern void Cairo_draw_line(int, int, int, int);
+extern void Cairo_Box(double, double, double, double);
+extern void Cairo_Set_window(double, double, double, double);
+extern void Cairo_draw_line(double, double, double, double);
extern void Cairo_draw_bitmap(int, int, int, const unsigned char *);
-extern void Cairo_draw_point(int, int);
+extern void Cairo_draw_point(double, double);
extern void Cairo_color(int);
extern int Cairo_lookup_color(int, int, int);
extern void Cairo_Erase(void);
-extern void Cairo_begin_scaled_raster(int, int[2][2], int[2][2]);
+extern void Cairo_begin_scaled_raster(int, int[2][2], double[2][2]);
extern int Cairo_scaled_raster(int, int,
const unsigned char *, const unsigned char *,
const unsigned char *, const unsigned char *);
extern void Cairo_end_scaled_raster(void);
-extern void Cairo_Line_width(int);
-extern void Cairo_Polygon(const int *, const int *, int);
-extern void Cairo_Polyline(const int *, const int *, int);
+extern void Cairo_Line_width(double);
+extern void Cairo_Polygon(const double *, const double *, int);
+extern void Cairo_Polyline(const double *, const double *, int);
extern void Cairo_Respond(void);
/* read.c */
Modified: grass/trunk/lib/display/cnversions.c
===================================================================
--- grass/trunk/lib/display/cnversions.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/display/cnversions.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -66,17 +66,17 @@
* \return int
*/
-int D_do_conversions(const struct Cell_head *window, int t, int b, int l,
- int r)
+int D_do_conversions(const struct Cell_head *window,
+ double t, double b, double l, double r)
{
struct vector ARRAY_SIZE;
struct rectangle WIND;
struct vector D_size, U_size;
- WIND.north = (double)t;
- WIND.south = (double)b;
- WIND.west = (double)l;
- WIND.east = (double)r;
+ WIND.north = t;
+ WIND.south = b;
+ WIND.west = l;
+ WIND.east = r;
is_lat_lon = (window->proj == PROJECTION_LL);
@@ -124,16 +124,16 @@
D_size.x = D.east - D.west;
D_size.y = D.south - D.north;
- ARRAY_SIZE.x = window->cols;
- ARRAY_SIZE.y = window->rows;
+ ARRAY_SIZE.x = (double)window->cols;
+ ARRAY_SIZE.y = (double)window->rows;
- A.west = 0.0;
+ A.west = 0.0;
A.north = 0.0;
- A.east = (double)ARRAY_SIZE.x;
- A.south = (double)ARRAY_SIZE.y;
+ A.east = ARRAY_SIZE.x;
+ A.south = ARRAY_SIZE.y;
- D_to_A_conv.x = (double)ARRAY_SIZE.x / D_size.x;
- D_to_A_conv.y = (double)ARRAY_SIZE.y / D_size.y;
+ D_to_A_conv.x = ARRAY_SIZE.x / D_size.x;
+ D_to_A_conv.y = ARRAY_SIZE.y / D_size.y;
#ifdef DEBUG
fprintf(stderr,
@@ -146,9 +146,9 @@
" U_w %10.1f U_e %10.1f U_s %10.1f U_n %10.1f\n",
U.west, U.east, U.south, U.north);
fprintf(stderr,
- " ARRAY_ROWS %d resolution_ns %10.2f\n", ARRAY_SIZE.y,
+ " ARRAY_ROWS %d resolution_ns %10.2f\n", (int)ARRAY_SIZE.y,
window->ns_res);
- fprintf(stderr, " ARRAY_COLS %d resolution_ew %10.2f\n", ARRAY_SIZE.x,
+ fprintf(stderr, " ARRAY_COLS %d resolution_ew %10.2f\n", (int)ARRAY_SIZE.x,
window->ew_res);
fprintf(stderr, " D_to_A_conv.x %10.1f D_to_A_conv.y %10.1f \n",
D_to_A_conv.x, D_to_A_conv.y);
@@ -249,12 +249,12 @@
x[1][1] = (int)A.south;
}
-void D_get_d(int x[2][2])
+void D_get_d(double x[2][2])
{
- x[0][0] = (int)D.west;
- x[0][1] = (int)D.east;
- x[1][0] = (int)D.north;
- x[1][1] = (int)D.south;
+ x[0][0] = D.west;
+ x[0][1] = D.east;
+ x[1][0] = D.north;
+ x[1][1] = D.south;
}
/*!
Deleted: grass/trunk/lib/display/draw.c
===================================================================
--- grass/trunk/lib/display/draw.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/display/draw.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,396 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: display
- * AUTHOR(S): CERL (original contributors)
- * Bernhard Reiter <bernhard intevation.de>,
- * Markus Neteler <neteler itc.it>,
- * Glynn Clements <glynn gclements.plus.com>,
- * Hamish Bowman <hamish_nospam yahoo.com>
- * PURPOSE:
- * COPYRIGHT: (C) 1999-2007 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
-
-/*******************************************************************
- * Line drawing in the current window.
- *
- * Clip window:
- * D_set_clip_window (top, bottom ,left, right)
- * establish clipping region for subseqent line drawing.
- * D_set_clip_window_to_map_window ()
- * set clipping to pixels corresponding to the current map region
- * (default)
- * D_set_clip_window_to_screen_window ()
- * set clipping to full extent of the window (ie disables clipping on screen)
- *
- * Moves.
- * D_move_abs(x,y) move to x,y.
- * D_move_rel(x,y) move to +x,+y.
- * Set current position. Position is not clipped.
- *
- * Draw line
- * D_cont_abs(x,y) draw to x,y.
- * D_cont_rel(x,y) draw to +x,+y.
- * Line draw from current position. New postion is not clipped.
- * The lines drawn are clipped however.
- * Return values indicate the nature of the clipping:
- * 0 no clipping
- * 1 part of the line is drawn
- * -1 none of the line is drawn
- *
- *
- */
-#include <grass/raster.h>
-#include <grass/gis.h>
-#include <grass/display.h>
-
-static int clip(void);
-static int line_eq(int, int, int, int, int, int);
-
-static int curx, cury;
-static int left, right, top, bottom; /* window edges */
-static int x1, y1, x2, y2;
-
-static int window_set = 0;
-
-#define swap(x,y) {int t; t=x; x=y; y=t;}
-#define limit(a,x,b) x<a?a:(x>b?b:x)
-
-
-/*!
- * \brief set clipping window
- *
- * Sets the clipping window to the pixel window that corresponds
- * to the current database region. This is the default.
- *
- * \param top
- * \param bottom
- * \param left
- * \param right
- * \return int
- */
-
-int D_set_clip_window(int Top, int Bottom, int Left, int Right)
-{
- /* make sure top is above bottom, left is left of right */
- if (Top > Bottom)
- swap(Top, Bottom);
- if (Left > Right)
- swap(Left, Right);
-
- /* make sure edges are within the true window edges */
- D_get_screen_window(&top, &bottom, &left, &right);
- Top = limit(top, Top, bottom);
- Bottom = limit(top, Bottom, bottom);
- Left = limit(left, Left, right);
- Right = limit(left, Right, right);
-
- /* set the window */
- top = Top;
- bottom = Bottom;
- left = Left;
- right = Right;
-
- window_set = 1;
-
- R_move_abs(left, top);
-
- return 0;
-}
-
-
-/*!
- * \brief set clipping window to map window
- *
- * Sets the clipping window to the pixel window that corresponds to the
- * current database region. This is the default.
- *
- * \param ~
- * \return int
- */
-
-int D_set_clip_window_to_map_window(void)
-{
- D_set_clip_window((int)D_get_d_north(),
- (int)D_get_d_south(),
- (int)D_get_d_west(), (int)D_get_d_east()
- );
-
- return 0;
-}
-
-
-/*!
- * \brief set clipping window to screen window
- *
- * Sets the clipping window to the pixel window that corresponds to the
- * full screen window. Off screen rendering is still clipped.
- *
- * \param ~
- * \return int
- */
-
-int D_set_clip_window_to_screen_window(void)
-{
- D_get_screen_window(&top, &bottom, &left, &right);
- D_set_clip_window(top, bottom, left, right);
-
- return 0;
-}
-
-
-/*!
- * \brief line to x,y
- *
- * Draws a line from the
- * current position to pixel location <b>x,y.</b> Any part of the line that
- * falls outside the clipping window is not drawn.
- * <b>Note.</b> The new position is <b>x,y</b>, even if it falls outside the
- * clipping window. Returns 0 if the line was contained entirely in the clipping
- * window, 1 if the line had to be clipped to draw it.
- *
- * \param x
- * \param y
- * \return int
- */
-
-int D_cont_abs(int x, int y)
-{
- int clipped;
-
- x1 = curx;
- y1 = cury;
- x2 = x;
- y2 = y;
- curx = x;
- cury = y;
-
- if (!window_set)
- D_set_clip_window_to_map_window();
-
- clipped = clip();
- if (clipped >= 0) {
- R_move_abs(x1, y1);
- R_cont_abs(x2, y2);
- }
-
- return clipped;
-}
-
-
-/*!
- * \brief line to x,y
- *
- * Equivalent to
- * <i>D_cont_abs</i>(curx+x, cury+y) where <b>curx, cury</b> is the current
- * pixel location.
- *
- * \param x
- * \param y
- * \return int
- */
-
-int D_cont_rel(int x, int y)
-{
- return D_cont_abs(curx + x, cury + y);
-}
-
-
-/*!
- * \brief move to pixel
- *
- * Move without drawing to
- * pixel location <b>x,y</b>, even if it falls outside the clipping window.
- *
- * \param x
- * \param y
- * \return int
- */
-
-int D_move_abs(int x, int y)
-{
- curx = x;
- cury = y;
- return 0;
-}
-
-
-/*!
- * \brief move to pixel
- *
- * Equivalent to
- * <i>D_move_abs</i>(curx+x, cury+y) where <b>curx, cury</b> is the current
- * pixel location.
- *
- * \param x
- * \param y
- * \return int
- */
-
-int D_move_rel(int x, int y)
-{
- curx += x;
- cury += y;
- return 0;
-}
-
-/*********************************************************************
- * this code is the window clipping for D_cont_abs()
- *********************************************************************/
-
-#define Y(x) line_eq(x,x0,y0,dx,dy,xround)
-
-#define X(y) line_eq(y,y0,x0,dy,dx,yround)
-
-
-static int clip(void)
-{
- register int x0, y0;
- register int dx, dy;
- int xround;
- int yround;
- int clipped;
-
- /*
- * quick check for line above,below,left,or right of window
- */
- if (x1 < left && x2 < left)
- return -1;
- if (x1 > right && x2 > right)
- return -1;
-
- if (y1 < top && y2 < top)
- return -1;
- if (y1 > bottom && y2 > bottom)
- return -1;
-
- /*
- * setup line equations variables
- */
- x0 = x1;
- y0 = y1;
-
- dx = x2 - x1;
- dy = y2 - y1;
-
- if ((xround = dx / 2) < 0)
- xround = -xround;
- if ((yround = dy / 2) < 0)
- yround = -yround;
-
- /*
- * clipping
- *
- * if x of endpoint 1 doesn't fall within the window
- * move x to the nearest edge
- * recalculate the y
- * if the new y doesn't fall within the window then
- * the line doesn't cross into the window
- *
- * if y of endpoint 1 doesn't fall within the window
- * move y to the nearest edge
- * recalculate the x
- * if the new x doesn't fall within the window then
- * the line doesn't cross into the window
- *
- * repeat for the second endpoint
- *
- */
-
- clipped = 0;
- if (x1 < left || x1 > right) {
- if (dx == 0)
- return -1;
-
- x1 = x1 < left ? left : right;
- y1 = Y(x1);
-
- if (y1 < top || y1 > bottom) {
- if (dy == 0)
- return -1;
-
- y1 = y1 < top ? top : bottom;
- x1 = X(y1);
-
- if (x1 < left || x1 > right)
- return -1;
- }
- clipped = 1;
- }
- if (y1 < top || y1 > bottom) {
- if (dy == 0)
- return -1;
- y1 = y1 < top ? top : bottom;
- x1 = X(y1);
-
- if (x1 < left || x1 > right) {
- if (dx == 0)
- return -1;
-
- x1 = x1 < left ? left : right;
- y1 = Y(x1);
-
- if (y1 < top || y1 > bottom)
- return -1;
- }
- clipped = 1;
- }
-
- if (x2 < left || x2 > right) {
- if (dx == 0)
- return -1;
-
- x2 = x2 < left ? left : right;
- y2 = Y(x2);
-
- if (y2 < top || y2 > bottom) {
- if (dy == 0)
- return -1;
-
- y2 = y2 < top ? top : bottom;
- x2 = X(y2);
-
- if (x2 < left || x2 > right)
- return -1;
- }
- clipped = 1;
- }
- if (y2 < top || y2 > bottom) {
- if (dy == 0)
- return -1;
-
- y2 = y2 < top ? top : bottom;
- x2 = X(y2);
-
- if (x2 < left || x2 > right) {
- if (dx == 0)
- return -1;
-
- x2 = x2 < left ? left : right;
- y2 = Y(x2);
-
- if (y2 < top || y2 > bottom)
- return -1;
- }
- clipped = 1;
- }
-
- return clipped;
-}
-
-static int line_eq(int x, int x0, int y0, int dx, int dy, int round)
-{
- register int t;
-
- if ((t = dy * (x - x0)) < 0)
- t -= round;
- else
- t += round;;
-
- return (y0 + t / dx);
-}
Modified: grass/trunk/lib/display/draw2.c
===================================================================
--- grass/trunk/lib/display/draw2.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/display/draw2.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,34 +1,4 @@
-/*******************************************************************
- * Line drawing in the current window.
- *
- * Clip window:
- * D_set_clip_window (top, bottom ,left, right)
- * establish clipping region for subseqent line drawing.
- * D_set_clip_window_to_map_window ()
- * set clipping to pixels corresponding to the current map region
- * (default)
- * D_set_clip_window_to_screen_window ()
- * set clipping to full extent of the window (ie disables clipping on screen)
- *
- * Moves.
- * D_move_abs(x,y) move to x,y.
- * D_move_rel(x,y) move to +x,+y.
- * Set current position. Position is not clipped.
- *
- * Draw line
- * D_cont_abs(x,y) draw to x,y.
- * D_cont_rel(x,y) draw to +x,+y.
- * Line draw from current position. New postion is not clipped.
- * The lines drawn are clipped however.
- * Return values indicate the nature of the clipping:
- * 0 no clipping
- * 1 part of the line is drawn
- * -1 none of the line is drawn
- *
- *
- */
-
#include <math.h>
#include <string.h>
@@ -68,26 +38,24 @@
#define min(x,y) ((x) < (y) ? (x) : (y))
#define max(x,y) ((x) > (y) ? (x) : (y))
-#define round(x) ((int) floor(0.5 + (x)))
-
-static int *xi, *yi;
+static double *xi, *yi;
static int nalloc_i;
static double *xf, *yf;
static int nalloc_f;
-static void alloc_int(int n)
+static void alloc_dst(int n)
{
if (nalloc_i >= n)
return;
nalloc_i = n;
- xi = G_realloc(xi, nalloc_i * sizeof(int));
- yi = G_realloc(yi, nalloc_i * sizeof(int));
+ xi = G_realloc(xi, nalloc_i * sizeof(double));
+ yi = G_realloc(yi, nalloc_i * sizeof(double));
}
-static void alloc_float(int n)
+static void alloc_src(int n)
{
if (nalloc_f >= n)
@@ -98,7 +66,7 @@
yf = G_realloc(yf, nalloc_f * sizeof(double));
}
-static void dealloc_float(const double **x, const double **y, int release)
+static void dealloc_src(const double **x, const double **y, int release)
{
if (release) {
G_free(*(double **)x);
@@ -114,47 +82,31 @@
yf = NULL;
}
-static int do_filter(int *x, int *y, int n)
+static int do_convert(const double *x, const double *y, int n)
{
+ static double eps = 0.5;
int i, j;
+ alloc_dst(n);
+
+ for (i = 0; i < n; i++) {
+ xi[i] = D_u_to_d_col(x[i]);
+ yi[i] = D_u_to_d_row(y[i]);
+ }
+
for (i = 0, j = 1; j < n; j++) {
- if (x[j] == x[i] && y[j] == y[i])
+ if (fabs(xi[j] - xi[i]) < eps && fabs(yi[j] - yi[i]) < eps)
continue;
i++;
if (i == j)
continue;
- x[i] = x[j];
- y[i] = y[j];
+ xi[i] = xi[j];
+ yi[i] = yi[j];
}
return i + 1;
}
-static void do_round(const double *x, const double *y, int n)
-{
- int i;
-
- alloc_int(n);
-
- for (i = 0; i < n; i++) {
- xi[i] = round(D_u_to_d_col(x[i]));
- yi[i] = round(D_u_to_d_row(y[i]));
- }
-}
-
-static void do_floor(const double *x, const double *y, int n)
-{
- int i;
-
- alloc_int(n);
-
- for (i = 0; i < n; i++) {
- xi[i] = floor(D_u_to_d_col(x[i]));
- yi[i] = floor(D_u_to_d_row(y[i]));
- }
-}
-
static double dist_plane(double x, double y, const struct plane *p)
{
return x * p->x + y * p->y + p->k;
@@ -332,12 +284,47 @@
* current database region. This is the default.
*
* \param ~
+ * \return void
*/
+void D_clip_to_display(void)
+{
+ D_set_clip(D_get_d_north(), D_get_d_south(),
+ D_get_d_west(), D_get_d_east());
+}
+
+/*!
+ * \brief set clipping window to screen window
+ *
+ * Sets the clipping window to the pixel window that corresponds to the
+ * full screen window. Off screen rendering is still clipped.
+ *
+ * \param ~
+ * \return int
+ */
+
+void D_clip_to_screen(void)
+{
+ double t, b, l, r;
+
+ D_get_screen_window(&t, &b, &l, &r);
+ D_set_clip(t, b, l, r);
+}
+
+
+/*!
+ * \brief set clipping window to map window
+ *
+ * Sets the clipping window to the pixel window that corresponds to the
+ * current database region. This is the default.
+ *
+ * \param ~
+ */
+
void D_clip_to_map(void)
{
- D_set_clip(D_get_u_north(),
- D_get_u_south(), D_get_u_west(), D_get_u_east());
+ D_set_clip(D_get_u_north(), D_get_u_south(),
+ D_get_u_west(), D_get_u_east());
}
/*!
@@ -356,6 +343,12 @@
cur.y = y;
}
+void D_move_abs_clip(double x, double y)
+{
+ cur.x = x;
+ cur.y = y;
+}
+
/*!
* \brief line to x,y
*
@@ -385,10 +378,10 @@
clipped = do_clip(&a, &b);
if (clipped >= 0) {
- int x1 = round(D_u_to_d_col(a.x));
- int y1 = round(D_u_to_d_row(a.y));
- int x2 = round(D_u_to_d_col(b.x));
- int y2 = round(D_u_to_d_row(b.y));
+ double x1 = D_u_to_d_col(a.x);
+ double y1 = D_u_to_d_row(a.y);
+ double x2 = D_u_to_d_col(b.x);
+ double y2 = D_u_to_d_row(b.y);
R_move_abs(x1, y1);
R_cont_abs(x2, y2);
@@ -421,6 +414,32 @@
return ret;
}
+static int line_clip_abs(double x1, double y1, double x2, double y2)
+{
+ struct vector a, b;
+ int clipped;
+
+ a.x = x1;
+ a.y = y1;
+
+ b.x = x2;
+ b.y = y2;
+
+ clipped = do_clip(&a, &b);
+
+ if (clipped >= 0) {
+ double x1 = a.x;
+ double y1 = a.y;
+ double x2 = b.x;
+ double y2 = b.y;
+
+ R_move_abs(x1, y1);
+ R_cont_abs(x2, y2);
+ }
+
+ return clipped;
+}
+
int D_cont_clip(double x, double y)
{
int ret;
@@ -439,6 +458,33 @@
return ret;
}
+int D_line_clip(double x1, double y1, double x2, double y2)
+{
+ D_move_clip(x1, y1);
+ return D_cont_clip(x2, y2);
+}
+
+int D_cont_abs_clip(double x, double y)
+{
+ int ret;
+
+ if (!window_set)
+ D_clip_to_display();
+
+ ret = line_clip_abs(cur.x, cur.y, x, y);
+
+ cur.x = x;
+ cur.y = y;
+
+ return ret;
+}
+
+int D_line_abs_clip(double x1, double y1, double x2, double y2)
+{
+ D_move_abs_clip(x1, y1);
+ return D_cont_abs_clip(x2, y2);
+}
+
void D_polydots_clip(const double *x, const double *y, int n)
{
double ux0 = clip.left;
@@ -447,7 +493,7 @@
if (!window_set)
D_clip_to_map();
- alloc_float(n);
+ alloc_src(n);
for (i = j = 0; i < n; i++) {
double xx = x[i];
@@ -466,8 +512,7 @@
j++;
}
- do_floor(xf, yf, n);
- n = do_filter(xi, yi, n);
+ do_convert(xf, yf, n);
R_polydots_abs(xi, yi, j);
}
@@ -491,7 +536,7 @@
int in1 = d1 <= 0;
if (!in0 && in1 && last != prev) { /* entering */
- alloc_float(j + 1);
+ alloc_src(j + 1);
xf[j] = x0;
yf[j] = y0;
j++;
@@ -499,7 +544,7 @@
}
if (in1 || in0) { /* inside or leaving */
- alloc_float(j + 1);
+ alloc_src(j + 1);
xf[j] = x1;
yf[j] = y1;
j++;
@@ -519,30 +564,29 @@
static void polyline_cull(const double *x, const double *y, int n)
{
- alloc_float(n + 10);
+ alloc_src(n + 10);
if (cull_polyline_plane(&n, x, y, &pl_left))
return;
- dealloc_float(&x, &y, 0);
+ dealloc_src(&x, &y, 0);
if (cull_polyline_plane(&n, x, y, &pl_rite))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
if (cull_polyline_plane(&n, x, y, &pl_bot))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
if (cull_polyline_plane(&n, x, y, &pl_top))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
- do_floor(x, y, n);
- n = do_filter(xi, yi, n);
+ do_convert(x, y, n);
R_polyline_abs(xi, yi, n);
}
@@ -602,7 +646,7 @@
int in1 = d1 <= 0;
if (!in0 && in1 && last != prev) { /* entering */
- alloc_float(j + 1);
+ alloc_src(j + 1);
xf[j] = x0;
yf[j] = y0;
j++;
@@ -610,7 +654,7 @@
}
if (in1 || in0) { /* inside or leaving */
- alloc_float(j + 1);
+ alloc_src(j + 1);
xf[j] = x1;
yf[j] = y1;
j++;
@@ -630,30 +674,29 @@
static void polygon_cull(const double *x, const double *y, int n)
{
- alloc_float(n + 10);
+ alloc_src(n + 10);
if (cull_polygon_plane(&n, x, y, &pl_left))
return;
- dealloc_float(&x, &y, 0);
+ dealloc_src(&x, &y, 0);
if (cull_polygon_plane(&n, x, y, &pl_rite))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
if (cull_polygon_plane(&n, x, y, &pl_bot))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
if (cull_polygon_plane(&n, x, y, &pl_top))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
- do_round(x, y, n);
- n = do_filter(xi, yi, n);
+ do_convert(x, y, n);
R_polygon_abs(xi, yi, n);
}
@@ -686,14 +729,14 @@
int in1 = d1 <= 0;
if (in0 != in1) { /* edge crossing */
- alloc_float(j + 1);
+ alloc_src(j + 1);
xf[j] = interpolate(x0, x1, d0, d1);
yf[j] = interpolate(y0, y1, d0, d1);
j++;
}
if (in1) { /* point inside */
- alloc_float(j + 1);
+ alloc_src(j + 1);
xf[j] = x[i];
yf[j] = y[i];
j++;
@@ -711,30 +754,29 @@
static void polygon_clip(const double *x, const double *y, int n)
{
- alloc_float(n + 10);
+ alloc_src(n + 10);
if (clip_polygon_plane(&n, x, y, &pl_left))
return;
- dealloc_float(&x, &y, 0);
+ dealloc_src(&x, &y, 0);
if (clip_polygon_plane(&n, x, y, &pl_rite))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
if (clip_polygon_plane(&n, x, y, &pl_bot))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
if (clip_polygon_plane(&n, x, y, &pl_top))
return;
- dealloc_float(&x, &y, 1);
+ dealloc_src(&x, &y, 1);
- do_round(x, y, n);
- n = do_filter(xi, yi, n);
+ do_convert(x, y, n);
R_polygon_abs(xi, yi, n);
}
@@ -753,17 +795,17 @@
static void box_clip(double x1, double y1, double x2, double y2)
{
double t, b, l, r;
- int ti, bi, li, ri;
+ double ti, bi, li, ri;
l = max(clip.left, min(x1, x2));
r = min(clip.rite, max(x1, x2));
b = max(clip.bot, min(y1, y2));
t = min(clip.top, max(y1, y2));
- li = round(D_u_to_d_col(l));
- ri = round(D_u_to_d_col(r));
- bi = round(D_u_to_d_row(b));
- ti = round(D_u_to_d_row(t));
+ li = D_u_to_d_col(l);
+ ri = D_u_to_d_col(r);
+ bi = D_u_to_d_row(b);
+ ti = D_u_to_d_row(t);
R_box_abs(li, ti, ri, bi);
}
@@ -796,38 +838,57 @@
void D_move(double x, double y)
{
- int xi = round(D_u_to_d_col(x));
- int yi = round(D_u_to_d_row(y));
+ double dx = D_u_to_d_col(x);
+ double dy = D_u_to_d_row(y);
- R_move_abs(xi, yi);
+ R_move_abs(dx, dy);
}
void D_cont(double x, double y)
{
- int xi = round(D_u_to_d_col(x));
- int yi = round(D_u_to_d_row(y));
+ double dx = D_u_to_d_col(x);
+ double dy = D_u_to_d_row(y);
- R_cont_abs(xi, yi);
+ R_cont_abs(dx, dy);
}
+void D_line(double x1, double y1, double x2, double y2)
+{
+ D_move(x1, y1);
+ D_cont(x2, y2);
+}
+
+void D_move_abs(double x, double y)
+{
+ R_move_abs(x, y);
+}
+
+void D_cont_abs(double x, double y)
+{
+ R_cont_abs(x, y);
+}
+
+void D_line_abs(double x1, double y1, double x2, double y2)
+{
+ D_move_abs(x1, y1);
+ D_cont_abs(x2, y2);
+}
+
void D_polydots(const double *x, const double *y, int n)
{
- do_floor(x, y, n);
- n = do_filter(xi, yi, n);
+ do_convert(x, y, n);
R_polydots_abs(xi, yi, n);
}
void D_polyline(const double *x, const double *y, int n)
{
- do_floor(x, y, n);
- n = do_filter(xi, yi, n);
+ do_convert(x, y, n);
R_polyline_abs(xi, yi, n);
}
void D_polygon(const double *x, const double *y, int n)
{
- do_round(x, y, n);
- n = do_filter(xi, yi, n);
+ do_convert(x, y, n);
R_polygon_abs(xi, yi, n);
}
@@ -837,20 +898,16 @@
double r = max(x1, x2);
double b = min(y1, y2);
double t = max(y1, y2);
- int li = round(D_u_to_d_col(l));
- int ri = round(D_u_to_d_col(r));
- int bi = round(D_u_to_d_row(b));
- int ti = round(D_u_to_d_row(t));
+ double li = D_u_to_d_col(l);
+ double ri = D_u_to_d_col(r);
+ double bi = D_u_to_d_row(b);
+ double ti = D_u_to_d_row(t);
R_box_abs(li, ti, ri, bi);
}
void D_line_width(double d)
{
- int w = round(d);
+ R_line_width(d > 0 ? d : 0);
+}
- if (w < 0)
- w = 0;
-
- R_line_width(w);
-}
Copied: grass/trunk/lib/display/icon.c (from rev 32646, grass/trunk/lib/gis/icon.c)
===================================================================
--- grass/trunk/lib/display/icon.c (rev 0)
+++ grass/trunk/lib/display/icon.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -0,0 +1,80 @@
+
+/**
+ * \file icon.c
+ *
+ * \brief GIS Library - Plot icon
+ *
+ * (C) 2001-2008 by the GRASS Development Team
+ *
+ * This program is free software under the GNU General Public License
+ * (>=v2). Read the file COPYING that comes with GRASS for details.
+ *
+ * \author GRASS GIS Development Team
+ *
+ * \date 1999-2008
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <grass/gis.h>
+#include <grass/display.h>
+
+static void line(double m[2][3], double x0, double y0, double x1, double y1)
+{
+ double tx0 = m[0][0] * x0 + m[0][1] * y0 + m[0][2];
+ double ty0 = m[1][0] * x0 + m[1][1] * y0 + m[1][2];
+ double tx1 = m[0][0] * x1 + m[0][1] * y1 + m[0][2];
+ double ty1 = m[1][0] * x1 + m[1][1] * y1 + m[1][2];
+
+ D_move(tx0, ty0);
+ D_cont(tx1, ty1);
+}
+
+/**
+ * \brief Plot icon
+ *
+ * \param[in] xc,yc icon coordinates
+ * \param[in] type icon type
+ * \param[in] angle rotation angle [rad]
+ * \param[in] scale scale factor
+ *
+ * \return 1
+ */
+void D_plot_icon(double xc, double yc, int type, double angle, double scale)
+{
+ static double old_a = 1e299, old_s = 0;
+ static double sin_a, cos_a;
+ static double m[2][3];
+
+ G_debug(2, "D_plot_icon(): xc=%g, yc=%g", xc, yc);
+
+ if (angle != old_a) {
+ sin_a = sin(angle);
+ cos_a = cos(angle);
+ }
+ if (angle != old_a || scale != old_s) {
+ m[0][0] = cos_a * scale;
+ m[0][1] = -sin_a * scale;
+ m[1][0] = sin_a * scale;
+ m[1][1] = cos_a * scale;
+ }
+ m[0][2] = xc;
+ m[1][2] = yc;
+
+ switch (type) {
+ case G_ICON_CROSS:
+ line(m, -0.5, 0.0, 0.5, 0.0);
+ line(m, 0.0, -0.5, 0.0, 0.5);
+ break;
+ case G_ICON_BOX:
+ line(m, -0.5, -0.5, 0.5, -0.5);
+ line(m, 0.5, -0.5, 0.5, 0.5);
+ line(m, 0.5, 0.5, -0.5, 0.5);
+ line(m, -0.5, 0.5, -0.5, -0.5);
+ break;
+ case G_ICON_ARROW:
+ line(m, -1, 0.5, 0, 0.0);
+ line(m, -1, -0.5, 0, 0.0);
+ break;
+ }
+}
Modified: grass/trunk/lib/display/raster.c
===================================================================
--- grass/trunk/lib/display/raster.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/display/raster.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -31,7 +31,8 @@
extern int D__overlay_mode;
-static int src[2][2], dst[2][2];
+static int src[2][2];
+static double dst[2][2];
static int draw_cell(int, const void *, struct Colors *, RASTER_MAP_TYPE);
@@ -129,7 +130,7 @@
* \return int
*/
-int D_cell_draw_setup(int t, int b, int l, int r)
+int D_cell_draw_setup(double t, double b, double l, double r)
{
struct Cell_head window;
Modified: grass/trunk/lib/display/setup.c
===================================================================
--- grass/trunk/lib/display/setup.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/display/setup.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -59,7 +59,7 @@
int D_setup(int clear)
{
struct Cell_head region;
- int t, b, l, r;
+ double t, b, l, r;
t = R_screen_top();
b = R_screen_bot();
Modified: grass/trunk/lib/display/symbol.c
===================================================================
--- grass/trunk/lib/display/symbol.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/display/symbol.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -44,14 +44,14 @@
* \return void
*/
-void D_symbol(const SYMBOL * Symb, int x0, int y0,
+void D_symbol(const SYMBOL * Symb, double x0, double y0,
const RGBA_Color * line_color, const RGBA_Color * fill_color)
{
int i, j, k;
const SYMBPART *part;
const SYMBCHAIN *chain;
- int xp, yp;
- int *x, *y;
+ double xp, yp;
+ double *x, *y;
G_debug(2, "D_symbol(): %d parts", Symb->count);
@@ -75,8 +75,8 @@
for (j = 0; j < part->count; j++) { /* for each component polygon */
chain = part->chain[j];
- x = G_malloc(sizeof(int) * chain->scount);
- y = G_malloc(sizeof(int) * chain->scount);
+ x = G_malloc(sizeof(double) * chain->scount);
+ y = G_malloc(sizeof(double) * chain->scount);
for (k = 0; k < chain->scount; k++) {
x[k] = x0 + chain->sx[k];
@@ -156,7 +156,7 @@
* \param secondary_color Secondary draw color
* \return void
*/
-void D_symbol2(const SYMBOL * Symb, int x0, int y0,
+void D_symbol2(const SYMBOL * Symb, double x0, double y0,
const RGBA_Color * primary_color,
const RGBA_Color * secondary_color)
{
@@ -164,8 +164,8 @@
int i, j, k;
const SYMBPART *part;
const SYMBCHAIN *chain;
- int xp, yp;
- int *x, *y;
+ double xp, yp;
+ double *x, *y;
G_debug(2, "D_symbol(): %d parts", Symb->count);
@@ -190,8 +190,8 @@
for (j = 0; j < part->count; j++) { /* for each component polygon */
chain = part->chain[j];
- x = G_malloc(sizeof(int) * chain->scount);
- y = G_malloc(sizeof(int) * chain->scount);
+ x = G_malloc(sizeof(double) * chain->scount);
+ y = G_malloc(sizeof(double) * chain->scount);
for (k = 0; k < chain->scount; k++) {
x[k] = x0 + chain->sx[k];
Modified: grass/trunk/lib/display/window.c
===================================================================
--- grass/trunk/lib/display/window.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/display/window.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -33,14 +33,14 @@
#include <grass/raster.h>
static struct {
- int t, b, l, r;
+ double t, b, l, r;
} screen_window;
static int screen_window_set;
static struct Cell_head map_window;
static int map_window_set;
-static void D_set_window(int t, int b, int l, int r)
+static void D_set_window(double t, double b, double l, double r)
{
screen_window.t = t;
screen_window.b = b;
@@ -62,7 +62,7 @@
* \return int
*/
-int D_get_screen_window(int *t, int *b, int *l, int *r)
+int D_get_screen_window(double *t, double *b, double *l, double *r)
{
if (!screen_window_set)
{
@@ -95,10 +95,10 @@
* \param bottom
* \param left
* \param right
- * \return int
+ * \return void
*/
-void D_new_window(char *name, int t, int b, int l, int r)
+void D_new_window(char *name, double t, double b, double l, double r)
{
screen_window_set = 0;
map_window_set = 0;
@@ -121,20 +121,20 @@
* \param top
* \param left
* \param right
- * \return int
+ * \return void
*/
-void D_new_window_percent(char *name, float b, float t, float l, float r)
+void D_new_window_percent(char *name, double b, double t, double l, double r)
{
- int scr_t = R_screen_top();
- int scr_b = R_screen_bot();
- int scr_l = R_screen_left();
- int scr_r = R_screen_rite();
+ double scr_t = R_screen_top();
+ double scr_b = R_screen_bot();
+ double scr_l = R_screen_left();
+ double scr_r = R_screen_rite();
- int win_t = 0.5 + scr_t + (scr_b - scr_t) * (100. - t) / 100.0;
- int win_b = 0.5 + scr_t + (scr_b - scr_t) * (100. - b) / 100.0;
- int win_l = 0.5 + scr_l + (scr_r - scr_l) * l / 100.0;
- int win_r = 0.5 + scr_l + (scr_r - scr_l) * r / 100.0;
+ double win_t = 0.5 + scr_t + (scr_b - scr_t) * (100. - t) / 100.0;
+ double win_b = 0.5 + scr_t + (scr_b - scr_t) * (100. - b) / 100.0;
+ double win_l = 0.5 + scr_l + (scr_r - scr_l) * l / 100.0;
+ double win_r = 0.5 + scr_l + (scr_r - scr_l) * r / 100.0;
if (win_t < scr_t)
win_t = scr_t;
@@ -159,12 +159,12 @@
* with lowercase letters.
*
* \param color
- * \return int
+ * \return void
*/
void D_show_window(int color)
{
- int t, b, l, r;
+ double t, b, l, r;
D_get_screen_window(&t, &b, &l, &r);
@@ -193,7 +193,7 @@
* Note this routine is called by <i>D_setup.</i>
*
* \param region
- * \return int
+ * \return void
*/
void D_check_map_window(struct Cell_head *wind)
@@ -218,10 +218,10 @@
* \param bottom
* \param left
* \param right
- * \return int
+ * \return void
*/
-void D_reset_screen_window(int t, int b, int l, int r)
+void D_reset_screen_window(double t, double b, double l, double r)
{
D_show_window(D_translate_color(DEFAULT_BG_COLOR));
@@ -256,7 +256,7 @@
void D_erase_window(void)
{
- int t, b, l, r;
+ double t, b, l, r;
D_get_screen_window(&t, &b, &l, &r);
R_box_abs(l, t, r, b);
@@ -265,7 +265,7 @@
void D_erase(const char *color)
{
- int t, b, l, r;
+ double t, b, l, r;
int colorindex;
D_get_screen_window(&t, &b, &l, &r);
Modified: grass/trunk/lib/driver/Box.c
===================================================================
--- grass/trunk/lib/driver/Box.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Box.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,9 +1,9 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Box_abs(int x1, int y1, int x2, int y2)
+void COM_Box_abs(double x1, double y1, double x2, double y2)
{
- int x[4], y[4];
+ double x[4], y[4];
if (driver->Box) {
(*driver->Box) (x1, y1, x2, y2);
@@ -22,7 +22,7 @@
COM_Polygon_abs(x, y, 4);
}
-void COM_Box_rel(int x, int y)
+void COM_Box_rel(double x, double y)
{
COM_Box_abs(cur_x, cur_y, cur_x + x, cur_y + y);
}
Modified: grass/trunk/lib/driver/Cont.c
===================================================================
--- grass/trunk/lib/driver/Cont.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Cont.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,14 +1,14 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Cont_abs(int x, int y)
+void COM_Cont_abs(double x, double y)
{
DRV_draw_line(cur_x, cur_y, x, y);
cur_x = x;
cur_y = y;
}
-void COM_Cont_rel(int x, int y)
+void COM_Cont_rel(double x, double y)
{
COM_Cont_abs(cur_x + x, cur_y + y);
}
Modified: grass/trunk/lib/driver/Draw.c
===================================================================
--- grass/trunk/lib/driver/Draw.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Draw.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -9,13 +9,13 @@
(*driver->draw_bitmap) (ncols, nrows, threshold, buf);
}
-void DRV_draw_line(int x0, int y0, int x1, int y1)
+void DRV_draw_line(double x0, double y0, double x1, double y1)
{
if (driver->draw_line)
(*driver->draw_line) (x0, y0, x1, y1);
}
-void DRV_draw_point(int x, int y)
+void DRV_draw_point(double x, double y)
{
if (driver->draw_point)
(*driver->draw_point) (x, y);
Modified: grass/trunk/lib/driver/Erase.c
===================================================================
--- grass/trunk/lib/driver/Erase.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Erase.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -3,17 +3,17 @@
void COM_Erase(void)
{
- int top, bot, left, rite;
+ double top, bot, left, rite;
if (driver->Erase) {
(*driver->Erase) ();
return;
}
- COM_Screen_top(&top);
- COM_Screen_bot(&bot);
- COM_Screen_rite(&rite);
- COM_Screen_left(&left);
+ top = COM_Screen_top();
+ bot = COM_Screen_bot();
+ rite = COM_Screen_rite();
+ left = COM_Screen_left();
COM_Box_abs(left, top, rite, bot);
}
Modified: grass/trunk/lib/driver/Get_t_box.c
===================================================================
--- grass/trunk/lib/driver/Get_t_box.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Get_t_box.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Get_text_box(const char *text, int *t, int *b, int *l, int *r)
+void COM_Get_text_box(const char *text, double *t, double *b, double *l, double *r)
{
if (!font_is_freetype()) {
soft_text_ext(cur_x, cur_y,
Modified: grass/trunk/lib/driver/Graph.c
===================================================================
--- grass/trunk/lib/driver/Graph.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Graph.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,10 +1,10 @@
#include "driver.h"
#include "driverlib.h"
-int COM_Graph_set(int argc, char **argv)
+int COM_Graph_set(void)
{
if (driver->Graph_set)
- return (*driver->Graph_set) (argc, argv);
+ return (*driver->Graph_set) ();
return 0;
}
Modified: grass/trunk/lib/driver/Line_width.c
===================================================================
--- grass/trunk/lib/driver/Line_width.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Line_width.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Line_width(int width)
+void COM_Line_width(double width)
{
if (driver->Line_width)
(*driver->Line_width) (width);
Modified: grass/trunk/lib/driver/Move.c
===================================================================
--- grass/trunk/lib/driver/Move.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Move.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,13 +1,13 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Move_abs(int x, int y)
+void COM_Move_abs(double x, double y)
{
cur_x = x;
cur_y = y;
}
-void COM_Move_rel(int x, int y)
+void COM_Move_rel(double x, double y)
{
cur_x += x;
cur_y += y;
Modified: grass/trunk/lib/driver/Polydots.c
===================================================================
--- grass/trunk/lib/driver/Polydots.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Polydots.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Polydots_abs(const int *xarray, const int *yarray, int number)
+void COM_Polydots_abs(const double *xarray, const double *yarray, int number)
{
int i;
@@ -16,7 +16,7 @@
}
}
-void COM_Polydots_rel(const int *xarray, const int *yarray, int number)
+void COM_Polydots_rel(const double *xarray, const double *yarray, int number)
{
int i;
Modified: grass/trunk/lib/driver/Polygon.c
===================================================================
--- grass/trunk/lib/driver/Polygon.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Polygon.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -5,26 +5,29 @@
struct point
{
- int x, y;
+ double x, y;
};
-static int cmp_int(const void *aa, const void *bb)
+static int cmp_double(const void *aa, const void *bb)
{
- const int *a = aa;
- const int *b = bb;
+ const double *a = aa;
+ const double *b = bb;
- return *a - *b;
+ return
+ *a > *b ? 1 :
+ *a < *b ? -1 :
+ 0;
}
-static void fill(int x0, int x1, int y)
+static void fill(double x0, double x1, double y)
{
COM_Box_abs(x0, y, x1, y + 1);
}
-static void line(const struct point *p, int n, int y)
+static void line(const struct point *p, int n, double y)
{
- static int *xs;
- static int max_x;
+ static double *xs;
+ static double max_x;
int num_x = 0;
int i;
@@ -54,13 +57,13 @@
if (num_x >= max_x) {
max_x += 20;
- xs = G_realloc(xs, max_x * sizeof(int));
+ xs = G_realloc(xs, max_x * sizeof(double));
}
xs[num_x++] = x;
}
- qsort(xs, num_x, sizeof(int), cmp_int);
+ qsort(xs, num_x, sizeof(double), cmp_double);
for (i = 0; i + 1 < num_x; i += 2)
fill(xs[i], xs[i + 1], y);
@@ -68,8 +71,8 @@
static void poly(const struct point *p, int n)
{
- int y0, y1;
- int i, y;
+ double y0, y1, y;
+ int i;
if (n < 3)
return;
@@ -97,7 +100,7 @@
line(p, n, y);
}
-static void fill_polygon(const int *xarray, const int *yarray, int count)
+static void fill_polygon(const double *xarray, const double *yarray, int count)
{
static struct point *points;
static int max_points;
@@ -119,7 +122,7 @@
poly(points, count);
}
-void COM_Polygon_abs(const int *xarray, const int *yarray, int number)
+void COM_Polygon_abs(const double *xarray, const double *yarray, int number)
{
if (driver->Polygon) {
(*driver->Polygon) (xarray, yarray, number);
@@ -129,16 +132,16 @@
fill_polygon(xarray, yarray, number);
}
-void COM_Polygon_rel(const int *xarray, const int *yarray, int number)
+void COM_Polygon_rel(const double *xarray, const double *yarray, int number)
{
- static int *xa, *ya;
+ static double *xa, *ya;
static int nalloc;
int i;
if (number > nalloc) {
nalloc = number;
- xa = G_realloc(xa, (size_t) nalloc * sizeof(int));
- ya = G_realloc(ya, (size_t) nalloc * sizeof(int));
+ xa = G_realloc(xa, (size_t) nalloc * sizeof(double));
+ ya = G_realloc(ya, (size_t) nalloc * sizeof(double));
}
xa[0] = xarray[0] + cur_x;
Modified: grass/trunk/lib/driver/Polyline.c
===================================================================
--- grass/trunk/lib/driver/Polyline.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Polyline.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Polyline_abs(const int *xarray, const int *yarray, int number)
+void COM_Polyline_abs(const double *xarray, const double *yarray, int number)
{
int i;
@@ -16,7 +16,7 @@
COM_Cont_abs(xarray[i], yarray[i]);
}
-void COM_Polyline_rel(const int *xarray, const int *yarray, int number)
+void COM_Polyline_rel(const double *xarray, const double *yarray, int number)
{
int i;
Modified: grass/trunk/lib/driver/Raster.c
===================================================================
--- grass/trunk/lib/driver/Raster.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Raster.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -10,7 +10,7 @@
******************************************************************************
*/
-void COM_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
+void COM_begin_scaled_raster(int mask, int src[2][2], double dst[2][2])
{
if (driver->Begin_scaled_raster)
(*driver->Begin_scaled_raster) (mask, src, dst);
Modified: grass/trunk/lib/driver/Returns.c
===================================================================
--- grass/trunk/lib/driver/Returns.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Returns.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,27 +1,27 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Screen_left(int *index)
+double COM_Screen_left(void)
{
- *index = screen_left;
+ return screen_left;
}
-void COM_Screen_rite(int *index)
+double COM_Screen_rite(void)
{
- *index = screen_right;
+ return screen_right;
}
-void COM_Screen_bot(int *index)
+double COM_Screen_bot(void)
{
- *index = screen_bottom;
+ return screen_bottom;
}
-void COM_Screen_top(int *index)
+double COM_Screen_top(void)
{
- *index = screen_top;
+ return screen_top;
}
-void COM_Number_of_colors(int *ncolors)
+int COM_Number_of_colors(void)
{
- *ncolors = NCOLORS;
+ return NCOLORS;
}
Modified: grass/trunk/lib/driver/Set_window.c
===================================================================
--- grass/trunk/lib/driver/Set_window.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Set_window.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Set_window(int t, int b, int l, int r)
+void COM_Set_window(double t, double b, double l, double r)
{
if (driver->Set_window)
(*driver->Set_window) (t, b, l, r);
Modified: grass/trunk/lib/driver/Text_size.c
===================================================================
--- grass/trunk/lib/driver/Text_size.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/Text_size.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,13 +1,13 @@
#include "driver.h"
#include "driverlib.h"
-void COM_Text_size(int x, int y)
+void COM_Text_size(double x, double y)
{
- text_size_x = (double)x / 25.0;
- text_size_y = (double)y / 25.0;
+ text_size_x = x / 25.0;
+ text_size_y = y / 25.0;
}
void COM_Text_rotation(double val)
{
- text_rotation = (double)val;
+ text_rotation = val;
}
Modified: grass/trunk/lib/driver/driver.h
===================================================================
--- grass/trunk/lib/driver/driver.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/driver.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -11,29 +11,27 @@
extern int screen_bottom;
extern int screen_top;
-extern int cur_x;
-extern int cur_y;
+extern double cur_x;
+extern double cur_y;
extern double text_size_x;
extern double text_size_y;
extern double text_rotation;
-extern int mouse_button[];
-
extern struct GFONT_CAP *ftcap;
struct driver
{
- void (*Box) (int, int, int, int);
+ void (*Box) (double, double, double, double);
void (*Erase) (void);
- int (*Graph_set) (int, char **);
+ int (*Graph_set) (void);
void (*Graph_close) (void);
- void (*Line_width) (int);
- void (*Polydots) (const int *, const int *, int);
- void (*Polyline) (const int *, const int *, int);
- void (*Polygon) (const int *, const int *, int);
- void (*Set_window) (int, int, int, int);
- void (*Begin_scaled_raster) (int, int[2][2], int[2][2]);
+ void (*Line_width) (double);
+ void (*Polydots) (const double *, const double *, int);
+ void (*Polyline) (const double *, const double *, int);
+ void (*Polygon) (const double *, const double *, int);
+ void (*Set_window) (double, double, double, double);
+ void (*Begin_scaled_raster) (int, int[2][2], double[2][2]);
int (*Scaled_raster) (int, int,
const unsigned char *,
const unsigned char *,
@@ -43,8 +41,8 @@
int (*lookup_color) (int, int, int);
void (*color) (int);
- void (*draw_line) (int, int, int, int);
- void (*draw_point) (int, int);
+ void (*draw_line) (double, double, double, double);
+ void (*draw_point) (double, double);
void (*draw_bitmap) (int, int, int, const unsigned char *);
void (*draw_text) (const char *);
};
@@ -52,7 +50,7 @@
/* Library Functions */
/* init.c */
-extern int LIB_init(const struct driver *drv, int argc, char **argv);
+extern int LIB_init(const struct driver *drv);
/* Commands */
@@ -60,16 +58,16 @@
extern void COM_Bitmap(int, int, int, const unsigned char *);
/* Box.c */
-extern void COM_Box_abs(int, int, int, int);
-extern void COM_Box_rel(int, int);
+extern void COM_Box_abs(double, double, double, double);
+extern void COM_Box_rel(double, double);
/* Color.c */
extern void COM_Color_RGB(unsigned char, unsigned char, unsigned char);
extern void COM_Standard_color(int);
/* Cont.c */
-extern void COM_Cont_abs(int, int);
-extern void COM_Cont_rel(int, int);
+extern void COM_Cont_abs(double, double);
+extern void COM_Cont_rel(double, double);
/* Erase.c */
extern void COM_Erase(void);
@@ -81,33 +79,33 @@
extern void COM_Font_info(char ***, int *);
/* Get_t_box.c */
-extern void COM_Get_text_box(const char *, int *, int *, int *, int *);
+extern void COM_Get_text_box(const char *, double *, double *, double *, double *);
/* Graph.c */
-extern int COM_Graph_set(int, char **);
+extern int COM_Graph_set(void);
extern void COM_Graph_close(void);
/* Line_width.c */
-extern void COM_Line_width(int);
+extern void COM_Line_width(double);
/* Move.c */
-extern void COM_Move_abs(int, int);
-extern void COM_Move_rel(int, int);
+extern void COM_Move_abs(double, double);
+extern void COM_Move_rel(double, double);
/* Polydots.c */
-extern void COM_Polydots_abs(const int *, const int *, int);
-extern void COM_Polydots_rel(const int *, const int *, int);
+extern void COM_Polydots_abs(const double *, const double *, int);
+extern void COM_Polydots_rel(const double *, const double *, int);
/* Polygon.c */
-extern void COM_Polygon_abs(const int *, const int *, int);
-extern void COM_Polygon_rel(const int *, const int *, int);
+extern void COM_Polygon_abs(const double *, const double *, int);
+extern void COM_Polygon_rel(const double *, const double *, int);
/* Polyline.c */
-extern void COM_Polyline_abs(const int *, const int *, int);
-extern void COM_Polyline_rel(const int *, const int *, int);
+extern void COM_Polyline_abs(const double *, const double *, int);
+extern void COM_Polyline_rel(const double *, const double *, int);
/* Raster.c */
-extern void COM_begin_scaled_raster(int, int[2][2], int[2][2]);
+extern void COM_begin_scaled_raster(int, int[2][2], double[2][2]);
extern int COM_scaled_raster(int, int, const unsigned char *,
const unsigned char *, const unsigned char *,
const unsigned char *);
@@ -117,20 +115,20 @@
extern void COM_Respond(void);
/* Returns.c */
-extern void COM_Screen_left(int *);
-extern void COM_Screen_rite(int *);
-extern void COM_Screen_bot(int *);
-extern void COM_Screen_top(int *);
-extern void COM_Number_of_colors(int *);
+extern double COM_Screen_left(void);
+extern double COM_Screen_rite(void);
+extern double COM_Screen_bot(void);
+extern double COM_Screen_top(void);
+extern int COM_Number_of_colors(void);
/* Set_window.c */
-extern void COM_Set_window(int, int, int, int);
+extern void COM_Set_window(double, double, double, double);
/* Text.c */
extern void COM_Text(const char *);
/* Text_size.c */
-extern void COM_Text_size(int, int);
+extern void COM_Text_size(double, double);
extern void COM_Text_rotation(double);
/* Driver Operations */
@@ -141,7 +139,7 @@
/* Draw.c */
extern void DRV_draw_bitmap(int, int, int, const unsigned char *);
-extern void DRV_draw_line(int x0, int y0, int x1, int y1);
-extern void DRV_draw_point(int x, int y);
+extern void DRV_draw_line(double, double, double, double);
+extern void DRV_draw_point(double, double);
#endif /* _DRIVER_H */
Modified: grass/trunk/lib/driver/driverlib.h
===================================================================
--- grass/trunk/lib/driver/driverlib.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/driverlib.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -13,15 +13,15 @@
/* Text2.c */
void drawchar(double, double, double, double, unsigned char);
-void soft_text_ext(int x, int, double, double, double, const char *);
-void get_text_ext(int *, int *, int *, int *);
+void soft_text_ext(int, int, double, double, double, const char *);
+void get_text_ext(double *, double *, double *, double *);
void soft_text(int, int, double, double, double, const char *);
void onechar(int, int, double, double, double, unsigned char);
/* Text3.c */
void soft_text_freetype(int, int, double, double, double, const char *);
void soft_text_ext_freetype(int, int, double, double, double, const char *);
-void get_text_ext_freetype(int *, int *, int *, int *);
+void get_text_ext_freetype(double *, double *, double *, double *);
/* font2.c */
int font_init(const char *);
@@ -35,7 +35,7 @@
int font_get_index(void);
/* parse_ftcap.c */
-extern int font_exists(const char *name);
+extern int font_exists(const char *);
extern struct GFONT_CAP *parse_freetypecap(void);
-extern void free_freetypecap(struct GFONT_CAP *ftcap);
-extern void free_font_list(char **fonts, int num_fonts);
+extern void free_freetypecap(struct GFONT_CAP *);
+extern void free_font_list(char **, int);
Modified: grass/trunk/lib/driver/init.c
===================================================================
--- grass/trunk/lib/driver/init.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/init.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -33,14 +33,14 @@
int screen_bottom;
int screen_top;
-int cur_x;
-int cur_y;
+double cur_x;
+double cur_y;
double text_size_x;
double text_size_y;
double text_rotation;
-int LIB_init(const struct driver *drv, int argc, char **argv)
+int LIB_init(const struct driver *drv)
{
const char *p;
@@ -57,7 +57,7 @@
screen_top = 0;
screen_bottom = (p && atoi(p)) ? atoi(p) : DEF_HEIGHT;
- if (COM_Graph_set(argc, argv) < 0)
+ if (COM_Graph_set() < 0)
exit(1);
return 0;
Modified: grass/trunk/lib/driver/text2.c
===================================================================
--- grass/trunk/lib/driver/text2.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/text2.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -125,7 +125,7 @@
dont_draw = 0;
}
-void get_text_ext(int *top, int *bot, int *left, int *rite)
+void get_text_ext(double *top, double *bot, double *left, double *rite)
{
*top = t;
*bot = b;
Modified: grass/trunk/lib/driver/text3.c
===================================================================
--- grass/trunk/lib/driver/text3.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/driver/text3.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -295,7 +295,7 @@
fdont_draw = 0;
}
-void get_text_ext_freetype(int *top, int *bot, int *left, int *rite)
+void get_text_ext_freetype(double *top, double *bot, double *left, double *rite)
{
*top = ft;
*bot = fb;
Deleted: grass/trunk/lib/gis/icon.c
===================================================================
--- grass/trunk/lib/gis/icon.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/gis/icon.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,112 +0,0 @@
-
-/**
- * \file icon.c
- *
- * \brief GIS Library - Plot icon
- *
- * (C) 2001-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2008
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <grass/gis.h>
-
-static void trans(double *x, double *y, int n_points,
- double angle, double scale, double xc, double yc)
-{
- double m[2][2];
- double sin_a = sin(angle);
- double cos_a = cos(angle);
- int i;
-
- m[0][0] = cos_a * scale;
- m[0][1] = -sin_a * scale;
- m[1][0] = sin_a * scale;
- m[1][1] = cos_a * scale;
-
- for (i = 0; i < n_points; i++) {
- double xi = x[i];
- double yi = y[i];
-
- x[i] = m[0][0] * xi + m[0][1] * yi + xc;
- y[i] = m[1][0] * xi + m[1][1] * yi + yc;
- }
-}
-
-/**
- * \brief Plot icon
- *
- * \param[in] xc,yc icon coordinates
- * \param[in] type icon type
- * \param[in] angle rotation angle [rad]
- * \param[in] scale scale factor
- *
- * \return 1
- */
-int G_plot_icon(double xc, double yc, int type, double angle, double scale)
-{
- int i, np = 0;
- double x[10], y[10];
-
- G_debug(2, "G_plot_icon(): xc=%g, yc=%g", xc, yc);
-
- /* diamond, box */
- switch (type) {
- case G_ICON_CROSS:
- x[0] = -0.5;
- y[0] = 0.0;
- x[1] = 0.5;
- y[1] = 0.0;
- x[2] = 0.0;
- y[2] = -0.5;
- x[3] = 0.0;
- y[3] = 0.5;
- np = 4;
- break;
- case G_ICON_BOX:
- G_debug(1, "box");
- x[0] = -0.5;
- y[0] = -0.5;
- x[1] = 0.5;
- y[1] = -0.5;
- x[2] = 0.5;
- y[2] = -0.5;
- x[3] = 0.5;
- y[3] = 0.5;
- x[4] = 0.5;
- y[4] = 0.5;
- x[5] = -0.5;
- y[5] = 0.5;
- x[6] = -0.5;
- y[6] = 0.5;
- x[7] = -0.5;
- y[7] = -0.5;
- np = 8;
- break;
- case G_ICON_ARROW:
- x[0] = -1;
- y[0] = 0.5;
- x[1] = 0;
- y[1] = 0.0;
- x[2] = -1;
- y[2] = -0.5;
- x[3] = 0;
- y[3] = 0.0;
- np = 4;
- break;
- }
-
- trans(x, y, np, angle, scale, xc, yc);
-
- for (i = 0; i < np; i += 2)
- G_plot_line(x[i], y[i], x[i + 1], y[i + 1]);
-
- return (1);
-}
Modified: grass/trunk/lib/htmldriver/Graph_Clse.c
===================================================================
--- grass/trunk/lib/htmldriver/Graph_Clse.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/htmldriver/Graph_Clse.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -9,12 +9,7 @@
#include "htmlmap.h"
/* sreen dimensions defined in Graph_Set.c */
-extern int screen_top;
-extern int screen_left;
-extern int screen_right;
-extern int screen_bottom;
-
/* point in polygon test by Randolph Franklin */
/* http://www.ecse.rpi.edu/Homepages/wrf/ */
/* adapted for integer coordinates */
Modified: grass/trunk/lib/htmldriver/Graph_Set.c
===================================================================
--- grass/trunk/lib/htmldriver/Graph_Set.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/htmldriver/Graph_Set.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -32,7 +32,7 @@
int MAX_POINTS;
int MINIMUM_DIST;
-int HTML_Graph_set(int argc, char **argv)
+int HTML_Graph_set(void)
{
char *p;
Modified: grass/trunk/lib/htmldriver/Polygon.c
===================================================================
--- grass/trunk/lib/htmldriver/Polygon.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/htmldriver/Polygon.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -57,7 +57,7 @@
}
-void HTML_Polygon(const int *px, const int *py, int n)
+void HTML_Polygon(const double *px, const double *py, int n)
{
struct MapPoly *new;
int i;
@@ -69,8 +69,10 @@
int *x = G_malloc(n * sizeof(int));
int *y = G_malloc(n * sizeof(int));
- memcpy(x, px, n * sizeof(int));
- memcpy(y, py, n * sizeof(int));
+ for (i = 0; i < n; i++) {
+ x[i] = (int) floor(px[i] + 0.5);
+ y[i] = (int) floor(py[i] + 0.5);
+ }
/*
* remove points that have adjacent duplicates or have differences of
Modified: grass/trunk/lib/htmldriver/htmlmap.h
===================================================================
--- grass/trunk/lib/htmldriver/htmlmap.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/htmldriver/htmlmap.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -39,10 +39,10 @@
extern void HTML_Graph_close(void);
/* Graph_Set.c */
-extern int HTML_Graph_set(int, char **);
+extern int HTML_Graph_set(void);
/* Polygon.c */
-extern void HTML_Polygon(const int *, const int *, int);
+extern void HTML_Polygon(const double *, const double *, int);
/* Text.c */
extern void HTML_Text(const char *);
Modified: grass/trunk/lib/pngdriver/Box.c
===================================================================
--- grass/trunk/lib/pngdriver/Box.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/Box.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,8 +1,13 @@
+#include <math.h>
#include "pngdriver.h"
-void PNG_Box(int x1, int y1, int x2, int y2)
+void PNG_Box(double fx1, double fy1, double fx2, double fy2)
{
+ int x1 = (int) floor(fx1 + 0.5);
+ int y1 = (int) floor(fy1 + 0.5);
+ int x2 = (int) floor(fx2 + 0.5);
+ int y2 = (int) floor(fy2 + 0.5);
int tmp;
int x, y;
Modified: grass/trunk/lib/pngdriver/Draw_line.c
===================================================================
--- grass/trunk/lib/pngdriver/Draw_line.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/Draw_line.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -7,6 +7,7 @@
*/
#include <stdlib.h>
+#include <math.h>
#include "pngdriver.h"
@@ -98,8 +99,12 @@
store_xy(x, y);
}
-void PNG_draw_line(int x1, int y1, int x2, int y2)
+void PNG_draw_line(double fx1, double fy1, double fx2, double fy2)
{
+ int x1 = (int) floor(fx1 + 0.5);
+ int y1 = (int) floor(fy1 + 0.5);
+ int x2 = (int) floor(fx2 + 0.5);
+ int y2 = (int) floor(fy2 + 0.5);
int dx, dy;
int i;
Modified: grass/trunk/lib/pngdriver/Draw_point.c
===================================================================
--- grass/trunk/lib/pngdriver/Draw_point.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/Draw_point.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,11 @@
+#include <math.h>
#include "pngdriver.h"
-void PNG_draw_point(int x, int y)
+void PNG_draw_point(double fx, double fy)
{
+ int x = (int) floor(fx + 0.5);
+ int y = (int) floor(fy + 0.5);
+
if (x < clip_left || x >= clip_rite || y < clip_top || y >= clip_bot)
return;
Modified: grass/trunk/lib/pngdriver/Graph_set.c
===================================================================
--- grass/trunk/lib/pngdriver/Graph_set.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/Graph_set.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -63,7 +63,7 @@
#endif
}
-int PNG_Graph_set(int argc, char **argv)
+int PNG_Graph_set(void)
{
unsigned int red, grn, blu;
int do_read = 0;
Modified: grass/trunk/lib/pngdriver/Line_width.c
===================================================================
--- grass/trunk/lib/pngdriver/Line_width.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/Line_width.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,3 +1,4 @@
+#include <math.h>
#include "pngdriver.h"
int linewidth;
@@ -2,5 +3,5 @@
-void PNG_Line_width(int width)
+void PNG_Line_width(double width)
{
- linewidth = (width < 0 ? 0 : width);
+ linewidth = (width < 0 ? 0 : (int) floor(width + 0.5));
}
Modified: grass/trunk/lib/pngdriver/Raster.c
===================================================================
--- grass/trunk/lib/pngdriver/Raster.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/Raster.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -57,10 +57,16 @@
trans = G_realloc(trans, nalloc * sizeof(int));
}
-void PNG_begin_scaled_raster(int mask, int s[2][2], int d[2][2])
+void PNG_begin_scaled_raster(int mask, int s[2][2], double fd[2][2])
{
+ int d[2][2];
int i;
+ d[0][0] = (int) floor(fd[0][0] + 0.5);
+ d[0][1] = (int) floor(fd[0][1] + 0.5);
+ d[1][0] = (int) floor(fd[1][0] + 0.5);
+ d[1][1] = (int) floor(fd[1][1] + 0.5);
+
ncols = d[0][1] - d[0][0];
memcpy(src, s, sizeof(src));
Modified: grass/trunk/lib/pngdriver/Set_window.c
===================================================================
--- grass/trunk/lib/pngdriver/Set_window.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/Set_window.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -17,12 +17,18 @@
*
*****************************************************************************/
+#include <math.h>
#include "pngdriver.h"
-void PNG_Set_window(int t, int b, int l, int r)
+void PNG_Set_window(double ft, double fb, double fl, double fr)
{
- clip_top = t > screen_top ? t : screen_top;
- clip_bot = b < screen_bottom ? b : screen_bottom;
- clip_left = l > screen_left ? l : screen_left;
- clip_rite = r < screen_right ? r : screen_right;
+ int t = (int) floor(ft + 0.5);
+ int b = (int) floor(fb + 0.5);
+ int l = (int) floor(fl + 0.5);
+ int r = (int) floor(fr + 0.5);
+
+ clip_top = t > screen_top ? t : screen_top;
+ clip_bot = b < screen_bottom ? b : screen_bottom;
+ clip_left = l > screen_left ? l : screen_left;
+ clip_rite = r < screen_right ? r : screen_right;
}
Modified: grass/trunk/lib/pngdriver/pngdriver.h
===================================================================
--- grass/trunk/lib/pngdriver/pngdriver.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/pngdriver/pngdriver.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -44,22 +44,22 @@
extern const struct driver *PNG_Driver(void);
-extern void PNG_Box(int, int, int, int);
+extern void PNG_Box(double, double, double, double);
extern void PNG_Client_Close(void);
extern void PNG_Erase(void);
extern void PNG_Graph_close(void);
-extern int PNG_Graph_set(int, char **);
-extern void PNG_Line_width(int);
-extern void PNG_begin_scaled_raster(int, int[2][2], int[2][2]);
+extern int PNG_Graph_set(void);
+extern void PNG_Line_width(double);
+extern void PNG_begin_scaled_raster(int, int[2][2], double[2][2]);
extern int PNG_scaled_raster(int, int, const unsigned char *,
const unsigned char *, const unsigned char *,
const unsigned char *);
extern void PNG_Respond(void);
-extern void PNG_Set_window(int, int, int, int);
+extern void PNG_Set_window(double, double, double, double);
extern void PNG_color(int);
extern void PNG_draw_bitmap(int, int, int, const unsigned char *);
-extern void PNG_draw_line(int, int, int, int);
-extern void PNG_draw_point(int, int);
+extern void PNG_draw_line(double, double, double, double);
+extern void PNG_draw_point(double, double);
extern int PNG_lookup_color(int, int, int);
#endif /* __PNGDRIVER_H__ */
Modified: grass/trunk/lib/psdriver/Box.c
===================================================================
--- grass/trunk/lib/psdriver/Box.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Box.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "psdriver.h"
-void PS_Box(int x1, int y1, int x2, int y2)
+void PS_Box(double x1, double y1, double x2, double y2)
{
- output("%d %d %d %d BOX\n", x1, y1, x2, y2);
+ output("%f %f %f %f BOX\n", x1, y1, x2, y2);
}
Modified: grass/trunk/lib/psdriver/Draw_line.c
===================================================================
--- grass/trunk/lib/psdriver/Draw_line.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Draw_line.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,7 +1,7 @@
#include "psdriver.h"
-void PS_draw_line(int x1, int y1, int x2, int y2)
+void PS_draw_line(double x1, double y1, double x2, double y2)
{
- output("%d %d %d %d LINE\n", x1, y1, x2, y2);
+ output("%f %f %f %f LINE\n", x1, y1, x2, y2);
}
Modified: grass/trunk/lib/psdriver/Draw_point.c
===================================================================
--- grass/trunk/lib/psdriver/Draw_point.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Draw_point.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,6 +1,6 @@
#include "psdriver.h"
-void PS_draw_point(int x, int y)
+void PS_draw_point(double x, double y)
{
- output("%d %d POINT\n", x, y);
+ output("%f %f POINT\n", x, y);
}
Modified: grass/trunk/lib/psdriver/Graph_set.c
===================================================================
--- grass/trunk/lib/psdriver/Graph_set.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Graph_set.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -169,7 +169,7 @@
screen_bottom = screen_top + height;
}
-int PS_Graph_set(int argc, char **argv)
+int PS_Graph_set(void)
{
const char *p;
Modified: grass/trunk/lib/psdriver/Line_width.c
===================================================================
--- grass/trunk/lib/psdriver/Line_width.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Line_width.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,9 +1,9 @@
#include "psdriver.h"
-void PS_Line_width(int width)
+void PS_Line_width(double width)
{
if (width < 0)
width = 0;
- output("%d WIDTH\n", width);
+ output("%f WIDTH\n", width);
}
Modified: grass/trunk/lib/psdriver/Polygon.c
===================================================================
--- grass/trunk/lib/psdriver/Polygon.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Polygon.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,17 +1,17 @@
#include "psdriver.h"
-void PS_Polygon(const int *xarray, const int *yarray, int number)
+void PS_Polygon(const double *xarray, const double *yarray, int number)
{
int i;
if (number < 2)
return;
- output("%d %d POLYGONSTART\n", xarray[0], yarray[0]);
+ output("%f %f POLYGONSTART\n", xarray[0], yarray[0]);
for (i = 1; i < number; i++)
- output("%d %d POLYGONVERTEX\n", xarray[i], yarray[i]);
+ output("%f %f POLYGONVERTEX\n", xarray[i], yarray[i]);
output("POLYGONEND\n");
}
Modified: grass/trunk/lib/psdriver/Polyline.c
===================================================================
--- grass/trunk/lib/psdriver/Polyline.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Polyline.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,17 +1,17 @@
#include "psdriver.h"
-void PS_Polyline(const int *xarray, const int *yarray, int number)
+void PS_Polyline(const double *xarray, const double *yarray, int number)
{
int i;
if (number < 2)
return;
- output("%d %d POLYLINESTART\n", xarray[0], yarray[0]);
+ output("%f %f POLYLINESTART\n", xarray[0], yarray[0]);
for (i = 1; i < number; i++)
- output("%d %d POLYLINEVERTEX\n", xarray[i], yarray[i]);
+ output("%f %f POLYLINEVERTEX\n", xarray[i], yarray[i]);
output("POLYLINEEND\n");
}
Modified: grass/trunk/lib/psdriver/Raster.c
===================================================================
--- grass/trunk/lib/psdriver/Raster.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Raster.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -5,7 +5,7 @@
static int masked;
-void PS_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
+void PS_begin_scaled_raster(int mask, int src[2][2], double dst[2][2])
{
const char *type = true_color ? (mask ? "RASTERRGBMASK" : "RASTERRGB")
: (mask ? "RASTERGRAYMASK" : "RASTERGRAY");
@@ -15,15 +15,15 @@
int sox = src[0][0];
int soy = src[1][0];
- int dsx = dst[0][1] - dst[0][0];
- int dsy = dst[1][1] - dst[1][0];
- int dox = dst[0][0];
- int doy = dst[1][0];
+ double dsx = dst[0][1] - dst[0][0];
+ double dsy = dst[1][1] - dst[1][0];
+ double dox = dst[0][0];
+ double doy = dst[1][0];
masked = mask;
output("gsave\n");
- output("%d %d translate %d %d scale\n", dox, doy, dsx, dsy);
+ output("%f %f translate %f %f scale\n", dox, doy, dsx, dsy);
output("%d %d [%d 0 0 %d %d %d] %s\n", ssx, ssy, ssx, ssy, sox, soy,
type);
}
Modified: grass/trunk/lib/psdriver/Set_window.c
===================================================================
--- grass/trunk/lib/psdriver/Set_window.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/Set_window.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -19,8 +19,8 @@
#include "psdriver.h"
-void PS_Set_window(int t, int b, int l, int r)
+void PS_Set_window(double t, double b, double l, double r)
{
- output("%d %d %d %d %s\n", t, b, l, r,
+ output("%f %f %f %f %s\n", t, b, l, r,
encapsulated ? "EPSWINDOW" : "WINDOW");
}
Modified: grass/trunk/lib/psdriver/psdriver.h
===================================================================
--- grass/trunk/lib/psdriver/psdriver.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/psdriver/psdriver.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -21,25 +21,25 @@
extern const struct driver *PS_Driver(void);
-extern void PS_Box(int, int, int, int);
+extern void PS_Box(double, double, double, double);
extern void PS_Client_Close(void);
extern void PS_Erase(void);
extern void PS_Graph_close(void);
-extern int PS_Graph_set(int, char **);
-extern void PS_Line_width(int);
+extern int PS_Graph_set(void);
+extern void PS_Line_width(double);
extern void PS_Respond(void);
-extern void PS_Set_window(int, int, int, int);
+extern void PS_Set_window(double, double, double, double);
extern void PS_color(int);
extern void PS_draw_bitmap(int, int, int, const unsigned char *);
-extern void PS_draw_line(int, int, int, int);
-extern void PS_draw_point(int, int);
+extern void PS_draw_line(double, double, double, double);
+extern void PS_draw_point(double, double);
extern int PS_lookup_color(int, int, int);
-extern void PS_begin_scaled_raster(int, int[2][2], int[2][2]);
+extern void PS_begin_scaled_raster(int, int[2][2], double[2][2]);
extern int PS_scaled_raster(int, int, const unsigned char *,
const unsigned char *, const unsigned char *,
const unsigned char *);
extern void PS_end_scaled_raster(void);
-extern void PS_Polygon(const int *, const int *, int);
-extern void PS_Polyline(const int *, const int *, int);
+extern void PS_Polygon(const double *, const double *, int);
+extern void PS_Polyline(const double *, const double *, int);
#endif /* __PSDRIVER_H__ */
Modified: grass/trunk/lib/raster/raster.c
===================================================================
--- grass/trunk/lib/raster/raster.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/lib/raster/raster.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -50,7 +50,7 @@
#endif
PNG_Driver();
- LIB_init(drv, 0, NULL);
+ LIB_init(drv);
init();
@@ -79,16 +79,12 @@
* Returns the coordinate of the left edge of the screen.
*
* \param void
- * \return int
+ * \return double
*/
-int R_screen_left(void)
+double R_screen_left(void)
{
- int l;
-
- COM_Screen_left(&l);
-
- return l;
+ return COM_Screen_left();
}
/*!
@@ -97,16 +93,12 @@
* Returns the coordinate of the right edge of the screen.
*
* \param void
- * \return int
+ * \return double
*/
-int R_screen_rite(void)
+double R_screen_rite(void)
{
- int r;
-
- COM_Screen_rite(&r);
-
- return r;
+ return COM_Screen_rite();
}
/*!
@@ -115,16 +107,12 @@
* Returns the coordinate of the bottom of the screen.
*
* \param void
- * \return int
+ * \return double
*/
-int R_screen_bot(void)
+double R_screen_bot(void)
{
- int b;
-
- COM_Screen_bot(&b);
-
- return b;
+ return COM_Screen_bot();
}
@@ -134,25 +122,17 @@
* Returns the coordinate of the top of the screen.
*
* \param void
- * \return int
+ * \return double
*/
-int R_screen_top(void)
+double R_screen_top(void)
{
- int t;
-
- COM_Screen_top(&t);
-
- return t;
+ return COM_Screen_top();
}
int R_get_num_colors(void)
{
- int c;
-
- COM_Number_of_colors(&c);
-
- return c;
+ return COM_Number_of_colors();
}
/*!
@@ -164,7 +144,7 @@
* See Display_Graphics_Library.
*
* \param index
- * \return int
+ * \return void
*/
void R_standard_color(int index)
@@ -183,10 +163,10 @@
* \param red
* \param grn
* \param blue
- * \return int
+ * \return void
*/
-void R_RGB_color(unsigned char red, unsigned char grn, unsigned char blu)
+void R_RGB_color(int red, int grn, int blu)
{
COM_Color_RGB(red, grn, blu);
}
@@ -197,10 +177,10 @@
* Changes the <b>width</b> of line to be used in subsequent draw commands.
*
* \param width
- * \return int
+ * \return void
*/
-void R_line_width(int width)
+void R_line_width(double width)
{
COM_Line_width(width);
}
@@ -211,7 +191,7 @@
* Erases the entire screen to black.
*
* \param void
- * \return int
+ * \return void
*/
void R_erase(void)
@@ -227,10 +207,10 @@
*
* \param x
* \param y
- * \return int
+ * \return void
*/
-void R_move_abs(int x, int y)
+void R_move_abs(double x, double y)
{
COM_Move_abs(x, y);
}
@@ -247,10 +227,10 @@
*
* \param x dx
* \param y dy
- * \return int
+ * \return void
*/
-void R_move_rel(int x, int y)
+void R_move_rel(double x, double y)
{
COM_Move_rel(x, y);
}
@@ -264,10 +244,10 @@
*
* \param x
* \param y
- * \return int
+ * \return void
*/
-void R_cont_abs(int x, int y)
+void R_cont_abs(double x, double y)
{
COM_Cont_abs(x, y);
}
@@ -286,10 +266,10 @@
*
* \param x
* \param y
- * \return int
+ * \return void
*/
-void R_cont_rel(int x, int y)
+void R_cont_rel(double x, double y)
{
COM_Cont_rel(x, y);
}
@@ -304,10 +284,10 @@
* \param xarray x
* \param yarray y
* \param number
- * \return int
+ * \return void
*/
-void R_polydots_abs(const int *xarray, const int *yarray, int number)
+void R_polydots_abs(const double *xarray, const double *yarray, int number)
{
COM_Polydots_abs(xarray, yarray, number);
}
@@ -324,10 +304,10 @@
* \param xarray x
* \param yarray y
* \param number
- * \return int
+ * \return void
*/
-void R_polydots_rel(const int *xarray, const int *yarray, int number)
+void R_polydots_rel(const double *xarray, const double *yarray, int number)
{
COM_Polydots_rel(xarray, yarray, number);
}
@@ -345,10 +325,10 @@
* \param xarray x
* \param yarray y
* \param number
- * \return int
+ * \return void
*/
-void R_polyline_abs(const int *xarray, const int *yarray, int number)
+void R_polyline_abs(const double *xarray, const double *yarray, int number)
{
COM_Polyline_abs(xarray, yarray, number);
}
@@ -367,10 +347,10 @@
* \param xarray x
* \param yarray y
* \param number
- * \return int
+ * \return void
*/
-void R_polyline_rel(const int *xarray, const int *yarray, int number)
+void R_polyline_rel(const double *xarray, const double *yarray, int number)
{
COM_Polyline_rel(xarray, yarray, number);
}
@@ -385,10 +365,10 @@
* \param xarray x
* \param yarray y
* \param number
- * \return int
+ * \return void
*/
-void R_polygon_abs(const int *xarray, const int *yarray, int number)
+void R_polygon_abs(const double *xarray, const double *yarray, int number)
{
COM_Polygon_abs(xarray, yarray, number);
}
@@ -405,10 +385,10 @@
* \param xarray x
* \param yarray y
* \param number
- * \return int
+ * \return void
*/
-void R_polygon_rel(const int *xarray, const int *yarray, int number)
+void R_polygon_rel(const double *xarray, const double *yarray, int number)
{
COM_Polygon_rel(xarray, yarray, number);
}
@@ -424,10 +404,10 @@
* \param y1
* \param x2
* \param y2
- * \return int
+ * \return void
*/
-void R_box_abs(int x1, int y1, int x2, int y2)
+void R_box_abs(double x1, double y1, double x2, double y2)
{
COM_Box_abs(x1, y1, x2, y2);
}
@@ -442,10 +422,10 @@
*
* \param x
* \param y
- * \return int
+ * \return void
*/
-void R_box_rel(int x, int y)
+void R_box_rel(double x, double y)
{
COM_Box_rel(x, y);
}
@@ -457,15 +437,15 @@
*
* \param width
* \param height
- * \return int
+ * \return void
*/
-void R_text_size(int width, int height)
+void R_text_size(double width, double height)
{
COM_Text_size(width, height);
}
-void R_text_rotation(float rotation)
+void R_text_rotation(double rotation)
{
COM_Text_rotation(rotation);
}
@@ -480,10 +460,10 @@
* \param b bottom
* \param l left
* \param r right
- * \return int
+ * \return void
*/
-void R_set_window(int t, int b, int l, int r)
+void R_set_window(double t, double b, double l, double r)
{
COM_Set_window(t, b, l, r);
}
@@ -495,7 +475,7 @@
* width and height, starting at the current screen location.
*
* \param sometext
- * \return int
+ * \return void
*/
void R_text(const char *text)
@@ -517,10 +497,10 @@
* \param b bottom
* \param l left
* \param r right
- * \return int
+ * \return void
*/
-void R_get_text_box(const char *text, int *t, int *b, int *l, int *r)
+void R_get_text_box(const char *text, double *t, double *b, double *l, double *r)
{
COM_Get_text_box(text, t, b, l, r);
}
@@ -531,7 +511,7 @@
* Set current font to <b>font name</b>.
*
* \param name
- * \return int
+ * \return void
*/
void R_font(const char *name)
@@ -554,7 +534,7 @@
COM_Font_info(list, count);
}
-void R_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
+void R_begin_scaled_raster(int mask, int src[2][2], double dst[2][2])
{
COM_begin_scaled_raster(mask, src, dst);
}
Modified: grass/trunk/raster/wildfire/r.spread/display.c
===================================================================
--- grass/trunk/raster/wildfire/r.spread/display.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/raster/wildfire/r.spread/display.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -25,7 +25,7 @@
{
extern struct Cell_head window;
extern int nrows, ncols; /*numbers of rows and columns in file */
- int t, b, l, r; /*top, bottom, left and right of frame */
+ double t, b, l, r; /*top, bottom, left and right of frame */
int width, height;
Modified: grass/trunk/vector/v.digit/display.c
===================================================================
--- grass/trunk/vector/v.digit/display.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/vector/v.digit/display.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -26,10 +26,10 @@
G_debug(2, "display_points()");
driver_line_width(var_geti(VAR_LINEWIDTH));
- for (i = 1; i < Points->n_points; i++) {
- G_plot_line(Points->x[i - 1], Points->y[i - 1], Points->x[i],
- Points->y[i]);
- }
+ driver_move(Points->x[0], Points->y[0]);
+ for (i = 1; i < Points->n_points; i++)
+ driver_cont(Points->x[i], Points->y[i]);
+
driver_line_width(0);
}
@@ -38,18 +38,12 @@
int flsh)
{
G_debug(2, "display_icon()");
-#if 0
- driver_line_width(var_geti(VAR_LINEWIDTH));
- G_plot_icon(x, y, icon, angle, Scale * size);
- driver_line_width(0);
-#else
if (icon == G_ICON_CROSS && angle == 0)
driver_plot_icon(x, y, "cross");
else if (icon == G_ICON_CROSS)
driver_plot_icon(x, y, "cross45");
else if (icon == G_ICON_BOX)
driver_plot_icon(x, y, "box");
-#endif
}
/* Display vector line
Modified: grass/trunk/vector/v.digit/driver.c
===================================================================
--- grass/trunk/vector/v.digit/driver.c 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/vector/v.digit/driver.c 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,3 +1,4 @@
+#include <math.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/display.h>
@@ -19,25 +20,45 @@
}
static int curx, cury;
+static double lastx;
-static int driver_move_abs(int x, int y)
+static void convert(double x, double y, int *xi, int *yi)
{
- curx = x;
- cury = y;
- return 0;
+ if (D_is_lat_lon()) {
+ double d = x - lastx;
+ if (fabs(d) > 180)
+ x -= 360 * floor(d / 360 + 0.5);
+ }
+
+ *xi = (int)floor(D_u_to_d_col(x));
+ *yi = (int)floor(D_u_to_d_row(y));
}
-static int driver_cont_abs(int x, int y)
+void driver_cont(double x, double y)
{
char buf[1024];
+ int xi, yi;
+ convert(x, y, &xi, &yi);
+
sprintf(buf, ".screen.canvas create line %d %d %d %d -width %d -fill %s",
- curx, cury, x, y, width, color);
+ curx, cury, xi, yi, width, color);
Tcl_Eval(Toolbox, buf);
+ curx = xi;
+ cury = yi;
+ lastx = x;
+}
+
+void driver_move(double x, double y)
+{
+ int xi, yi;
+
+ convert(x, y, &xi, &yi);
+
curx = x;
cury = y;
- return 0;
+ lastx = x;
}
void driver_plot_icon(double x, double y, const char *icon)
@@ -45,7 +66,8 @@
char buf[1024];
int xi, yi;
- G_plot_where_xy(x, y, &xi, &yi);
+ xi = (int) floor(D_u_to_d_col(x));
+ yi = (int) floor(D_u_to_d_row(y));
sprintf(buf,
".screen.canvas create bitmap %d %d -bitmap @$vdpath/%s.xbm -foreground %s -anchor center",
@@ -88,8 +110,6 @@
int driver_refresh(void)
{
setup();
- G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
- D_get_d_east(), driver_move_abs, driver_cont_abs);
return 1;
}
@@ -110,8 +130,6 @@
Scale = (n - s) / (D_get_d_south() - D_get_d_north());
- G_setup_plot(D_get_d_north(), D_get_d_south(), D_get_d_west(),
- D_get_d_east(), driver_move_abs, driver_cont_abs);
return 1;
}
Modified: grass/trunk/vector/v.digit/proto.h
===================================================================
--- grass/trunk/vector/v.digit/proto.h 2008-08-08 23:10:20 UTC (rev 32649)
+++ grass/trunk/vector/v.digit/proto.h 2008-08-09 07:05:29 UTC (rev 32650)
@@ -1,3 +1,4 @@
+
/* Driver */
int driver_open(void);
int driver_close(void);
@@ -4,8 +5,9 @@
int driver_refresh(void);
void driver_rgb_color(int r, int g, int b);
void driver_line_width(int w);
-void driver_plot_line(double x1, double y1, double x2, double y2);
void driver_plot_icon(double x, double y, const char *icon);
+void driver_move(double x, double y);
+void driver_cont(double x, double y);
/* Miscellaneous */
void tool_centre(void);
More information about the grass-commit
mailing list