[GRASS-SVN] r32584 - in grass/trunk: display display/d.barscale
display/d.colors display/d.colortable display/d.erase
display/d.font 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.measure display/d.nviz 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.rast display/d.what.vect display/d.zoom
display/drivers general/g.mapset imagery include include/Make
lib lib/cairodriver lib/display lib/driver lib/htmldriver
lib/pngdriver lib/psdriver lib/raster raster/r.profile
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 6 17:50:18 EDT 2008
Author: glynn
Date: 2008-08-06 17:50:17 -0400 (Wed, 06 Aug 2008)
New Revision: 32584
Added:
grass/trunk/lib/cairodriver/description.html
grass/trunk/lib/htmldriver/
grass/trunk/lib/htmldriver/Driver.c
grass/trunk/lib/htmldriver/Graph_Clse.c
grass/trunk/lib/htmldriver/Graph_Set.c
grass/trunk/lib/htmldriver/Makefile
grass/trunk/lib/htmldriver/Polygn_abs.c
grass/trunk/lib/htmldriver/README
grass/trunk/lib/htmldriver/Text.c
grass/trunk/lib/htmldriver/description.html
grass/trunk/lib/htmldriver/htmlmap.h
grass/trunk/lib/pngdriver/description.html
grass/trunk/lib/psdriver/description.html
grass/trunk/lib/raster/raster.c
Removed:
grass/trunk/display/d.ask/
grass/trunk/display/d.barscale/mouse.c
grass/trunk/display/d.extend/
grass/trunk/display/d.font.freetype/
grass/trunk/display/d.frame/
grass/trunk/display/d.geodesic/mouse.c
grass/trunk/display/d.legend/box.c
grass/trunk/display/d.menu/
grass/trunk/display/d.mon/
grass/trunk/display/d.rast.edit/
grass/trunk/display/d.rhumbline/mouse.c
grass/trunk/display/d.save/
grass/trunk/display/drivers/HTMLMAP/
grass/trunk/display/drivers/PNG/
grass/trunk/display/drivers/PS/
grass/trunk/display/drivers/cairo/
grass/trunk/imagery/i.ask/
grass/trunk/include/graphics.h
grass/trunk/include/monitors.h
grass/trunk/lib/display/get_win.c
grass/trunk/lib/display/ident_win.c
grass/trunk/lib/display/popup.c
grass/trunk/lib/driver/Get_location.c
grass/trunk/lib/driver/Panel.c
grass/trunk/lib/driver/Work.c
grass/trunk/lib/driver/command.c
grass/trunk/lib/driver/connect_sock.c
grass/trunk/lib/driver/main.c
grass/trunk/lib/driver/pad.c
grass/trunk/lib/driver/pad.h
grass/trunk/lib/raster/com_get.c
grass/trunk/lib/raster/com_io.c
grass/trunk/lib/raster/com_pad.c
grass/trunk/lib/raster/com_proto.c
grass/trunk/lib/raster/common.c
grass/trunk/lib/raster/io_sock.c
grass/trunk/lib/raster/loc_get.c
grass/trunk/lib/raster/loc_io.c
grass/trunk/lib/raster/loc_pad.c
grass/trunk/lib/raster/loc_proto.c
grass/trunk/lib/raster/open.h
grass/trunk/lib/raster/parse_mon.c
grass/trunk/lib/raster/rem_get.c
grass/trunk/lib/raster/rem_io.c
grass/trunk/lib/raster/rem_pad.c
grass/trunk/lib/raster/rem_proto.c
grass/trunk/lib/raster/transport.h
Modified:
grass/trunk/display/Makefile
grass/trunk/display/d.barscale/draw_scale.c
grass/trunk/display/d.barscale/main.c
grass/trunk/display/d.barscale/options.h
grass/trunk/display/d.colors/main.c
grass/trunk/display/d.colortable/main.c
grass/trunk/display/d.erase/main.c
grass/trunk/display/d.font/main.c
grass/trunk/display/d.geodesic/main.c
grass/trunk/display/d.graph/main.c
grass/trunk/display/d.grid/main.c
grass/trunk/display/d.his/main.c
grass/trunk/display/d.histogram/main.c
grass/trunk/display/d.info/main.c
grass/trunk/display/d.labels/main.c
grass/trunk/display/d.legend/main.c
grass/trunk/display/d.measure/main.c
grass/trunk/display/d.nviz/local.h
grass/trunk/display/d.nviz/main.c
grass/trunk/display/d.path/main.c
grass/trunk/display/d.path/proto.h
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.rast/local_proto.h
grass/trunk/display/d.rast/main.c
grass/trunk/display/d.rgb/main.c
grass/trunk/display/d.rhumbline/main.c
grass/trunk/display/d.text.new/main.c
grass/trunk/display/d.thematic.area/main.c
grass/trunk/display/d.vect.chart/main.c
grass/trunk/display/d.vect/main.c
grass/trunk/display/d.what.rast/main.c
grass/trunk/display/d.what.vect/main.c
grass/trunk/display/d.what.vect/what.c
grass/trunk/display/d.what.vect/what.h
grass/trunk/display/d.zoom/main.c
grass/trunk/general/g.mapset/main.c
grass/trunk/imagery/Makefile
grass/trunk/include/Make/Grass.make.in
grass/trunk/include/display.h
grass/trunk/include/raster.h
grass/trunk/lib/Makefile
grass/trunk/lib/cairodriver/Driver.c
grass/trunk/lib/display/list.c
grass/trunk/lib/display/setup.c
grass/trunk/lib/display/window.c
grass/trunk/lib/driver/Makefile
grass/trunk/lib/driver/driver.h
grass/trunk/lib/driver/driverlib.h
grass/trunk/lib/driver/init.c
grass/trunk/lib/pngdriver/Driver.c
grass/trunk/lib/psdriver/Driver.c
grass/trunk/lib/psdriver/Makefile
grass/trunk/lib/raster/Makefile
grass/trunk/raster/r.profile/local_proto.h
grass/trunk/raster/r.profile/main.c
Log:
Breaking stuff part 2: the Tek4014 is obsolete
Eliminate monitors, and all that depends upon them; direct rendering only
No mouse, no panels, no pads
Modified: grass/trunk/display/Makefile
===================================================================
--- grass/trunk/display/Makefile 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/Makefile 2008-08-06 21:50:17 UTC (rev 32584)
@@ -2,17 +2,10 @@
MODULE_TOPDIR = ..
SUBDIRS = \
- drivers \
- d.ask \
d.barscale \
d.colorlist \
- d.colors \
d.colortable \
d.erase \
- d.extend \
- d.extract \
- d.font \
- d.frame \
d.geodesic \
d.graph \
d.grid \
@@ -22,28 +15,30 @@
d.labels \
d.legend \
d.linegraph \
- d.measure \
- d.menu \
- d.mon \
d.nviz \
d.path \
- d.profile \
d.rast \
d.rast.arrow \
d.rast.num \
d.rgb \
d.rhumbline \
- d.save \
d.text.new \
d.title \
d.vect \
d.vect.chart \
d.thematic.area \
- d.what.rast \
- d.what.vect \
- d.where \
- d.zoom
+# d.colors \
+# d.extract \
+# d.font \
+# d.measure \
+# d.profile \
+# d.what.rast \
+# d.what.vect \
+# d.where \
+# d.zoom \
+# drivers
+
include $(MODULE_TOPDIR)/include/Make/Dir.make
default: parsubdirs
Modified: grass/trunk/display/d.barscale/draw_scale.c
===================================================================
--- grass/trunk/display/d.barscale/draw_scale.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.barscale/draw_scale.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -59,7 +59,7 @@
"5000 miles", 8046720.000, 20000000., 5},}
};
-int draw_scale(char *save, int toptext)
+int draw_scale(int toptext)
{
double meters;
double line_len;
@@ -93,9 +93,6 @@
pr = x_pos + w + 2; /* 1 pixel margin for both sides */
pb = y_pos + h + 2; /* 1 pixel margin for both sides */
- if (save)
- R_panel_save(save, pt, pb, pl, pr);
-
if (do_background) {
D_raster_use_color(color1);
@@ -169,9 +166,6 @@
if (pr > r)
pr = r;
- if (save)
- R_panel_save(save, pt, pb, pl, pr);
-
if (do_background) {
D_raster_use_color(color1);
Modified: grass/trunk/display/d.barscale/main.c
===================================================================
--- grass/trunk/display/d.barscale/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.barscale/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -41,12 +41,11 @@
int main(int argc, char **argv)
{
- char window_name[64];
struct Cell_head window;
int t, b, l, r;
struct GModule *module;
struct Option *opt1, *opt2, *opt3;
- struct Flag *mouse, *feet, *top, *linescale, *northarrow, *scalebar;
+ struct Flag *feet, *top, *linescale, *northarrow, *scalebar;
struct Cell_head W;
/* Initialize the GIS calls */
@@ -56,10 +55,6 @@
module->keywords = _("display, cartography");
module->description = _("Displays a barscale on the graphics monitor.");
- mouse = G_define_flag();
- mouse->key = 'm';
- mouse->description = _("Use mouse to interactively place scale");
-
feet = G_define_flag();
feet->key = 'f';
feet->description = _("Use feet/miles instead of meters");
@@ -139,13 +134,6 @@
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
-
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
-
/* Parse and select background color */
color1 = D_parse_color(opt1->answer, 1);
if (color1 == 0)
@@ -158,47 +146,20 @@
/* Read in the map window associated with window */
G_get_window(&window);
- if (D_check_map_window(&window))
- G_fatal_error(_("Setting map window"));
+ D_check_map_window(&window);
if (G_set_window(&window) == -1)
G_fatal_error(_("Current window not settable"));
/* Determine conversion factors */
- if (D_get_screen_window(&t, &b, &l, &r))
- G_fatal_error(_("Getting screen window"));
+ D_get_screen_window(&t, &b, &l, &r);
+
if (D_do_conversions(&window, t, b, l, r))
G_fatal_error(_("Error in calculating conversions"));
- if (!mouse->answer) {
- /* Draw the scale */
- draw_scale(NULL, top->answer);
+ /* Draw the scale */
+ draw_scale(top->answer);
- /* Add this command to list */
- D_add_to_list(G_recreate_command());
- }
- else if (mouse_query(top->answer)) {
- char cmdbuf[255];
-
- sprintf(cmdbuf, "%s at=%f,%f", argv[0], east, north);
-
- sprintf(cmdbuf, "%s bcolor=%s", cmdbuf, opt1->answer);
- sprintf(cmdbuf, "%s tcolor=%s", cmdbuf, opt2->answer);
- if (top->answer)
- strcat(cmdbuf, " -t");
- if (feet->answer)
- strcat(cmdbuf, " -f");
- if (linescale->answer)
- strcat(cmdbuf, " -l");
- if (northarrow->answer)
- strcat(cmdbuf, " -n");
- if (scalebar->answer)
- strcat(cmdbuf, " -s");
-
- /* Add this command to list */
- D_add_to_list(cmdbuf);
- }
-
R_close_driver();
exit(EXIT_SUCCESS);
Deleted: grass/trunk/display/d.barscale/mouse.c
===================================================================
--- grass/trunk/display/d.barscale/mouse.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.barscale/mouse.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include "options.h"
-
-int mouse_query(int toptext)
-{
- int t, b, l, r;
- char *panel = G_tempfile();
- int x_pos, y_pos, button;
-
- fprintf(stderr, "Left: choose location\n" "Middle: cancel\n");
-
- R_get_location_with_pointer(&x_pos, &y_pos, &button);
-
- if (button == 2)
- return 0;
-
- D_get_screen_window(&t, &b, &l, &r);
-
- for (;;) {
- east = (x_pos * 100.0) / (r - l);
- north = (y_pos * 100.0) / (b - t);
-
- draw_scale(panel, toptext);
-
- fprintf(stderr,
- "\n"
- "Left: choose location\n"
- "Middle: cancel\n" "Right: confirm location\n");
-
- R_get_location_with_pointer(&x_pos, &y_pos, &button);
-
- switch (button) {
- case 1:
- R_panel_restore(panel);
- break;
- case 2:
- R_panel_restore(panel);
- return 0;
- case 3:
- R_panel_delete(panel);
- return 1;
- }
- }
-}
Modified: grass/trunk/display/d.barscale/options.h
===================================================================
--- grass/trunk/display/d.barscale/options.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.barscale/options.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -9,7 +9,4 @@
extern int draw;
/* draw_scale.c */
-int draw_scale(char *save, int toptext);
-
-/* mouse.c */
-int mouse_query(int toptext);
+int draw_scale(int toptext);
Modified: grass/trunk/display/d.colors/main.c
===================================================================
--- grass/trunk/display/d.colors/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.colors/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -37,15 +37,6 @@
/* Initialize the GIS calls */
G_gisinit(argv[0]);
- /* Try to get default raster name, don't fail so --interface-description works */
- /* don't let R_open_driver() kill us */
- R__open_quiet();
- if (R_open_driver() == 0) {
- if (D_get_cell_name(name) < 0)
- *name = 0;
- R_close_driver();
- }
-
module = G_define_module();
module->keywords = _("display");
module->description =
Modified: grass/trunk/display/d.colortable/main.c
===================================================================
--- grass/trunk/display/d.colortable/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.colortable/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -35,7 +35,6 @@
int cols;
char buff[256];
- char window_name[64];
char *mapset;
struct FPRange fp_range;
struct Colors colors;
@@ -147,11 +146,6 @@
if (R_open_driver() != 0)
G_fatal_error("No graphics device selected");
- if (D_get_cur_wind(window_name))
- G_fatal_error("No current frame");
- if (D_set_cur_wind(window_name))
- G_fatal_error("Current frame not available");
-
/* Figure out where to put boxes */
D_get_screen_window(&t, &b, &l, &r);
@@ -270,8 +264,6 @@
}
}
- D_add_to_list(G_recreate_command());
-
R_close_driver();
return 0;
Modified: grass/trunk/display/d.erase/main.c
===================================================================
--- grass/trunk/display/d.erase/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.erase/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -21,10 +21,8 @@
int main(int argc, char *argv[])
{
struct Option *color;
- struct Flag *eraseframe, *dontaddtolist;
+ struct Flag *eraseframe;
struct GModule *module;
- char name[256], buf[128];
- char *err;
G_gisinit(argv[0]);
@@ -48,40 +46,19 @@
eraseframe->key = 'f';
eraseframe->description = _("Remove all frames and erase the screen");
- dontaddtolist = G_define_flag();
- dontaddtolist->key = 'x';
- dontaddtolist->description =
- _("Don't add to list of commands in monitor");
-
if (argc > 1 && G_parser(argc, argv))
exit(1);
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- err = NULL;
- if (D_get_cur_wind(name))
- err = _("No current frame");
- else if (D_set_cur_wind(name))
- err = _("Current frame not available");
- else {
- /* D_setup(1);
- R_standard_color(D_translate_color(color->answer));
- D_erase_window(); */
- D_erase(color->answer);
+ D_erase(color->answer);
- if (eraseframe->answer) {
- D_full_screen();
- }
- if (!dontaddtolist->answer) {
- sprintf(buf, "d.erase color=%s", color->answer);
- D_add_to_list(buf);
- }
+ if (eraseframe->answer) {
+ D_full_screen();
}
R_close_driver();
- if (err)
- G_fatal_error(err);
exit(0);
}
Modified: grass/trunk/display/d.font/main.c
===================================================================
--- grass/trunk/display/d.font/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.font/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -132,7 +132,6 @@
R_charset(opt3->answer);
/* add this command to the list */
- D_add_to_list(G_recreate_command());
R_close_driver();
exit(EXIT_SUCCESS);
Modified: grass/trunk/display/d.geodesic/main.c
===================================================================
--- grass/trunk/display/d.geodesic/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.geodesic/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -30,7 +30,6 @@
{
int line_color;
int text_color;
- int use_mouse;
double lon1, lat1, lon2, lat2;
char msg[100];
char *deftcolor;
@@ -53,7 +52,7 @@
parm.coor->key = "coor";
parm.coor->key_desc = "lon1,lat1,lon2,lat2";
parm.coor->type = TYPE_STRING;
- parm.coor->required = NO;
+ parm.coor->required = YES;
parm.coor->description = "Starting and ending coordinates";
parm.lcolor = G_define_option();
@@ -81,29 +80,25 @@
exit(1);
}
- use_mouse = 1;
- if (parm.coor->answer) {
- if (parm.coor->answers[0] == NULL)
- G_fatal_error("No coordinates given");
+ if (parm.coor->answers[0] == NULL)
+ G_fatal_error("No coordinates given");
- if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
- }
- if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
- }
- if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
- }
- if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
- }
- use_mouse = 0;
+ if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
}
+ if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
+ }
+ if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
+ }
+ if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
+ }
if (R_open_driver() != 0)
G_fatal_error("No graphics device selected");
@@ -126,14 +121,8 @@
text_color = D_translate_color(parm.tcolor->answer);
setup_plot();
- if (use_mouse)
- mouse(line_color, text_color);
- else
- plot(lon1, lat1, lon2, lat2, line_color, text_color);
+ plot(lon1, lat1, lon2, lat2, line_color, text_color);
- if (!use_mouse)
- D_add_to_list(G_recreate_command());
-
R_close_driver();
exit(0);
}
Deleted: grass/trunk/display/d.geodesic/mouse.c
===================================================================
--- grass/trunk/display/d.geodesic/mouse.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.geodesic/mouse.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include "local_proto.h"
-
-void mouse(int line_color, int text_color)
-{
- int x1, y1, x2, y2;
- double lat1, lon1, lat2, lon2;
- int top, bottom, left, right;
- int button;
-
- right = (int)D_get_d_east();
- left = (int)D_get_d_west();
- top = (int)D_get_d_north();
- bottom = (int)D_get_d_south();
-
- x2 = x1 = (right + left) / 2;
- y2 = y1 = (top + bottom) / 2;
-
- fprintf(stderr, "\n");
- fprintf(stderr, "Left: begin\n");
- fprintf(stderr, "Middle: draw\n");
- fprintf(stderr, "Right: quit\n");
-
- while (1) {
- R_standard_color(line_color);
- R_get_location_with_line(x1, y1, &x2, &y2, &button);
- if (button == 3)
- return;
- if (x2 < left || x2 > right)
- continue;
- if (y2 < top || y2 > bottom)
- continue;
-
- if (button == 2) {
- lon1 = D_d_to_u_col((double)x1);
- lat1 = D_d_to_u_row((double)y1);
- lon2 = D_d_to_u_col((double)x2);
- lat2 = D_d_to_u_row((double)y2);
- plot(lon1, lat1, lon2, lat2, line_color, text_color);
- }
-
- x1 = x2;
- y1 = y2;
- }
-}
Modified: grass/trunk/display/d.graph/main.c
===================================================================
--- grass/trunk/display/d.graph/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.graph/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -41,7 +41,6 @@
int main(int argc, char **argv)
{
- char window_name[64];
struct GModule *module;
struct Option *opt1, *opt2;
struct Flag *mapcoords;
@@ -115,15 +114,8 @@
else
mapunits = FALSE;
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
+ D_get_screen_window(&t, &b, &l, &r);
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
- if (D_get_screen_window(&t, &b, &l, &r))
- G_fatal_error(_("Getting screen window"));
-
/* Finish graphics setup */
R_set_window(t, b, l, r);
D_setup(0);
@@ -136,9 +128,6 @@
R_text_rotation(0.0); /* reset */
R_line_width(0); /* reset */
- if (opt1->answer)
- D_add_to_list(G_recreate_command());
-
R_close_driver();
exit(EXIT_SUCCESS);
Modified: grass/trunk/display/d.grid/main.c
===================================================================
--- grass/trunk/display/d.grid/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.grid/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -218,8 +218,6 @@
plot_border(size, east, north);
}
- D_add_to_list(G_recreate_command());
-
R_close_driver();
exit(EXIT_SUCCESS);
Modified: grass/trunk/display/d.his/main.c
===================================================================
--- grass/trunk/display/d.his/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.his/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -54,7 +54,6 @@
struct GModule *module;
struct Option *opt_h, *opt_i, *opt_s, *brighten;
struct Flag *nulldraw;
- char window_name[64];
int t, b, l, r;
double bright_mult;
@@ -116,14 +115,6 @@
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current graphics window"));
-
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current graphics window not available"));
-
- D_set_cell_name("his result");
-
/* Prepare the raster cell drawing functions */
D_get_screen_window(&t, &b, &l, &r);
D_set_overlay_mode(nulldraw->answer ? 1 : 0);
@@ -267,7 +258,6 @@
D_cell_draw_end();
/* Close down connection to display driver */
- D_add_to_list(G_recreate_command());
R_close_driver();
/* Close the raster maps */
Modified: grass/trunk/display/d.histogram/main.c
===================================================================
--- grass/trunk/display/d.histogram/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.histogram/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -208,7 +208,6 @@
bar(&dist_stats, &pcolors);
R_flush();
- D_add_to_list(G_recreate_command());
R_close_driver();
exit(EXIT_SUCCESS);
Modified: grass/trunk/display/d.info/main.c
===================================================================
--- grass/trunk/display/d.info/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.info/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -24,7 +24,6 @@
struct GModule *module;
struct Flag *rflag, *dflag, *cflag, *fflag, *bflag, *gflag;
int l, r, t, b;
- char window_name[128];
struct Cell_head window;
G_gisinit(argv[0]);
@@ -99,18 +98,11 @@
}
if (bflag->answer) {
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
/* Read in the map window associated with window */
G_get_window(&window);
- if (D_check_map_window(&window))
- G_fatal_error(_("Setting map window"));
- if (D_get_screen_window(&t, &b, &l, &r))
- G_fatal_error(_("Getting screen window"));
+ D_check_map_window(&window);
+ D_get_screen_window(&t, &b, &l, &r);
if (D_do_conversions(&window, t, b, l, r))
G_fatal_error(_("Error in calculating conversions"));
@@ -123,11 +115,6 @@
}
if (gflag->answer) {
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
/* Read in the map window associated with window */
G_get_window(&window);
fprintf(stdout, "w=%f\n", window.west);
Modified: grass/trunk/display/d.labels/main.c
===================================================================
--- grass/trunk/display/d.labels/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.labels/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -27,7 +27,6 @@
int main(int argc, char **argv)
{
struct Cell_head window;
- char window_name[64];
char *label_name;
char *mapset;
double minreg, maxreg, reg, dx, dy;
@@ -101,7 +100,6 @@
if (reg < minreg) {
G_warning(_
("Region size is lower than minreg, nothing displayed."));
- D_add_to_list(G_recreate_command());
R_close_driver();
exit(0);
}
@@ -111,7 +109,6 @@
if (reg > maxreg) {
G_warning(_
("Region size is greater than maxreg, nothing displayed."));
- D_add_to_list(G_recreate_command());
R_close_driver();
exit(0);
}
@@ -122,15 +119,8 @@
if (infile == NULL)
G_fatal_error(_("Unable to open label file <%s>"), label_name);
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
+ D_check_map_window(&window);
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
- if (D_check_map_window(&window))
- G_fatal_error(_("Setting map window"));
-
if (G_set_window(&window) == -1)
G_fatal_error(_("Current window not settable"));
@@ -143,8 +133,6 @@
/* Go draw the raster map */
do_labels(infile, !horiz_flag->answer);
- D_add_to_list(G_recreate_command());
-
R_text_rotation(0.0); /* reset */
R_close_driver();
Deleted: grass/trunk/display/d.legend/box.c
===================================================================
--- grass/trunk/display/d.legend/box.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.legend/box.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,47 +0,0 @@
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
-
-
-int get_legend_box(int *x0, int *x1, int *y0, int *y1)
-{
- int screen_x, screen_y;
- int button;
- int cur_screen_x, cur_screen_y;
-
- D_get_screen_window(&cur_screen_y, &screen_y, &cur_screen_x, &screen_x);
-
- fprintf(stderr, "\n\n");
- fprintf(stderr, "Buttons:\n");
- fprintf(stderr, "Left: Establish a corner\n");
- fprintf(stderr, "Middle: Cancel\n");
- fprintf(stderr, "Right: Accept box for legend\n\n");
-
- do {
- R_get_location_with_box(cur_screen_x, cur_screen_y, &screen_x,
- &screen_y, &button);
- button &= 0xf;
-
-
- switch (button) {
- case 1:
- cur_screen_x = screen_x;
- cur_screen_y = screen_y;
- break;
- case 2:
- return (0);
- case 3:
- break;
- }
-
- } while (button != 3);
-
- *x0 = cur_screen_x;
- *x1 = screen_x;
- *y0 = cur_screen_y;
- *y1 = screen_y;
-
- fprintf(stderr, "\n");
- return (1);
-
-}
Modified: grass/trunk/display/d.legend/main.c
===================================================================
--- grass/trunk/display/d.legend/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.legend/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -40,7 +40,6 @@
char *mapset;
char buff[512];
char *map_name;
- char window_name[64];
int black;
int cats_num;
int color;
@@ -52,7 +51,7 @@
int lines, steps;
int new_colr, fp;
int t, b, l, r;
- int hide_catnum, hide_catstr, hide_nodata, do_smooth, use_mouse;
+ int hide_catnum, hide_catstr, hide_nodata, do_smooth;
char *cstr;
int white;
int x_box[5];
@@ -61,7 +60,7 @@
struct Colors colors;
struct GModule *module;
struct Option *opt1, *opt2, *opt4, *opt5, *opt6, *opt7, *opt8, *opt9;
- struct Flag *hidestr, *hidenum, *hidenodata, *smooth, *mouse, *flipit;
+ struct Flag *hidestr, *hidenum, *hidenodata, *smooth, *flipit;
struct Range range;
struct FPRange fprange;
CELL min_ind, max_ind, null_cell;
@@ -156,10 +155,6 @@
opt9->guisection = _("Advanced");
- mouse = G_define_flag();
- mouse->key = 'm';
- mouse->description = _("Use mouse to size & place legend");
-
hidestr = G_define_flag();
hidestr->key = 'v';
hidestr->description = _("Do not show category labels");
@@ -196,7 +191,6 @@
hide_catnum = hidenum->answer;
hide_nodata = hidenodata->answer;
do_smooth = smooth->answer;
- use_mouse = mouse->answer;
flip = flipit->answer;
color = 0; /* if only to get rid of the compiler warning */
@@ -274,12 +268,6 @@
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
-
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
white = D_translate_color(DEFAULT_FG_COLOR);
black = D_translate_color(DEFAULT_BG_COLOR);
@@ -287,39 +275,24 @@
D_get_screen_window(&t, &b, &l, &r);
R_set_window(t, b, l, r);
- if (use_mouse) {
- if (!get_legend_box(&x0, &x1, &y0, &y1))
- exit(EXIT_SUCCESS);
- G_debug(1, "mouse placement as percentage of display window "
- "[bottom,top,left,right]:\n \"at=%.1f,%.1f,%.1f,%.1f\"",
- 100. * (b - y1) / (b - t), 100. * (b - y0) / (b - t),
- 100. * x0 / (r - l), 100. * x1 / (r - l));
-
- Y1 = 100. - (y1 - t) * 100. / (b - t);
- Y0 = 100. - (y0 - t) * 100. / (b - t);
- X0 = (x0 - l) * 100. / (r - l);
- X1 = (x1 - l) * 100. / (r - l);
+ if (opt7->answer != NULL) {
+ sscanf(opt7->answers[0], "%lf", &Y1);
+ sscanf(opt7->answers[1], "%lf", &Y0);
+ sscanf(opt7->answers[2], "%lf", &X0);
+ sscanf(opt7->answers[3], "%lf", &X1);
}
- else {
- if (opt7->answer != NULL) {
- sscanf(opt7->answers[0], "%lf", &Y1);
- sscanf(opt7->answers[1], "%lf", &Y0);
- sscanf(opt7->answers[2], "%lf", &X0);
- sscanf(opt7->answers[3], "%lf", &X1);
- }
- else { /* default */
- Y1 = 12;
- Y0 = 88;
- X0 = 3;
- X1 = 7;
- }
-
- x0 = l + (int)((r - l) * X0 / 100.);
- x1 = l + (int)((r - l) * X1 / 100.);
- y0 = t + (int)((b - t) * (100. - Y0) / 100.); /* make lower left the origin */
- y1 = t + (int)((b - t) * (100. - Y1) / 100.);
+ else { /* default */
+ Y1 = 12;
+ Y0 = 88;
+ X0 = 3;
+ X1 = 7;
}
+ x0 = l + (int)((r - l) * X0 / 100.);
+ x1 = l + (int)((r - l) * X1 / 100.);
+ y0 = t + (int)((b - t) * (100. - Y0) / 100.); /* make lower left the origin */
+ y1 = t + (int)((b - t) * (100. - Y1) / 100.);
+
if (y0 > y1) { /* allow for variety in order of corner */
flip = !flip; /* selection without broken output */
xyTemp = y0;
@@ -496,7 +469,7 @@
}
/* center really tiny legends */
- if (!use_mouse && opt7->answer == NULL) { /* if defualt scaling */
+ if (opt7->answer == NULL) { /* if defualt scaling */
if (!do_smooth && (dots_per_line < 4)) /* if so small that there's no box */
if ((b - (dots_per_line * lines)) / (b * 1.0) > 0.15) /* if there's more than a 15% blank at the bottom */
y0 = ((b - t) - (dots_per_line * lines)) / 2;
@@ -687,7 +660,7 @@
/* scale text to fit in window if position not manually set */
/* usually not needed, except when frame is really narrow */
- if (!use_mouse && opt7->answer == NULL) { /* ie defualt scaling */
+ if (opt7->answer == NULL) { /* ie defualt scaling */
ScaleFactor = ((r - x1) / ((MaxLabelLen + 1) * txsiz * 0.81)); /* ?? txsiz*.81=actual text width. */
if (ScaleFactor < 1.0) {
txsiz = (int)(txsiz * ScaleFactor);
@@ -775,7 +748,7 @@
txsiz = (int)((y1 - y0) / (2.0 * lines));
/* scale text to fit in window if position not manually set */
- if (!use_mouse && opt7->answer == NULL) { /* ie defualt scaling */
+ if (opt7->answer == NULL) { /* ie defualt scaling */
ScaleFactor = ((true_r - true_l) / ((MaxLabelLen + 3) * txsiz * 0.81)); /* ?? txsiz*.81=actual text width. */
if (ScaleFactor < 1.0) {
txsiz = (int)floor(txsiz * ScaleFactor);
@@ -917,17 +890,7 @@
R_text(buff);
}
}
- if (use_mouse) {
- char buf[512];
- mouse->answer = 0;
- sprintf(buf, "%s at=%.1f,%.1f,%.1f,%.1f", G_recreate_command(),
- Y1, Y0, X0, X1);
- D_add_to_list(buf);
- }
- else
- D_add_to_list(G_recreate_command());
-
R_close_driver();
exit(EXIT_SUCCESS);
}
Modified: grass/trunk/display/d.measure/main.c
===================================================================
--- grass/trunk/display/d.measure/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.measure/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -30,7 +30,6 @@
int main(int argc, char **argv)
{
- char frame[64];
struct GModule *module;
struct
{
@@ -86,12 +85,6 @@
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- if (D_get_cur_wind(frame))
- G_fatal_error(_("No current frame"));
-
- if (D_set_cur_wind(frame))
- G_fatal_error(_("Current frame not available"));
-
color1 = D_translate_color(parm.c1->answer);
color2 = D_translate_color(parm.c2->answer);
s_flag = parm.s->answer;
Modified: grass/trunk/display/d.nviz/local.h
===================================================================
--- grass/trunk/display/d.nviz/local.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.nviz/local.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,8 +1,3 @@
-static int move(int, int);
-static int cont(int, int);
-static int min_range[5], max_range[5];
-static int which_range;
-static int change_range;
static double dist, e = 0, n = 0;
static double DIST, HT;
int do_profile(double, double, double, double, char *, int, int);
Modified: grass/trunk/display/d.nviz/main.c
===================================================================
--- grass/trunk/display/d.nviz/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.nviz/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -46,7 +46,7 @@
char outfile[GNAME_MAX];
int fd, projection;
char buf[512], buf1[1024], buf2[1024];
- int screen_x, screen_y, button;
+ int screen_x, screen_y;
int i, k;
int frame_start = 0;
double e1, e2, n1, n2;
@@ -56,7 +56,7 @@
{
struct Option *opt1, *route, *name, *output, *dist, *ht, *frames,
*start;
- struct Flag *i, *f, *c, *k, *o, *e;
+ struct Flag *f, *c, *k, *o, *e;
}
parm;
struct GModule *module;
@@ -112,10 +112,6 @@
parm.start->description = _("Start frame number (default=0)");
- parm.i = G_define_flag();
- parm.i->key = 'i';
- parm.i->description = _("Interactively select route");
-
parm.f = G_define_flag();
parm.f->key = 'f';
parm.f->description = _("Full render -- Save images");
@@ -142,7 +138,7 @@
exit(EXIT_FAILURE);
/* check arguments */
- if ((!parm.i->answer) && (!parm.route->answer))
+ if (!parm.route->answer)
G_fatal_error(_
("Either -i flag and/or route parameter must be used"));
@@ -241,99 +237,34 @@
fprintf(fp, "%s", buf1);
}
- /* Get coords */
- /* Select points interactively */
- if (parm.i->answer) {
- int count = 0;
+ /* Coords from Command Line */
+ for (i = 0; parm.route->answers[i]; i += 2) {
+ /* Test for number coordinate pairs */
+ k = i;
+ }
- if (R_open_driver() != 0)
- G_fatal_error(_("No graphics device selected"));
- D_setup(0);
+ if (k < 6) {
+ /* Only one coordinate pair supplied */
+ G_fatal_error(_("You must provide at least four points %d"), k);
- G_setup_plot(D_get_d_north(),
- D_get_d_south(),
- D_get_d_west(), D_get_d_east(), move, cont);
-
- dist = 0;
-
- fprintf(stderr, "\n\n");
- fprintf(stderr, "Use mouse to select Start Point\n");
- R_get_location_with_pointer(&screen_x, &screen_y, &button);
- e1 = D_d_to_u_col((double)screen_x);
- n1 = D_d_to_u_row((double)screen_y);
-
- fprintf(stderr, "\nUse mouse to select route \n");
- fprintf(stderr, "Buttons:\n");
- fprintf(stderr, "Left: Mark next point\n");
- fprintf(stderr, "Middle: Mark next point\n");
- fprintf(stderr, "Right: Finish route and exit\n\n");
-
- while (button != 3) {
- count++;
- R_get_location_with_line((int)(0.5 + D_u_to_d_col(e1)),
- (int)(0.5 + D_u_to_d_row(n1)), &screen_x,
- &screen_y, &button);
- if (button == 1 || button == 2) {
- e2 = D_d_to_u_col((double)screen_x);
- n2 = D_d_to_u_row((double)screen_y);
- }
- else {
- if (e2 == -9999. || n2 == -9999.) {
- G_fatal_error(_("You must select more than one point"));
-
- }
- break;
- }
-
- /* draw line from p1 to p2 */
- G_plot_line(e1, n1, e2, n2);
-
+ }
+ else {
+ for (i = 0; i <= k - 2; i += 2) {
+ sscanf(parm.route->answers[i], "%lf", &e1);
+ sscanf(parm.route->answers[i + 1], "%lf", &n1);
+ sscanf(parm.route->answers[i + 2], "%lf", &e2);
+ sscanf(parm.route->answers[i + 3], "%lf", &n2);
/* Get profile info */
do_profile(e1, e2, n1, n2, name, fd, data_type);
- n1 = n2;
- e1 = e2;
- R_stabilize();
+ /* Get last coord */
+ if (i == k - 2)
+ do_profile(e2, e2, n2, n2, name, fd, data_type);
}
-
- if (count < 4) {
- G_fatal_error(_("You must select at least four points"));
-
- }
-
- R_close_driver();
-
}
- else {
+ /* done with coordinates */
- /* Coords from Command Line */
- for (i = 0; parm.route->answers[i]; i += 2) {
- /* Test for number coordinate pairs */
- k = i;
- }
- if (k < 6) {
- /* Only one coordinate pair supplied */
- G_fatal_error(_("You must provide at least four points %d"), k);
-
- }
- else {
- for (i = 0; i <= k - 2; i += 2) {
- sscanf(parm.route->answers[i], "%lf", &e1);
- sscanf(parm.route->answers[i + 1], "%lf", &n1);
- sscanf(parm.route->answers[i + 2], "%lf", &e2);
- sscanf(parm.route->answers[i + 3], "%lf", &n2);
- /* Get profile info */
- do_profile(e1, e2, n1, n2, name, fd, data_type);
-
- /* Get last coord */
- if (i == k - 2)
- do_profile(e2, e2, n2, n2, name, fd, data_type);
- }
- }
- } /* done with coordinates */
-
-
/* Output final part of script */
/* generate key-frame script */
if (key_frames) {
@@ -475,36 +406,6 @@
} /* done with do_profile */
-static int move(int x, int y)
-{
- D_move_abs(x, y);
-
- return 0;
-}
-
-static int cont(int x, int y)
-{
- if (D_cont_abs(x, y)) { /* clipped */
- change_range = 1;
- }
- else { /* keep track of left,right x for lines drawn in window */
-
- if (change_range) {
- which_range++;
- min_range[which_range] = max_range[which_range] = x;
- change_range = 0;
- }
- else {
- if (x < min_range[which_range])
- min_range[which_range] = x;
- else if (x > max_range[which_range])
- max_range[which_range] = x;
- }
- }
-
- return 0;
-}
-
/*****************************
* read_rast
* function to get raster value at set location
Modified: grass/trunk/display/d.path/main.c
===================================================================
--- grass/trunk/display/d.path/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.path/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -40,7 +40,6 @@
int type, afield, nfield, geo;
struct color_rgb color, hcolor, bgcolor;
int r, g, b;
- int use_mouse;
double x1, y1, x2, y2;
/* Initialize the GIS calls */
@@ -62,7 +61,7 @@
coor_opt->key = "coor";
coor_opt->key_desc = "x1,y1,x2,y2";
coor_opt->type = TYPE_STRING;
- coor_opt->required = NO;
+ coor_opt->required = YES;
coor_opt->description = _("Starting and ending coordinates");
afield_opt = G_define_standard_option(G_OPT_V_FIELD);
@@ -137,24 +136,19 @@
nfield = atoi(nfield_opt->answer);
- use_mouse = TRUE;
- if (coor_opt->answer) {
- if (coor_opt->answers[0] == NULL)
- G_fatal_error(_("No coordinates given"));
+ if (coor_opt->answers[0] == NULL)
+ G_fatal_error(_("No coordinates given"));
- if (!G_scan_easting(coor_opt->answers[0], &x1, G_projection()))
- G_fatal_error(_("%s - illegal x value"), coor_opt->answers[0]);
- if (!G_scan_northing(coor_opt->answers[1], &y1, G_projection()))
- G_fatal_error(_("%s - illegal y value"), coor_opt->answers[1]);
- if (!G_scan_easting(coor_opt->answers[2], &x2, G_projection()))
- G_fatal_error(_("%s - illegal x value"), coor_opt->answers[2]);
- if (!G_scan_northing(coor_opt->answers[3], &y2, G_projection()))
- G_fatal_error(_("%s - illegal y value"), coor_opt->answers[3]);
+ if (!G_scan_easting(coor_opt->answers[0], &x1, G_projection()))
+ G_fatal_error(_("%s - illegal x value"), coor_opt->answers[0]);
+ if (!G_scan_northing(coor_opt->answers[1], &y1, G_projection()))
+ G_fatal_error(_("%s - illegal y value"), coor_opt->answers[1]);
+ if (!G_scan_easting(coor_opt->answers[2], &x2, G_projection()))
+ G_fatal_error(_("%s - illegal x value"), coor_opt->answers[2]);
+ if (!G_scan_northing(coor_opt->answers[3], &y2, G_projection()))
+ G_fatal_error(_("%s - illegal y value"), coor_opt->answers[3]);
- use_mouse = FALSE;
- }
-
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
@@ -204,10 +198,7 @@
Vect_net_build_graph(&Map, type, afield, nfield, afcol->answer,
abcol->answer, ncol->answer, geo, 0);
- if (use_mouse)
- path(&Map, &color, &hcolor, &bgcolor, bold_f->answer);
- else
- coor_path(&Map, &hcolor, bold_f->answer, x1, y1, x2, y2);
+ coor_path(&Map, &hcolor, bold_f->answer, x1, y1, x2, y2);
R_close_driver();
Modified: grass/trunk/display/d.path/proto.h
===================================================================
--- grass/trunk/display/d.path/proto.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.path/proto.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,5 +1,2 @@
-int path(struct Map_info *, const struct color_rgb *,
- const struct color_rgb *, const struct color_rgb *, int);
-
int coor_path(struct Map_info *, const struct color_rgb *, int,
double, double, double, double);
Modified: grass/trunk/display/d.path/select.c
===================================================================
--- grass/trunk/display/d.path/select.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.path/select.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -12,161 +12,6 @@
#define WDTH 5
-int display(struct Map_info *Map, struct line_pnts *,
- const struct color_rgb *, int, int, int);
-
-int path(struct Map_info *Map, const struct color_rgb *color,
- const struct color_rgb *hcolor, const struct color_rgb *bgcolor,
- int be_bold)
-{
- int button, ret;
- int screen_x, screen_y;
- double x, y, nx, ny, fx, fy, tx, ty, msize;
- double x1, y1, x2, y2, maxdist;
- struct line_pnts *Points;
- int node;
- int from_disp = 0, to_disp = 0, sp_disp = 0, from_node = 0, to_node = 0;
-
- Points = Vect_new_line_struct();
-
- msize = 10 * (D_d_to_u_col(2.0) - D_d_to_u_col(1.0)); /* do it better */
- G_debug(1, "msize = %f\n", msize);
-
- G_message(_("\nMouse Buttons:"));
- fprintf(stderr, _("Left: Select From\n"));
- fprintf(stderr, _("Middle: Select To\n"));
- fprintf(stderr, _("Right: Quit\n\n"));
-
- while (1) {
- R_get_location_with_pointer(&screen_x, &screen_y, &button);
-
- x = D_d_to_u_col((double)(screen_x));
- y = D_d_to_u_row((double)(screen_y));
- /* fprintf (stderr, "%f %f\n", x, y); */
-
- x1 = D_d_to_u_col((double)(screen_x - WDTH));
- y1 = D_d_to_u_row((double)(screen_y - WDTH));
- x2 = D_d_to_u_col((double)(screen_x + WDTH));
- y2 = D_d_to_u_row((double)(screen_y + WDTH));
-
- x1 = fabs(x2 - x1);
- y1 = fabs(y2 - y1);
-
- if (x1 > y1)
- maxdist = x1;
- else
- maxdist = y1;
- G_debug(1, "Maximum distance in map units = %f\n", maxdist);
-
- node = Vect_find_node(Map, x, y, 0.0, maxdist, 0);
-
- if (node > 0) {
- Vect_get_node_coor(Map, node, &nx, &ny, NULL);
- fprintf(stderr, _("Node %d: %f %f\n"), node, nx, ny);
- }
-
- if (sp_disp) { /* erase old */
- /* delete old highlight */
-
- display(Map, Points, color, from_node, to_node, be_bold);
-
- R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
- if (!from_node)
- G_plot_line(Points->x[0], Points->y[0], Points->x[1],
- Points->y[1]);
-
- if (!to_node)
- G_plot_line(Points->x[Points->n_points - 2],
- Points->y[Points->n_points - 2],
- Points->x[Points->n_points - 1],
- Points->y[Points->n_points - 1]);
- }
-
- switch (button) {
- case 1:
- if (from_disp) {
- R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
- G_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
- }
- if (node > 0) {
- fx = nx;
- fy = ny;
- from_node = 1;
- }
- else {
- fx = x;
- fy = y;
- from_node = 0;
- }
- R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
- G_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
- R_flush();
- from_disp = 1;
- break;
- case 2:
- if (to_disp) {
- R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
- G_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
- }
- if (node > 0) {
- tx = nx;
- ty = ny;
- to_node = 1;
- }
- else {
- tx = x;
- ty = y;
- to_node = 0;
- }
- R_RGB_color(hcolor->r, hcolor->g, hcolor->b);
- G_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
- R_flush();
- to_disp = 1;
- break;
- case 3:
- if (from_disp) {
- R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
- G_plot_icon(fx, fy, G_ICON_BOX, 0.0, msize);
- }
- if (to_disp) {
- R_RGB_color(bgcolor->r, bgcolor->g, bgcolor->b);
- G_plot_icon(tx, ty, G_ICON_CROSS, 0.0, msize);
- }
- return 1;
- break;
- }
- if (from_disp && to_disp) {
- double fdist, tdist, cost;
-
- G_debug(2, "find path %f %f -> %f %f", fx, fy, tx, ty);
-
- ret =
- Vect_net_shortest_path_coor(Map, fx, fy, 0.0, tx, ty, 0.0,
- 5 * maxdist, 5 * maxdist, &cost,
- Points, NULL, NULL, NULL, &fdist,
- &tdist);
- if (ret == 0) {
- fprintf(stdout, _("Destination unreachable\n"));
- sp_disp = 0;
- }
- else {
- fprintf(stdout, _("Costs on the network = %f\n"), cost);
- fprintf(stdout, _(" Distance to the network = %f, "
- "distance from the network = %f\n\n"),
- fdist, tdist);
-
- display(Map, Points, hcolor, 1, 1, be_bold);
- sp_disp = 1;
- }
-
- }
- R_flush();
- };
-
- return 0;
-}
-
-
int display(struct Map_info *Map, struct line_pnts *Points,
const struct color_rgb *color, int first, int last, int be_bold)
{
Modified: grass/trunk/display/d.rast/display.c
===================================================================
--- grass/trunk/display/d.rast/display.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rast/display.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -12,7 +12,7 @@
int display(char *name,
char *mapset,
int overlay,
- char *bg, RASTER_MAP_TYPE data_type, int invert, int nocmd)
+ char *bg, RASTER_MAP_TYPE data_type, int invert)
{
struct Colors colors;
int r, g, b;
@@ -40,14 +40,6 @@
/* release the colors now */
G_free_colors(&colors);
- /* record the raster map */
- if (!nocmd) {
- D_set_cell_name(G_fully_qualified_name(name, mapset));
- D_add_to_cell_list(G_fully_qualified_name(name, mapset));
-
- D_add_to_list(G_recreate_command());
- }
-
return 0;
}
Modified: grass/trunk/display/d.rast/local_proto.h
===================================================================
--- grass/trunk/display/d.rast/local_proto.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rast/local_proto.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -3,7 +3,7 @@
int get_rgb(char *, int *, int *, int *);
/* display.c */
-int display(char *, char *, int, char *, RASTER_MAP_TYPE, int, int);
+int display(char *, char *, int, char *, RASTER_MAP_TYPE, int);
int mask_raster_array(void *, int, int, RASTER_MAP_TYPE);
/* main.c */
Modified: grass/trunk/display/d.rast/main.c
===================================================================
--- grass/trunk/display/d.rast/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rast/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -42,7 +42,6 @@
struct Option *bg;
struct Flag *flag_o;
struct Flag *flag_i;
- struct Flag *flag_x;
/* Initialize the GIS calls */
G_gisinit(argv[0]);
@@ -93,11 +92,6 @@
flag_i->key = 'i';
flag_i->description = _("Invert catlist");
- flag_x = G_define_flag();
- flag_x->key = 'x';
- flag_x->description =
- _("Don't add to list of rasters and commands in monitor");
-
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
@@ -132,11 +126,9 @@
/* use DCELL even if the map is FCELL */
if (fp)
- display(name, mapset, overlay, bg->answer, DCELL_TYPE, invert,
- flag_x->answer);
+ display(name, mapset, overlay, bg->answer, DCELL_TYPE, invert);
else
- display(name, mapset, overlay, bg->answer, CELL_TYPE, invert,
- flag_x->answer);
+ display(name, mapset, overlay, bg->answer, CELL_TYPE, invert);
R_close_driver();
Modified: grass/trunk/display/d.rast.arrow/arrow.c
===================================================================
--- grass/trunk/display/d.rast.arrow/arrow.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rast.arrow/arrow.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -64,7 +64,6 @@
double D_ew, D_ns;
char *mapset;
char layer_name[128];
-int layer_set;
int map_type, arrow_color, grid_color, x_color, unknown_color;
@@ -72,10 +71,8 @@
{
extern double D_ew, D_ns;
extern int D_x, D_y;
- char window_name[128];
struct Cell_head window;
int t, b, l, r;
- char full_name[128];
RASTER_MAP_TYPE raster_type, mag_raster_type = -1;
int layer_fd;
void *raster_row, *ptr;
@@ -115,7 +112,7 @@
opt1 = G_define_option();
opt1->key = "map";
opt1->type = TYPE_STRING;
- opt1->required = NO;
+ opt1->required = YES;
opt1->multiple = NO;
opt1->gisprompt = "old,cell,raster";
opt1->description = _("Name of raster aspect map to be displayed");
@@ -189,16 +186,10 @@
exit(-1);
- if (opt1->answer) {
- G_strncpy(layer_name, opt1->answer, sizeof(layer_name) - 1);
- if ((mapset = G_find_cell2(layer_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), layer_name);
- layer_set = 1;
- }
- else
- layer_set = 0;
+ G_strncpy(layer_name, opt1->answer, sizeof(layer_name) - 1);
+ if ((mapset = G_find_cell2(layer_name, "")) == NULL)
+ G_fatal_error(_("Raster map <%s> not found"), layer_name);
-
arrow_color = D_translate_color(opt3->answer);
x_color = D_translate_color(opt5->answer);
unknown_color = D_translate_color(opt6->answer);
@@ -245,17 +236,10 @@
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
-
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
/* Read in the map window associated with window */
G_get_window(&window);
- if (D_check_map_window(&window))
- G_fatal_error(_("Setting map window"));
+ D_check_map_window(&window);
if (G_set_window(&window) == -1)
G_fatal_error(_("Current window not settable"));
@@ -362,19 +346,6 @@
}
}
- /* if we didn't get a layer name from the arg options, then
- get name of layer that is on the screen */
- if (!layer_set) {
- if (D_get_cell_name(full_name))
- G_fatal_error(_("No raster map exists in the current window"));
-
- mapset = G_find_cell(full_name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), full_name);
-
- sscanf(full_name, "%s", layer_name);
- }
-
/* open the raster map */
layer_fd = G_open_cell_old(layer_name, mapset);
if (layer_fd < 0)
@@ -596,7 +567,7 @@
G_close_cell(layer_fd);
if (opt7->answer)
G_close_cell(mag_fd);
- D_add_to_list(G_recreate_command());
+
R_close_driver();
exit(0);
Modified: grass/trunk/display/d.rast.num/number.c
===================================================================
--- grass/trunk/display/d.rast.num/number.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rast.num/number.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -53,7 +53,6 @@
DCELL *cell;
char *mapset;
char full_name[128];
- char window_name[64];
double D_north, D_east;
double D_south, D_west;
double U_east, U_north;
@@ -87,7 +86,6 @@
"displayed to the graphics monitor.");
opt1 = G_define_standard_option(G_OPT_R_MAP);
- opt1->required = NO;
opt2 = G_define_option();
opt2->key = "grid_color";
@@ -127,12 +125,7 @@
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- if (opt1->answer)
- strcpy(full_name, opt1->answer);
- else {
- if (D_get_cell_name(full_name))
- G_fatal_error(_("No raster map exists in current window"));
- }
+ strcpy(full_name, opt1->answer);
if (strcmp("none", opt2->answer) == 0)
grid_color = -1;
@@ -158,18 +151,11 @@
/* Setup driver and check important information */
- if (D_get_cur_wind(window_name))
- G_fatal_error(_("No current window"));
-
- if (D_set_cur_wind(window_name))
- G_fatal_error(_("Current window not available"));
-
/* Read in the map window associated with window */
G_get_window(&window);
- if (D_check_map_window(&window))
- G_fatal_error(_("Setting map window"));
+ D_check_map_window(&window);
if (G_set_window(&window) == -1)
G_fatal_error(_("Current window not settable"));
@@ -303,7 +289,7 @@
}
G_close_cell(layer_fd);
- D_add_to_list(G_recreate_command());
+
R_close_driver();
exit(EXIT_SUCCESS);
Modified: grass/trunk/display/d.rgb/main.c
===================================================================
--- grass/trunk/display/d.rgb/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rgb/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -45,7 +45,6 @@
struct Cell_head window;
struct GModule *module;
struct Flag *flag_o;
- struct Flag *flag_x;
int t, b, l, r;
int i;
@@ -61,10 +60,6 @@
flag_o->key = 'o';
flag_o->description = _("Overlay (non-null values only)");
- flag_x = G_define_flag();
- flag_x->key = 'x';
- flag_x->description = _("Don't add to list of commands in monitor");
-
for (i = 0; i < 3; i++) {
char buff[80];
@@ -138,10 +133,6 @@
G_percent(window.rows, window.rows, 5);
D_cell_draw_end();
- /* Close down connection to window driver */
- if (!flag_x->answer)
- D_add_to_list(G_recreate_command());
-
R_close_driver();
/* Close the raster maps */
Modified: grass/trunk/display/d.rhumbline/main.c
===================================================================
--- grass/trunk/display/d.rhumbline/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rhumbline/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -31,7 +31,6 @@
{
int line_color;
int text_color = 0;
- int use_mouse;
double lon1, lat1, lon2, lat2;
struct GModule *module;
struct
@@ -51,7 +50,7 @@
parm.coor->key = "coor";
parm.coor->key_desc = "lon1,lat1,lon2,lat2";
parm.coor->type = TYPE_STRING;
- parm.coor->required = NO;
+ parm.coor->required = YES;
parm.coor->description = "Starting and ending coordinates";
parm.lcolor = G_define_option();
@@ -78,30 +77,26 @@
G_fatal_error("%s: database is not a %s database",
argv[0], G__projection_name(PROJECTION_LL));
- use_mouse = 1;
- if (parm.coor->answer) {
- if (parm.coor->answers[0] == NULL)
- G_fatal_error("No coordinates given");
+ if (parm.coor->answers[0] == NULL)
+ G_fatal_error("No coordinates given");
- if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
- }
- if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
+ if (!G_scan_easting(parm.coor->answers[0], &lon1, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[0]);
+ }
+ if (!G_scan_northing(parm.coor->answers[1], &lat1, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[1]);
- }
- if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
- }
- if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
- G_usage();
- G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
- }
- use_mouse = 0;
}
+ if (!G_scan_easting(parm.coor->answers[2], &lon2, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[2]);
+ }
+ if (!G_scan_northing(parm.coor->answers[3], &lat2, G_projection())) {
+ G_usage();
+ G_fatal_error("%s - illegal longitude", parm.coor->answers[3]);
+ }
if (R_open_driver() != 0)
G_fatal_error("No graphics device selected");
@@ -125,12 +120,7 @@
#endif
setup_plot();
- if (use_mouse)
- mouse(line_color, text_color);
- else {
- plot(lon1, lat1, lon2, lat2, line_color, text_color);
- D_add_to_list(G_recreate_command());
- }
+ plot(lon1, lat1, lon2, lat2, line_color, text_color);
R_close_driver();
exit(0);
Deleted: grass/trunk/display/d.rhumbline/mouse.c
===================================================================
--- grass/trunk/display/d.rhumbline/mouse.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.rhumbline/mouse.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,53 +0,0 @@
-#include <stdio.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-#include "local_proto.h"
-
-int mouse(int line_color, int text_color)
-{
- int x1, y1, x2, y2;
- double lat1, lon1, lat2, lon2;
- int top, bottom, left, right;
- int button;
-
- right = (int)D_get_d_east();
- left = (int)D_get_d_west();
- top = (int)D_get_d_north();
- bottom = (int)D_get_d_south();
-
- x2 = x1 = (right + left) / 2;
- y2 = y1 = (top + bottom) / 2;
-
- fprintf(stderr, "\n");
- fprintf(stderr, "Left: begin\n");
- fprintf(stderr, "Middle: draw\n");
- fprintf(stderr, "Right: quit\n");
-
- while (1) {
- R_standard_color(line_color);
- R_get_location_with_line(x1, y1, &x2, &y2, &button);
-#ifdef DEBUG
- fprintf(stdout, "button=%d x1,y1=%d,%d x2,y2=%d,%d\n", button, x1,
- y1, x2, y2);
-#endif
- if (button == 3)
- return -1;
- if (x2 < left || x2 > right)
- continue;
- if (y2 < top || y2 > bottom)
- continue;
-
- if (button == 2) {
- lon1 = D_d_to_u_col((double)x1);
- lat1 = D_d_to_u_row((double)y1);
- lon2 = D_d_to_u_col((double)x2);
- lat2 = D_d_to_u_row((double)y2);
- plot(lon1, lat1, lon2, lat2, line_color, text_color);
- }
-
- x1 = x2;
- y1 = y2;
- }
-
- return 0;
-}
Modified: grass/trunk/display/d.text.new/main.c
===================================================================
--- grass/trunk/display/d.text.new/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.text.new/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -72,7 +72,7 @@
static void set_color(char *);
static int get_coordinates(int *, int *, double *, double *,
- struct rectinfo, char **, char, char, char);
+ struct rectinfo, char **, char, char);
static void draw_text(char *, int *, int *, int, char *, double, char);
int main(int argc, char **argv)
@@ -91,6 +91,7 @@
struct Option *font;
struct Option *path;
struct Option *charset;
+ struct Option *input;
} opt;
struct
{
@@ -99,7 +100,6 @@
struct Flag *b;
struct Flag *r;
struct Flag *s;
- struct Flag *m;
struct Flag *c;
} flag;
@@ -115,12 +115,10 @@
char bold;
/* window info */
- char win_name[64];
struct rectinfo win;
/* command file */
FILE *cmd_fp;
- char *cmd_file;
char buf[512];
@@ -138,8 +136,7 @@
module = G_define_module();
module->keywords = _("display");
module->description =
- _
- ("Draws text in the active display frame on the graphics monitor using the current font.");
+ _("Draws text in the active display frame on the graphics monitor using the current font.");
opt.text = G_define_option();
opt.text->key = "text";
@@ -225,9 +222,9 @@
opt.charset->description =
_("Text encoding (only applicable to TrueType fonts)");
- flag.m = G_define_flag();
- flag.m->key = 'm';
- flag.m->description = _("Use mouse to interactively place text");
+ opt.input = G_define_standard_option(G_OPT_F_INPUT);
+ opt.input->required = NO;
+ opt.input->description = _("Input file");
flag.p = G_define_flag();
flag.p->key = 'p';
@@ -260,8 +257,6 @@
/* parse and check options and flags */
if ((opt.line->answer && opt.at->answer) ||
- (opt.line->answer && flag.m->answer) ||
- (opt.at->answer && flag.m->answer) ||
(flag.p->answer && flag.g->answer))
G_fatal_error(_("Please choose only one placement method"));
@@ -296,12 +291,6 @@
D_setup(0);
- if (D_get_cur_wind(win_name))
- G_fatal_error(_("No current window"));
-
- if (D_set_cur_wind(win_name))
- G_fatal_error(_("Current window not available"));
-
/* figure out where to put text */
D_get_screen_window(&win.t, &win.b, &win.l, &win.r);
R_set_window(win.t, win.b, win.l, win.r);
@@ -321,9 +310,9 @@
orig_x = orig_y = 0;
- if (opt.at->answer || flag.m->answer) {
+ if (opt.at->answer) {
if (get_coordinates(&x, &y, &east, &north,
- win, opt.at->answers, flag.m->answer,
+ win, opt.at->answers,
flag.p->answer, flag.g->answer))
G_fatal_error(_("Invalid coordinates"));
orig_x = x;
@@ -348,39 +337,7 @@
if (text[0])
draw_text(text, &x2, &y2, size, align, rotation, bold);
- if (opt.at->answer || opt.line->answer)
- D_add_to_list(G_recreate_command());
- else {
- if (flag.m->answer) {
- if (flag.p->answer)
- sprintf(buf, "%s -p at=%d,%d", argv[0], x, y);
- else if (flag.g->answer)
- sprintf(buf, "%s -g at=%f,%f", argv[0], east, north);
- else
- sprintf(buf, "%s at=%f,%f", argv[0],
- (double)(x * 100.0 / (double)(win.r - win.l)),
- (double)((win.b - y) * 100.0 / (double)(win.b -
- win.t)));
- sprintf(buf, "%s text=\"%s\"", buf, opt.text->answer);
- sprintf(buf, "%s size=%s", buf, opt.size->answer);
- sprintf(buf, "%s color=%s", buf, opt.color->answer);
- sprintf(buf, "%s align=%s", buf, opt.align->answer);
- sprintf(buf, "%s rotation=%s", buf, opt.rotation->answer);
- sprintf(buf, "%s linespacing=%s", buf,
- opt.linespacing->answer);
- if (flag.b->answer)
- strcat(buf, " -b");
- if (flag.r->answer)
- strcat(buf, " -r");
- if (flag.s->answer)
- strcat(buf, " -s");
- }
- else
- sprintf(buf, "%s line=1", G_recreate_command());
- D_add_to_list(buf);
- }
-
/* reset */
R_text_size(5, 5);
R_text_rotation(0.0);
@@ -390,25 +347,26 @@
exit(EXIT_SUCCESS);
}
- if (isatty(0))
- fprintf(stdout,
- _
- ("\nPlease enter text instructions. Enter EOF (ctrl-d) on last line to quit\n"));
+ if (!opt.input->answer || strcmp(opt.input->answer, "-") == 0)
+ cmd_fp = stdin;
+ else {
+ cmd_fp = fopen(opt.input->answer, "r");
+ if (!cmd_fp)
+ G_fatal_error(_("Unable to open input file <%s>"), opt.input->answer);
+ }
- cmd_file = G_tempfile();
- if ((cmd_fp = fopen(cmd_file, "w")) == NULL)
- G_fatal_error(_("Unable to open temporary file <%s>"), cmd_file);
+ if (isatty(fileno(cmd_fp)))
+ fprintf(stderr,
+ _("\nPlease enter text instructions. Enter EOF (ctrl-d) on last line to quit\n"));
set_x = set_y = set_l = 0;
first_text = 1;
linefeed = 1;
/* do the plotting */
- while (fgets(buf, 512, stdin)) {
+ while (fgets(buf, sizeof(buf), cmd_fp)) {
int buf_len;
char *buf_ptr, *ptr;
- fprintf(cmd_fp, "%s", buf);
-
buf_len = strlen(buf) - 1;
for (; buf[buf_len] == '\r' || buf[buf_len] == '\n'; buf_len--) ;
buf[buf_len + 1] = 0;
@@ -559,11 +517,9 @@
}
}
- fclose(cmd_fp);
+ if (cmd_fp != stdin)
+ fclose(cmd_fp);
- sprintf(buf, "%s < %s", G_recreate_command(), cmd_file);
- D_add_to_list(buf);
-
/* reset */
R_text_size(5, 5);
R_text_rotation(0.0);
@@ -599,25 +555,12 @@
static int
get_coordinates(int *x, int *y, double *east, double *north,
- struct rectinfo win, char **at, char mouse, char pixel,
+ struct rectinfo win, char **at, char pixel,
char geocoor)
{
- int i;
double e, n;
- if (mouse) {
- fprintf(stderr, _("Click!\n"));
- fprintf(stderr, _(" Left: Place text here\n"));
- fprintf(stderr, _(" Right: Quit\n"));
-
- R_get_location_with_pointer(x, y, &i);
- i &= 0x0f;
- if (i != 1)
- return 1;
- e = D_d_to_u_col((double)*x);
- n = D_d_to_u_row((double)*y);
- }
- else if (at) {
+ if (at) {
e = atof(at[0]);
n = atof(at[1]);
if (pixel) {
Modified: grass/trunk/display/d.thematic.area/main.c
===================================================================
--- grass/trunk/display/d.thematic.area/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.thematic.area/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -56,7 +56,7 @@
struct Option *field_opt;
struct Option *render_opt;
struct Option *legend_file_opt;
- struct Flag *legend_flag, *algoinfo_flag, *x_flag, *nodraw_flag;
+ struct Flag *legend_flag, *algoinfo_flag, *nodraw_flag;
struct cat_list *Clist;
int *cats, ncat, nrec, ctype;
@@ -185,12 +185,6 @@
nodraw_flag->key = 'n';
nodraw_flag->description = _("Do not draw map, only output the legend");
- x_flag = G_define_flag();
- x_flag->key = 'x';
- x_flag->description =
- _("Don't add to list of vectors and commands in monitor "
- "(it won't be drawn if the monitor is refreshed)");
-
/* Check command line */
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
@@ -467,13 +461,6 @@
} /* end window check if */
- if (!x_flag->answer) {
- D_add_to_list(G_recreate_command());
-
- D_set_dig_name(G_fully_qualified_name(map_name, mapset));
- D_add_to_dig_list(G_fully_qualified_name(map_name, mapset));
- }
-
R_close_driver();
} /* end of nodraw_flag condition */
Modified: grass/trunk/display/d.vect/main.c
===================================================================
--- grass/trunk/display/d.vect/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.vect/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -103,7 +103,7 @@
struct Option *width_opt, *wcolumn_opt, *wscale_opt;
struct Option *render_opt;
struct Flag *verbose_flag; /* please remove before GRASS 7 released */
- struct Flag *id_flag, *table_acolors_flag, *cats_acolors_flag, *x_flag,
+ struct Flag *id_flag, *table_acolors_flag, *cats_acolors_flag,
*zcol_flag;
struct cat_list *Clist;
int *cats, ncat;
@@ -363,12 +363,6 @@
id_flag->guisection = _("Query");
id_flag->description = _("Use values from 'cats' option as feature id");
- x_flag = G_define_flag();
- x_flag->key = 'x';
- x_flag->description =
- _("Don't add to list of vectors and commands in monitor "
- "(it won't be drawn if the monitor is refreshed)");
-
zcol_flag = G_define_flag();
zcol_flag->key = 'z';
zcol_flag->description = _("Colorize polygons according to z height)");
@@ -413,9 +407,7 @@
minreg = atof(minreg_opt->answer);
if (reg < minreg) {
- G_message(_
- ("Region size is lower than minreg, nothing displayed."));
- D_add_to_list(G_recreate_command());
+ G_message(_("Region size is lower than minreg, nothing displayed."));
exit(EXIT_SUCCESS);
}
}
@@ -423,9 +415,7 @@
maxreg = atof(maxreg_opt->answer);
if (reg > maxreg) {
- G_message(_
- ("Region size is greater than maxreg, nothing displayed."));
- D_add_to_list(G_recreate_command());
+ G_message(_("Region size is greater than maxreg, nothing displayed."));
exit(EXIT_SUCCESS);
}
}
@@ -737,13 +727,6 @@
}
}
- if (!x_flag->answer) {
- D_add_to_list(G_recreate_command());
-
- D_set_dig_name(G_fully_qualified_name(map_name, mapset));
- D_add_to_dig_list(G_fully_qualified_name(map_name, mapset));
- }
-
R_close_driver();
if (verbose)
Modified: grass/trunk/display/d.vect.chart/main.c
===================================================================
--- grass/trunk/display/d.vect.chart/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.vect.chart/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -279,12 +279,6 @@
sizecol_opt->answer, size, scale,
&ocolor, colors, y_center, max_reference);
- if (ret == 0) {
- D_add_to_list(G_recreate_command());
- D_set_dig_name(G_fully_qualified_name(map_opt->answer, mapset));
- D_add_to_dig_list(G_fully_qualified_name(map_opt->answer, mapset));
- }
-
R_close_driver();
Vect_close(&Map);
Modified: grass/trunk/display/d.what.rast/main.c
===================================================================
--- grass/trunk/display/d.what.rast/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.what.rast/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -30,7 +30,6 @@
int main(int argc, char **argv)
{
struct Cell_head window;
- char temp[128];
int t, b, l, r;
int i, j;
int width, mwidth;
@@ -49,27 +48,13 @@
"within the current geographic region.");
- /* Don't fail initially if driver open fails, and don't let call kill
- * us -- set quiet mode
- */
- R__open_quiet();
- if (R_open_driver() == 0) {
- if (D_get_cell_list(&rast, &nrasts) < 0)
- rast = NULL;
- else {
- rast = (char **)G_realloc(rast, (nrasts + 1) * sizeof(char *));
- rast[nrasts] = NULL;
- }
- R_close_driver();
- }
+ rast = NULL;
opt1 = G_define_option();
opt1->key = "map";
opt1->type = TYPE_STRING;
- opt1->required = NO;
+ opt1->required = YES;
opt1->multiple = YES;
- if (rast)
- opt1->answers = rast;
opt1->gisprompt = "old,cell,raster";
opt1->description = _("Name of existing raster map(s)");
opt1->key_desc = "name";
@@ -96,10 +81,7 @@
_
("Print out col/row for the entire map in grid resolution of the region");
- if (!rast)
- opt1->required = YES;
-
- if ((argc > 1 || !rast) && G_parser(argc, argv))
+ if (argc > 1 && G_parser(argc, argv))
exit(EXIT_FAILURE);
@@ -109,17 +91,10 @@
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- if (D_get_cur_wind(temp))
- G_fatal_error(_("No current graphics window"));
-
- if (D_set_cur_wind(temp))
- G_fatal_error(_("Current graphics window not available"));
-
/* Read in the map window associated with window */
G_get_window(&window);
- if (D_check_map_window(&window))
- G_fatal_error(_("Setting graphics window"));
+ D_check_map_window(&window);
if (G_set_window(&window) == -1)
G_fatal_error(_("Can't set current graphics window"));
Modified: grass/trunk/display/d.what.vect/main.c
===================================================================
--- grass/trunk/display/d.what.vect/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.what.vect/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -40,7 +40,7 @@
int main(int argc, char **argv)
{
- struct Flag *once, *terse, *txt, *topo_flag, *flash, *edit_flag;
+ struct Flag *once, *terse, *txt, *topo_flag, *edit_flag;
struct Option *opt1;
struct GModule *module;
char *mapset, *openvect();
@@ -56,19 +56,8 @@
_("Allows the user to interactively query a vector map layer "
"at user-selected locations within the current geographic region.");
- /* Conditionalize R_open_driver() so "help" works, open quiet as well */
- R__open_quiet();
- if (R_open_driver() == 0) {
- if (D_get_dig_list(&vect, &nvects) < 0)
- vect = NULL;
- else {
- vect = (char **)G_realloc(vect, (nvects + 1) * sizeof(char *));
- vect[nvects] = NULL;
- }
+ vect = NULL;
- R_close_driver();
- }
-
once = G_define_flag();
once->key = '1';
once->description = _("Identify just one location");
@@ -78,9 +67,7 @@
opt1->type = TYPE_STRING;
opt1->multiple = YES;
opt1->key_desc = "name";
- if (vect)
- opt1->answers = vect;
- opt1->required = NO;
+ opt1->required = YES;
opt1->gisprompt = "old,vector,vector";
opt1->description = _("Name of existing vector map");
@@ -97,18 +84,11 @@
topo_flag->key = 'd';
topo_flag->description = _("Print topological information (debugging)");
- flash = G_define_flag();
- flash->key = 'f';
- flash->description = _("Enable flashing (slower)");
-
edit_flag = G_define_flag();
edit_flag->key = 'e';
edit_flag->description = _("Open form in edit mode");
- if (!vect)
- opt1->required = YES;
-
- if ((argc > 1 || !vect) && G_parser(argc, argv))
+ if (argc > 1 && G_parser(argc, argv))
exit(EXIT_FAILURE);
if (opt1->answers && opt1->answers[0])
@@ -160,14 +140,13 @@
G_fatal_error(_("No graphics device selected"));
D_setup(0);
- what(once->answer, txt->answer, terse->answer, flash->answer,
+ what(once->answer, txt->answer, terse->answer,
width, mwidth, topo_flag->answer, edit_flag->answer);
for (i = 0; i < nvects; i++)
Vect_close(&Map[i]);
R_close_driver();
- R_pad_freelist(vect, nvects);
G_message(_("Done."));
exit(EXIT_SUCCESS);
Modified: grass/trunk/display/d.what.vect/what.c
===================================================================
--- grass/trunk/display/d.what.vect/what.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.what.vect/what.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -15,7 +15,7 @@
#define WDTH 5
-int what(int once, int txt, int terse, int flash, int width, int mwidth,
+int what(int once, int txt, int terse, int width, int mwidth,
int topo, int edit)
{
int type, edit_mode;
@@ -32,7 +32,6 @@
double maxdist;
int getz = 0;
struct field_info *Fi;
- int flash_basecolr, flash_colr;
plus_t line, area = 0, centroid;
int i;
@@ -41,18 +40,12 @@
char buf[1000], *str, title[500];
dbString html;
char *form;
- char *panell;
if (terse)
txt = 1; /* force text for terse */
G_get_set_window(&window);
- if (flash)
- 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);
-
-
G_begin_polygon_area_calculations();
nrows = window.rows;
ncols = window.cols;
@@ -69,32 +62,15 @@
else
notty = 0;
- if (flash) {
- panell = G_tempfile();
- flash_basecolr = YELLOW;
- }
-
do {
- if (flash)
- R_panel_save(panell, R_screen_top(), R_screen_bot(),
- R_screen_left(), R_screen_rite());
-
if (!terse)
- show_buttons(once, flash);
+ show_buttons(once);
R_get_location_with_pointer(&screen_x, &screen_y, &button);
if (!once) {
if (button == 3) {
- if (flash)
- R_panel_delete(panell);
break;
}
if (button == 2) {
- if (flash) {
- R_panel_delete(panell);
- flash_basecolr++;
- if (flash_basecolr >= G_num_standard_colors())
- flash_basecolr = 1;
- }
continue;
}
}
@@ -123,8 +99,6 @@
maxdist = y1;
G_debug(1, "Maximum distance in map units = %f\n", maxdist);
- if (flash)
- flash_colr = flash_basecolr;
F_clear();
for (i = 0; i < nvects; i++) {
Vect_reset_cats(Cats);
@@ -325,11 +299,6 @@
}
}
}
-
- if (flash) {
- flash_line(&Map[i], line, Points, BLACK);
- flash_line(&Map[i], line, Points, flash_colr);
- }
}
if (area > 0) {
@@ -408,11 +377,6 @@
if (centroid > 0) {
Vect_read_line(&Map[i], Points, Cats, centroid);
}
-
- if (flash) {
- flash_area(&Map[i], area, Points, BLACK);
- flash_area(&Map[i], area, Points, flash_colr);
- }
}
if (Cats->n_cats > 0) {
@@ -490,19 +454,8 @@
G_debug(3, db_get_string(&html));
F_open(title, db_get_string(&html));
}
-
- if (flash) {
- flash_colr++;
- if (flash_colr >= G_num_standard_colors())
- flash_colr = 1;
- }
}
- if (flash) {
- R_panel_restore(panell);
- R_panel_delete(panell);
- }
-
} while (!once);
Vect_destroy_line_struct(Points);
@@ -510,7 +463,7 @@
}
/* TODO */
-int show_buttons(int once, int flash)
+int show_buttons(int once)
{
if (once) {
fprintf(stderr, _("\nClick mouse button on desired location\n\n"));
@@ -520,13 +473,8 @@
fprintf(stderr, "\n");
fprintf(stderr, _("Buttons\n"));
fprintf(stderr, _(" Left: what's here\n"));
- if (flash) {
- fprintf(stderr, _(" Middle: toggle flash color\n"));
- nlines = 5;
- }
- else
- nlines = 4;
fprintf(stderr, _(" Right: quit\n"));
+ nlines = 4;
}
return 0;
Modified: grass/trunk/display/d.what.vect/what.h
===================================================================
--- grass/trunk/display/d.what.vect/what.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.what.vect/what.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -2,8 +2,8 @@
char *openvect(char *);
/* what.c */
-int what(int, int, int, int, int, int, int, int);
-int show_buttons(int, int);
+int what(int, int, int, int, int, int, int);
+int show_buttons(int);
/*flash.c */
void flash_area(struct Map_info *, plus_t, struct line_pnts *, int);
Modified: grass/trunk/display/d.zoom/main.c
===================================================================
--- grass/trunk/display/d.zoom/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/display/d.zoom/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -37,7 +37,7 @@
#ifdef QUIET
struct Flag *quiet;
#endif
- struct Flag *just, *full, *hand, *pan, *last;
+ struct Flag *full, *hand, *pan, *last;
struct Option *rmap, *vmap, *zoom;
struct GModule *module;
double magnify;
@@ -59,32 +59,13 @@
_("Allows the user to change the current geographic "
"region settings interactively, with a mouse.");
- /* Conditionalize R_open_driver() so "help" works, open quiet as well */
- R__open_quiet();
- if (R_open_driver() == 0) {
- if (D_get_cell_list(&rast, &nrasts) < 0)
- rast = NULL;
- else {
- rast = (char **)G_realloc(rast, (nrasts + 1) * sizeof(char *));
- rast[nrasts] = NULL;
- }
+ rast = NULL;
+ vect = NULL;
- if (D_get_dig_list(&vect, &nvects) < 0)
- vect = NULL;
- else {
- vect = (char **)G_realloc(vect, (nvects + 1) * sizeof(char *));
- vect[nvects] = NULL;
- }
-
- R_close_driver();
- }
-
rmap = G_define_option();
rmap->key = "rast";
rmap->type = TYPE_STRING;
rmap->multiple = YES;
- if (rast)
- rmap->answers = rast;
rmap->required = NO;
rmap->gisprompt = "old,cell,raster";
rmap->description = _("Name of raster map");
@@ -93,8 +74,6 @@
vmap->key = "vector";
vmap->type = TYPE_STRING;
vmap->multiple = YES;
- if (vect)
- vmap->answers = vect;
vmap->required = NO;
vmap->gisprompt = "old,dig,vector";
vmap->description = _("Name of vector map");
@@ -125,20 +104,11 @@
hand->key = 'h';
hand->description = _("Handheld mode");
- just = G_define_flag();
- just->key = 'j';
- just->description = _("Just redraw given maps using default colors");
-
last = G_define_flag();
last->key = 'r';
last->description = _("Return to previous zoom");
- if (!rast && !vect) {
- rmap->required = YES;
- just->answer = 1;
- }
-
- if ((argc > 1 || (!rast && !vect)) && G_parser(argc, argv))
+ if (argc > 1 && G_parser(argc, argv))
exit(EXIT_FAILURE);
if ((full->answer + pan->answer + hand->answer) > 1)
@@ -153,49 +123,9 @@
#endif
cmd = NULL;
- if (!just->answer) {
- if (R_open_driver() != 0)
- G_fatal_error(_("No graphics device selected"));
- stat = R_pad_get_item("list", &list, &nlists);
- R_close_driver();
- if (stat || !nlists) {
- G_message(_("ERROR: can not get \"list\" items"));
- G_message(_("-j flag forced"));
- just->answer = 1;
- }
- else {
- cmd = (char *)G_malloc(strlen(list[0]) + 1);
- strcpy(cmd, list[0]);
- for (i = 1; i < nlists; i++) {
- cmd =
- (char *)G_realloc(cmd, strlen(cmd) + strlen(list[i]) + 2);
- strcat(cmd, "\n");
- strcat(cmd, list[i]);
- }
- }
- }
+ rast = rmap->answers;
+ vect = vmap->answers;
- if (just->answer) {
- if (rmap->answers && rmap->answers[0])
- rast = rmap->answers;
- else {
- rast = NULL;
- nrasts = 0;
- }
- if (vmap->answers && vmap->answers[0])
- vect = vmap->answers;
- else {
- vect = NULL;
- nvects = 0;
- }
- }
-
-
- /* Make sure map is available */
- if (rmap->required == YES && rmap->answers == NULL)
- G_fatal_error(_("No map is displayed in GRASS monitor"));
-
-
if (rast) {
struct Cell_head window;
@@ -229,9 +159,6 @@
}
}
- if (vmap->required == YES && vmap->answers == NULL)
- exit(EXIT_SUCCESS);
-
if (vect) {
struct Map_info Map;
BOUND_BOX box;
@@ -343,12 +270,6 @@
R_close_driver();
- if (rast)
- R_pad_freelist(rast, nrasts);
-
- if (vect)
- R_pad_freelist(vect, nvects);
-
G_message(_("Zooming complete."));
exit(stat);
}
Modified: grass/trunk/general/g.mapset/main.c
===================================================================
--- grass/trunk/general/g.mapset/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/general/g.mapset/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -22,8 +22,6 @@
#include <string.h>
#include <unistd.h>
#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/display.h>
#include <grass/glocale.h>
#include <grass/spawn.h>
@@ -39,8 +37,7 @@
char *mapset_old_path, *mapset_new_path;
char *lock_prog;
char path[GPATH_MAX];
- char *shell, *monitor;
- struct MON_CAP *cap;
+ char *shell;
G_gisinit(argv[0]);
@@ -92,7 +89,6 @@
mapset_old = G__getenv("MAPSET");
G_asprintf(&mapset_old_path, "%s/%s/%s", gisdbase_old, location_old,
mapset_old);
- monitor = G__getenv("MONITOR");
/* New values */
if (gisdbase_opt->answer)
@@ -175,21 +171,6 @@
("%s is currently running GRASS in selected mapset or lock file cannot be checked"),
G_whoami());
- /* Erase monitors */
- G_message(_("Erasing monitors..."));
- while ((cap = R_parse_monitorcap(MON_NEXT, "")) != NULL) {
- G__setenv("MONITOR", cap->name);
- R__open_quiet();
- if (R_open_driver() == 0) {
- D_erase(DEFAULT_BG_COLOR);
- D_add_to_list("d.erase");
- R_close_driver();
- R_release_driver();
- }
- }
- if (monitor)
- G_setenv("MONITOR", monitor);
-
/* Clean temporary directory */
sprintf(path, "%s/etc/clean_temp", G_gisbase());
G_message(_("Cleaning up temporary files..."));
Modified: grass/trunk/imagery/Makefile
===================================================================
--- grass/trunk/imagery/Makefile 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/imagery/Makefile 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,7 +1,6 @@
MODULE_TOPDIR = ..
SUBDIRS = \
- i.ask \
i.atcorr \
i.cluster \
i.find \
Modified: grass/trunk/include/Make/Grass.make.in
===================================================================
--- grass/trunk/include/Make/Grass.make.in 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/include/Make/Grass.make.in 2008-08-06 21:50:17 UTC (rev 32584)
@@ -102,6 +102,7 @@
PNGDRIVER_LIBNAME = grass_pngdriver
PSDRIVER_LIBNAME = grass_psdriver
CAIRODRIVER_LIBNAME = grass_cairodriver
+HTMLDRIVER_LIBNAME = grass_htmldriver
EDIT_LIBNAME = grass_edit
G3D_LIBNAME = grass_g3d
GIS_LIBNAME = grass_gis
@@ -200,6 +201,7 @@
PNGDRIVERLIB = -l$(PNGDRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB) $(PNGLIB)
PSDRIVERLIB = -l$(PSDRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB)
CAIRODRIVERLIB = -l$(CAIRODRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB)
+HTMLDRIVERLIB = -l$(HTMLDRIVER_LIBNAME) $(DRIVERLIB) $(GISLIB)
EDITLIB = -l$(EDIT_LIBNAME) $(GISLIB) $(VASKLIB)
G3DLIB = -l$(G3D_LIBNAME) $(GISLIB)
GISLIB = -l$(GIS_LIBNAME) $(DATETIMELIB) $(XDRLIB) $(SOCKLIB) $(INTLLIB)
@@ -299,6 +301,7 @@
PNGDRIVERDEP= $(ARCH_LIBDIR)/$(LIB_PREFIX)$(PNGDRIVER_LIBNAME)$(LIB_SUFFIX)
PSDRIVERDEP = $(ARCH_LIBDIR)/$(LIB_PREFIX)$(PSDRIVER_LIBNAME)$(LIB_SUFFIX)
CAIRODRIVERDEP = $(ARCH_LIBDIR)/$(LIB_PREFIX)$(CAIRODRIVER_LIBNAME)$(LIB_SUFFIX)
+HTMLDRIVERDEP = $(ARCH_LIBDIR)/$(LIB_PREFIX)$(HTMLDRIVER_LIBNAME)$(LIB_SUFFIX)
DSPFDEP = $(ARCH_LIBDIR)/$(LIB_PREFIX)$(DSPF_LIBNAME)$(LIB_SUFFIX)
EDITDEP = $(ARCH_LIBDIR)/$(LIB_PREFIX)$(EDIT_LIBNAME)$(LIB_SUFFIX)
G3DDEP = $(ARCH_LIBDIR)/$(LIB_PREFIX)$(G3D_LIBNAME)$(LIB_SUFFIX)
Modified: grass/trunk/include/display.h
===================================================================
--- grass/trunk/include/display.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/include/display.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -68,26 +68,10 @@
void D_box(double, double, double, double);
void D_line_width(double);
-/* get_win.c */
-int get_win_w_mouse(float *, float *, float *, float *);
-
-/* ident_win.c */
-int ident_win(char *);
-
/* list.c */
-int D_set_cell_name(const char *);
-int D_get_cell_name(char *);
-int D_set_dig_name(const char *);
-int D_get_dig_name(char *);
-int D_add_to_cell_list(const char *);
-int D_get_cell_list(char ***, int *);
-int D_add_to_dig_list(const char *);
-int D_get_dig_list(char ***, int *);
-int D_add_to_list(const char *);
-int D_get_list(char ***, int *);
-int D_clear_window(void);
-int D_set_erase_color(const char *);
-int D_get_erase_color(char *);
+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 *[]);
@@ -130,15 +114,12 @@
int D_color_number_to_RGB(int, int *, int *, int *);
/* window.c */
-int D_new_window(char *, int, int, int, int);
-int D_new_window_percent(char *, float, float, float, float);
-int D_set_cur_wind(const char *);
-int D_get_cur_wind(char *);
-int D_show_window(int);
+void D_new_window(char *, int, int, int, int);
+void D_new_window_percent(char *, float, float, float, float);
+void D_show_window(int);
int D_get_screen_window(int *, int *, int *, int *);
-int D_check_map_window(struct Cell_head *);
-int D_reset_screen_window(int, int, int, int);
-int D_timestamp(void);
+void D_check_map_window(struct Cell_head *);
+void D_reset_screen_window(int, int, int, int);
void D_remove_window(void);
void D_erase_window(void);
void D_erase(const char *);
Deleted: grass/trunk/include/graphics.h
===================================================================
--- grass/trunk/include/graphics.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/include/graphics.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,94 +0,0 @@
-/*
- * command esc character
- * set to have most bits (but not all) set to 1
- */
-
-#define COMMAND_ESC 127
-
-/*
- * BEGIN sync count
- * This is number of zero bytes to be returned by
- * driver in response to a BEGIN request
- */
-
-#define BEGIN_SYNC_COUNT 32
-
-/*
- * command tokens
- * note: none should be zero, or equal to COMMAND_ESC
- */
-
-#define GET_NUM_COLORS 1
-#define CONT_ABS 4
-#define CONT_REL 5
-#define RGB_COLOR 6
-#define ERASE 7
-#define GET_LOCATION_WITH_BOX 8
-#define GET_LOCATION_WITH_LINE 9
-#define GET_LOCATION_WITH_POINTER 10
-#define GRAPH_CLOSE 11
-#define MOVE_ABS 13
-#define MOVE_REL 14
-#define POLYGON_ABS 15
-#define POLYGON_REL 16
-#define POLYLINE_ABS 17
-#define POLYLINE_REL 18
-#define POLYDOTS_ABS 19
-#define POLYDOTS_REL 20
-#define SCREEN_LEFT 25
-#define SCREEN_RITE 26
-#define SCREEN_BOT 27
-#define SCREEN_TOP 28
-#define TEXT 29
-#define TEXT_SIZE 30
-#define TEXT_ROTATION 39
-#define SET_WINDOW 40
-#define GET_TEXT_BOX 42
-#define FONT 44
-#define RESPOND 45
-#define BEGIN 46
-#define STANDARD_COLOR 47
-#define BOX_ABS 48
-#define BOX_REL 49
-#define PANEL_SAVE 53
-#define PANEL_RESTORE 54
-#define PANEL_DELETE 55
-
-#define PAD_CREATE 61
-#define PAD_CURRENT 62
-#define PAD_DELETE 63
-#define PAD_INVENT 64
-#define PAD_LIST 65
-#define PAD_SELECT 66
-
-#define PAD_APPEND_ITEM 71
-#define PAD_DELETE_ITEM 72
-#define PAD_GET_ITEM 73
-#define PAD_LIST_ITEMS 74
-#define PAD_SET_ITEM 75
-
-/* fonts */
-#define FONT_INFO 76
-#define FONT_LIST 77
-#define CHARSET 78
-
-/* line attributes */
-#define LINE_WIDTH 79
-
-/* bitmap */
-#define BITMAP 80
-
-/* scaled raster */
-#define BEGIN_SCALED_RASTER 84
-#define SCALED_RASTER 85
-#define END_SCALED_RASTER 86
-
-/* return codes for pad routines */
-
-#define OK 0
-#define NO_MEMORY 1
-#define NO_PAD 2
-#define NO_CUR_PAD 3
-#define NO_ITEM 4
-#define DUPLICATE 5
-#define ILLEGAL 6
Deleted: grass/trunk/include/monitors.h
===================================================================
--- grass/trunk/include/monitors.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/include/monitors.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,20 +0,0 @@
-#ifndef _GRASS_MONITORS_H
-#define _GRASS_MONITORS_H
-
-struct MON_CAP
-{
- char *name; /* name of monitor */
- char *path; /* full path name to execute monitor */
- char *comment; /* like this */
- char *link; /* were monitor interfaces to gis */
- char *tty; /* where monitor must be run from */
- char *where; /* version of above for user */
-};
-
-#define MON_NEXT 1
-#define MON_NAME 2
-#define MON_PATH 3
-#define MON_LINK 4
-#define MON_CLOSE 5
-
-#endif
Modified: grass/trunk/include/raster.h
===================================================================
--- grass/trunk/include/raster.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/include/raster.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,63 +1,12 @@
#ifndef _GRASS_RASTER_H
#define _GRASS_RASTER_H
-#include <grass/monitors.h>
-
-/* common.c */
void R_flush(void);
-void R_pad_perror(const char *, int);
-void R_pad_freelist(char **, int);
-
-/* get.c */
-void R_get_location_with_box(int, int, int *, int *, int *);
-void R_get_location_with_line(int, int, int *, int *, int *);
-void R_get_location_with_pointer(int *, int *, int *);
-
-/* io.c */
-int _send_ident(int);
-int _send_char(const unsigned char *);
-int _send_char_array(int, const unsigned char *);
-int _send_int_array(int, const int *);
-int _send_float_array(int, const float *);
-int _send_int(const int *);
-int _send_float(const float *);
-int _send_text(const char *);
-
-int _get_char(char *);
-int _get_int(int *);
-int _get_float(float *);
-int _get_text(char *);
-char *_get_text_2(void);
-
+int R_open_driver(void);
void R__open_quiet(void);
-int sync_driver(char *name);
-void _hold_signals(int);
void R_stabilize(void);
-void R_kill_driver(void);
void R_close_driver(void);
-void R_release_driver(void);
-/* io_fifo.c / io_sock.c */
-int unlock_driver(int);
-int R_open_driver(void);
-
-/* pad.c */
-int R_pad_create(const char *);
-int R_pad_current(char *);
-int R_pad_delete(void);
-int R_pad_invent(char *);
-int R_pad_list(char ***, int *);
-int R_pad_select(const char *);
-int R_pad_append_item(const char *, const char *, int);
-int R_pad_delete_item(const char *);
-int R_pad_get_item(const char *, char ***, int *);
-int R_pad_list_items(char ***, int *);
-int R_pad_set_item(const char *, const char *);
-
-/* parse_mon.c */
-struct MON_CAP *R_parse_monitorcap(int, char *);
-
-/* protocol.c */
int R_screen_left(void);
int R_screen_rite(void);
int R_screen_bot(void);
@@ -94,10 +43,6 @@
void R_font_list(char ***, int *);
void R_font_info(char ***, int *);
-void R_panel_save(const char *, int, int, int, int);
-void R_panel_restore(const char *);
-void R_panel_delete(const char *);
-
void R_begin_scaled_raster(int, int[2][2], int[2][2]);
int R_scaled_raster(int, int,
const unsigned char *,
Modified: grass/trunk/lib/Makefile
===================================================================
--- grass/trunk/lib/Makefile 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/Makefile 2008-08-06 21:50:17 UTC (rev 32584)
@@ -9,6 +9,7 @@
driver \
pngdriver \
psdriver \
+ htmldriver \
raster \
bitmap \
btree \
Modified: grass/trunk/lib/cairodriver/Driver.c
===================================================================
--- grass/trunk/lib/cairodriver/Driver.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/cairodriver/Driver.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -32,15 +32,9 @@
drv.Client_Open = NULL;
drv.Client_Close = Cairo_Client_Close;
drv.Erase = Cairo_Erase;
- drv.Get_with_box = NULL;
- drv.Get_with_line = NULL;
- drv.Get_with_pointer = NULL;
drv.Graph_set = Cairo_Graph_set;
drv.Graph_close = Cairo_Graph_close;
drv.Line_width = Cairo_Line_width;
- drv.Panel_save = NULL;
- drv.Panel_restore = NULL;
- drv.Panel_delete = NULL;
drv.Polydots_abs = NULL;
drv.Polydots_rel = NULL;
drv.Polyline_abs = Cairo_Polyline_abs;
@@ -52,8 +46,6 @@
drv.Scaled_raster = Cairo_scaled_raster;
drv.End_scaled_raster = Cairo_end_scaled_raster;
drv.Respond = Cairo_Respond;
- drv.Work_stream = NULL;
- drv.Do_work = NULL;
drv.lookup_color = Cairo_lookup_color;
drv.color = Cairo_color;
drv.draw_line = Cairo_draw_line;
Added: grass/trunk/lib/cairodriver/description.html
===================================================================
--- grass/trunk/lib/cairodriver/description.html (rev 0)
+++ grass/trunk/lib/cairodriver/description.html 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,174 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <TITLE>Cairo driver</TITLE>
+ <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+ <link rel="stylesheet" href="grassdocs.css" type="text/css">
+</HEAD>
+<BODY bgColor=white>
+
+<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
+
+<H2>NAME</H2>
+<EM><B>Cairo driver</B></EM> - driver for bitmap or vector output using
+the Cairo graphics library.
+<BR>
+<EM>(drivers)</EM>
+
+<H2>DESCRIPTION</H2>
+
+The Cairo driver generates PNG, BMP, PPM, PS, PDF or SVG images from GRASS
+display commands, using the
+<A HREF="http://www.cairographics.org/">Cairo graphics library</A>.
+The image format is selected from the extension of the output file.
+
+<P>
+It is started as 'pseudo' monitor (output to an image file) and when
+stopped, all output from previously used display commands are written to
+the output file.
+
+<H2>USAGE</H2>
+
+<H3>Environment variables</H3>
+
+Several environment variables affect the operation of the Cairo driver:
+
+<UL>
+ <LI><B>GRASS_WIDTH=xxx</B><BR>
+ the width of the image.
+ </LI><BR>
+ <LI><B>GRASS_HEIGHT=yyy</B><BR>
+ the height of the image.
+ </LI><BR>
+ <LI><B>GRASS_CAIROFILE=filename</B><BR>
+ the name and format of the resulting image file, default is
+ <tt>map.png</tt>.<BR>
+ The image format is determined from the file extension.<BR>
+ Supported bitmap formats:
+ <UL>
+ <LI><B>.png</B> - Portable Network Graphics (PNG)</LI>
+ <LI><B>.bmp</B> - Windows Bitmap (BMP)</LI>
+ <LI><B>.ppm</B> - Portable Pixmap (PPM)</LI>
+ </UL>
+ Supported vector formats:
+ <UL>
+ <LI><B>.pdf</B> - Portable Document Format (PDF)</LI>
+ <LI><B>.ps</B> - PostScript (PS)</LI>
+ <LI><B>.svg</B> - Scalable Vector Graphics (SVG)</LI>
+ </UL>
+ (Note: Some formats may not be available, depending on your platform and
+ the Cairo library that GRASS was built with.)
+ </LI><BR>
+ <LI><B>GRASS_BACKGROUNDCOLOR=RRGGBB</B><BR>
+ specifies the background color to use in RGB
+ notation (hex values). Default is <b>FFFFFF</b> (white).
+ </LI><BR>
+ <LI><B>GRASS_TRANSPARENT=[TRUE|FALSE]</B><BR>
+ sets transparent background on (TRUE) or off (FALSE, default).
+ </LI><BR>
+ <LI><B>GRASS_AUTO_WRITE=[TRUE|FALSE]</B><BR>
+ if set to <tt>TRUE</tt>, the image file will be written after each
+ operation (i.e. whenever a client disconnects), rather than
+ only being written out when the driver terminates.<BR>
+ (Note: This only applies to bitmap formats - vector formats
+ are always written directly to file).
+ </LI><BR>
+ <LI><B>GRASS_CAIRO_READ</B><BR>
+ if <tt>TRUE</tt>, the Cairo driver will initialize the image from
+ the contents of GRASS_CAIROFILE.<BR>
+ (Note: This is only supported for bitmap formats)
+ </LI><BR>
+ <LI><B>GRASS_CAIRO_MAPPED</B><BR>
+ if <tt>TRUE</tt>, the Cairo driver will map GRASS_CAIROFILE as its framebuffer,
+ rather than using memory. This only works with BMP files.
+ </LI>
+</UL>
+
+<H3>Examples</H3>
+
+Example using the driver directly (bash-syntax):
+<div class="code"><PRE>
+export GRASS_CAIROFILE=spearfish.png
+export GRASS_WIDTH=800
+export GRASS_HEIGHT=800
+
+d.mon start=cairo
+d.rast map=elevation.10m
+d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
+d.vect map=roads width=2
+d.mon stop=cairo
+</PRE></div>
+
+Example using <em><a href="d.out.file.html">d.out.file</a></em>:
+<div class="code"><PRE>
+d.mon x0
+d.rast map=elevation.10m
+d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
+d.vect map=roads width=2
+
+d.out.file -c sf_cairo format=png size=800,800
+</PRE></div>
+
+<P>
+A more complicated example using <em><a href="d.out.file.html">d.out.file</a></em>:
+<div class="code"><PRE>
+r.shaded.relief map=elevation.dem
+r.watershed elev=elevation.dem basin=watershed.basin thresh=10000
+
+d.mon x1
+d.shadedmap rel=elevation.dem.shade drape=watershed.basin bright=30
+d.vect streams color=aqua fcolor=aqua type=area,line
+d.vect roads where="label ~ 'light-duty road'" color=grey
+d.vect roads where="label ~ 'unimproved'" color=orange
+d.vect roads where="label ~ 'secondary highway'" color=100:100:100 width=2
+d.vect roads where="label ~ 'primary highway'" color=50:50:50 width=2
+d.vect railroads col=red width=2
+d.vect roads where="label = 'interstate'" color=black width=3
+
+d.vect archsites icon=basic/star size=25 fcolor=yellow
+
+d.font Andale_Mono
+echo "Spearfish, SD" | d.text color=black at=28,53 -b
+
+d.out.file -c sf_cairo2 format=png
+</PRE></div>
+
+
+<H2>NOTES</H2>
+
+The driver is still in development. Enable it by specifying
+<CODE>--with-cairo</CODE> when configuring GRASS. This
+requires a reasonably recent version of the Cairo libraries
+and a working pkg-config.
+
+<P>
+Antialiasing is enabled by default for bitmap formats. There is
+currently no way of disabling this.
+
+<P>
+Cairo supports true vector format output whenever possible. However,
+if the selected format doesn't support a necessary feature, Cairo may
+fall back on rendering a bitmap representation of the image wrapped in
+the selected vector format.
+
+<P>
+Cairo driver output via <em><A HREF="d.out.file.html">d.out.file</A></em>
+is supported via the -c flag.</P>
+
+<h2>SEE ALSO</h2>
+<EM>
+<A HREF="htmlmapdriver.html">HTMLMAP driver</A>,
+<A HREF="pngdriver.html">PNG driver</A>,
+<A HREF="psdriver.html">PostScript driver</A>,
+<A href="xdriver.html">XDRIVER</A>
+<BR>
+<A HREF="d.frame.html">d.frame</A>,
+<A href="d.mon.html">d.mon</A>,
+<A href="d.rast.html">d.rast</A>,
+<A href="d.vect.html">d.vect</A>
+<A href="d.out.file.html">d.out.file</A>
+</EM>
+
+<H2>AUTHOR</H2>
+Lars Ahlzen <<I>lars (at) ahlzen.com</I>><BR>
+and the GRASS Development Team.
Deleted: grass/trunk/lib/display/get_win.c
===================================================================
--- grass/trunk/lib/display/get_win.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/display/get_win.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,49 +0,0 @@
-#include <stdio.h>
-#include <grass/raster.h>
-
-int get_win_w_mouse(float *top, float *bottom, float *left, float *right)
-{
- int button;
- int st, sb, sl, sr;
- int t, b, l, r;
-
- st = R_screen_top();
- sb = R_screen_bot();
- sl = R_screen_left();
- sr = R_screen_rite();
-
- fprintf(stderr, "\nButtons:\n");
- fprintf(stderr, "Left: Establish a corner\n");
- fprintf(stderr, "Right: Accept window\n");
-
- l = sl;
- b = sb;
- r = l + 10;
- t = b - 10;
-
- do {
- R_get_location_with_box(l, b, &r, &t, &button);
- if (button == 1) {
- l = r;
- b = t;
- }
- } while (button != 3);
-
- if (l > r) {
- button = l;
- l = r;
- r = button;
- }
-
- if (t > b) {
- button = t;
- t = b;
- b = button;
- }
- *bottom = 100. - 100. * (b - st) / (sb - st);
- *top = 100. - 100. * (t - st) / (sb - st);
- *left = 100. * (l - sl) / (sr - sl);
- *right = 100. * (r - sl) / (sr - sl);
-
- return 0;
-}
Deleted: grass/trunk/lib/display/ident_win.c
===================================================================
--- grass/trunk/lib/display/ident_win.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/display/ident_win.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,66 +0,0 @@
-#include <string.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-
-int ident_win(char *cur_pad)
-{
- char **list;
- char **pads;
- int count;
- int closest;
- int npads;
- int p;
- int stat;
- int x, y, t, b, l, r;
- int button;
- int gotone;
-
- /* Get list of pads (windows) */
- R_pad_list(&pads, &npads);
-
- button = 1;
-
- x = (R_screen_rite() + R_screen_left()) / 2;
- y = (R_screen_top() + R_screen_bot()) / 2;
-
- while (button == 1) {
- closest = 9999999;
- gotone = 0;
-
- R_get_location_with_pointer(&x, &y, &button);
- for (p = 0; p < npads; p++) {
- if (!strlen(pads[p]))
- continue;
-
- stat = R_pad_select(pads[p]);
- if (stat) {
- R_pad_perror("ERROR", stat);
- continue;
- }
-
- /* Check each window's "d_win" */
- stat = R_pad_get_item("d_win", &list, &count);
- if (stat) {
- R_pad_perror("ERROR", stat);
- continue;
- }
- sscanf(list[0], "%d %d %d %d", &t, &b, &l, &r);
- R_pad_freelist(list, count);
-
- /* If chosen point is outside pad window, continue */
- if (x < l || x > r || y < t || y > b)
- continue;
-
- /* If right edge closer than closest, the save pad name */
- if ((r - x) >= 0 && (r - x) < closest) {
- closest = r - x;
- gotone = 1;
- strcpy(cur_pad, pads[p]);
- }
- }
-
- if (gotone)
- D_set_cur_wind(cur_pad);
- }
- return (button);
-}
Modified: grass/trunk/lib/display/list.c
===================================================================
--- grass/trunk/lib/display/list.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/display/list.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,51 +1,5 @@
/* Routines to manage the graphics window contents list
*
- * D_clear_window()
- * Removes all information about current window
- *
- * D_add_to_list(string)
- * Adds string to growing list of screen contents.
- * "string" is, by convention, a command string.
- *
- * D_get_list(list,count)
- * returns the list of the commands for the maps currently displayed
- *
- * D_set_cell_name(name)
- * sets the name of the cell file currently displayed
- *
- * D_get_cell_name(name)
- * returns the name of the cell file currently displayed
- *
- * D_set_dig_name(name)
- * sets the name of the dig file currently displayed
- *
- * D_get_dig_name(name)
- * returns the name of the dig file currently displayed
- *
- * D_set_site_name(name)
- * sets the name of the site_lists file currently displayed
- *
- * D_get_site_name(name)
- * returns the name of the site_lists file currently displayed
- *
- * D_add_to_cell_list(name)
- * adds the name of the cell file currently displayed to cell_list
- *
- * D_get_cell_list(list,count)
- * returns the list of the cell_list currently displayed
- *
- * D_add_to_dig_list(name)
- * adds the name of the dig file currently displayed to dig_list
- *
- * D_get_dig_list(list,count)
- * returns the list of the dig_list currently displayed
- *
- * D_add_to_site_list(name)
- * adds the name of the site_lists file currently displayed to site_list
- *
- * D_get_site_list(list,count)
- * returns the list of the site_list currently displayed
- *
* D_set_erase_color(color)
* sets the color name of the current erase color for the window
*
@@ -61,156 +15,6 @@
/*!
- * \brief add raster map name to display list
- *
- * Stores the raster\remarks{As with the change from <i>window</i> to
- * <i>frame</i>, GRASS 4.0 changed word usage from <i>cell</i> to
- * <i>raster.</i> For compatibility with existing code, the routines have not
- * changed their names.} map <b>name</b> in the information associated with
- * the current frame.
- *
- * \param name
- * \return int
- */
-
-int D_set_cell_name(const char *name)
-{
- R_pad_delete_item("cell");
-
- return (R_pad_set_item("cell", name));
-}
-
-
-/*!
- * \brief retrieve raster map name
- *
- * Returns the <b>name</b> of the raster map associated with the current frame.
- *
- * \param name
- * \return int
- */
-
-int D_get_cell_name(char *name)
-{
- int stat;
- char **list;
- int count;
-
- if ((stat = R_pad_get_item("cell", &list, &count)))
- return (-1);
-
- strcpy(name, list[0]);
-
- R_pad_freelist(list, count);
- return (0);
-}
-
-
-/*!
- * \brief add vector map name to display list
- *
- * Stores the vector map <b>name</b> in the information associated with
- * the current frame.
- *
- * \param name
- * \return int
- */
-
-int D_set_dig_name(const char *name)
-{
- R_pad_delete_item("dig");
-
- return (R_pad_set_item("dig", name));
-}
-
-
-/*!
- * \brief retrieve vector map name
- *
- * Returns the <b>name</b> of the vector map associated with the current frame.
- *
- * \param name
- * \return int
- */
-
-int D_get_dig_name(char *name)
-{
- int stat;
- char **list;
- int count;
-
- if ((stat = R_pad_get_item("dig", &list, &count)))
- return (-1);
-
- strcpy(name, list[0]);
-
- R_pad_freelist(list, count);
- return (0);
-}
-
-
-int D_add_to_cell_list(const char *name)
-{
- return (R_pad_append_item("cell_list", name, 1));
-}
-
-int D_get_cell_list(char ***list, int *count)
-{
- int stat;
-
- if ((stat = R_pad_get_item("cell_list", list, count)))
- return (-1);
-
- return (0);
-}
-
-int D_add_to_dig_list(const char *name)
-{
- return (R_pad_append_item("dig_list", name, 1));
-}
-
-int D_get_dig_list(char ***list, int *count)
-{
- int stat;
-
- if ((stat = R_pad_get_item("dig_list", list, count)))
- return (-1);
-
- return (0);
-}
-
-
-/*!
- * \brief add command to frame display list
- *
- * Adds <b>string</b> to list of screen contents. By convention,
- * <b>string</b> is a command string which could be used to recreate a part of
- * the graphics contents. This should be done for all screen graphics except for
- * the display of raster maps. The <i>D_set_cell_name</i> routine,the
- * <i>D_set_dig_name</i> routine and the <i>D_set_site_name</i> routine
- * are used for this special case.
- *
- * \param string
- * \return int
- */
-
-int D_add_to_list(const char *string)
-{
- return (R_pad_append_item("list", string, 0));
-}
-
-int D_get_list(char ***list, int *count)
-{
- int stat;
-
- if ((stat = R_pad_get_item("list", list, count)))
- return (-1);
-
- return (0);
-}
-
-
-/*!
* \brief clears information about current frame
*
* Removes all information about the current frame. This includes the map region and the
@@ -220,49 +24,25 @@
* \return int
*/
-
-/*!
- * \brief clear frame display lists
- *
- * Removes all display information lists associated with the current frame.
- *
- * \param ~
- * \return int
- */
-
-int D_clear_window(void)
+void D_clear_window(void)
{
- R_pad_delete_item("list");
- R_pad_delete_item("cell");
- R_pad_delete_item("dig");
- R_pad_delete_item("site");
- R_pad_delete_item("cell_list");
- R_pad_delete_item("dig_list");
- R_pad_delete_item("site_list");
- R_pad_delete_item("m_win");
- R_pad_delete_item("erase");
- return 0;
}
-int D_set_erase_color(const char *colorname)
+static char *erase_color;
+
+void D_set_erase_color(const char *colorname)
{
- R_pad_delete_item("erase");
+ if (erase_color)
+ G_free(erase_color);
- return (R_pad_set_item("erase", colorname));
+ erase_color = G_store(colorname);
}
-int D_get_erase_color(char *colorname)
+void D_get_erase_color(char *colorname)
{
- int stat;
- char **list;
- int count;
+ if (!erase_color)
+ erase_color = G_store(DEFAULT_BG_COLOR);
- if ((stat = R_pad_get_item("erase", &list, &count)))
- return (-1);
-
- strcpy(colorname, list[0]);
-
- R_pad_freelist(list, count);
- return (0);
+ strcpy(colorname, erase_color);
}
Deleted: grass/trunk/lib/display/popup.c
===================================================================
--- grass/trunk/lib/display/popup.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/display/popup.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,210 +0,0 @@
-
-/****************************************************************************
- * D_popup(back_colr, text_colr, div_colr, top, left, percent_per_line, options)
- * int back_colr ; color of window
- * int text_color ; color of text and border
- * int div_color ; color of item divider lines
- * int left, top ; pixle coordinates of top-left corner
- * (Coordinate system is 0,0 lower left,
- * 100,100 upper right)
- * int percent_per_line ; percent of entire window per line of text
- * char *options[] ; array of text showing options.
- * The first entry is a title, not an option
- *
- * The bottom-right coordinates are calculated based on the top-left coors.,
- * the percent_per_line, the number of options, and the longest option text
- * length. If necessary, the window is moved to make sure it is inside
- * the screen.
- *
- * - Current screen contents are stashed away in the area.
- * - Area is blanked with the background color and fringed with the
- * text color.
- * - Options are drawn using the current font.
- * - User uses the mouse to choose the desired option.
- * - Area is restored with the original contents.
- * - Number of this option is returned to the calling program.
- ***************************************************************************/
-#include <string.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/display.h>
-
-#define Y_BORDER 5
-#define X_BORDER 5
-
-
-/*!
- * \brief pop-up menu
- *
- * This routine provides a pop-up type menu
- * on the graphics screen. The <b>bcolor</b> specifies the background color.
- * The <b>tcolor</b> is the text color. The <b>dcolor</b> specifies the color
- * of the line used to divide the menu items. The <b>top</b> and <b>left</b>
- * specify the placement of the top left corner of the menu on the screen. 0,0 is
- * at the bottom left of the screen, and 100,100 is at the top right. The
- * <b>size</b> of the text is given as a percentage of the vertical size of the
- * screen. The <b>options</b> array is a NULL terminated array of character
- * strings. The first is a menu title and the rest are the menu options (i.e.,
- * options[0] is the menu title, and options[1], options[2], etc., are the menu
- * options). The last option must be the NULL pointer.
- * The coordinates of the bottom right of the menu are calculated based on the
- * <b>top left</b> coordinates, the <b>size</b>, the number of
- * <b>options</b>, and the longest option text length. If necessary, the menu
- * coordinates are adjusted to make sure the menu is on the screen.
- * <i>D_popup(~)</i> does the following:
- * <ol>
- <li> Current screen contents under the menu are saved.
- </li>
- <li> Area is blanked with the background color and fringed with the text color.
- </li>
- <li> Menu options are drawn using the current font.
- </li>
- <li> User uses the mouse to choose the desired option.
- </li>
- <li> Menu is erased and screen is restored with the original contents.
- </li>
- <li> Number of the selected option is returned to the calling module.
- </li></ol>
- *
- * \param bcolor
- * \param tcolor
- * \param dcolor
- * \param top
- * \param left
- * \param size
- * \param options[]
- * \return int
- */
-
-int D_popup(int back_colr, int text_colr, int div_colr,
- int top, int left, int percent_per_line, char *options[])
-{
- int t, l, b, r;
- int opt;
- int x, y;
- int button;
- int text_size;
- int text_raise;
- int n_options;
- int max_len;
- int len;
- char *panel;
- int dots_per_line, dots_per_char, height, width;
-
- /* Figure the number of options and the max length of options */
- max_len = 0;
- for (n_options = 0; options[n_options] != NULL; n_options++) {
- len = strlen(options[n_options]);
- if (max_len < len)
- max_len = len;
- }
-
- /* Figure the dots per line and dots_per_char */
- height = R_screen_bot() - R_screen_top();
- width = R_screen_rite() - R_screen_left();
- dots_per_line = height * percent_per_line / 100;
- dots_per_char = width / (max_len + 2);
- /* we want the box to fit into window horizontally */
-
- t = R_screen_bot() - (R_screen_bot() - R_screen_top()) * top / 100;
- l = R_screen_left() + (R_screen_rite() - R_screen_left()) * left / 100;
-
- /* Figure the bottom and right of the window */
- text_size = (int)(.8 * (float)dots_per_line);
- if (text_size > dots_per_char)
- text_size = dots_per_char;
-
- text_raise = (dots_per_line - text_size + 1) / 2;
- if (text_raise == 0)
- text_raise = 1;
- b = Y_BORDER + t + dots_per_line * n_options;
- r = 2 * X_BORDER + l + text_size * max_len;
-
- /* Adjust, if necessary, to make sure window is all on screen */
- if (t < R_screen_top()) {
- b = b + (R_screen_top() - t);
- t = R_screen_top();
- }
- if (b > R_screen_bot()) {
- t = t - (b - R_screen_bot());
- b = R_screen_bot();
- }
- if (t < R_screen_top())
- G_fatal_error("popup window too big vertically\n");
-
- if (l < R_screen_left()) {
- r = r + (R_screen_left() - l);
- l = R_screen_left();
- }
- if (r > R_screen_rite()) {
- l = l - (r - R_screen_rite());
- r = R_screen_rite();
- }
- if (l < R_screen_left()) {
- /* actually, this should never happen */
- fprintf(stderr, "ERROR:\n");
- fprintf(stderr, "popup window too big horizontally\n");
- fprintf(stderr, "to fit into the graphics window.\n");
- fprintf(stderr, "Widen the graphics window.");
- fprintf(stderr, "\nExiting...\n");
- exit(1);
- }
-
- /* Make sure text is not drawn outside of window */
- R_set_window(t, b, l, r);
-
- /* Save the panel in some name */
- panel = G_tempfile();
- R_panel_save(panel, t, b, l, r);
-
- /* Clear the panel */
- R_standard_color(back_colr);
- R_box_abs(l, t, r, b);
-
- /* Draw border */
- R_standard_color(text_colr);
- R_move_abs(l + 1, t + 1);
- R_cont_abs(r - 1, t + 1);
- R_cont_abs(r - 1, b - 1);
- R_cont_abs(l + 1, b - 1);
- R_cont_abs(l + 1, t + 1);
-
- /* Prepare for text */
- R_text_size(text_size, text_size);
-
- /* list the options */
- for (opt = 1; opt <= n_options; opt++) {
- if (opt != n_options) {
- R_standard_color(div_colr);
- R_move_abs(l + 2, t + Y_BORDER + opt * dots_per_line);
- R_cont_rel(r - l - 4, 0);
- }
- R_standard_color(text_colr);
- R_move_abs(l + X_BORDER,
- t + Y_BORDER + opt * dots_per_line - text_raise);
- R_text(options[opt - 1]);
- }
-
- R_flush();
-
- x = (l + r) / 2;
- y = (t + b) / 2;
-
- while (1) {
- int n;
-
- R_get_location_with_pointer(&x, &y, &button);
- if (x > r
- || x < l || y < t + Y_BORDER + dots_per_line || y > b - Y_BORDER)
- continue;
-
- n = y - t - Y_BORDER;
- if (n % dots_per_line == 0)
- continue;
-
- R_panel_restore(panel);
- R_panel_delete(panel);
- return (n / dots_per_line);
- }
-}
Modified: grass/trunk/lib/display/setup.c
===================================================================
--- grass/trunk/lib/display/setup.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/display/setup.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -59,22 +59,15 @@
int D_setup(int clear)
{
struct Cell_head region;
- char name[128];
int t, b, l, r;
- if (D_get_cur_wind(name)) {
- t = R_screen_top();
- b = R_screen_bot();
- l = R_screen_left();
- r = R_screen_rite();
- strcpy(name, "full_screen");
- D_new_window(name, t, b, l, r);
- }
+ t = R_screen_top();
+ b = R_screen_bot();
+ l = R_screen_left();
+ r = R_screen_rite();
+ D_new_window("full_screen", t, b, l, r);
- if (D_set_cur_wind(name))
- G_fatal_error("Current graphics frame not available");
- if (D_get_screen_window(&t, &b, &l, &r))
- G_fatal_error("Getting graphics coordinates");
+ D_get_screen_window(&t, &b, &l, &r);
/* clear the frame, if requested to do so */
if (clear) {
@@ -85,8 +78,7 @@
/* Set the map region associated with graphics frame */
G_get_set_window(®ion);
- if (D_check_map_window(®ion))
- G_fatal_error("Setting graphics coordinates");
+ D_check_map_window(®ion);
if (G_set_window(®ion) < 0)
G_fatal_error("Invalid graphics coordinates");
Modified: grass/trunk/lib/display/window.c
===================================================================
--- grass/trunk/lib/display/window.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/display/window.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -7,14 +7,6 @@
* D_reset_screen_window(t, b, l, r)
* resets the edges of the current window
*
- * D_set_cur_wind(name)
- * saves "name" in cur_w field in "no-name" pad
- * outlines previous current window in GRAY
- * outlines "name" in DEFAULT_FG_COLOR
- *
- * D_get_cur_wind(name)
- * gets the current name stored in cur_w field in "no_name" pad
- *
* D_show_window(color)
* outlines current window in color (from ../colors.h)
*
@@ -40,8 +32,50 @@
#include <grass/display.h>
#include <grass/raster.h>
+static struct {
+ int 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)
+{
+ screen_window.t = t;
+ screen_window.b = b;
+ screen_window.l = l;
+ screen_window.r = r;
+ screen_window_set = 1;
+}
+
/*!
+ * \brief retrieve current frame coordinates
+ *
+ * Returns current frame's
+ * coordinates in the pointers <b>top, bottom, left</b>, and <b>right.</b>
+ *
+ * \param top
+ * \param bottom
+ * \param left
+ * \param right
+ * \return int
+ */
+
+int D_get_screen_window(int *t, int *b, int *l, int *r)
+{
+ if (!screen_window_set)
+ return -1;
+
+ *t = screen_window.t;
+ *b = screen_window.b;
+ *l = screen_window.l;
+ *r = screen_window.r;
+ return 0;
+}
+
+
+/*!
* \brief create new graphics frame
*
* Creates a new frame <b>name</b> with
@@ -57,45 +91,13 @@
* \return int
*/
-int D_new_window(char *name, int t, int b, int l, int r)
+void D_new_window(char *name, int t, int b, int l, int r)
{
- int stat;
- char buff[256];
-
- /* If no name was sent, get a unique name for the window */
- if (!*name)
- R_pad_invent(name);
-
- /* Create the work pad */
- if ((stat = R_pad_create(name))) {
- R_pad_perror(name, stat);
- return (-1);
- }
-
- /* Select work pad for use */
- if ((stat = R_pad_select(name)))
- goto pad_error;
-
- /* Timestamp current pad */
- D_timestamp();
-
- sprintf(buff, "%d %d %d %d", t, b, l, r);
- if ((stat = R_pad_set_item("d_win", buff)))
- goto pad_error;
-
+ screen_window_set = 0;
+ map_window_set = 0;
/* Display outline of new window */
D_show_window(GRAY);
-
- R_set_window(t, b, l, r);
-
- return (0);
-
- pad_error:
- R_pad_delete();
- sprintf(buff, "window <%s>, item <%s>", name, "d_win");
- R_pad_perror(buff, stat);
-
- return (-1);
+ D_set_window(t, b, l, r);
}
@@ -115,7 +117,7 @@
* \return int
*/
-int D_new_window_percent(char *name, float b, float t, float l, float r)
+void D_new_window_percent(char *name, float b, float t, float l, float r)
{
int scr_t = R_screen_top();
int scr_b = R_screen_bot();
@@ -136,113 +138,11 @@
if (win_r > scr_r)
win_r = scr_r;
- return D_new_window(name, win_t, win_b, win_l, win_r);
+ D_new_window(name, win_t, win_b, win_l, win_r);
}
/*!
- * \brief set current graphics frame
- *
- * Selects the frame <b>name</b> to be the current frame. The previous current frame
- * (if there was one) is outlined in grey. The selected current frame is outlined
- * in white.
- *
- * \param name
- * \return int
- */
-
-int D_set_cur_wind(const char *name)
-{
- char pad_cur[64];
- int stat;
- int not_same_window;
- int t, b, l, r;
-
- /* Abort if window name is null */
- if (!strlen(name))
- return (-1);
-
- /* Abort if window name is not available */
- if ((stat = R_pad_select(name)))
- return (stat);
-
- /* Get name of current window pad */
- D_get_cur_wind(pad_cur);
-
- /* Establish whether it is the same as the currently selected pad */
- if (strlen(pad_cur)) {
- not_same_window = strcmp(name, pad_cur);
- if (not_same_window) {
- R_pad_select(pad_cur);
- D_show_window(GRAY);
- }
- }
- else {
- not_same_window = 1;
- }
-
- if (not_same_window) {
- /* Delete the current window name in no-name pad */
- R_pad_select("");
- if ((stat = R_pad_delete_item("cur_w")))
- return (stat);
-
- /* Update the current window name in no-name pad */
- if ((stat = R_pad_set_item("cur_w", name)))
- return (stat);
-
- /* Select new window pad */
- if ((stat = R_pad_select(name)))
- return (stat);
-
- /* Outline new window in highlight color */
- D_show_window(D_translate_color(DEFAULT_FG_COLOR));
-
- /* Tell driver of current window */
- D_get_screen_window(&t, &b, &l, &r);
- R_set_window(t, b, l, r);
- }
- else {
- /* Select new window pad */
- if ((stat = R_pad_select(name)))
- return (stat);
- }
-
- return (0);
-}
-
-
-/*!
- * \brief identify current graphics frame
- *
- * Captures the name of the current frame in string <b>name.</b>
- *
- * \param name
- * \return int
- */
-
-int D_get_cur_wind(char *name)
-{
- int count;
- int stat;
- char **list;
-
- if ((stat = R_pad_select("")))
- return (stat);
-
- if ((stat = R_pad_get_item("cur_w", &list, &count))) {
- strcpy(name, "");
- return (stat);
- }
-
- strcpy(name, list[0]);
- R_pad_freelist(list, count);
- R_pad_select(name);
- return (0);
-}
-
-
-/*!
* \brief outlines current frame
*
* Outlines
@@ -255,15 +155,13 @@
* \return int
*/
-int D_show_window(int color)
+void D_show_window(int color)
{
int t, b, l, r;
- int stat;
- if ((stat = D_get_screen_window(&t, &b, &l, &r)))
- return (stat);
+ D_get_screen_window(&t, &b, &l, &r);
- R_set_window(t - 1, b + 1, l - 1, r + 1);
+ D_set_window(t - 1, b + 1, l - 1, r + 1);
R_standard_color(color);
R_move_abs(l - 1, b);
@@ -273,43 +171,11 @@
R_cont_abs(l - 1, b);
R_flush();
- R_set_window(t, b, l, r);
-
- return (0);
+ D_set_window(t, b, l, r);
}
/*!
- * \brief retrieve current frame coordinates
- *
- * Returns current frame's
- * coordinates in the pointers <b>top, bottom, left</b>, and <b>right.</b>
- *
- * \param top
- * \param bottom
- * \param left
- * \param right
- * \return int
- */
-
-int D_get_screen_window(int *t, int *b, int *l, int *r)
-{
- int stat;
- int count;
- char **list;
-
- if ((stat = R_pad_get_item("d_win", &list, &count)))
- return (stat);
-
- sscanf(list[0], "%d %d %d %d", t, b, l, r);
-
- R_pad_freelist(list, count);
-
- return (0);
-}
-
-
-/*!
* \brief assign/retrieve current map region
*
* Graphics frames can have GRASS map regions associated with
@@ -323,51 +189,15 @@
* \return int
*/
-int D_check_map_window(struct Cell_head *wind)
+void D_check_map_window(struct Cell_head *wind)
{
- char buff[256];
- char ebuf[64], nbuf[64], sbuf[64], wbuf[64];
- int num;
- int count;
- char **list;
- char *err;
-
- if (0 != R_pad_get_item("m_win", &list, &count)) {
- G_format_easting(wind->east, ebuf, wind->proj);
- G_format_easting(wind->west, wbuf, wind->proj);
- G_format_northing(wind->north, nbuf, wind->proj);
- G_format_northing(wind->south, sbuf, wind->proj);
- sprintf(buff, "%d %d %s %s %s %s %d %d",
- wind->proj, wind->zone,
- ebuf, wbuf, nbuf, sbuf, wind->rows, wind->cols);
- if (R_pad_set_item("m_win", buff))
- return (-1);
- return (0);
+ if (map_window_set)
+ *wind = map_window;
+ else
+ {
+ map_window = *wind;
+ map_window_set = 1;
}
- else {
- num = sscanf(list[0], "%d %d %s %s %s %s %d %d",
- &wind->proj, &wind->zone,
- ebuf, wbuf, nbuf, sbuf, &wind->rows, &wind->cols);
-
- R_pad_freelist(list, count);
-
- if (num != 8)
- return -2;
-
- if (!G_scan_easting(ebuf, &wind->east, wind->proj))
- return -2;
- if (!G_scan_easting(wbuf, &wind->west, wind->proj))
- return -2;
- if (!G_scan_northing(nbuf, &wind->north, wind->proj))
- return -2;
- if (!G_scan_northing(sbuf, &wind->south, wind->proj))
- return -2;
-
- if ((err = G_adjust_Cell_head(wind, 1, 1)))
- return -2;
-
- return 0;
- }
}
@@ -384,68 +214,16 @@
* \return int
*/
-int D_reset_screen_window(int t, int b, int l, int r)
+void D_reset_screen_window(int t, int b, int l, int r)
{
- int stat;
- char buff[256];
-
D_show_window(D_translate_color(DEFAULT_BG_COLOR));
- sprintf(buff, "%d %d %d %d", t, b, l, r);
- R_pad_delete_item("d_win");
- if ((stat = R_pad_set_item("d_win", buff)))
- return (stat);
+ D_set_window(t, b, l, r);
D_show_window(D_translate_color(DEFAULT_FG_COLOR));
-
- return (0);
}
-
/*!
- * \brief give current time to frame
- *
- * Timestamp the current
- * frame. This is used primarily to identify which frames are on top of other,
- * specified frames.
- *
- * \param ~
- * \return int
- */
-
-int D_timestamp(void)
-{
- char buff[128];
- int stat;
- int count;
- char **list;
- char cur_pad[64];
- int cur_time;
-
- R_pad_current(cur_pad);
-
- R_pad_select("");
- if ((stat = R_pad_get_item("time", &list, &count))) {
- R_pad_set_item("time", "1");
- R_pad_select(cur_pad);
- R_pad_set_item("time", "1");
- return (1);
- }
-
- sscanf(list[0], "%d", &cur_time);
- sprintf(buff, "%d", cur_time + 1);
- R_pad_set_item("time", buff);
-
- R_pad_freelist(list, count);
-
- R_pad_select(cur_pad);
-
- R_pad_delete_item("time");
- return (R_pad_set_item("time", buff));
-}
-
-
-/*!
* \brief remove a frame
*
* Removes any trace of the
@@ -456,9 +234,8 @@
void D_remove_window(void)
{
- R_pad_delete();
- R_pad_select("");
- R_pad_delete_item("cur_w");
+ screen_window_set = 0;
+ map_window_set = 0;
}
/*!
@@ -500,20 +277,8 @@
void D_remove_windows(void)
{
- char **pads;
- int npads;
- int i;
-
- R_pad_list(&pads, &npads);
-
- R_pad_select("");
- R_pad_delete_item("time");
- R_pad_delete_item("cur_w");
-
- for (i = 0; i < npads; i++) {
- R_pad_select(pads[i]);
- R_pad_delete();
- }
+ screen_window_set = 0;
+ map_window_set = 0;
}
void D_full_screen(void)
@@ -521,9 +286,8 @@
D_remove_windows();
D_new_window_percent("full_screen", 0.0, 100.0, 0.0, 100.0);
- if (D_set_cur_wind("full_screen") == 0)
- D_timestamp();
R_standard_color(D_translate_color(DEFAULT_BG_COLOR));
R_erase();
}
+
Deleted: grass/trunk/lib/driver/Get_location.c
===================================================================
--- grass/trunk/lib/driver/Get_location.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/Get_location.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,41 +0,0 @@
-#include "driver.h"
-#include "driverlib.h"
-
-int COM_Get_location_with_pointer(int *wx, int *wy, int *button)
-{
- int ret = 0;
-
- if (driver->Get_with_pointer) {
- ret = (*driver->Get_with_pointer) (wx, wy, button);
- if (*button >= 1 && *button <= 3)
- *button = mouse_button[*button - 1];
- }
-
- return ret;
-}
-
-int COM_Get_location_with_line(int cx, int cy, int *wx, int *wy, int *button)
-{
- int ret = 0;
-
- if (driver->Get_with_line) {
- ret = (*driver->Get_with_line) (cx, cy, wx, wy, button);
- if (*button >= 1 && *button <= 3)
- *button = mouse_button[*button - 1];
- }
-
- return ret;
-}
-
-int COM_Get_location_with_box(int cx, int cy, int *wx, int *wy, int *button)
-{
- int ret = 0;
-
- if (driver->Get_with_box) {
- ret = (*driver->Get_with_box) (cx, cy, wx, wy, button);
- if (*button >= 1 && *button <= 3)
- *button = mouse_button[*button - 1];
- }
-
- return ret;
-}
Modified: grass/trunk/lib/driver/Makefile
===================================================================
--- grass/trunk/lib/driver/Makefile 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/Makefile 2008-08-06 21:50:17 UTC (rev 32584)
@@ -6,46 +6,6 @@
EXTRA_LIBS=$(GISLIB) $(FTLIB) $(ICONVLIB)
LIB_NAME = $(DRIVER_LIBNAME)
-LIB_OBJS =\
- Bitmap.o\
- Box.o\
- Client.o\
- Color.o\
- Cont.o\
- Draw.o\
- Erase.o\
- Font.o\
- Get_location.o\
- Get_t_box.o\
- Graph.o\
- Line_width.o\
- Move.o\
- Panel.o\
- Polydots.o\
- Polyline.o\
- Polygon.o\
- Raster.o\
- Respond.o\
- Returns.o\
- Set_window.o\
- Text.o\
- Text_size.o\
- Work.o\
- font2.o\
- font_freetype.o\
- init.o\
- pad.o\
- parse_ftcap.o\
- text2.o\
- text3.o
-
-ifneq ($(HAVE_SOCKET),)
- LIB_OBJS += \
- main.o\
- command.o\
- connect_sock.o
-endif
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
default: lib
Deleted: grass/trunk/lib/driver/Panel.c
===================================================================
--- grass/trunk/lib/driver/Panel.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/Panel.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,21 +0,0 @@
-#include "driver.h"
-#include "driverlib.h"
-
-void COM_Panel_save(const char *name, int top, int bottom, int left,
- int right)
-{
- if (driver->Panel_save)
- (*driver->Panel_save) (name, top, bottom, left, right);
-}
-
-void COM_Panel_restore(const char *name)
-{
- if (driver->Panel_restore)
- (*driver->Panel_restore) (name);
-}
-
-void COM_Panel_delete(const char *name)
-{
- if (driver->Panel_delete)
- (*driver->Panel_delete) (name);
-}
Deleted: grass/trunk/lib/driver/Work.c
===================================================================
--- grass/trunk/lib/driver/Work.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/Work.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,19 +0,0 @@
-#include "driver.h"
-#include "driverlib.h"
-
-int COM_Has_work(void)
-{
- return driver->Do_work ? 1 : 0;
-}
-
-int COM_Work_stream(void)
-{
- return driver->Work_stream ? (*driver->Work_stream) ()
- : -1;
-}
-
-void COM_Do_work(int opened)
-{
- if (driver->Do_work)
- (*driver->Do_work) (opened);
-}
Deleted: grass/trunk/lib/driver/command.c
===================================================================
--- grass/trunk/lib/driver/command.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/command.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,639 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: driver
- * AUTHOR(S): Glynn Clements <glynn gclements.plus.com> (original contributor)
- * Jachym Cepicky <jachym les-ejk.cz>
- * PURPOSE:
- * COPYRIGHT: (C) 2006-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.
- *
- *****************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include <grass/gis.h>
-#include <grass/graphics.h>
-#include "driverlib.h"
-#include "driver.h"
-#include "pad.h"
-#include <grass/glocale.h>
-
-#define REC(a,b) if ((ateof=rec((a),(b)))) break
-#define RECTEXT(x,s) if ((ateof=rectext(&x,&s))) break
-#define SEND(a,b) _send((a),(b))
-#define SENDTEXT(x) sendtext((x))
-
-static int rec(void *, int);
-static int rectext(char **, int *);
-static int _send(const void *, int);
-static int sendtext(const char *);
-static int RESULT(int);
-
-static int _wfd;
-static int _rfd;
-
-static char inbuf[4096];
-static int n_read;
-static int atbuf;
-
-static char current_command;
-
-static int ateof;
-
-static PAD *curpad; /* current selected pad */
-
-static unsigned char *blua;
-static unsigned char *grna;
-static unsigned char *reda;
-static unsigned char *nula;
-static int blu_alloc;
-static int grn_alloc;
-static int red_alloc;
-static int nul_alloc;
-
-static int *xarray;
-static int *yarray;
-static int n_xarray;
-static int n_yarray;
-
-static char lc;
-
-static void *xalloc(void *buf, int *cur, int new, int len)
-{
- if (*cur < new) {
- buf = G_realloc(buf, (size_t) new * len);
- *cur = new;
- }
-
- return buf;
-}
-
-void command_init(int rfd, int wfd)
-{
- _rfd = rfd;
- _wfd = wfd;
-
- atbuf = n_read = 0;
- current_command = 0;
-
- ateof = 0;
-}
-
-int LIB_command_get_input(void)
-{
- return _rfd;
-}
-
-static void send_fonts(void (*func) (char ***, int *))
-{
- char **fonts;
- int num_fonts;
- int i;
-
- (*func) (&fonts, &num_fonts);
- SEND(&num_fonts, sizeof num_fonts);
- for (i = 0; i < num_fonts; i++)
- SENDTEXT(fonts[i]);
- free_font_list(fonts, num_fonts);
-}
-
-int process_command(int c)
-{
- static char *name;
- static int name_size;
- static char *text;
- static int text_size;
-
- int t, b, l, r, ret;
- int x, y;
- unsigned char red, grn, blu;
- int number;
- int index;
- int button;
- float wx;
- ITEM *item;
- LIST *list;
- PAD *pad;
- unsigned char ch;
- int src[2][2], dst[2][2];
-
- switch (c) {
- case BEGIN:
- ch = 0;
- for (index = -10; index < BEGIN_SYNC_COUNT; index++)
- SEND(&ch, 1);
- ch = COMMAND_ESC;
- SEND(&ch, 1);
- break;
- case RESPOND:
- COM_Respond();
- SEND(&ch, 1);
- break;
- case GET_NUM_COLORS:
- COM_Number_of_colors(&index);
- SEND(&index, sizeof index);
- break;
- case STANDARD_COLOR:
- REC(&index, sizeof index);
- COM_Standard_color(index);
- break;
- case RGB_COLOR:
- REC(&red, sizeof red);
- REC(&grn, sizeof grn);
- REC(&blu, sizeof blu);
- COM_Color_RGB(red, grn, blu);
- break;
- case LINE_WIDTH:
- REC(&number, sizeof number);
- COM_Line_width(number);
- break;
- case CONT_ABS:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- COM_Cont_abs(x, y);
- break;
- case CONT_REL:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- COM_Cont_rel(x, y);
- break;
- case BOX_ABS:
- REC(&l, sizeof l);
- REC(&t, sizeof t);
- REC(&r, sizeof r);
- REC(&b, sizeof b);
- COM_Box_abs(l, t, r, b);
- break;
- case BOX_REL:
- REC(&l, sizeof l);
- REC(&t, sizeof t);
- COM_Box_rel(l, t);
- break;
- case ERASE:
- COM_Erase();
- break;
- case GET_LOCATION_WITH_BOX:
- REC(&t, sizeof t);
- REC(&b, sizeof b);
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- COM_Get_location_with_box(t, b, &x, &y, &button);
- SEND(&x, sizeof x);
- SEND(&y, sizeof y);
- SEND(&button, sizeof button);
- break;
- case GET_LOCATION_WITH_LINE:
- REC(&t, sizeof t);
- REC(&b, sizeof b);
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- COM_Get_location_with_line(t, b, &x, &y, &button);
- SEND(&x, sizeof x);
- SEND(&y, sizeof y);
- SEND(&button, sizeof button);
- break;
- case GET_LOCATION_WITH_POINTER:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- REC(&button, sizeof button);
- COM_Get_location_with_pointer(&x, &y, &button);
- SEND(&x, sizeof x);
- SEND(&y, sizeof y);
- SEND(&button, sizeof button);
- break;
- case GRAPH_CLOSE:
- COM_Graph_close();
- exit(0);
- case MOVE_ABS:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- COM_Move_abs(x, y);
- break;
- case MOVE_REL:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- COM_Move_rel(x, y);
- break;
- case BITMAP:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- REC(&index, sizeof index);
- blua =
- (unsigned char *)xalloc(blua, &blu_alloc, x * y, sizeof(*blua));
- REC(blua, x * y * sizeof(char));
- COM_Bitmap(x, y, index, blua);
- break;
- case BEGIN_SCALED_RASTER:
- REC(&index, sizeof(int));
- REC(&src[0][0], 4 * sizeof(int));
- REC(&dst[0][0], 4 * sizeof(int));
- COM_begin_scaled_raster(index, src, dst);
- break;
- case SCALED_RASTER:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- reda = (unsigned char *)xalloc(reda, &red_alloc, x, sizeof(*reda));
- grna = (unsigned char *)xalloc(grna, &grn_alloc, x, sizeof(*grna));
- blua = (unsigned char *)xalloc(blua, &blu_alloc, x, sizeof(*blua));
- nula = (unsigned char *)xalloc(nula, &nul_alloc, x, sizeof(*nula));
- REC(reda, x * sizeof(char));
- REC(grna, x * sizeof(char));
- REC(blua, x * sizeof(char));
- REC(nula, x * sizeof(char));
- REC(&t, sizeof t);
- ret = COM_scaled_raster(x, y, reda, grna, blua, t ? nula : NULL);
- SEND(&ret, sizeof ret);
- break;
- case END_SCALED_RASTER:
- COM_end_scaled_raster();
- break;
- case POLYGON_ABS:
- REC(&number, sizeof number);
- xarray = (int *)xalloc(xarray, &n_xarray, number, sizeof(*xarray));
- yarray = (int *)xalloc(yarray, &n_yarray, number, sizeof(*yarray));
- REC(xarray, number * sizeof(xarray[0]));
- REC(yarray, number * sizeof(yarray[0]));
- COM_Polygon_abs(xarray, yarray, number);
- break;
- case POLYGON_REL:
- REC(&number, sizeof number);
- xarray = (int *)xalloc(xarray, &n_xarray, number, sizeof(*xarray));
- yarray = (int *)xalloc(yarray, &n_yarray, number, sizeof(*yarray));
- REC(xarray, number * sizeof(xarray[0]));
- REC(yarray, number * sizeof(yarray[0]));
- COM_Polygon_rel(xarray, yarray, number);
- break;
- case POLYLINE_ABS:
- REC(&number, sizeof number);
- xarray = (int *)xalloc(xarray, &n_xarray, number, sizeof(*xarray));
- yarray = (int *)xalloc(yarray, &n_yarray, number, sizeof(*yarray));
- REC(xarray, number * sizeof(xarray[0]));
- REC(yarray, number * sizeof(yarray[0]));
- COM_Polyline_abs(xarray, yarray, number);
- break;
- case POLYLINE_REL:
- REC(&number, sizeof number);
- xarray = (int *)xalloc(xarray, &n_xarray, number, sizeof(*xarray));
- yarray = (int *)xalloc(yarray, &n_yarray, number, sizeof(*yarray));
- REC(xarray, number * sizeof(xarray[0]));
- REC(yarray, number * sizeof(yarray[0]));
- COM_Polyline_rel(xarray, yarray, number);
- break;
- case POLYDOTS_ABS:
- REC(&number, sizeof number);
- xarray = (int *)xalloc(xarray, &n_xarray, number, sizeof(*xarray));
- yarray = (int *)xalloc(yarray, &n_yarray, number, sizeof(*yarray));
- REC(xarray, number * sizeof(xarray[0]));
- REC(yarray, number * sizeof(yarray[0]));
- COM_Polydots_abs(xarray, yarray, number);
- break;
- case POLYDOTS_REL:
- REC(&number, sizeof number);
- xarray = (int *)xalloc(xarray, &n_xarray, number, sizeof(*xarray));
- yarray = (int *)xalloc(yarray, &n_yarray, number, sizeof(*yarray));
- REC(xarray, number * sizeof(xarray[0]));
- REC(yarray, number * sizeof(yarray[0]));
- COM_Polydots_rel(xarray, yarray, number);
- break;
- case SCREEN_LEFT:
- COM_Screen_left(&index);
- SEND(&index, sizeof index);
- break;
- case SCREEN_RITE:
- COM_Screen_rite(&index);
- SEND(&index, sizeof index);
- break;
- case SCREEN_BOT:
- COM_Screen_bot(&index);
- SEND(&index, sizeof index);
- break;
- case SCREEN_TOP:
- COM_Screen_top(&index);
- SEND(&index, sizeof index);
- break;
- case SET_WINDOW:
- REC(&t, sizeof t);
- REC(&b, sizeof b);
- REC(&l, sizeof l);
- REC(&r, sizeof r);
- COM_Set_window(t, b, l, r);
- break;
- case GET_TEXT_BOX:
- RECTEXT(text, text_size);
- COM_Get_text_box(text, &t, &b, &l, &r);
- SEND(&t, sizeof t);
- SEND(&b, sizeof b);
- SEND(&l, sizeof l);
- SEND(&r, sizeof r);
- break;
- case FONT:
- RECTEXT(text, text_size);
- COM_Font_get(text);
- break;
- case CHARSET:
- RECTEXT(text, text_size);
- COM_Font_init_charset(text);
- break;
- case FONT_LIST:
- send_fonts(COM_Font_list);
- break;
- case FONT_INFO:
- send_fonts(COM_Font_info);
- break;
- case TEXT:
- RECTEXT(text, text_size);
- COM_Text(text);
- break;
- case TEXT_SIZE:
- REC(&x, sizeof x);
- REC(&y, sizeof y);
- COM_Text_size(x, y);
- break;
- case TEXT_ROTATION:
- REC(&wx, sizeof wx);
- COM_Text_rotation(wx);
- break;
- case PANEL_SAVE:
- RECTEXT(text, text_size);
- REC(&t, sizeof t);
- REC(&b, sizeof b);
- REC(&l, sizeof l);
- REC(&r, sizeof r);
- COM_Panel_save(text, t, b, l, r);
- break;
- case PANEL_RESTORE:
- RECTEXT(text, text_size);
- COM_Panel_restore(text);
- break;
- case PANEL_DELETE:
- RECTEXT(text, text_size);
- COM_Panel_delete(text);
- break;
- case PAD_CREATE:
- RECTEXT(text, text_size);
- if (*text == 0) /* this is scratch pad */
- RESULT(OK);
- else if (find_pad(text) != NULL)
- RESULT(DUPLICATE); /* duplicate pad */
- else if (create_pad(text))
- RESULT(OK);
- else
- RESULT(NO_MEMORY);
- break;
-
- case PAD_CURRENT:
- if (curpad == NULL) {
- RESULT(NO_CUR_PAD);
- SENDTEXT("");
- }
- else {
- RESULT(OK);
- SENDTEXT(curpad->name);
- }
- break;
-
- case PAD_DELETE:
- if (curpad == NULL)
- RESULT(NO_CUR_PAD);
- else if (*curpad->name == 0)
- RESULT(ILLEGAL);
- else {
- delete_pad(curpad);
- curpad = NULL;
- RESULT(OK);
- }
- break;
-
- case PAD_INVENT:
- invent_pad(text);
- SENDTEXT(text);
- break;
-
- case PAD_LIST:
- for (pad = pad_list(); pad != NULL; pad = pad->next)
- if (*pad->name)
- SENDTEXT(pad->name);
- SENDTEXT("");
- break;
-
- case PAD_SELECT:
- RECTEXT(text, text_size); /* pad name */
- curpad = find_pad(text);
- if (curpad == NULL)
- RESULT(NO_PAD);
- else
- RESULT(OK);
- break;
-
- case PAD_GET_ITEM:
- RECTEXT(text, text_size); /* item name */
- if (curpad == NULL) {
- RESULT(NO_CUR_PAD);
- break;
- }
- item = find_item(curpad, text);
- if (item == NULL) {
- RESULT(NO_ITEM);
- break;
- }
- RESULT(OK);
- for (list = item->list; list != NULL; list = list->next)
- if (*list->value)
- SENDTEXT(list->value);
- SENDTEXT("");
- break;
-
- case PAD_SET_ITEM:
- RECTEXT(name, name_size); /* item name */
- RECTEXT(text, text_size); /* item value */
- if (curpad == NULL) {
- RESULT(NO_CUR_PAD);
- break;
- }
- delete_item(curpad, name);
- if (append_item(curpad, name, text, 0))
- RESULT(OK);
- else
- RESULT(NO_MEMORY);
- break;
-
- case PAD_APPEND_ITEM:
- RECTEXT(name, name_size); /* item name */
- RECTEXT(text, text_size); /* item value */
- REC(&index, sizeof index); /* replace flag */
- if (curpad == NULL) {
- RESULT(NO_CUR_PAD);
- break;
- }
- if (append_item(curpad, name, text, index))
- RESULT(OK);
- else
- RESULT(NO_MEMORY);
- break;
-
- case PAD_DELETE_ITEM:
- RECTEXT(text, text_size); /* item name */
- if (curpad == NULL) {
- RESULT(NO_CUR_PAD);
- break;
- }
- delete_item(curpad, text);
- RESULT(OK);
- break;
-
- case PAD_LIST_ITEMS:
- if (curpad == NULL) {
- RESULT(NO_CUR_PAD);
- break;
- }
- RESULT(OK);
- for (item = curpad->items; item != NULL; item = item->next)
- if (*item->name)
- SENDTEXT(item->name);
- SENDTEXT("");
- break;
-
- default:
- G_warning(_("Unknown command: %d last: %d"), c, lc);
- break;
- }
- lc = c;
-
- return ateof;
-}
-
-static int read1(char *c)
-{
- if (atbuf == n_read) {
- atbuf = 0;
- n_read = read(_rfd, inbuf, sizeof inbuf);
- if (n_read < 0)
- perror("Monitor: read1: Error reading input");
- if (n_read <= 0)
- return 1; /* EOF */
- }
- *c = inbuf[atbuf++];
- return 0;
-}
-
-int get_command(char *c)
-{
- /* is there a command char pending? */
- if ((*c = current_command)) {
- current_command = 0;
- return 0;
- }
-
- /*
- * look for 1 (or more) COMMAND_ESC chars
- * followed by a non-zero comamnd token char
- */
- while (read1(c) == 0) { /* while !EOF */
- if (*c != COMMAND_ESC)
- continue;
- while (*c == COMMAND_ESC)
- if (read1(c) != 0) {
- G_warning(_("Monitor: get_command: Premature EOF"));
- return 1; /* EOF */
- }
- if (*c)
- return 0; /* got the command token */
- }
- return 1; /* EOF */
-}
-
-static int get1(char *c)
-{
- if (read1(c) != 0)
- return 1; /* EOF */
- if (*c != COMMAND_ESC)
- return 0; /* OK */
- if (read1(c) != 0)
- return 1; /* EOF */
- if (*c) {
- current_command = *c;
- return -1; /* Got command within data */
- }
- *c = COMMAND_ESC; /* sequence COMMAND_ESC,0 becomes data COMMAND_ESC */
- return 0; /* OK */
-}
-
-static int rec(void *buf, int n)
-{
- char *cbuf = buf;
- int stat;
-
- while (n-- > 0) {
- if ((stat = get1(cbuf++)) != 0)
- return stat; /* EOF or COMMAND_ESC */
- }
- return 0;
-}
-
-static int rectext(char **buff_p, int *size_p)
-{
- char *buff = *buff_p;
- int size = *size_p;
- int i, stat;
-
- for (i = 0;; i++) {
- char c;
-
- stat = get1(&c);
- if (stat != 0)
- return stat; /* EOF or COMMAND_ESC */
-
- if (i >= size) {
- *size_p = size = size ? size * 2 : 1000;
- *buff_p = buff = G_realloc(buff, size);
- }
-
- buff[i] = c;
-
- if (!c)
- return 0;
- }
-}
-
-static int _send(const void *buf, int n)
-{
- int r = write(_wfd, buf, n);
-
- if (r < 0) {
- perror("Monitor: _send: write");
- return 1;
- }
- if (r < n) {
- G_warning("Monitor: _send: write returned short count: %d of %d",
- r, n);
- return 1;
- }
- return 0;
-}
-
-static int sendtext(const char *s)
-{
- SEND(s, strlen(s) + 1);
- return 0;
-}
-
-static int RESULT(int n)
-{
- unsigned char c;
-
- c = n;
- SEND(&c, 1);
-
- return 0;
-}
Deleted: grass/trunk/lib/driver/connect_sock.c
===================================================================
--- grass/trunk/lib/driver/connect_sock.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/connect_sock.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,93 +0,0 @@
-
-#include <grass/config.h>
-
-#ifdef HAVE_SOCKET
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include <grass/gis.h>
-#include "driverlib.h"
-
-int prepare_connection_sock(const char *me)
-{
- const char *connpath;
- int fd;
-
- connpath = G_sock_get_fname(me);
- if (!connpath)
- G_fatal_error("Couldn't get socket path");
-
- /* Now we must check and see whether or not someone */
- /* (possibly another invocation of ourself) is using our socket. */
-
- if (G_sock_exists(connpath)) {
- if ((fd = G_sock_connect(connpath)) >= 0) {
- close(fd);
- G_warning("Graphics driver [%s] is already running", me);
- G_fatal_error("Unable to start monitor <%s>", me);
- }
-
- if (unlink(connpath) < 0) {
- G_warning("Failed to remove stale socket file: %s", connpath);
- G_fatal_error("Unable to start monitor <%s>", me);
- }
- }
-
- /* We are free to run now. No one is using our socket. */
- if ((fd = G_sock_bind(connpath)) < 0) {
- G_fatal_error("Can't bind to socket: error \"%s\"\n",
- strerror(errno));
- }
-
- /* Now set up listen */
- if (G_sock_listen(fd, 1) != 0) {
- G_fatal_error("G_sock_listen: error \"%s\"\n", strerror(errno));
- }
-
- return fd;
-}
-
-int get_connection_sock(int listenfd, int *rfd, int *wfd, int other_fd)
-{
- int fd;
-
-#ifndef __MINGW32__
- if (other_fd >= 0) {
- fd_set waitset;
-
- FD_ZERO(&waitset);
- FD_SET(listenfd, &waitset);
- FD_SET(other_fd, &waitset);
- if (select(FD_SETSIZE, &waitset, NULL, NULL, NULL) < 0) {
- perror("get_connection_sock: select");
- exit(EXIT_FAILURE);
- }
-
- if (!FD_ISSET(listenfd, &waitset))
- return -1;
- }
-#endif
-
- /* G_sock_accept will block until a connection is requested */
- fd = G_sock_accept(listenfd);
- if (fd >= 0) {
- *rfd = fd;
- *wfd = dup(fd);
- return 0;
- }
-
- if (errno == EINTR)
- return -1;
-
- G_warning("G_sock_accept: error \"%s\"", strerror(errno));
- COM_Graph_close();
- exit(EXIT_FAILURE);
-}
-
-#endif /* HAVE_SOCKET */
Modified: grass/trunk/lib/driver/driver.h
===================================================================
--- grass/trunk/lib/driver/driver.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/driver.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -29,15 +29,9 @@
void (*Client_Open) (void);
void (*Client_Close) (void);
void (*Erase) (void);
- int (*Get_with_box) (int, int, int *, int *, int *);
- int (*Get_with_line) (int, int, int *, int *, int *);
- int (*Get_with_pointer) (int *, int *, int *);
int (*Graph_set) (int, char **);
void (*Graph_close) (void);
void (*Line_width) (int);
- void (*Panel_save) (const char *, int, int, int, int);
- void (*Panel_restore) (const char *);
- void (*Panel_delete) (const char *);
void (*Polydots_abs) (const int *, const int *, int);
void (*Polydots_rel) (const int *, const int *, int);
void (*Polyline_abs) (const int *, const int *, int);
@@ -52,8 +46,6 @@
const unsigned char *, const unsigned char *);
void (*End_scaled_raster) (void);
void (*Respond) (void);
- int (*Work_stream) (void);
- void (*Do_work) (int);
int (*lookup_color) (int, int, int);
void (*color) (int);
@@ -65,15 +57,9 @@
/* Library Functions */
-/* command.c */
-extern int LIB_command_get_input(void);
-
/* init.c */
extern int LIB_init(const struct driver *drv, int argc, char **argv);
-/* main.c */
-extern int LIB_main(int argc, char **argv);
-
/* Commands */
/* Bitmap.c */
@@ -104,11 +90,6 @@
extern void COM_Font_list(char ***, int *);
extern void COM_Font_info(char ***, int *);
-/* Get_location.c */
-extern int COM_Get_location_with_box(int, int, int *, int *, int *);
-extern int COM_Get_location_with_line(int, int, int *, int *, int *);
-extern int COM_Get_location_with_pointer(int *, int *, int *);
-
/* Get_t_box.c */
extern void COM_Get_text_box(const char *, int *, int *, int *, int *);
@@ -123,11 +104,6 @@
extern void COM_Move_abs(int, int);
extern void COM_Move_rel(int, int);
-/* Panel.c */
-extern void COM_Panel_save(const char *, int, int, int, int);
-extern void COM_Panel_restore(const char *);
-extern void COM_Panel_delete(const char *);
-
/* Polydots.c */
extern void COM_Polydots_abs(const int *, const int *, int);
extern void COM_Polydots_rel(const int *, const int *, int);
@@ -167,11 +143,6 @@
extern void COM_Text_size(int, int);
extern void COM_Text_rotation(double);
-/* Work.c */
-extern int COM_Has_work(void);
-extern int COM_Work_stream(void);
-extern void COM_Do_work(int);
-
/* Driver Operations */
/* Color.c */
Modified: grass/trunk/lib/driver/driverlib.h
===================================================================
--- grass/trunk/lib/driver/driverlib.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/driverlib.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -34,15 +34,6 @@
const char *font_get_charset(void);
int font_get_index(void);
-/* connect_sock.c */
-int get_connection_sock(int, int *, int *, int);
-int prepare_connection_sock(const char *);
-
-/* command.c */
-void command_init(int, int);
-int get_command(char *);
-int process_command(int);
-
/* parse_ftcap.c */
extern int font_exists(const char *name);
extern struct GFONT_CAP *parse_freetypecap(void);
Modified: grass/trunk/lib/driver/init.c
===================================================================
--- grass/trunk/lib/driver/init.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/init.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -21,7 +21,6 @@
#include <grass/freetypecap.h>
#include "driverlib.h"
#include "driver.h"
-#include "pad.h"
const struct driver *driver;
@@ -41,8 +40,6 @@
double text_size_y;
double text_rotation;
-int mouse_button[3] = { 1, 2, 3 };
-
int LIB_init(const struct driver *drv, int argc, char **argv)
{
const char *p;
@@ -60,25 +57,8 @@
screen_top = 0;
screen_bottom = (p && atoi(p)) ? atoi(p) : DEF_HEIGHT;
- /* read mouse button setting */
- if ((p = getenv("GRASS_MOUSE_BUTTON"))) {
- int i;
-
- for (i = 0; i < 3 && p[i]; i++) {
- if (p[i] < '1' || p[i] > '3')
- break;
- }
- if (i == 3 && p[0] != p[1] && p[1] != p[2] && p[0] != p[2]) {
- for (i = 0; i < 3; i++)
- mouse_button[i] = p[i] - '0';
- }
- }
-
if (COM_Graph_set(argc, argv) < 0)
exit(1);
- /* initialize the pads */
- create_pad(""); /* scratch pad */
-
return 0;
}
Deleted: grass/trunk/lib/driver/main.c
===================================================================
--- grass/trunk/lib/driver/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,157 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE: driver
- * AUTHOR(S): Glynn Clements <glynn gclements.plus.com>(original contributor)
- * Jachym Cepicky <jachym les-ejk.cz>
- * PURPOSE: graphics monitor driver
- * COPYRIGHT: (C) 2006-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.
- *
- *****************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <unistd.h>
-
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "driverlib.h"
-#include "driver.h"
-#include "pad.h"
-
-static jmp_buf save;
-
-static RETSIGTYPE handle_sigpipe(int sig)
-{
- longjmp(save, 1);
-}
-
-static RETSIGTYPE handle_sigterm(int sig)
-{
- COM_Graph_close();
-}
-
-int LIB_main(int argc, char **argv)
-{
- char *me;
- int _wfd;
- int _rfd;
- int eof;
-
- char c;
- pid_t pid;
- int foreground;
- int listenfd;
-
-#ifndef __MINGW32__
- struct sigaction sigact;
-#endif
-
- /* The calling syntax is as follows:
- monitor_name [-] ["input_fifo output_fifo"]
-
- The "-", if present, causes the monitor to run in foreground.
- Otherwise, once it has been determined that the monitor is not
- already running, we will fork and the parent will exit, so that
- the monitor is left running in background.
- */
-
- if (argc < 2) {
- G_warning("Usage: %s <name> [-]", argv[0]);
- return 1;
- }
-
- /* whoami */
- me = argv[1];
-
- foreground = (argc >= 3 && argv[2][0] == '-');
-
-#ifndef __MINGW32__
-#ifdef SIGPIPE
- sigact.sa_handler = handle_sigpipe;
- sigemptyset(&sigact.sa_mask);
- sigact.sa_flags = 0;
- sigaction(SIGPIPE, &sigact, NULL);
-#endif
- sigact.sa_handler = handle_sigterm;
- sigemptyset(&sigact.sa_mask);
- sigact.sa_flags = 0;
- sigaction(SIGTERM, &sigact, NULL);
-#endif
-
- listenfd = prepare_connection_sock(me);
-
- G_message(_("Graphics driver [%s] started"), me);
-
-#ifndef __MINGW32__
- if (!foreground) {
- pid = fork();
- if (pid) {
- if (pid > 0) { /* parent exits */
- exit(0);
- }
- else { /* weren't able to fork */
-
- G_fatal_error("Error - Could not fork to start [%s]", me);
- exit(EXIT_FAILURE);
- }
- }
- else {
- /* change process groups to be shielded from keyboard signals */
-#ifdef SETPGRP_VOID
- setpgrp();
-#else
- setpgrp(0, getpid());
-#endif
- }
- } /* monitor runs */
-#endif
-
- while (1) { /* re-open upon EOF */
- for (;;) {
- if (get_connection_sock(listenfd, &_rfd, &_wfd, COM_Work_stream())
- >= 0)
- break;
-
- COM_Do_work(0);
- }
-
- command_init(_rfd, _wfd);
-
- COM_Client_Open();
-
- eof = 0;
-
- while (eof <= 0) {
- COM_Do_work(1);
-
- if (setjmp(save)) {
- G_warning("Monitor <%s>: Caught SIGPIPE", me);
- break;
- }
-
- if (get_command(&c) != 0)
- break;
-
- if (process_command(c)) {
- G_warning("Monitor <%s>: Premature EOF", me);
- break;
- }
- }
-
- /* read encountered EOF. close socket now */
- close(_wfd);
- close(_rfd);
- _rfd = _wfd = -1; /* Set to invalid file descriptor number */
-
- COM_Client_Close();
- }
-
- return 0;
-}
Deleted: grass/trunk/lib/driver/pad.c
===================================================================
--- grass/trunk/lib/driver/pad.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/pad.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,226 +0,0 @@
-
-/* required for NULL */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include "pad.h"
-
-static PAD *padlist;
-
-static int free_item(ITEM * item)
-{
- LIST *list, *next;
-
- if (item->name != NULL)
- G_free(item->name);
- for (list = item->list; list != NULL; list = next) {
- next = list->next;
- if (list->value)
- G_free(list->value);
- G_free(list);
- }
- G_free(item);
-
- return 0;
-}
-
-static ITEM *new_item(PAD * pad, const char *name)
-{
- ITEM *item;
-
- item = (ITEM *) G_malloc((size_t) sizeof(ITEM));
- if (item == NULL)
- return (ITEM *) NULL;
-
- item->name = G_store(name);
- if (item->name == NULL) {
- G_free(item);
- return (ITEM *) NULL;
- }
- item->list = NULL;
- item->next = pad->items;
- if (item->next != NULL)
- item->next->prev = item;
- item->prev = NULL;
- pad->items = item;
-
- return item;
-}
-
-static int remove_value(ITEM * item, const char *value)
-{
- LIST **p = &item->list;
- LIST *l = *p;
-
- for (l = *p; l; l = *p) {
- if (value && l->value && !strcmp(value, l->value)) {
- *p = l->next;
- if (l->value)
- G_free(l->value);
- G_free(l);
- }
- else
- p = &l->next;
- }
-
- return 0;
-}
-
-int append_item(PAD * pad, const char *name, const char *value, int replace)
-{
- ITEM *item;
- LIST *cur, *prev;
- LIST *list;
-
- if (pad == NULL)
- return 0;
-
- /* allocate a list struct and put value into it */
- list = (LIST *) G_malloc((size_t) sizeof(LIST));
- if (list == NULL)
- return 0;
- list->next = NULL;
- list->value = G_store(value);
- if (list->value == NULL) {
- G_free(list);
- return 0;
- }
- /* find the named item for the current pad */
- item = find_item(pad, name);
- if (item == NULL)
- item = new_item(pad, name);
- if (item == NULL)
- return 0;
-
- /* remove any existing occurences of the value */
- if (replace)
- remove_value(item, value);
-
- /* add the LIST at the end of the item LIST */
- prev = NULL;
- for (cur = item->list; cur != NULL; cur = cur->next)
- prev = cur;
-
- if (prev == NULL)
- item->list = list;
- else
- prev->next = list;
-
- return 1;
-}
-
-int delete_item(PAD * pad, const char *name)
-{
- ITEM *item;
-
- item = find_item(pad, name);
- if (item == NULL)
- return 0;
-
- if (item->prev == NULL)
- pad->items = item->next;
- else
- item->prev->next = item->next;
-
- if (item->next != NULL)
- item->next->prev = item->prev;
-
- /* free the item */
- free_item(item);
-
- return 1;
-}
-
-ITEM *find_item(PAD * pad, const char *name)
-{
- ITEM *item;
-
- if (pad != NULL)
- for (item = pad->items; item != NULL; item = item->next)
- if (strcmp(name, item->name) == 0)
- return item;
- return (ITEM *) NULL;
-}
-
-PAD *pad_list(void)
-{
- return padlist;
-}
-
-static int delink_pad(PAD * pad)
-{
- if (pad == NULL)
- return 1;
-
- if (pad->prev == NULL)
- padlist = pad->next;
- else
- pad->prev->next = pad->next;
-
- if (pad->next != NULL)
- pad->next->prev = pad->prev;
-
- return 0;
-}
-
-int create_pad(const char *name)
-{
- PAD *pad;
-
- pad = (PAD *) G_malloc((size_t) sizeof(PAD));
- if (pad == NULL)
- return 0;
- pad->name = G_store(name);
- if (pad->name == NULL) {
- G_free(pad);
- return 0;
- }
- pad->items = NULL;
- pad->next = padlist;
- if (pad->next != NULL)
- pad->next->prev = pad;
- pad->prev = NULL;
- padlist = pad;
- return 1;
-}
-
-int delete_pad(PAD * pad)
-{
- ITEM *item, *next;
-
- if (pad == NULL)
- return 0;
-
- delink_pad(pad);
-
- /* free the items */
- for (item = pad->items; item != NULL; item = next) {
- next = item->next;
- free_item(item);
- }
- G_free(pad);
-
- return 1;
-}
-
-PAD *find_pad(const char *name)
-{
- PAD *pad;
-
- for (pad = padlist; pad != NULL; pad = pad->next)
- if (strcmp(name, pad->name) == 0)
- return pad;
- return (PAD *) NULL;
-}
-
-int invent_pad(char *name)
-{
- static int i = 0;
-
- do
- sprintf(name, "%d", ++i);
- while (find_pad(name) != NULL);
-
- return 0;
-}
Deleted: grass/trunk/lib/driver/pad.h
===================================================================
--- grass/trunk/lib/driver/pad.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/driver/pad.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,34 +0,0 @@
-
-#ifndef _PAD_H_
-#define _PAD_H_
-
-typedef struct _list
-{
- char *value;
- struct _list *next;
-} LIST;
-
-typedef struct _item_
-{
- char *name;
- LIST *list;
- struct _item_ *next, *prev;
-} ITEM;
-
-typedef struct _pad_
-{
- char *name;
- ITEM *items;
- struct _pad_ *next, *prev;
-} PAD;
-
-PAD *pad_list(void);
-PAD *find_pad(const char *);
-int delete_pad(PAD *);
-int create_pad(const char *);
-int append_item(PAD *, const char *, const char *, int);
-int invent_pad(char *);
-int delete_item(PAD *, const char *);
-ITEM *find_item(PAD *, const char *);
-
-#endif /* _PAD_H_ */
Property changes on: grass/trunk/lib/htmldriver
___________________________________________________________________
Name: svn:ignore
+ *.tmp.html
*OBJ*
Added: grass/trunk/lib/htmldriver/Driver.c
===================================================================
--- grass/trunk/lib/htmldriver/Driver.c (rev 0)
+++ grass/trunk/lib/htmldriver/Driver.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,57 @@
+
+/****************************************************************************
+ *
+ * MODULE: HTMLMAP
+ * AUTHOR(S): Glynn Clements <glynn gclements.plus.com> (original contributor)
+ *
+ * PURPOSE: driver to allow HTML image maps
+ * COPYRIGHT: (C) 2007-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.
+ *
+ *****************************************************************************/
+
+#include <stdio.h>
+#include "driver.h"
+#include "htmlmap.h"
+
+const struct driver *HTML_Driver(void)
+{
+ static struct driver drv;
+ static int initialized;
+
+ if (initialized)
+ return &drv;
+
+ drv.Box_abs = NULL;
+ drv.Box_rel = NULL;
+ drv.Client_Open = NULL;
+ drv.Client_Close = NULL;
+ drv.Erase = NULL;
+ drv.Graph_set = HTML_Graph_set;
+ drv.Graph_close = HTML_Graph_close;
+ drv.Line_width = NULL;
+ drv.Polydots_abs = NULL;
+ drv.Polydots_rel = NULL;
+ drv.Polyline_abs = NULL;
+ drv.Polyline_rel = NULL;
+ drv.Polygon_abs = HTML_Polygon_abs;
+ drv.Polygon_rel = NULL;
+ drv.Set_window = NULL;
+ drv.Begin_scaled_raster = NULL;
+ drv.Scaled_raster = NULL;
+ drv.End_scaled_raster = NULL;
+ drv.Respond = NULL;
+ drv.lookup_color = NULL;
+ drv.color = NULL;
+ drv.draw_line = NULL;
+ drv.draw_point = NULL;
+ drv.draw_bitmap = NULL;
+ drv.draw_text = HTML_Text;
+
+ initialized = 1;
+
+ return &drv;
+}
Added: grass/trunk/lib/htmldriver/Graph_Clse.c
===================================================================
--- grass/trunk/lib/htmldriver/Graph_Clse.c (rev 0)
+++ grass/trunk/lib/htmldriver/Graph_Clse.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,166 @@
+/*
+ * Close down the graphics processing. This gets called only at driver
+ * termination time.
+ */
+
+
+#include <grass/gis.h>
+#include "driverlib.h"
+#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 */
+
+static int pnpoly(int npol, int *xp, int *yp, int x, int y)
+{
+ int i, j, c = 0;
+
+ for (i = 0, j = npol - 1; i < npol; j = i++) {
+ if ((((yp[i] <= y) && (y < yp[j])) ||
+ ((yp[j] <= y) && (y < yp[i]))) &&
+ (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i]))
+ c = !c;
+ }
+ return c;
+}
+
+
+
+void HTML_Graph_close(void)
+{
+ struct MapPoly *poly, *test_poly;
+
+ int i;
+ int inside;
+
+ /*
+ * exmaine the list of polygons, if a polygon wholly exists inside of
+ * another polygon, then remove it.
+ *
+ */
+
+ for (poly = head; poly != NULL; poly = poly->next_poly) {
+
+ for (test_poly = head; test_poly != NULL;
+ test_poly = test_poly->next_poly) {
+ if (poly == test_poly) {
+ continue; /* don't check ourselves */
+ }
+
+ inside = 1;
+ for (i = 0; i < poly->num_pts && inside; i++) {
+ inside = pnpoly(test_poly->num_pts,
+ test_poly->x_pts, test_poly->y_pts,
+ poly->x_pts[i], poly->y_pts[i]);
+ }
+ if (inside) {
+ poly->num_pts = 0; /* mark polygon as having no points */
+ break;
+ }
+ }
+
+ }
+
+
+ /*
+ * write any beginning prologue appropriate for the map type
+ */
+
+ switch (html_type) {
+
+ case APACHE:
+ fprintf(output, "#base _base_\n#default _default_\n");
+ break;
+
+ case RAW:
+ break;
+
+ case CLIENT:
+ fprintf(output, "<MAP NAME=\"map\">\n");
+ break;
+ }
+
+ /*
+ * write the polygons in a specific format
+ */
+
+ for (poly = head; poly != NULL; poly = poly->next_poly) {
+ if (poly->num_pts >= 3) {
+
+ switch (html_type) {
+
+ case APACHE:
+ fprintf(output, "poly %s", poly->url);
+ for (i = 0; i < poly->num_pts; i++) {
+ fprintf(output, " %d,%d", poly->x_pts[i], poly->y_pts[i]);
+ }
+ fprintf(output, " %d,%d", poly->x_pts[0], poly->y_pts[0]);
+ fprintf(output, "\n");
+ break;
+
+ case RAW:
+ fprintf(output, "%s", poly->url);
+ for (i = 0; i < poly->num_pts; i++) {
+ fprintf(output, " %d %d", poly->x_pts[i], poly->y_pts[i]);
+ }
+ fprintf(output, " %d %d", poly->x_pts[0], poly->y_pts[0]);
+ fprintf(output, "\n");
+ break;
+
+ case CLIENT:
+ fprintf(output,
+ "<AREA SHAPE=\"POLY\"\n HREF=\"%s\"\n ALT=\"%s\"\n COORDS=\"",
+ poly->url, poly->url);
+ for (i = 0; i < poly->num_pts; i++) {
+ if (i > 0)
+ fprintf(output, ", ");
+ /*
+ * don't add newlines, which confuses the weak-minded
+ * i.e., ms internet exploder :-(
+ * was: if (i % 8 == 0 && i != 0) fprintf(output,"\n ");
+ */
+ fprintf(output, "%d,%d", poly->x_pts[i], poly->y_pts[i]);
+ }
+ fprintf(output, ", %d,%d", poly->x_pts[0], poly->y_pts[0]);
+ fprintf(output, "\">\n");
+ break;
+
+ }
+
+ }
+
+ }
+
+ /* final stuff, if needed */
+
+ switch (html_type) {
+
+ case APACHE:
+ break;
+
+ case RAW:
+ break;
+
+ case CLIENT:
+ fprintf(output,
+ "<AREA SHAPE=\"RECT\" NOHREF COORDS=\"%d,%d %d,%d\">\n",
+ screen_left, screen_top, screen_right, screen_bottom);
+ fprintf(output, "</MAP>\n");
+ break;
+
+ }
+
+ /*
+ * close file
+ */
+
+ fclose(output);
+}
Added: grass/trunk/lib/htmldriver/Graph_Set.c
===================================================================
--- grass/trunk/lib/htmldriver/Graph_Set.c (rev 0)
+++ grass/trunk/lib/htmldriver/Graph_Set.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,146 @@
+/*
+ * Start up graphics processing. Anything that needs to be assigned, set up,
+ * started-up, or otherwise initialized happens here. This is called only at
+ * the startup of the graphics driver.
+ *
+ * The external variables define the pixle limits of the graphics surface. The
+ * coordinate system used by the applications programs has the (0,0) origin
+ * in the upper left-hand corner. Hence,
+ * screen_left < screen_right
+ * screen_top < screen_bottom
+ *
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <grass/gis.h>
+#include "driverlib.h"
+#include "driver.h"
+#include "htmlmap.h"
+
+char *last_text;
+int last_text_len;
+char *file_name;
+int html_type;
+FILE *output;
+
+struct MapPoly *head;
+struct MapPoly **tail;
+
+int BBOX_MINIMUM;
+int MAX_POINTS;
+int MINIMUM_DIST;
+
+int HTML_Graph_set(int argc, char **argv)
+{
+ char *p;
+
+ G_gisinit("HTMLMAP driver");
+
+ NCOLORS = 256;
+
+ /*
+ * set the minimum bounding box dimensions
+ */
+
+ if (NULL != (p = getenv("GRASS_HTMLMINBBOX"))) {
+ BBOX_MINIMUM = atoi(p);
+ if (BBOX_MINIMUM <= 0) {
+ BBOX_MINIMUM = DEF_MINBBOX;
+ }
+ }
+ else {
+ BBOX_MINIMUM = DEF_MINBBOX;
+ }
+
+ /*
+ * set the maximum number of points
+ */
+
+ if (NULL != (p = getenv("GRASS_HTMLMAXPOINTS"))) {
+ MAX_POINTS = atoi(p);
+ if (MAX_POINTS <= 0) {
+ MAX_POINTS = DEF_MAXPTS;
+ }
+ }
+ else {
+ MAX_POINTS = DEF_MAXPTS;
+ }
+
+ /*
+ * set the minimum difference to keep a point
+ */
+
+ if (NULL != (p = getenv("GRASS_HTMLMINDIST"))) {
+ MINIMUM_DIST = atoi(p);
+ if (MINIMUM_DIST <= 0) {
+ MINIMUM_DIST = DEF_MINDIST;
+ }
+ }
+ else {
+ MINIMUM_DIST = DEF_MINDIST;
+ }
+
+
+ /*
+ * open the output file
+ */
+
+ if (NULL != (p = getenv("GRASS_HTMLFILE"))) {
+ if (strlen(p) == 0) {
+ p = FILE_NAME;
+ }
+ }
+ else {
+ p = FILE_NAME;
+ }
+ file_name = p;
+
+ output = fopen(file_name, "w");
+ if (output == NULL) {
+ G_fatal_error("HTMLMAP: couldn't open output file %s", file_name);
+ exit(EXIT_FAILURE);
+ }
+
+
+ G_message("HTMLMAP: collecting to file: %s\n width = %d, height = %d, ",
+ file_name, screen_right, screen_bottom);
+
+ /*
+ * check type of map wanted
+ */
+
+ if (NULL == (p = getenv("GRASS_HTMLTYPE"))) {
+ p = "CLIENT";
+ }
+
+ if (strcmp(p, "APACHE") == 0) {
+ html_type = APACHE;
+ fprintf(stdout, "type = APACHE\n");
+
+ }
+ else if (strcmp(p, "RAW") == 0) {
+ html_type = RAW;
+ fprintf(stdout, "type = RAW\n");
+
+ }
+ else {
+ html_type = CLIENT;
+ fprintf(stdout, "type = CLIENT\n");
+ }
+
+
+ /*
+ * initialize text memory and list pointers
+ */
+
+ last_text = (char *)G_malloc(INITIAL_TEXT + 1);
+ last_text[0] = '\0';
+ last_text_len = INITIAL_TEXT;
+
+ head = NULL;
+ tail = &head;
+
+ return 0;
+}
Added: grass/trunk/lib/htmldriver/Makefile
===================================================================
--- grass/trunk/lib/htmldriver/Makefile (rev 0)
+++ grass/trunk/lib/htmldriver/Makefile 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../..
+
+include $(MODULE_TOPDIR)/include/Make/Platform.make
+
+PACKAGE ="libhtmldriver"
+DEFS=-DPACKAGE=\"$(PACKAGE)\"
+EXTRA_CFLAGS=-I../driver $(PICFLAGS) $(DEFS)
+
+EXTRA_LIBS=$(DRIVERLIB) $(GISLIB)
+LIB_NAME = $(HTMLDRIVER_LIBNAME)
+
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+
+default: lib
Added: grass/trunk/lib/htmldriver/Polygn_abs.c
===================================================================
--- grass/trunk/lib/htmldriver/Polygn_abs.c (rev 0)
+++ grass/trunk/lib/htmldriver/Polygn_abs.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,211 @@
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <grass/gis.h>
+#include "driverlib.h"
+#include "htmlmap.h"
+
+#define RAD_DEG 57.29578
+
+/* max points & bbox minimum dimension defined in Graph_Set.c */
+extern int MAX_POINTS;
+extern int BBOX_MINIMUM;
+extern int MINIMUM_DIST;
+
+
+static void delete_point(int *x, int *y, int count)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ x[i] = x[i + 1];
+ y[i] = y[i + 1];
+ }
+
+
+}
+
+static double find_azimuth(double x1, double y1, double x2, double y2)
+{
+ double xx, yy;
+
+ xx = x1 - x2;
+ yy = y1 - y2;
+
+ if (x1 == x2) {
+ return (y2 > y1) ? 90.0 : 270.0;
+ }
+ else {
+ if (y2 < y1) {
+ if (x2 > x1) {
+ return 360.0 + (RAD_DEG * atan(yy / xx));
+ }
+ else {
+ return 180.0 + (RAD_DEG * atan(yy / xx));
+ }
+ }
+ else {
+ if (x2 > x1) {
+ return (RAD_DEG * atan(yy / xx));
+ }
+ else {
+ return 180.0 + (RAD_DEG * atan(yy / xx));
+ }
+ }
+ }
+}
+
+
+void HTML_Polygon_abs(const int *px, const int *py, int n)
+{
+ struct MapPoly *new;
+ int i;
+ int delta_x, delta_y;
+ int min_x, max_x, min_y, max_y;
+
+ double min_azimuth = 1.0;
+ double azimuth1, azimuth2, diff1, diff2;
+ 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));
+
+ /*
+ * remove points that have adjacent duplicates or have differences of
+ * less the the minimum allowed. remove end points that are same as
+ * the begin point (ending point = starting point is added
+ * during Graph_Clse)
+ */
+
+ i = 0;
+ while (i < (n - 1)) {
+ delta_x = x[i] - x[i + 1];
+ if (delta_x < 0)
+ delta_x = -delta_x;
+ delta_y = y[i] - y[i + 1];
+ if (delta_y < 0)
+ delta_y = -delta_y;
+
+ if ((x[i] == x[i + 1] && y[i] == y[i + 1]) ||
+ (delta_x <= MINIMUM_DIST && delta_y <= MINIMUM_DIST)) {
+ delete_point(&x[i + 1], &y[i + 1], n - i - 1);
+ --n;
+ }
+ else {
+ ++i;
+ }
+ }
+
+ /* perform same checks for last point & first point */
+ while (1) {
+ delta_x = x[0] - x[n - 1];
+ if (delta_x < 0)
+ delta_x = -delta_x;
+ delta_y = y[0] - y[n - 1];
+ if (delta_y < 0)
+ delta_y = -delta_y;
+
+ if ((x[0] == x[n - 1] && y[0] == y[n - 1]) ||
+ (delta_x <= MINIMUM_DIST && delta_y <= MINIMUM_DIST)) {
+ --n;
+ }
+ else {
+ break;
+ }
+ }
+
+
+
+ /*
+ * if a polygon has either x or y extents less than the bounding box
+ * minimum, ignore it
+ *
+ */
+
+ min_x = max_x = x[0];
+ min_y = max_y = y[0];
+ for (i = 0; i < n; i++) {
+ if (x[i] < min_x)
+ min_x = x[i];
+ if (x[i] > max_x)
+ max_x = x[i];
+ if (y[i] < min_y)
+ min_y = y[i];
+ if (y[i] > max_y)
+ max_y = y[i];
+ }
+ delta_x = max_x - min_x;
+ delta_y = max_y - min_y;
+ if (delta_x < BBOX_MINIMUM || delta_y < BBOX_MINIMUM) {
+ n = 0;
+ }
+
+
+ /*
+ * remove points in excess of MAX_POINTS vertices
+ */
+
+ while (n > MAX_POINTS) {
+
+ for (i = 0; i < (n - 2); i++) {
+
+ /*
+ * see if middle point can be removed, by checking if the
+ * relative bearing to the middle is less than our current tolerance
+ */
+
+ azimuth1 = find_azimuth((double)x[i], (double)y[i],
+ (double)x[i + 1], (double)y[i + 1]);
+ azimuth2 = find_azimuth((double)x[i], (double)y[i],
+ (double)x[i + 2], (double)y[i + 2]);
+
+ diff1 = fmod(fabs((azimuth2 + 360.0) - azimuth1), 360.0);
+ diff2 = fmod(fabs((azimuth1 + 360.0) - azimuth2), 360.0);
+
+ if (diff1 <= min_azimuth || diff2 <= min_azimuth) {
+
+ delete_point(&x[i + 1], &y[i + 1], n - i - 1);
+ --n;
+ ++i;
+ /* either stop deleting points because we're less than 100,
+ or keep deleting points with the same difference as this
+ one (which might make a smaller polygon yet).
+ if (n <= 100) {
+ break;
+ }
+ */
+ }
+
+ }
+
+ /* increase minimum azimuth difference for next round */
+ min_azimuth += 1.0;
+ }
+
+ /*
+ * copy remaining points into a new MapPoly
+ */
+
+ if (n >= 3) {
+
+ new = (struct MapPoly *)G_malloc(sizeof(struct MapPoly));
+
+ /* grab the last text string written as url */
+ new->url = G_store(last_text);
+
+ /* hook up new MapPoly into list */
+ new->next_poly = NULL;
+ *tail = new;
+ tail = &(new->next_poly);
+
+ new->num_pts = n;
+ new->x_pts = x;
+ new->y_pts = y;
+ }
+ else {
+ G_free(x);
+ G_free(y);
+ }
+}
Added: grass/trunk/lib/htmldriver/README
===================================================================
--- grass/trunk/lib/htmldriver/README (rev 0)
+++ grass/trunk/lib/htmldriver/README 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,172 @@
+ HTMLMAP driver
+
+ Tom Poindexter
+ tpoindex at nyx.net
+
+ This display driver is to allow the generation of HTML image maps for
+area vector data. HTML image maps are used in conjunction with images
+to provide unique URL targets for different portions of an image. The HTMLMAP
+driver can create both client-side image maps embedded into HTML files, or
+server-side image maps used by web server software.
+
+ Note that commands that require the MOUSE will NOT work correctly (or
+at all!)
+
+ Polygons can at most have 100 vertices (this limit imposed by HTML image map
+formats.) The driver will attempt to trim polygons that have more that 100
+vertices (also see GRASS_HTMLMAXPOINTS, below.) Also, any polygon that is
+entirely bounded by another polygon will be discarded.
+
+ Text written to the driver before polygons are used as the HREF tag for
+all subsequent polygons written. It is intended that all polygons
+that exists in a vector file will have the same HREF tag.
+
+ The only GRASS display commands that should be used with this driver are:
+ d.text - pass href information for resulting image maps.
+ d.vect.area - draw polygons from a vector file.
+
+
+ 0. Set environment variables:
+
+ GRASS_WIDTH=xxx #if you want another size than the default 640
+ export GRASS_WIDTH
+ GRASS_HEIGHT=xxx #if you want another size than the default 480
+ export GRASS_WIDTH
+
+ Additionally, HTMLMAP driver recognizes:
+
+ export GRASS_HTMLTYPE
+ GRASS_HTMLTYPE=xxx
+ specifies the type of Html map to create:
+ CLIENT - Netscape client-side image map (default). (NAME="map")
+ APACHE - Apache/NCSA server-side image map
+ RAW - Raw url and polygon vertices ("url x1 y1 x2 y2 .....")
+ suitable for conversion to CERN server format, or
+ any other format with user supplied conversion program.
+
+ export GRASS_HTMLFILE
+ GRASS_HTMLFILE=xxxxxx
+ specifies the resulting file to store the html image map,
+ default is 'htmlmap'. Files without absolute path names are
+ written in the current directory where the driver was started.
+
+ Any existing file is overwritten without warning.
+
+
+ export GRASS_HTMLMINDIST
+ GRASS_HTMLMINDIST=xx
+ specifies the minimum distance (in pixels) that a point must
+ change from the previous one to keep in the list of vertices
+ for a polygon. The default is '2', which means that a point's
+ x or y difference from the previous point must change by a number
+ of pixels greate than this value. This parameters helps
+ to eliminate points closely spaced points.
+
+
+ export GRASS_HTMLMINBBOX
+ GRASS_HTMLMINBBOX=xx
+ specifies the minimum bounding box dimenions (both width and
+ height) in order to store a polygon. The default is '2', which
+ means any polygon having bounding box width or height extent
+ of less than 2 pixels will not be output as a clickable area.
+ This parameter helps to eliminate clickable areas that are one
+ pixel in height or width, typically a single point or line.
+
+
+ export GRASS_HTMLMAXPOINTS
+ GRASS_HTMLMAXPOINTS=xx
+ specifies the maxiumum number of vertices that a polygon can
+ have. The default is 99. Some browser can only handle
+ image map polygons of less that 100 vertices.
+
+
+ 1. Start it up.
+
+ # set the environment variables (above) if desired, or use defaults
+
+ d.mon start=HTMLMAP
+ d.mon select=HTMLMAP
+
+ 2. Display text strings (href's) and area polygons:
+
+ echo "http://www.no-such-place.net/area51/" | d.text
+ d.vect.area map=area51
+ echo "http://www.roswell-nm.net/little/green/men.html" | d.text
+ d.vect.area map=roswell
+
+ 3. When done displaying stuff to HTMLMAP driver, use
+
+ d.mon stop=HTMLMAP
+
+ This will write the image map file file. A new file called 'htmlmap'
+ (or whatever you specified with GRASS_HTMLFILE) will be created
+ in your current directory.
+
+ 4. In practice, you'll want to create gif/jpg/png images that correspond
+ with your newly created image map:
+
+ # using previous GRASS_WIDTH & GRASS_HEIGHT
+ d.mon start=CELL
+ d.mon select=CELL
+ d.rast map=terrain
+ d.vect.area map=area51 fillcolor=white linecolor=blue
+ d.vect.area map=roswell fillcolor=yellow linecolor=blue
+ d.vect map=states color=green
+ d.vect map=roads color=blue
+ d.mon stop=CELL
+ # make the region the same as the newly created cell for ppm export
+ g.pushregion.sh # or g.region save=saved.reg
+ g.region raster=D_cell
+ r.out.ppm -q input=D_cell output=alien.ppm
+ # use the netpbm utilities to create a gif (quantize if needed)
+ ppmquant 128 <alien.ppm | ppmtogif >alien.gif
+ # assemble some html with the image and the image map
+ echo '<html><body><img src="alien.gif" usemap="#map">' >alien.html
+ cat htmlmap >>alien.html
+ echo '</body></html>' >>alien.html
+ # don't forget to reset your region
+ g.popregion.sh # or g.region region=saved.reg
+ # take a look and test it out
+ netscape file:`pwd`/alien.html &
+
+
+
+ Building the HTMLMAP driver:
+
+ Change to the HTMLMAP directory, and make it:
+
+ cd src/display/devices/HTMLMAP
+ gmake5
+
+ If all goes well, the HTMLMAP driver will be compiled and moved into
+ your device driver directory ($GISBASE/driver) and "etc/monitorcap"
+ will be modified.
+
+
+ Other:
+
+ Don't forget to add the HTMLMAP driver in your monitorcap file!
+ Your monitorcap file exists as $GISBASE/etc/monitorcap.
+
+ HTMLMAP:driver/HTMLMAP:Create HTML Image Map: \
+ /usr/local/grass43/dev/fifo.9a /usr/local/grass43/dev/fifo.9b \
+ ::any terminal
+
+ Note: This job will be done by the Gmakefile.
+
+ HTMLMAP was adapted from the CELL driver in GRASS 4.3. Point-in-
+ polygon-test code was lifted from Randolph Franklin's web page, see
+
+ http://www.ecse.rpi.edu/Homepages/wrf/
+ http://www.ecse.rpi.edu/Homepages/wrf/research/geom/pnpoly.html
+
+
+ If you create an HTML file with two or more images & image maps, you
+ will need to edit the map names. The HTMLMAP driver creates its map
+ with the name 'map'. A small sed script can easily change the map name:
+
+ sed -e 's/NAME="map"/NAME="foomap"/' <htmlmap >foomap.html
+
+
+-----------------------------
+http://www.nyx.net/~tpoindex/grass-stuff/
Added: grass/trunk/lib/htmldriver/Text.c
===================================================================
--- grass/trunk/lib/htmldriver/Text.c (rev 0)
+++ grass/trunk/lib/htmldriver/Text.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,30 @@
+
+/* Text.c - save text string into last_text buffer */
+
+#include <stdlib.h>
+#include <string.h>
+#include <grass/gis.h>
+#include "driverlib.h"
+#include "htmlmap.h"
+
+void HTML_Text(const char *text)
+{
+ int len = strlen(text);
+ const char *s;
+ char *d;
+
+ if (len > last_text_len) {
+ G_free(last_text);
+ last_text = (char *)G_malloc(len + 1);
+ last_text_len = len;
+ }
+
+ /* copy string to last_text area, make sure we don't copy \n */
+ for (d = last_text, s = text; *s != '\0'; s++) {
+ if (*s != '\n') {
+ *d = *s;
+ d++;
+ }
+ }
+ *d = '\0';
+}
Added: grass/trunk/lib/htmldriver/description.html
===================================================================
--- grass/trunk/lib/htmldriver/description.html (rev 0)
+++ grass/trunk/lib/htmldriver/description.html 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,190 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <TITLE>HTMLMAP driver</TITLE>
+ <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+ <link rel="stylesheet" href="grassdocs.css" type="text/css">
+</HEAD>
+<BODY bgColor=white>
+
+<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
+
+<H2>NAME</H2>
+
+<EM><B>HTMLMAP driver</B></EM> - driver to create HTML image maps.
+<BR><EM>(drivers)</EM>
+
+<H2>DESCRIPTION</H2>
+
+The HTMLMAP driver allows the generation of HTML image maps
+for area vector data. HTML image maps are used in conjunction with images to
+provide unique URL targets for different portions of an image. The HTMLMAP
+driver can create both client-side image maps embedded into HTML files, or
+server-side image maps used by web server software.
+<P>
+Note that GRASS display commands that require the MOUSE will not work
+correctly (or at all!)
+<P>
+Polygons can at most have 100 vertices (this limit imposed by HTML image map
+formats, see <B>GRASS_HTMLMAXPOINTS</B> below.) The driver will attempt to
+trim polygons that have more that 100
+vertices by removing vertices with the least amount of angle to the next
+vertice. Also, any polygon that is entirely bounded by another polygon will be
+discarded.
+<P>
+Text written to the driver before polygons are used as the HREF tag for all
+subsequent polygons written. All polygons that exist in a vector map will have
+the same HREF tag.
+<P>
+The only GRASS display commands that should be used with this driver are:
+<UL>
+ <LI><a href="d.text.html">d.text</A>
+ - pass href information for resulting image maps.</LI>
+ <LI><a href="d.vect.html">d.vect</A>
+ - draw polygons from a vector map.</LI>
+</UL>
+
+<H2>USAGE</H2>
+
+<H3>Environment variables</H3>Several environment variables effect the operation
+of HTMLMAP.
+
+<UL>
+ <LI><B>GRASS_WIDTH=xxx</B><BR>the width of the image map (default is
+ 640).
+ </LI><BR>
+ <LI><B>GRASS_HEIGHT=yyy</B><BR>the height of the image map (default is
+ 480).
+ </LI><BR>
+ <LI><B>GRASS_HTMLTYPE=type</B><BR>the type of image mape to create (default is
+ CLIENT):
+ <UL>
+ <DD><TT><B>CLIENT</B></TT> Netscape/IE client-side image map.
+ (NAME="map")<BR>
+ <DD><TT><B>APACHE</B></TT> Apache/NCSA server-side image
+ map.<BR>
+ <DD><TT><B>RAW</B></TT> Raw url
+ and polygon vertices ( <I>url x1 y1 x2 y2
+ ..... </I>), suitable for conversion to CERN server format, or any other
+ format with user supplied conversion program.</DD>
+ </UL>
+ </LI><BR>
+ <LI><B>GRASS_HTMLFILE=filename</B><BR>
+ specifies the resulting file to store
+ the html image map, default is <tt>htmlmap</tt>. Files without absolute path
+ names are written in the current directory where the driver was started.
+ <BR>
+ <em>Any existing file of the same name is overwritten without
+ warning.</em>
+ </LI><BR>
+ <LI><B>GRASS_HTMLMINDIST=n</B><BR>specifies the minimum distance in pixels
+ that a point must change from the previous point to keep in the list of
+ vertices for a polygon. The default is <tt>2</tt>, which means that a
+ point's x and y difference from the previous point must change by a number
+ of pixels greater than this value. This parameter helps to eliminate
+ closely spaced points.
+ </LI><BR>
+ <LI><B>GRASS_HTMLMINBBOX=n</B><BR>specifies the minimum bounding box
+ dimensions to record a polygon as a clickable area.
+ The default is <tt>2</tt>, which means that a polygon with a bounding box
+ of less than this value is not included. This parameter helps to eliminate
+ polygons than are a point or line.
+ </LI><BR>
+ <LI><B>GRASS_HTMLMAXPOINTS=n</B><BR>specifies the maximum number of
+ vertices included in a polygon's clickable area.
+ The default is <tt>99</tt>. Some browsers can only accomodate polygons of
+ 100 vertices or less. The HTMLMAP driver automatically ensures that a
+ polygon is closed by making the last point the same as the first
+ point.</LI><BR>
+</UL>
+
+<H3>Typical usage</H3>
+<UL>
+ <LI>Start up the driver
+<DIV class="code"><PRE>
+d.mon start=HTMLMAP
+</PRE></DIV>
+ </LI>
+ <LI>Display text strings (HREF's) and polygons
+<DIV class="code"><PRE>
+echo "http://www.no-such-place.net/area51/" | d.text
+d.vect map=area51
+echo "http://www.roswell-nm.net/little/green/men.html" | d.text
+d.vect map=roswell
+</PRE></div>
+ <LI>Stop the driver when all polygon have been displayed. This will cause a file
+ named 'htmlmap' to be created in your current directory.
+<DIV class="code"><PRE>
+d.mon stop=HTMLMAP
+</PRE></DIV>
+ <LI>You will also want to create an image for your image map. Use the PNG
+ driver and other utilities to create .gif or .jpg files.
+ <i>The following example is somewhat out of date and refers to options
+ available in GRASS 5.</i>
+<DIV class="code"><PRE>
+# using previous GRASS_WIDTH & GRASS_HEIGHT
+d.mon start=PNG
+d.mon select=PNG
+d.rast map=terrain
+d.vect map=area51 fillcolor=white linecolor=blue
+d.vect map=roswell fillcolor=yellow linecolor=blue
+d.vect map=states color=green
+d.vect map=roads color=black
+d.mon stop=PNG
+<!-- ???? FIXME -->
+# make the region the same as the newly created cell for ppm export
+g.region save=saved.reg
+g.region raster=D_cell
+r.out.ppm -q input=D_cell output=alien.ppm
+
+# use the netpbm utilities to create a gif (quantize if needed)
+ppmquant 128 <alien.ppm | ppmtogif >alien.gif
+
+# assemble some html with the image and the image map
+echo '<html><body><img src="alien.gif" usemap="#map">' >alien.html
+cat htmlmap >>alien.html
+echo '</body></html>' >>alien.html
+
+# don't forget to reset your region
+g.region region=saved.reg
+
+# take a look and test it out
+netscape file:`pwd`/alien.html &
+</PRE></DIV>
+ </LI>
+</UL>
+
+<H2>NOTES</H2>
+
+HTMLMAP was adapted from the CELL driver in GRASS 4.3.
+Point-in-polygon test code was lifted from Randolph Franklin's web page, see
+<UL>
+ <LI><a href="http://www.ecse.rpi.edu/Homepages/wrf/">http://www.ecse.rpi.edu/Homepages/wrf/</A></LI>
+ <LI><a href="http://www.ecse.rpi.edu/Homepages/wrf/research/geom/pnpoly.html">http://www.ecse.rpi.edu/Homepages/wrf/research/geom/pnpoly.html</A></LI>
+</UL>
+
+<P>
+If you create an HTML file with two or more images and image maps, you will
+need to edit the map names. The HTMLMAP driver creates its map with the name
+<tt>map</tt>. A small sed script can easily change the map name:
+
+<PRE>
+ sed -e 's/NAME="map"/NAME="foomap"/' < htmlmap > foomap.html
+</PRE>
+
+<H2>SEE ALSO</H2>
+
+<EM>
+ <a href="displaydrivers.html">Display drivers</a>
+ <br>
+ <a href="pngdriver.html">PNG driver</A>,
+ <a href="psdriver.html">PostScript driver</A>,
+ <a href="xdriver.html">XDRIVER</A>
+ <BR>
+ <A href="d.mon.html">d.mon</A>,
+ <a href="d.text.html">d.text</A>,
+ <a href="d.vect.html">d.vect</A>
+</EM>
+
+<p>
+<i>Last changed: $Date: 2008-03-23 14:34:53 +0000 (Sun, 23 Mar 2008) $</i>
Added: grass/trunk/lib/htmldriver/htmlmap.h
===================================================================
--- grass/trunk/lib/htmldriver/htmlmap.h (rev 0)
+++ grass/trunk/lib/htmldriver/htmlmap.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,48 @@
+
+#include <stdio.h>
+
+#define DEF_MINBBOX 2
+#define DEF_MINDIST 2
+#define DEF_MAXPTS 99
+
+#define FILE_NAME "htmlmap"
+
+#define INITIAL_TEXT 1000
+
+#define APACHE 0 /* write output in apache/ncsa server image map format */
+#define NCSA 0 /* write output in apache/ncsa server image map format */
+#define CLIENT 1 /* write output in netscape client side image map format */
+#define RAW 2 /* write output in raw format */
+
+extern char *last_text;
+extern int last_text_len;
+extern char *file_name;
+extern int html_type;
+extern FILE *output;
+
+struct MapPoly
+{
+ char *url;
+ int num_pts;
+ int *x_pts;
+ int *y_pts;
+ struct MapPoly *next_poly;
+};
+
+extern struct MapPoly *head;
+extern struct MapPoly **tail;
+
+/* Driver.c */
+extern const struct driver *HTML_Driver(void);
+
+/* Graph_Clse.c */
+extern void HTML_Graph_close(void);
+
+/* Graph_Set.c */
+extern int HTML_Graph_set(int, char **);
+
+/* Polygn_abs.c */
+extern void HTML_Polygon_abs(const int *, const int *, int);
+
+/* Text.c */
+extern void HTML_Text(const char *);
Modified: grass/trunk/lib/pngdriver/Driver.c
===================================================================
--- grass/trunk/lib/pngdriver/Driver.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/pngdriver/Driver.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -32,15 +32,9 @@
drv.Client_Open = NULL;
drv.Client_Close = PNG_Client_Close;
drv.Erase = PNG_Erase;
- drv.Get_with_box = NULL;
- drv.Get_with_line = NULL;
- drv.Get_with_pointer = NULL;
drv.Graph_set = PNG_Graph_set;
drv.Graph_close = PNG_Graph_close;
drv.Line_width = PNG_Line_width;
- drv.Panel_save = NULL;
- drv.Panel_restore = NULL;
- drv.Panel_delete = NULL;
drv.Polydots_abs = NULL;
drv.Polydots_rel = NULL;
drv.Polyline_abs = NULL;
@@ -52,8 +46,6 @@
drv.Scaled_raster = PNG_scaled_raster;
drv.End_scaled_raster = NULL;
drv.Respond = PNG_Respond;
- drv.Work_stream = NULL;
- drv.Do_work = NULL;
drv.lookup_color = PNG_lookup_color;
drv.color = PNG_color;
drv.draw_line = PNG_draw_line;
Added: grass/trunk/lib/pngdriver/description.html
===================================================================
--- grass/trunk/lib/pngdriver/description.html (rev 0)
+++ grass/trunk/lib/pngdriver/description.html 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <TITLE>PNG driver</TITLE>
+ <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+ <link rel="stylesheet" href="grassdocs.css" type="text/css">
+</HEAD>
+<BODY bgColor=white>
+
+<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
+
+<H2>NAME</H2>
+<EM><B> PNG driver</B></EM> - driver to create PNG and PPM images.
+<BR><EM>(drivers)</EM>
+
+<H2>DESCRIPTION</H2>
+
+The PNG driver generates PNG and PPM images from GRASS display commands.
+Per default PNG files are written with this driver. It is started as 'pseudo' monitor
+(image file instead) and when stopped, all output from previously used
+display commands are written to the PNG image file.
+
+<H2>USAGE</H2>
+
+<H3>Environment variables</H3>
+Several environment variables effect the operation
+of the PNG driver.
+<UL>
+ <LI><B>GRASS_WIDTH=xxx</B><BR>
+ the width of the image map (default is 640).</LI><BR>
+ <LI><B>GRASS_HEIGHT=yyy</B><BR>
+ the height of the image map (default is 480).</LI><BR>
+ <LI><B>GRASS_PNGFILE=filename</B><BR>
+ the filename to put the resulting image in, default is <tt>map.png</tt>.
+ If you set GRASS_PNGFILE to a filename which ends in ".ppm", a PPM
+ file will be created.<br><br>
+ <LI><B>GRASS_BACKGROUNDCOLOR=RRGGBB</B><BR>
+ specifies the background color to use in RGB
+ notation (hex values). Default is <b>000000</b> (black).<br><br>
+ <LI><B>GRASS_TRANSPARENT=[TRUE|FALSE]</B><BR>
+ sets transparent background on (TRUE) or off (FALSE, default).</LI><BR>
+ <LI><B>GRASS_TRUECOLOR=[TRUE|FALSE]</B><BR>
+ sets true-color support</LI><BR>
+ <LI><B>GRASS_PNG_COMPRESSION=[0|1|9]</B><BR>
+ compression level of PNG files (0 = none, 1 = fastest, 9 = best, default is 6)</LI><BR>
+ <LI><B>GRASS_PNG_AUTO_WRITE=[TRUE|FALSE]</B><BR>
+ if set to <tt>TRUE</tt>, the image file will be written after each
+ operation (i.e. whenever a client disconnects), rather than
+ only being written out when the driver terminates.</LI><BR>
+ <LI><B>GRASS_PNG_READ</B><BR>
+ if <tt>TRUE</tt>, the PNG driver will initialize the image from
+ the contents of GRASS_PNGFILE.</LI><BR>
+ <LI><B>GRASS_PNG_MAPPED</B><BR>
+ if <tt>TRUE</tt>, the PNG driver will map GRASS_PNGFILE as its framebuffer,
+ rather than using memory. This only works with BMP files.</LI><BR>
+ <LI><B>GRASS_RENDER_IMMEDIATE=[TRUE|FALSE]</B><BR>
+ tells the raster library to use its built-in PNG driver rather
+ than connecting to an external monitor process using sockets. If
+ <tt>TRUE</tt>, there is no need to run <tt>d.mon start=PNG</tt>.
+</UL>
+
+<H3>Example</H3>
+<OL>
+ <LI>Define driver settings (here: bash shell syntax)
+<DIV class="code"><PRE>
+export GRASS_RENDER_IMMEDIATE=TRUE
+export GRASS_TRUECOLOR=TRUE
+</PRE></DIV>
+ </LI>
+ <LI>Start up the driver
+<DIV class="code"><PRE>
+d.mon start=PNG
+</PRE></DIV>
+ </LI>
+ <LI>Display raster map and vector polygons
+<DIV class="code"><PRE>
+d.rast <i>somerastermap</i>
+d.vect <i>somevectormap</i> color=red
+</PRE></DIV>
+ </LI>
+ <LI> Stop the driver subsequently. This will write a
+ file named <tt>map.png</tt> to be created in your current directory:
+<DIV class="code"><PRE>
+d.mon stop=PNG
+</PRE></DIV>
+ </LI>
+</OL>
+
+<H2>NOTES</H2>
+
+The PNG driver uses the libpng (see the <a href="http://www.libpng.org/pub/png/">libpng</a>
+home page) and zlib (see the
+<a href="http://www.zlib.net">zlib</a> home page), all which needs to
+be installed for the PNG driver to work (it's worth it).
+<p>
+The resolution of the <i>PNG</i> raster map is defined by the map
+extents. Use <em>g.region -p</em> to get the number of rows and cols and
+use the environment variables to set the PNG size. If you would like a
+larger image, multiply both rows and cols by the same whole number to
+preserve the aspect ratio.
+<p>
+Further PNG file processing (e.g. quantization to 1 bit for monochrome images)
+can be done with 'pnmquant' of the <a href="http://netpbm.sourceforge.net/">netpbm</a> tools.
+
+<h2>SEE ALSO</h2>
+<EM>
+ <a href="displaydrivers.html">Display drivers</a>
+ <br>
+ <A HREF="htmlmapdriver.html">HTMLMAP driver</A>,
+ <A HREF="psdriver.html">PostScript driver</A>,
+ <A href="xdriver.html">XDRIVER</A>
+ <BR>
+ <A HREF="d.frame.html">d.frame</A>,
+ <A href="d.mon.html">d.mon</A>,
+ <A href="d.rast.html">d.rast</A>,
+ <A href="d.vect.html">d.vect</A>
+</EM>
+
+<H2>AUTHOR</H2>
+Original version: Per Henrik Johansen <<I>phj (at) norgit.no</I>> <I><a href="http://www.norgit.no">NORGIT AS</a></I>
+<BR>
+Rewritten by: Glynn Clements, 2003
+
+<p>
+<i>Last changed: $Date: 2008-03-23 14:34:53 +0000 (Sun, 23 Mar 2008) $</i>
Modified: grass/trunk/lib/psdriver/Driver.c
===================================================================
--- grass/trunk/lib/psdriver/Driver.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/psdriver/Driver.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -32,15 +32,9 @@
drv.Client_Open = NULL;
drv.Client_Close = PS_Client_Close;
drv.Erase = PS_Erase;
- drv.Get_with_box = NULL;
- drv.Get_with_line = NULL;
- drv.Get_with_pointer = NULL;
drv.Graph_set = PS_Graph_set;
drv.Graph_close = PS_Graph_close;
drv.Line_width = PS_Line_width;
- drv.Panel_save = NULL;
- drv.Panel_restore = NULL;
- drv.Panel_delete = NULL;
drv.Polydots_abs = NULL;
drv.Polydots_rel = NULL;
drv.Polyline_abs = PS_Polyline_abs;
@@ -52,8 +46,6 @@
drv.Scaled_raster = PS_scaled_raster;
drv.End_scaled_raster = PS_end_scaled_raster;
drv.Respond = PS_Respond;
- drv.Work_stream = NULL;
- drv.Do_work = NULL;
drv.lookup_color = PS_lookup_color;
drv.color = PS_color;
drv.draw_line = PS_draw_line;
Modified: grass/trunk/lib/psdriver/Makefile
===================================================================
--- grass/trunk/lib/psdriver/Makefile 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/psdriver/Makefile 2008-08-06 21:50:17 UTC (rev 32584)
@@ -9,25 +9,6 @@
EXTRA_LIBS=$(DRIVERLIB) $(GISLIB)
LIB_NAME = $(PSDRIVER_LIBNAME)
-LIB_OBJS = \
- Box.o \
- Client.o \
- Color.o \
- Color_table.o \
- Draw_bitmap.o \
- Draw_line.o \
- Draw_point.o \
- Driver.o \
- Erase.o \
- Graph_close.o \
- Graph_set.o \
- Line_width.o \
- Polygon.o \
- Polyline.o \
- Raster.o \
- Respond.o \
- Set_window.o
-
include $(MODULE_TOPDIR)/include/Make/Lib.make
default: lib $(ETC)/psdriver.ps
Added: grass/trunk/lib/psdriver/description.html
===================================================================
--- grass/trunk/lib/psdriver/description.html (rev 0)
+++ grass/trunk/lib/psdriver/description.html 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,109 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <TITLE>PS driver</TITLE>
+ <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+ <link rel="stylesheet" href="grassdocs.css" type="text/css">
+</HEAD>
+<BODY bgColor=white>
+
+<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
+
+<H2>NAME</H2>
+<EM><B> PS driver</B></EM> - driver to create PostScript files.
+<BR><EM>(drivers)</EM>
+
+<H2>DESCRIPTION</H2>
+
+The PS driver generates a PostScript file from GRASS display commands.
+The driver is started as 'pseudo' monitor (PS file instead) and when
+stopped, all output from previously used display commands are written
+to the PostScript file.
+
+<H2>USAGE</H2>
+<H3>Environment variables</H3>
+Several environment variables effect the operation
+of the PS driver:
+
+<UL>
+ <LI><B>GRASS_PSFILE</B><BR>
+ name of output file. If it ends with ".eps" an EPS file
+ will be created.</LI><BR>
+ <LI><B>GRASS_PAPER</B><BR>
+ sets the screen dimensions and margins to
+ fit a standard paper size, see also GRASS_WIDTH, GRASS_HEIGHT.</LI><BR>
+ <LI><B>GRASS_WIDTH</B><BR>
+ defines the width of the screen, see also GRASS_HEIGHT</LI><BR>
+ <LI><B>GRASS_HEIGHT</B><BR>
+ defines the height of the screen, see also GRASS_WIDTH</LI><BR>
+ <LI><B>GRASS_TRUECOLOR</B><BR>
+ if <tt>TRUE</tt>, the PS driver generates color output, otherwise
+ monochrome.</LI><BR>
+ <LI><B>GRASS_LANDSCAPE</B><BR>
+ if <tt>TRUE</tt>, the screen is rotated 90 degrees
+ counter-clockwise so that a "landscape" screen fits better on
+ "portrait" paper.</LI><BR>
+ <LI><B>GRASS_PS_HEADER</B><BR>
+ if <tt>FALSE</tt>, the output is appended to any existing file,
+ and no prolog or setup sections are generated.</LI><BR>
+ <LI><B>GRASS_PS_TRAILER</B><BR>
+ if <tt>FALSE</tt>, no trailer section is generated.</LI>
+</UL>
+
+<H3>Example</H3>
+<OL>
+ <LI>Start up the driver
+<DIV class="code"><PRE>
+d.mon start=PS
+</PRE></DIV>
+ </LI>
+ <LI>Display raster map and vector polygons
+<DIV class="code"><PRE>
+d.rast <i>somerastermap</i>
+d.vect map=<i>somevectormap</i> color=red
+</PRE></DIV>
+ </LI>
+ <LI> Stop the driver subsequently. This will write a
+ file named <tt>map.ps</tt> to be created in your current directory:
+<DIV class="code"><PRE>
+d.mon stop=PS
+</PRE></DIV>
+ </LI>
+</OL>
+
+<H2>NOTES</H2>
+
+The resolution of the <i>PS</i> raster map is defined by the map
+extents. Use <em>g.region -p</em> to get the number of rows and cols and
+use the environment variables to set the PS size. If you would like a
+larger image, multiply both rows and cols by the same whole number to
+preserve the aspect ratio.
+<P>
+GRASS_TRUECOLOR requires either PostScript level 2 or level 1 plus the
+colorimage and setrgbcolor operators (this is the case for colour printers
+which pre-date level 2 PostScript).
+<p>
+Only masked images (<tt>d.rast -o</tt>, <tt>d.rgb -o</tt>, <tt>d.his
+-n</tt>) require PostScript level 3.
+
+<h2>SEE ALSO</h2>
+<EM>
+ <a href="displaydrivers.html">Display drivers</a>
+ <br>
+ <A HREF="htmlmapdriver.html">HTMLMAP driver</A>,
+ <A HREF="pngdriver.html">PNG driver</A>,
+ <A href="xdriver.html">XDRIVER</A>
+ <BR>
+ <A HREF="d.frame.html">d.frame</A>,
+ <A href="d.out.file.html">d.out.file</A>,
+ <A href="d.mon.html">d.mon</A>,
+ <A href="d.rast.html">d.rast</A>,
+ <A href="d.vect.html">d.vect</A>
+</EM>
+
+<H2>AUTHOR</H2>
+
+Glynn Clements, 2007
+
+<p>
+<i>Last changed: $Date: 2008-03-23 14:34:53 +0000 (Sun, 23 Mar 2008) $</i>
Modified: grass/trunk/lib/raster/Makefile
===================================================================
--- grass/trunk/lib/raster/Makefile 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/Makefile 2008-08-06 21:50:17 UTC (rev 32584)
@@ -4,7 +4,7 @@
DEFS=-DPACKAGE=\"$(PACKAGE)\"
EXTRA_CFLAGS=$(GETHOSTNAME) $(FTINC) -I../driver $(PICFLAGS) $(DEFS)
-EXTRA_LIBS=$(DRIVERLIB) $(GISLIB) $(PNGDRIVERLIB) $(PSDRIVERLIB)
+EXTRA_LIBS=$(DRIVERLIB) $(GISLIB) $(PNGDRIVERLIB) $(PSDRIVERLIB) $(HTMLDRIVERLIB)
LIB_NAME = $(RASTER_LIBNAME)
include $(MODULE_TOPDIR)/include/Make/Lib.make
Deleted: grass/trunk/lib/raster/com_get.c
===================================================================
--- grass/trunk/lib/raster/com_get.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/com_get.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,20 +0,0 @@
-#include <grass/gis.h>
-
-#include <grass/raster.h>
-#include <grass/graphics.h>
-#include "transport.h"
-
-void R_get_location_with_box(int cx, int cy, int *wx, int *wy, int *button)
-{
- trans->get_location_with_box(cx, cy, wx, wy, button);
-}
-
-void R_get_location_with_line(int cx, int cy, int *wx, int *wy, int *button)
-{
- trans->get_location_with_line(cx, cy, wx, wy, button);
-}
-
-void R_get_location_with_pointer(int *wx, int *wy, int *button)
-{
- trans->get_location_with_pointer(wx, wy, button);
-}
Deleted: grass/trunk/lib/raster/com_io.c
===================================================================
--- grass/trunk/lib/raster/com_io.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/com_io.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,211 +0,0 @@
-
-#include <grass/config.h>
-
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "driver.h"
-#include "transport.h"
-
-struct transport loc_trans = {
- LOC_open_driver,
- LOC__open_quiet,
- LOC_stabilize,
- LOC_kill_driver,
- LOC_close_driver,
- LOC_release_driver,
- LOC_screen_left,
- LOC_screen_rite,
- LOC_screen_bot,
- LOC_screen_top,
- LOC_get_num_colors,
- LOC_standard_color,
- LOC_RGB_color,
- LOC_line_width,
- LOC_erase,
- LOC_move_abs,
- LOC_move_rel,
- LOC_cont_abs,
- LOC_cont_rel,
- LOC_polydots_abs,
- LOC_polydots_rel,
- LOC_polyline_abs,
- LOC_polyline_rel,
- LOC_polygon_abs,
- LOC_polygon_rel,
- LOC_box_abs,
- LOC_box_rel,
- LOC_text_size,
- LOC_text_rotation,
- LOC_set_window,
- LOC_text,
- LOC_get_text_box,
- LOC_font,
- LOC_charset,
- LOC_font_list,
- LOC_font_info,
- LOC_panel_save,
- LOC_panel_restore,
- LOC_panel_delete,
- LOC_begin_scaled_raster,
- LOC_scaled_raster,
- LOC_end_scaled_raster,
- LOC_bitmap,
- LOC_get_location_with_box,
- LOC_get_location_with_line,
- LOC_get_location_with_pointer,
- LOC_pad_create,
- LOC_pad_current,
- LOC_pad_delete,
- LOC_pad_invent,
- LOC_pad_list,
- LOC_pad_select,
- LOC_pad_append_item,
- LOC_pad_delete_item,
- LOC_pad_get_item,
- LOC_pad_list_items,
- LOC_pad_set_item
-};
-
-#ifdef HAVE_SOCKET
-
-struct transport rem_trans = {
- REM_open_driver,
- REM__open_quiet,
- REM_stabilize,
- REM_kill_driver,
- REM_close_driver,
- REM_release_driver,
- REM_screen_left,
- REM_screen_rite,
- REM_screen_bot,
- REM_screen_top,
- REM_get_num_colors,
- REM_standard_color,
- REM_RGB_color,
- REM_line_width,
- REM_erase,
- REM_move_abs,
- REM_move_rel,
- REM_cont_abs,
- REM_cont_rel,
- REM_polydots_abs,
- REM_polydots_rel,
- REM_polyline_abs,
- REM_polyline_rel,
- REM_polygon_abs,
- REM_polygon_rel,
- REM_box_abs,
- REM_box_rel,
- REM_text_size,
- REM_text_rotation,
- REM_set_window,
- REM_text,
- REM_get_text_box,
- REM_font,
- REM_charset,
- REM_font_list,
- REM_font_info,
- REM_panel_save,
- REM_panel_restore,
- REM_panel_delete,
- REM_begin_scaled_raster,
- REM_scaled_raster,
- REM_end_scaled_raster,
- REM_bitmap,
- REM_get_location_with_box,
- REM_get_location_with_line,
- REM_get_location_with_pointer,
- REM_pad_create,
- REM_pad_current,
- REM_pad_delete,
- REM_pad_invent,
- REM_pad_list,
- REM_pad_select,
- REM_pad_append_item,
- REM_pad_delete_item,
- REM_pad_get_item,
- REM_pad_list_items,
- REM_pad_set_item
-};
-
-#endif
-
-const struct transport *trans;
-
-static const struct transport *get_trans(void)
-{
-#ifndef HAVE_SOCKET
- return &loc_trans;
-#else
- const char *p = getenv("GRASS_RENDER_IMMEDIATE");
-
- if (!p)
- return &rem_trans;
-
- if (G_strcasecmp(p, "TRUE") == 0)
- return &loc_trans;
-
- if (G_strcasecmp(p, "FALSE") == 0)
- return &rem_trans;
-
- if (G_strcasecmp(p, "PNG") == 0)
- return &loc_trans;
-
- if (G_strcasecmp(p, "PS") == 0)
- return &loc_trans;
-
- G_warning("Unrecognised GRASS_RENDER_IMMEDIATE setting: %s", p);
-
- return &rem_trans;
-#endif
-}
-
-static void init_transport(void)
-{
- if (trans)
- return;
-
- trans = get_trans();
-}
-
-int R_open_driver(void)
-{
- init_transport();
- return trans->open_driver();
-}
-
-void R__open_quiet(void)
-{
- init_transport();
- trans->open_quiet();
-}
-
-void R_stabilize(void)
-{
- trans->stabilize();
-}
-
-void R_kill_driver(void)
-{
- trans->kill_driver();
-}
-
-void R_close_driver(void)
-{
- trans->close_driver();
-}
-
-void R_release_driver(void)
-{
- trans->release_driver();
-}
Deleted: grass/trunk/lib/raster/com_pad.c
===================================================================
--- grass/trunk/lib/raster/com_pad.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/com_pad.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,72 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-#include "transport.h"
-
-/* PAD FUNCTIONS
- The monitor has a very simple database management capability
- which supports the windowing. There are scratch pads
- to be written on. Each scratch pad can contain items, and
- each item can have a list of values. These are NOT to be
- used by the programmer. They are used indirectly through
- the displaylib library calls.
- */
-
-int R_pad_create(const char *pad)
-{
- return trans->pad_create(pad);
-}
-
-int R_pad_current(char *name)
-{
- return trans->pad_current(name);
-}
-
-int R_pad_delete(void)
-{
- return trans->pad_delete();
-}
-
-int R_pad_invent(char *pad)
-{
- return trans->pad_invent(pad);
-}
-
-int R_pad_list(char ***list, int *count)
-{
- return trans->pad_list(list, count);
-}
-
-int R_pad_select(const char *pad)
-{
- return trans->pad_select(pad);
-}
-
-int R_pad_append_item(const char *item, const char *value, int replace)
-{
- return trans->pad_append_item(item, value, replace);
-}
-
-int R_pad_delete_item(const char *name)
-{
- return trans->pad_delete_item(name);
-}
-
-int R_pad_get_item(const char *name, char ***list, int *count)
-{
- return trans->pad_get_item(name, list, count);
-}
-
-int R_pad_list_items(char ***list, int *count)
-{
- return trans->pad_list_items(list, count);
-}
-
-int R_pad_set_item(const char *name, const char *value)
-{
- return trans->pad_set_item(name, value);
-}
Deleted: grass/trunk/lib/raster/com_proto.c
===================================================================
--- grass/trunk/lib/raster/com_proto.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/com_proto.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,535 +0,0 @@
-
-#include <stdio.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "transport.h"
-
-/*!
- * \brief screen left edge
- *
- * Returns the coordinate of the left edge of the screen.
- *
- * \param void
- * \return int
- */
-
-int R_screen_left(void)
-{
- return trans->screen_left();
-}
-
-/*!
- * \brief screen right edge
- *
- * Returns the coordinate of the right edge of the screen.
- *
- * \param void
- * \return int
- */
-
-int R_screen_rite(void)
-{
- return trans->screen_rite();
-}
-
-/*!
- * \brief bottom of screen
- *
- * Returns the coordinate of the bottom of the screen.
- *
- * \param void
- * \return int
- */
-
-int R_screen_bot(void)
-{
- return trans->screen_bot();
-}
-
-
-/*!
- * \brief top of screen
- *
- * Returns the coordinate of the top of the screen.
- *
- * \param void
- * \return int
- */
-
-int R_screen_top(void)
-{
- return trans->screen_top();
-}
-
-void R_get_num_colors(int *n)
-{
- trans->get_num_colors(n);
-}
-
-
-/*!
- * \brief select standard color
- *
- * Selects the
- * standard <b>color</b> to be used in subsequent draw commands. The
- * <b>color</b> value is best retrieved using <i>D_translate_color.</i>
- * See Display_Graphics_Library.
- *
- * \param index
- * \return int
- */
-
-void R_standard_color(int index)
-{
- trans->standard_color(index);
-}
-
-/*!
- * \brief select color
- *
- * When in
- * float mode (see <i>R_color_table_float</i>), this call selects the color
- * most closely matched to the <b>red, grn</b>, and <b>blue</b> intensities
- * requested. These values must be in the range of 0-255.
- *
- * \param red
- * \param grn
- * \param blue
- * \return int
- */
-
-void R_RGB_color(unsigned char red, unsigned char grn, unsigned char blu)
-{
- trans->RGB_color(red, grn, blu);
-}
-
-/*!
- * \brief change the width of line
- *
- * Changes the <b>width</b> of line to be used in subsequent draw commands.
- *
- * \param width
- * \return int
- */
-
-void R_line_width(int width)
-{
- trans->line_width(width);
-}
-
-/*!
- * \brief erase screen
- *
- * Erases the entire screen to black.
- *
- * \param void
- * \return int
- */
-
-void R_erase(void)
-{
- trans->erase();
-}
-
-/*!
- * \brief move current location
- *
- * Move the current location to the absolute screen coordinate <b>x,y.</b>
- * Nothing is drawn on the screen.
- *
- * \param x
- * \param y
- * \return int
- */
-
-void R_move_abs(int x, int y)
-{
- trans->move_abs(x, y);
-}
-
-/*!
- * \brief move current location
- *
- * Shift the current screen location by the values in <b>dx</b> and <b>dy</b>:
- \code
- Newx = Oldx + dx;
- Newy = Oldy + dy;
- \endcode
- * Nothing is drawn on the screen.
- *
- * \param x dx
- * \param y dy
- * \return int
- */
-
-void R_move_rel(int x, int y)
-{
- trans->move_rel(x, y);
-}
-
-/*!
- * \brief draw line
- *
- * Draw a line using the current color, selected via <i>R_color</i>, from the
- * current location to the location specified by <b>x,y.</b> The current location
- * is updated to <b>x,y.</b>
- *
- * \param x
- * \param y
- * \return int
- */
-
-void R_cont_abs(int x, int y)
-{
- trans->cont_abs(x, y);
-}
-
-/*!
- * \brief draw line
- *
- * Draw a line using the
- * current color, selected via <i>R_color</i>, from the current location to
- * the relative location specified by <b>x</b> and <b>y.</b> The current
- * location is updated:
- \code
- Newx = Oldx + x;
- Newy = Oldy + y;
- \endcode
- *
- * \param x
- * \param y
- * \return int
- */
-
-void R_cont_rel(int x, int y)
-{
- trans->cont_rel(x, y);
-}
-
-/*!
- * \brief draw a series of dots
- *
- * Pixels at the <b>num</b> absolute positions in the <b>x</b> and
- * <b>y</b> arrays are turned to the current color. The current location is
- * left updated to the position of the last dot.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void R_polydots_abs(const int *xarray, const int *yarray, int number)
-{
- trans->polydots_abs(xarray, yarray, number);
-}
-
-/*!
- * \brief draw a series of dots
- *
- * Pixels at the <b>number</b> relative positions in the <b>x</b> and
- * <b>y</b> arrays are turned to the current color. The first position is
- * relative to the starting current location; the succeeding positions are then
- * relative to the previous position. The current location is updated to the
- * position of the last dot.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void R_polydots_rel(const int *xarray, const int *yarray, int number)
-{
- trans->polydots_rel(xarray, yarray, number);
-}
-
-/*!
- * \brief draw an open polygon
- *
- * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b>
- * arrays are used to generate a multisegment line (often curved). This line is
- * drawn with the current color. The current location is left updated to the
- * position of the last point.
- * <b>Note.</b> It is not assumed that the line is closed, i.e., no line is
- * drawn from the last point to the first point.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void R_polyline_abs(const int *xarray, const int *yarray, int number)
-{
- trans->polyline_abs(xarray, yarray, number);
-}
-
-/*!
- * \brief draw an open polygon
- *
- * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
- * arrays are used to generate a multisegment line (often curved). The first
- * position is relative to the starting current location; the succeeding
- * positions are then relative to the previous position. The current location is
- * updated to the position of the last point. This line is drawn with the current
- * color.
- * <b>Note.</b> No line is drawn between the last point and the first point.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void R_polyline_rel(const int *xarray, const int *yarray, int number)
-{
- trans->polyline_rel(xarray, yarray, number);
-}
-
-/*!
- * \brief draw a closed polygon
- *
- * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b> arrays
- * outline a closed polygon which is filled with the current color. The current
- * location is undefined afterwards.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void R_polygon_abs(const int *xarray, const int *yarray, int number)
-{
- trans->polygon_abs(xarray, yarray, number);
-}
-
-/*!
- * \brief draw a closed polygon
- *
- * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
- * arrays outline a closed polygon which is filled with the current color. The
- * first position is relative to the starting current location; the succeeding
- * positions are then relative to the previous position. The current location is
- * undefined afterwards.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void R_polygon_rel(const int *xarray, const int *yarray, int number)
-{
- trans->polygon_rel(xarray, yarray, number);
-}
-
-/*!
- * \brief fill a box
- *
- * A box is drawn in the current color using the coordinates <b>x1,y1</b> and
- * <b>x2,y2</b> as opposite corners of the box. The current location is undefined
- * afterwards
- *
- * \param x1
- * \param y1
- * \param x2
- * \param y2
- * \return int
- */
-
-void R_box_abs(int x1, int y1, int x2, int y2)
-{
- trans->box_abs(x1, y1, x2, y2);
-}
-
-
-/*!
- * \brief fill a box
- *
- * A box is drawn in the current color using the current location as one corner
- * and the current location plus <b>x</b> and <b>y</b> as the opposite corner
- * of the box. The current location is undefined afterwards.
- *
- * \param x
- * \param y
- * \return int
- */
-
-void R_box_rel(int x, int y)
-{
- trans->box_rel(x, y);
-}
-
-/*!
- * \brief set text size
- *
- * Sets text pixel width and height to <b>width</b> and <b>height.</b>
- *
- * \param width
- * \param height
- * \return int
- */
-
-void R_text_size(int width, int height)
-{
- trans->text_size(width, height);
-}
-
-void R_text_rotation(float rotation)
-{
- trans->text_rotation(rotation);
-}
-
-/*!
- * \brief set text clipping frame
- *
- * Subsequent calls to <i>R_text</i> will have text strings
- * clipped to the screen frame defined by <b>top, bottom, left, right.</b>
- *
- * \param t top
- * \param b bottom
- * \param l left
- * \param r right
- * \return int
- */
-
-void R_set_window(int t, int b, int l, int r)
-{
- trans->set_window(t, b, l, r);
-}
-
-/*!
- * \brief write text
- *
- * Writes <b>text</b> in the current color and font, at the current text
- * width and height, starting at the current screen location.
- *
- * \param sometext
- * \return int
- */
-
-void R_text(const char *text)
-{
- trans->text(text);
-}
-
-/*!
- * \brief get text extents
- *
- * The extent of the area enclosing the <b>text</b>
- * is returned in the integer pointers <b>top, bottom, left</b>, and
- * <b>right.</b> No text is actually drawn. This is useful for capturing the
- * text extent so that the text location can be prepared with proper background
- * or border.
- *
- * \param sometext
- * \param t top
- * \param b bottom
- * \param l left
- * \param r right
- * \return int
- */
-
-void R_get_text_box(const char *text, int *t, int *b, int *l, int *r)
-{
- trans->get_text_box(text, t, b, l, r);
-}
-
-/*!
- * \brief choose font
- *
- * Set current font to <b>font name</b>. Available fonts are:
- *
- <table>
- <tr><td><b>Font Name</b></td><td><b>Description</b></td></tr>
- <tr><td>cyrilc </td><td> cyrillic</td></tr>
- <tr><td>gothgbt </td><td> Gothic Great Britain triplex</td></tr>
- <tr><td>gothgrt </td><td> Gothic German triplex</td></tr>
- <tr><td>gothitt </td><td> Gothic Italian triplex</td></tr>
- <tr><td>greekc </td><td> Greek complex</td></tr>
- <tr><td>greekcs </td><td> Greek complex script</td></tr>
- <tr><td>greekp </td><td> Greek plain</td></tr>
- <tr><td>greeks </td><td> Greek simplex</td></tr>
- <tr><td>italicc </td><td> Italian complex</td></tr>
- <tr><td>italiccs </td><td> Italian complex small</td></tr>
- <tr><td>italict </td><td> Italian triplex</td></tr>
- <tr><td>romanc </td><td> Roman complex</td></tr>
- <tr><td>romancs </td><td> Roman complex small</td></tr>
- <tr><td>romand </td><td> Roman duplex</td></tr>
- <tr><td>romanp </td><td> Roman plain</td></tr>
- <tr><td>romans </td><td> Roman simplex</td></tr>
- <tr><td>romant </td><td> Roman triplex</td></tr>
- <tr><td>scriptc </td><td> Script complex</td></tr>
- <tr><td>scripts </td><td> Script simplex</td></tr>
- </table>
- *
- * \param name
- * \return int
- */
-
-void R_font(const char *name)
-{
- trans->font(name);
-}
-
-void R_charset(const char *name)
-{
- trans->charset(name);
-}
-
-void R_font_list(char ***list, int *count)
-{
- trans->font_list(list, count);
-}
-
-void R_font_info(char ***list, int *count)
-{
- trans->font_info(list, count);
-}
-
-void R_panel_save(const char *name, int t, int b, int l, int r)
-{
- trans->panel_save(name, t, b, l, r);
-}
-
-void R_panel_restore(const char *name)
-{
- trans->panel_restore(name);
-}
-
-void R_panel_delete(const char *name)
-{
- trans->panel_delete(name);
-}
-
-void R_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
-{
- trans->begin_scaled_raster(mask, src, dst);
-}
-
-int R_scaled_raster(int n, int row,
- const unsigned char *red, const unsigned char *grn,
- const unsigned char *blu, const unsigned char *nul)
-{
- return trans->scaled_raster(n, row, red, grn, blu, nul);
-}
-
-void R_end_scaled_raster(void)
-{
- trans->end_scaled_raster();
-}
-
-void R_bitmap(int ncols, int nrows, int threshold, const unsigned char *buf)
-{
- trans->bitmap(ncols, nrows, threshold, buf);
-}
Deleted: grass/trunk/lib/raster/common.c
===================================================================
--- grass/trunk/lib/raster/common.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/common.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,67 +0,0 @@
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-/*!
- * \brief flush graphics
- *
- * Send all pending graphics commands to the graphics driver.
- * This is done automatically when graphics input requests are made.
- * Generally this is only needed for interactive graphics.
- *
- * \param void
- * \return int
- */
-
-void R_flush(void)
-{
- R_stabilize();
-}
-
-void R_pad_perror(const char *msg, int code)
-{
- const char *err;
-
- switch (code) {
- case OK:
- err = "";
- break;
- case NO_CUR_PAD:
- err = "no current pad";
- break;
- case NO_PAD:
- err = "pad not found";
- break;
- case NO_MEMORY:
- err = "out of memory";
- break;
- case NO_ITEM:
- err = "item not found";
- break;
- case ILLEGAL:
- err = "illegal request";
- break;
- case DUPLICATE:
- err = "duplicate name";
- break;
- default:
- err = "unknown error";
- break;
- }
-
- fprintf(stderr, "%s%s%s\n", msg, *msg ? " : " : "", err);
-}
-
-void R_pad_freelist(char **list, int count)
-{
- int i;
-
- if (count <= 0)
- return;
-
- for (i = 0; i < count; i++)
- G_free(list[i]);
-
- G_free(list);
-}
Deleted: grass/trunk/lib/raster/io_sock.c
===================================================================
--- grass/trunk/lib/raster/io_sock.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/io_sock.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,128 +0,0 @@
-
-#include <grass/config.h>
-
-#ifdef HAVE_SOCKET
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#ifdef __MINGW32__
-#include <winsock2.h>
-#define ECONNREFUSED WSAECONNREFUSED
-#define EADDRINUSE WSAEADDRINUSE
-#define ENOTSOCK WSAENOTSOCK
-#define ETIMEDOUT WSAETIMEDOUT
-#endif
-
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-
-#include "open.h"
-
-extern int _rfd, _wfd;
-extern int _quiet;
-
-extern int sync_driver(char *);
-
-static char *sockpath;
-
-/*!
- * \brief initialize graphics
- *
- * Initializes connection to
- * current graphics driver. Refer to GRASS User's Manual entries on the
- * <i>d.mon</i> command. If connection cannot be made, the application module
- * sends a message to the user stating that a driver has not been selected or
- * could not be opened. Note that only one application module can be connected to
- * a graphics driver at once.
- * After all graphics have been completed, the driver should be closed.
- *
- * \param void
- * \return int
- */
-
-int REM_open_driver(void)
-{
- int verbose;
- char *name;
-
- verbose = !_quiet;
- _quiet = 0;
-
- name = getenv("MONITOR_OVERRIDE");
- if (!name)
- name = G__getenv("MONITOR");
-
- if (!name) {
- if (verbose) {
- G_warning(_("No graphics monitor has been selected for output."));
- G_warning(_
- ("Please run \"d.mon\" to select a graphics monitor."));
- }
- return (NO_MON);
- }
-
- /* Get the full path to the unix socket */
- if ((sockpath = G_sock_get_fname(name)) == NULL) {
- if (verbose)
- G_warning(_("Failed to get socket name for monitor <%s>."), name);
- return (NO_MON);
- }
-
- /* See if the socket exists, if it doesn't no point in trying to
- * connect to it.
- */
- if (!G_sock_exists(sockpath)) {
- if (verbose)
- G_warning(_("No socket to connect to for monitor <%s>."), name);
- return (NO_MON);
- }
-
- /** We try to make a connection now **/
-
- _wfd = G_sock_connect(sockpath);
- if (_wfd > 0) { /* success */
- _rfd = dup(_wfd);
- sync_driver(name);
- return (OK);
- }
-
- switch (errno) {
- case ECONNREFUSED:
- case EADDRINUSE:
- if (verbose) {
- G_warning(_
- ("Socket is already in use or not accepting connections."));
- G_warning(_("Use d.mon to select a monitor"));
- }
- return (NO_RUN);
- case EBADF:
- case ENOTSOCK:
- if (verbose) {
- G_warning(_("Trying to connect to something not a socket."));
- G_warning(_("Probably program error."));
- }
- return (NO_RUN);
- case ETIMEDOUT:
- if (verbose) {
- G_warning(_("Connect attempt timed out."));
- G_warning(_("Probably an error with the server."));
- }
- return (NO_RUN);
- default:
- break;
- }
-
- if (verbose)
- G_warning(_("Connection failed."));
-
- /* We couldn't connect... */
- return (NO_RUN);
-}
-
-#endif /* HAVE_SOCKET */
Deleted: grass/trunk/lib/raster/loc_get.c
===================================================================
--- grass/trunk/lib/raster/loc_get.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/loc_get.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,18 +0,0 @@
-#include <grass/gis.h>
-
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "transport.h"
-
-void LOC_get_location_with_box(int cx, int cy, int *wx, int *wy, int *button)
-{
-}
-
-void LOC_get_location_with_line(int cx, int cy, int *wx, int *wy, int *button)
-{
-}
-
-void LOC_get_location_with_pointer(int *wx, int *wy, int *button)
-{
-}
Deleted: grass/trunk/lib/raster/loc_io.c
===================================================================
--- grass/trunk/lib/raster/loc_io.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/loc_io.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,96 +0,0 @@
-
-#include <grass/config.h>
-
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "driver.h"
-#include "transport.h"
-#include "open.h"
-#include "pad.h"
-
-extern const struct driver *PNG_Driver(void);
-extern const struct driver *PS_Driver(void);
-
-static void LOC_init(void)
-{
- const char *name = "full_screen";
- const char *fenc = getenv("GRASS_ENCODING");
- const char *font = getenv("GRASS_FONT");
- int t = R_screen_top();
- int b = R_screen_bot();
- int l = R_screen_left();
- int r = R_screen_rite();
- char buff[256];
-
- R_font(font ? font : "romans");
-
- if (fenc)
- R_charset(fenc);
-
- R_pad_select("");
- R_pad_set_item("time", "1");
- R_pad_set_item("cur_w", name);
-
- R_pad_create(name);
- R_pad_select(name);
- R_pad_set_item("time", "1");
-
- sprintf(buff, "%d %d %d %d", t, b, l, r);
- R_pad_set_item("d_win", buff);
-
- R_set_window(t, b, l, r);
-}
-
-int LOC_open_driver(void)
-{
- const char *p = getenv("GRASS_RENDER_IMMEDIATE");
- const struct driver *drv = (p && G_strcasecmp(p, "PS") == 0)
- ? PS_Driver()
- : PNG_Driver();
-
- LIB_init(drv, 0, NULL);
-
- LOC_init();
-
- COM_Client_Open();
-
- return OK;
-}
-
-int LOC__open_quiet(void)
-{
- return 0;
-}
-
-void LOC_stabilize(void)
-{
- COM_Respond();
-}
-
-void LOC_kill_driver(void)
-{
- COM_Graph_close();
-}
-
-void LOC_close_driver(void)
-{
- LOC_stabilize();
- COM_Client_Close();
- LOC_kill_driver();
-}
-
-void LOC_release_driver(void)
-{
- LOC_stabilize();
- COM_Client_Close();
-}
Deleted: grass/trunk/lib/raster/loc_pad.c
===================================================================
--- grass/trunk/lib/raster/loc_pad.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/loc_pad.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,178 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "transport.h"
-#include "pad.h"
-
-/* PAD FUNCTIONS
- The monitor has a very simple database management capabil
- ity which supports the windowing. There are scratch pads
- to be written on. Each scratch pad can contain items, and
- each item can have a list of values. These are NOT to be
- used by the programmer. They are used indirectly through
- the displaylib library calls.
- */
-
-static PAD *curpad; /* current selected pad */
-
-int LOC_pad_create(const char *pad)
-{
- if (*pad == 0) /* this is scratch pad */
- return OK;
- else if (find_pad(pad) != NULL)
- return DUPLICATE; /* duplicate pad */
- else if (create_pad(pad))
- return OK;
- else
- return NO_MEMORY;
-}
-
-int LOC_pad_current(char *name)
-{
- if (curpad == NULL) {
- *name = '\0';
- return NO_CUR_PAD;
- }
- else {
- strcpy(name, curpad->name);
- return OK;
- }
-}
-
-int LOC_pad_delete(void)
-{
- if (curpad == NULL)
- return NO_CUR_PAD;
- else if (*curpad->name == 0)
- return ILLEGAL;
- else {
- delete_pad(curpad);
- curpad = NULL;
- return OK;
- }
-}
-
-int LOC_pad_invent(char *pad)
-{
- invent_pad(pad);
-
- return 0;
-}
-
-int LOC_pad_list(char ***list, int *count)
-{
- PAD *p;
- char **l;
- int n;
-
- for (p = pad_list(), n = 0; p; p = p->next)
- if (*p->name)
- n++;
-
- *count = n;
- *list = l = G_malloc(n * sizeof(char *));
-
- for (p = pad_list(); p; p = p->next)
- if (*p->name)
- *l++ = G_store(p->name);
-
- return 0;
-}
-
-int LOC_pad_select(const char *pad)
-{
- curpad = find_pad(pad);
-
- if (curpad == NULL)
- return NO_PAD;
-
- return OK;
-}
-
-int LOC_pad_append_item(const char *item, const char *value, int replace)
-{
- if (curpad == NULL)
- return NO_CUR_PAD;
-
- if (append_item(curpad, item, value, replace))
- return OK;
-
- return NO_MEMORY;
-}
-
-int LOC_pad_delete_item(const char *name)
-{
- if (curpad == NULL)
- return NO_CUR_PAD;
-
- delete_item(curpad, name);
- return OK;
-}
-
-int LOC_pad_get_item(const char *name, char ***list, int *count)
-{
- ITEM *item;
- LIST *p;
- char **l;
- int n;
-
- if (curpad == NULL)
- return NO_CUR_PAD;
-
- item = find_item(curpad, name);
- if (item == NULL)
- return NO_ITEM;
-
- for (p = item->list, n = 0; p; p = p->next)
- if (*p->value)
- n++;
-
- *count = n;
- *list = l = G_malloc(n * sizeof(char *));
-
- for (p = item->list, n = 0; p; p = p->next)
- if (*p->value)
- *l++ = G_store(p->value);
-
- return OK;
-}
-
-int LOC_pad_list_items(char ***list, int *count)
-{
- ITEM *p;
- char **l;
- int n;
-
- if (curpad == NULL)
- return NO_CUR_PAD;
-
- for (p = curpad->items, n = 0; p; p = p->next)
- if (*p->name)
- n++;
- *count = n;
- *list = l = G_malloc(n * sizeof(char *));
-
- for (p = curpad->items, n = 0; p; p = p->next)
- if (*p->name)
- *l++ = G_store(p->name);
-
- return OK;
-}
-
-int LOC_pad_set_item(const char *name, const char *value)
-{
- if (curpad == NULL)
- return NO_CUR_PAD;
-
- delete_item(curpad, name);
-
- if (append_item(curpad, name, value, 0))
- return OK;
-
- return NO_MEMORY;
-}
Deleted: grass/trunk/lib/raster/loc_proto.c
===================================================================
--- grass/trunk/lib/raster/loc_proto.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/loc_proto.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,558 +0,0 @@
-
-#include <stdio.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "driver.h"
-#include "transport.h"
-
-/*!
- * \brief screen left edge
- *
- * Returns the coordinate of the left edge of the screen.
- *
- * \param void
- * \return int
- */
-
-int LOC_screen_left(void)
-{
- int l;
-
- COM_Screen_left(&l);
-
- return l;
-}
-
-/*!
- * \brief screen right edge
- *
- * Returns the coordinate of the right edge of the screen.
- *
- * \param void
- * \return int
- */
-
-int LOC_screen_rite(void)
-{
- int r;
-
- COM_Screen_rite(&r);
-
- return r;
-}
-
-/*!
- * \brief bottom of screen
- *
- * Returns the coordinate of the bottom of the screen.
- *
- * \param void
- * \return int
- */
-
-int LOC_screen_bot(void)
-{
- int b;
-
- COM_Screen_bot(&b);
-
- return b;
-}
-
-
-/*!
- * \brief top of screen
- *
- * Returns the coordinate of the top of the screen.
- *
- * \param void
- * \return int
- */
-
-int LOC_screen_top(void)
-{
- int t;
-
- COM_Screen_top(&t);
-
- return t;
-}
-
-void LOC_get_num_colors(int *n)
-{
- COM_Number_of_colors(n);
-}
-
-/*!
- * \brief select standard color
- *
- * Selects the
- * standard <b>color</b> to be used in subsequent draw commands. The
- * <b>color</b> value is best retrieved using <i>D_translate_color.</i>
- * See Display_Graphics_Library.
- *
- * \param index
- * \return int
- */
-
-void LOC_standard_color(int index)
-{
- COM_Standard_color(index);
-}
-
-/*!
- * \brief select color
- *
- * When in
- * float mode (see <i>R_color_table_float</i>), this call selects the color
- * most closely matched to the <b>red, grn</b>, and <b>blue</b> intensities
- * requested. These values must be in the range of 0-255.
- *
- * \param red
- * \param grn
- * \param blue
- * \return int
- */
-
-void LOC_RGB_color(unsigned char red, unsigned char grn, unsigned char blu)
-{
- COM_Color_RGB(red, grn, blu);
-}
-
-/*!
- * \brief change the width of line
- *
- * Changes the <b>width</b> of line to be used in subsequent draw commands.
- *
- * \param width
- * \return int
- */
-
-void LOC_line_width(int width)
-{
- COM_Line_width(width);
-}
-
-/*!
- * \brief erase screen
- *
- * Erases the entire screen to black.
- *
- * \param void
- * \return int
- */
-
-void LOC_erase(void)
-{
- COM_Erase();
-}
-
-/*!
- * \brief move current location
- *
- * Move the current location to the absolute screen coordinate <b>x,y.</b>
- * Nothing is drawn on the screen.
- *
- * \param x
- * \param y
- * \return int
- */
-
-void LOC_move_abs(int x, int y)
-{
- COM_Move_abs(x, y);
-}
-
-/*!
- * \brief move current location
- *
- * Shift the current screen location by the values in <b>dx</b> and <b>dy</b>:
- \code
- Newx = Oldx + dx;
- Newy = Oldy + dy;
- \endcode
- * Nothing is drawn on the screen.
- *
- * \param x dx
- * \param y dy
- * \return int
- */
-
-void LOC_move_rel(int x, int y)
-{
- COM_Move_rel(x, y);
-}
-
-/*!
- * \brief draw line
- *
- * Draw a line using the current color, selected via <i>R_color</i>, from the
- * current location to the location specified by <b>x,y.</b> The current location
- * is updated to <b>x,y.</b>
- *
- * \param x
- * \param y
- * \return int
- */
-
-void LOC_cont_abs(int x, int y)
-{
- COM_Cont_abs(x, y);
-}
-
-/*!
- * \brief draw line
- *
- * Draw a line using the
- * current color, selected via <i>R_color</i>, from the current location to
- * the relative location specified by <b>x</b> and <b>y.</b> The current
- * location is updated:
- \code
- Newx = Oldx + x;
- Newy = Oldy + y;
- \endcode
- *
- * \param x
- * \param y
- * \return int
- */
-
-void LOC_cont_rel(int x, int y)
-{
- COM_Cont_rel(x, y);
-}
-
-/*!
- * \brief draw a series of dots
- *
- * Pixels at the <b>num</b> absolute positions in the <b>x</b> and
- * <b>y</b> arrays are turned to the current color. The current location is
- * left updated to the position of the last dot.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void LOC_polydots_abs(const int *xarray, const int *yarray, int number)
-{
- COM_Polydots_abs(xarray, yarray, number);
-}
-
-/*!
- * \brief draw a series of dots
- *
- * Pixels at the <b>number</b> relative positions in the <b>x</b> and
- * <b>y</b> arrays are turned to the current color. The first position is
- * relative to the starting current location; the succeeding positions are then
- * relative to the previous position. The current location is updated to the
- * position of the last dot.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void LOC_polydots_rel(const int *xarray, const int *yarray, int number)
-{
- COM_Polydots_rel(xarray, yarray, number);
-}
-
-/*!
- * \brief draw an open polygon
- *
- * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b>
- * arrays are used to generate a multisegment line (often curved). This line is
- * drawn with the current color. The current location is left updated to the
- * position of the last point.
- * <b>Note.</b> It is not assumed that the line is closed, i.e., no line is
- * drawn from the last point to the first point.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void LOC_polyline_abs(const int *xarray, const int *yarray, int number)
-{
- COM_Polyline_abs(xarray, yarray, number);
-}
-
-/*!
- * \brief draw an open polygon
- *
- * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
- * arrays are used to generate a multisegment line (often curved). The first
- * position is relative to the starting current location; the succeeding
- * positions are then relative to the previous position. The current location is
- * updated to the position of the last point. This line is drawn with the current
- * color.
- * <b>Note.</b> No line is drawn between the last point and the first point.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void LOC_polyline_rel(const int *xarray, const int *yarray, int number)
-{
- COM_Polyline_rel(xarray, yarray, number);
-}
-
-/*!
- * \brief draw a closed polygon
- *
- * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b> arrays
- * outline a closed polygon which is filled with the current color. The current
- * location is undefined afterwards.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void LOC_polygon_abs(const int *xarray, const int *yarray, int number)
-{
- COM_Polygon_abs(xarray, yarray, number);
-}
-
-/*!
- * \brief draw a closed polygon
- *
- * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
- * arrays outline a closed polygon which is filled with the current color. The
- * first position is relative to the starting current location; the succeeding
- * positions are then relative to the previous position. The current location is
- * undefined afterwards.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- * \return int
- */
-
-void LOC_polygon_rel(const int *xarray, const int *yarray, int number)
-{
- COM_Polygon_rel(xarray, yarray, number);
-}
-
-/*!
- * \brief fill a box
- *
- * A box is drawn in the current color using the coordinates <b>x1,y1</b> and
- * <b>x2,y2</b> as opposite corners of the box. The current location is undefined
- * afterwards
- *
- * \param x1
- * \param y1
- * \param x2
- * \param y2
- * \return int
- */
-
-void LOC_box_abs(int x1, int y1, int x2, int y2)
-{
- COM_Box_abs(x1, y1, x2, y2);
-}
-
-
-/*!
- * \brief fill a box
- *
- * A box is drawn in the current color using the current location as one corner
- * and the current location plus <b>x</b> and <b>y</b> as the opposite corner
- * of the box. The current location is undefined afterwards.
- *
- * \param x
- * \param y
- * \return int
- */
-
-void LOC_box_rel(int x, int y)
-{
- COM_Box_rel(x, y);
-}
-
-/*!
- * \brief set text size
- *
- * Sets text pixel width and height to <b>width</b> and <b>height.</b>
- *
- * \param width
- * \param height
- * \return int
- */
-
-void LOC_text_size(int width, int height)
-{
- COM_Text_size(width, height);
-}
-
-void LOC_text_rotation(float rotation)
-{
- COM_Text_rotation(rotation);
-}
-
-/*!
- * \brief set text clipping frame
- *
- * Subsequent calls to <i>R_text</i> will have text strings
- * clipped to the screen frame defined by <b>top, bottom, left, right.</b>
- *
- * \param t top
- * \param b bottom
- * \param l left
- * \param r right
- * \return int
- */
-
-void LOC_set_window(int t, int b, int l, int r)
-{
- COM_Set_window(t, b, l, r);
-}
-
-/*!
- * \brief write text
- *
- * Writes <b>text</b> in the current color and font, at the current text
- * width and height, starting at the current screen location.
- *
- * \param sometext
- * \return int
- */
-
-void LOC_text(const char *text)
-{
- COM_Text(text);
-}
-
-/*!
- * \brief get text extents
- *
- * The extent of the area enclosing the <b>text</b>
- * is returned in the integer pointers <b>top, bottom, left</b>, and
- * <b>right.</b> No text is actually drawn. This is useful for capturing the
- * text extent so that the text location can be prepared with proper background
- * or border.
- *
- * \param sometext
- * \param t top
- * \param b bottom
- * \param l left
- * \param r right
- * \return int
- */
-
-void LOC_get_text_box(const char *text, int *t, int *b, int *l, int *r)
-{
- COM_Get_text_box(text, t, b, l, r);
-}
-
-/*!
- * \brief choose font
- *
- * Set current font to <b>font name</b>. Available fonts are:
- *
- <table>
- <tr><td><b>Font Name</b></td><td><b>Description</b></td></tr>
- <tr><td>cyrilc </td><td> cyrillic</td></tr>
- <tr><td>gothgbt </td><td> Gothic Great Britain triplex</td></tr>
- <tr><td>gothgrt </td><td> Gothic German triplex</td></tr>
- <tr><td>gothitt </td><td> Gothic Italian triplex</td></tr>
- <tr><td>greekc </td><td> Greek complex</td></tr>
- <tr><td>greekcs </td><td> Greek complex script</td></tr>
- <tr><td>greekp </td><td> Greek plain</td></tr>
- <tr><td>greeks </td><td> Greek simplex</td></tr>
- <tr><td>italicc </td><td> Italian complex</td></tr>
- <tr><td>italiccs </td><td> Italian complex small</td></tr>
- <tr><td>italict </td><td> Italian triplex</td></tr>
- <tr><td>romanc </td><td> Roman complex</td></tr>
- <tr><td>romancs </td><td> Roman complex small</td></tr>
- <tr><td>romand </td><td> Roman duplex</td></tr>
- <tr><td>romanp </td><td> Roman plain</td></tr>
- <tr><td>romans </td><td> Roman simplex</td></tr>
- <tr><td>romant </td><td> Roman triplex</td></tr>
- <tr><td>scriptc </td><td> Script complex</td></tr>
- <tr><td>scripts </td><td> Script simplex</td></tr>
- </table>
- *
- * \param name
- * \return int
- */
-
-void LOC_font(const char *name)
-{
- COM_Font_get(name);
-}
-
-void LOC_charset(const char *name)
-{
- COM_Font_init_charset(name);
-}
-
-void LOC_font_list(char ***list, int *count)
-{
- COM_Font_list(list, count);
-}
-
-void LOC_font_info(char ***list, int *count)
-{
- COM_Font_info(list, count);
-}
-
-void LOC_panel_save(const char *name, int t, int b, int l, int r)
-{
- close(creat(name, 0666));
-
- COM_Panel_save(name, t, b, l, r);
- R_stabilize();
-}
-
-void LOC_panel_restore(const char *name)
-{
- COM_Panel_restore(name);
- R_stabilize();
-}
-
-void LOC_panel_delete(const char *name)
-{
- COM_Panel_delete(name);
- R_stabilize();
-
- remove(name);
-}
-
-void LOC_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
-{
- COM_begin_scaled_raster(mask, src, dst);
-}
-
-int LOC_scaled_raster(int n, int row,
- const unsigned char *red, const unsigned char *grn,
- const unsigned char *blu, const unsigned char *nul)
-{
- return COM_scaled_raster(n, row, red, grn, blu, nul);
-}
-
-void LOC_end_scaled_raster(void)
-{
- COM_end_scaled_raster();
-}
-
-void LOC_bitmap(int ncols, int nrows, int threshold, const unsigned char *buf)
-{
- COM_Bitmap(ncols, nrows, threshold, buf);
-}
Deleted: grass/trunk/lib/raster/open.h
===================================================================
--- grass/trunk/lib/raster/open.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/open.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,15 +0,0 @@
-/* quiet mode returns: 0 - open OK */
-/* -1 - driver locked */
-/* -2 - driver not running */
-/* -3 - can't open fifos */
-/* -4 - no such monitor */
-/* -5 - GIS_LOCK undefined in shell environment */
-/* -6 - couldn't read, write or create lock file */
-
-#define OK 0
-#define LOCKED -1
-#define NO_RUN -2
-#define NO_OPEN -3
-#define NO_MON -4
-#define NO_KEY -5
-#define LOCK_FAILED -6
Deleted: grass/trunk/lib/raster/parse_mon.c
===================================================================
--- grass/trunk/lib/raster/parse_mon.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/parse_mon.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,166 +0,0 @@
-/* parse_mon - parse monitorcap entry */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-#include <grass/monitors.h>
-
-static FILE *monitors = NULL;
-static struct MON_CAP cap;
-
-static char *substr(char *, char *);
-static int read_line(FILE *, char *, int);
-
-struct MON_CAP *R_parse_monitorcap(int field, char *key)
-{
- int rewound;
- char line[1024];
- char *p;
- char file[500];
- char *gisbase;
-
- gisbase = G_gisbase();
-
- rewound = 0;
- if (!(field == MON_NEXT || field == MON_NAME ||
- field == MON_PATH || field == MON_LINK || field == MON_CLOSE))
- return (NULL);
- if (monitors == NULL) {
- sprintf(file, "%s/etc/monitorcap", gisbase);
- if ((monitors = fopen(file, "r")) == NULL)
- G_fatal_error("Unable to open %s", file);
- }
- else {
- if (field == MON_CLOSE) {
- fclose(monitors);
- monitors = NULL;
- return (NULL);
- }
- }
- while (-1) {
- if (read_line(monitors, line, sizeof line)) {
- if (field == MON_NEXT)
- return (NULL);
- rewind(monitors);
- if (read_line(monitors, line, sizeof line) || rewound)
- return (NULL);
- rewound = -1;
- }
- cap.path = cap.comment = cap.link = cap.tty = cap.where = NULL;
- if ((cap.name = G_malloc(strlen(line) + 1)) == NULL)
- return (NULL);
- strcpy(cap.name, line);
- if ((p = substr(":", cap.name)) != NULL) {
- *p++ = '\0';
- cap.path = p;
- if ((p = substr(":", p)) != NULL) {
- *p++ = '\0';
- cap.comment = p;
- if ((p = substr(":", p)) != NULL) {
- *p++ = '\0';
- cap.link = p;
- if ((p = substr(":", p)) != NULL) {
- *p++ = '\0';
- cap.tty = p;
- if ((p = substr(":", p)) != NULL) {
- *p++ = 0;
- cap.where = p;
- if ((p = substr("\n", p)) != NULL)
- *p = '\0';
- }
- }
- }
- }
- }
- if (cap.path == NULL || cap.link == NULL || cap.where == NULL ||
- cap.tty == NULL || cap.comment == NULL)
- G_free(cap.name);
- else {
- sprintf(line, "%s/%s", gisbase, cap.path);
- cap.path = G_store(line);
-
- if (field == MON_NEXT ||
- (field == MON_NAME && !strcmp(key, cap.name))
- || (field == MON_PATH && !strcmp(key, cap.path))
- || (field == MON_LINK && !strcmp(key, cap.link)))
- return (&cap);
- else
- G_free(cap.name);
- }
- }
-}
-
-/* read_line - read a line, possibly continued with a "\" into a buffer */
-
-static int read_line(FILE * file, /* file from which to read */
- char *line, /* buffer in which to put it */
- int size)
-{ /* size of buffer */
- int length, full_line, eof, done;
- char c, last_c;
-
- *line = '\0';
- for (length = full_line = eof = 0; !full_line && !eof;) { /* one entire line at a time */
- while (1) {
- eof = (fgets(line + length, size - length - 1, file) == NULL);
- if (eof)
- break;
- if (*(line + length) != '#')
- break;
- }
- length = strlen(line) - 1;
- if (*(line + length) == '\n') {
- if (*(line + length - 1) == '\\')
- --length;
- else
- full_line = -1;
- }
- else {
- if (length != -1) {
- fprintf(stderr, "error: input line too long\n");
- full_line = -1;
- last_c = c = ' ';
- for (done = 0; !done;) {
- if ((c = getc(file)) != EOF) {
- if (c == '\n' && last_c != '\\')
- done = -1;
- else
- last_c = c;
- }
- else
- eof = done = -1;
- }
- }
- }
- }
- return (eof);
-}
-
-/* substr - find substring in a string. returns pointer to start of */
-/* substring or NULL if not found */
-
-static char *substr(char *string, char *buffer)
-{
- int start, i, found;
- char c;
-
- start = i = found = 0;
- while ((c = *(buffer + start + i)) != '\0' && !found) {
- if (c == *(string + i)) {
- if (*(string + ++i) == '\0')
- found = -1;
- }
- else {
- start++;
- i = 0;
- }
- }
- if (found)
- return (buffer + start);
- else
- return (NULL);
-}
Added: grass/trunk/lib/raster/raster.c
===================================================================
--- grass/trunk/lib/raster/raster.c (rev 0)
+++ grass/trunk/lib/raster/raster.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -0,0 +1,573 @@
+
+#include <grass/config.h>
+
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include <grass/raster.h>
+
+#include "driver.h"
+
+
+extern const struct driver *PNG_Driver(void);
+extern const struct driver *PS_Driver(void);
+extern const struct driver *HTML_Driver(void);
+
+static void init(void)
+{
+ const char *fenc = getenv("GRASS_ENCODING");
+ const char *font = getenv("GRASS_FONT");
+ int t = R_screen_top();
+ int b = R_screen_bot();
+ int l = R_screen_left();
+ int r = R_screen_rite();
+
+ R_font(font ? font : "romans");
+
+ if (fenc)
+ R_charset(fenc);
+
+ R_set_window(t, b, l, r);
+}
+
+int R_open_driver(void)
+{
+ const char *p = getenv("GRASS_RENDER_IMMEDIATE");
+ const struct driver *drv =
+ (p && G_strcasecmp(p, "PS") == 0) ? PS_Driver() :
+ (p && G_strcasecmp(p, "HTML") == 0) ? HTML_Driver() :
+ PNG_Driver();
+
+ LIB_init(drv, 0, NULL);
+
+ init();
+
+ COM_Client_Open();
+
+ return 0;
+}
+
+void R__open_quiet(void)
+{
+}
+
+void R_stabilize(void)
+{
+ COM_Respond();
+}
+
+void R_close_driver(void)
+{
+ R_stabilize();
+ COM_Client_Close();
+}
+
+void R_flush(void)
+{
+ R_stabilize();
+}
+
+/*!
+ * \brief screen left edge
+ *
+ * Returns the coordinate of the left edge of the screen.
+ *
+ * \param void
+ * \return int
+ */
+
+int R_screen_left(void)
+{
+ int l;
+
+ COM_Screen_left(&l);
+
+ return l;
+}
+
+/*!
+ * \brief screen right edge
+ *
+ * Returns the coordinate of the right edge of the screen.
+ *
+ * \param void
+ * \return int
+ */
+
+int R_screen_rite(void)
+{
+ int r;
+
+ COM_Screen_rite(&r);
+
+ return r;
+}
+
+/*!
+ * \brief bottom of screen
+ *
+ * Returns the coordinate of the bottom of the screen.
+ *
+ * \param void
+ * \return int
+ */
+
+int R_screen_bot(void)
+{
+ int b;
+
+ COM_Screen_bot(&b);
+
+ return b;
+}
+
+
+/*!
+ * \brief top of screen
+ *
+ * Returns the coordinate of the top of the screen.
+ *
+ * \param void
+ * \return int
+ */
+
+int R_screen_top(void)
+{
+ int t;
+
+ COM_Screen_top(&t);
+
+ return t;
+}
+
+void R_get_num_colors(int *n)
+{
+ COM_Number_of_colors(n);
+}
+
+/*!
+ * \brief select standard color
+ *
+ * Selects the
+ * standard <b>color</b> to be used in subsequent draw commands. The
+ * <b>color</b> value is best retrieved using <i>D_translate_color.</i>
+ * See Display_Graphics_Library.
+ *
+ * \param index
+ * \return int
+ */
+
+void R_standard_color(int index)
+{
+ COM_Standard_color(index);
+}
+
+/*!
+ * \brief select color
+ *
+ * When in
+ * float mode (see <i>R_color_table_float</i>), this call selects the color
+ * most closely matched to the <b>red, grn</b>, and <b>blue</b> intensities
+ * requested. These values must be in the range of 0-255.
+ *
+ * \param red
+ * \param grn
+ * \param blue
+ * \return int
+ */
+
+void R_RGB_color(unsigned char red, unsigned char grn, unsigned char blu)
+{
+ COM_Color_RGB(red, grn, blu);
+}
+
+/*!
+ * \brief change the width of line
+ *
+ * Changes the <b>width</b> of line to be used in subsequent draw commands.
+ *
+ * \param width
+ * \return int
+ */
+
+void R_line_width(int width)
+{
+ COM_Line_width(width);
+}
+
+/*!
+ * \brief erase screen
+ *
+ * Erases the entire screen to black.
+ *
+ * \param void
+ * \return int
+ */
+
+void R_erase(void)
+{
+ COM_Erase();
+}
+
+/*!
+ * \brief move current location
+ *
+ * Move the current location to the absolute screen coordinate <b>x,y.</b>
+ * Nothing is drawn on the screen.
+ *
+ * \param x
+ * \param y
+ * \return int
+ */
+
+void R_move_abs(int x, int y)
+{
+ COM_Move_abs(x, y);
+}
+
+/*!
+ * \brief move current location
+ *
+ * Shift the current screen location by the values in <b>dx</b> and <b>dy</b>:
+ \code
+ Newx = Oldx + dx;
+ Newy = Oldy + dy;
+ \endcode
+ * Nothing is drawn on the screen.
+ *
+ * \param x dx
+ * \param y dy
+ * \return int
+ */
+
+void R_move_rel(int x, int y)
+{
+ COM_Move_rel(x, y);
+}
+
+/*!
+ * \brief draw line
+ *
+ * Draw a line using the current color, selected via <i>R_color</i>, from the
+ * current location to the location specified by <b>x,y.</b> The current location
+ * is updated to <b>x,y.</b>
+ *
+ * \param x
+ * \param y
+ * \return int
+ */
+
+void R_cont_abs(int x, int y)
+{
+ COM_Cont_abs(x, y);
+}
+
+/*!
+ * \brief draw line
+ *
+ * Draw a line using the
+ * current color, selected via <i>R_color</i>, from the current location to
+ * the relative location specified by <b>x</b> and <b>y.</b> The current
+ * location is updated:
+ \code
+ Newx = Oldx + x;
+ Newy = Oldy + y;
+ \endcode
+ *
+ * \param x
+ * \param y
+ * \return int
+ */
+
+void R_cont_rel(int x, int y)
+{
+ COM_Cont_rel(x, y);
+}
+
+/*!
+ * \brief draw a series of dots
+ *
+ * Pixels at the <b>num</b> absolute positions in the <b>x</b> and
+ * <b>y</b> arrays are turned to the current color. The current location is
+ * left updated to the position of the last dot.
+ *
+ * \param xarray x
+ * \param yarray y
+ * \param number
+ * \return int
+ */
+
+void R_polydots_abs(const int *xarray, const int *yarray, int number)
+{
+ COM_Polydots_abs(xarray, yarray, number);
+}
+
+/*!
+ * \brief draw a series of dots
+ *
+ * Pixels at the <b>number</b> relative positions in the <b>x</b> and
+ * <b>y</b> arrays are turned to the current color. The first position is
+ * relative to the starting current location; the succeeding positions are then
+ * relative to the previous position. The current location is updated to the
+ * position of the last dot.
+ *
+ * \param xarray x
+ * \param yarray y
+ * \param number
+ * \return int
+ */
+
+void R_polydots_rel(const int *xarray, const int *yarray, int number)
+{
+ COM_Polydots_rel(xarray, yarray, number);
+}
+
+/*!
+ * \brief draw an open polygon
+ *
+ * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b>
+ * arrays are used to generate a multisegment line (often curved). This line is
+ * drawn with the current color. The current location is left updated to the
+ * position of the last point.
+ * <b>Note.</b> It is not assumed that the line is closed, i.e., no line is
+ * drawn from the last point to the first point.
+ *
+ * \param xarray x
+ * \param yarray y
+ * \param number
+ * \return int
+ */
+
+void R_polyline_abs(const int *xarray, const int *yarray, int number)
+{
+ COM_Polyline_abs(xarray, yarray, number);
+}
+
+/*!
+ * \brief draw an open polygon
+ *
+ * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
+ * arrays are used to generate a multisegment line (often curved). The first
+ * position is relative to the starting current location; the succeeding
+ * positions are then relative to the previous position. The current location is
+ * updated to the position of the last point. This line is drawn with the current
+ * color.
+ * <b>Note.</b> No line is drawn between the last point and the first point.
+ *
+ * \param xarray x
+ * \param yarray y
+ * \param number
+ * \return int
+ */
+
+void R_polyline_rel(const int *xarray, const int *yarray, int number)
+{
+ COM_Polyline_rel(xarray, yarray, number);
+}
+
+/*!
+ * \brief draw a closed polygon
+ *
+ * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b> arrays
+ * outline a closed polygon which is filled with the current color. The current
+ * location is undefined afterwards.
+ *
+ * \param xarray x
+ * \param yarray y
+ * \param number
+ * \return int
+ */
+
+void R_polygon_abs(const int *xarray, const int *yarray, int number)
+{
+ COM_Polygon_abs(xarray, yarray, number);
+}
+
+/*!
+ * \brief draw a closed polygon
+ *
+ * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
+ * arrays outline a closed polygon which is filled with the current color. The
+ * first position is relative to the starting current location; the succeeding
+ * positions are then relative to the previous position. The current location is
+ * undefined afterwards.
+ *
+ * \param xarray x
+ * \param yarray y
+ * \param number
+ * \return int
+ */
+
+void R_polygon_rel(const int *xarray, const int *yarray, int number)
+{
+ COM_Polygon_rel(xarray, yarray, number);
+}
+
+/*!
+ * \brief fill a box
+ *
+ * A box is drawn in the current color using the coordinates <b>x1,y1</b> and
+ * <b>x2,y2</b> as opposite corners of the box. The current location is undefined
+ * afterwards
+ *
+ * \param x1
+ * \param y1
+ * \param x2
+ * \param y2
+ * \return int
+ */
+
+void R_box_abs(int x1, int y1, int x2, int y2)
+{
+ COM_Box_abs(x1, y1, x2, y2);
+}
+
+
+/*!
+ * \brief fill a box
+ *
+ * A box is drawn in the current color using the current location as one corner
+ * and the current location plus <b>x</b> and <b>y</b> as the opposite corner
+ * of the box. The current location is undefined afterwards.
+ *
+ * \param x
+ * \param y
+ * \return int
+ */
+
+void R_box_rel(int x, int y)
+{
+ COM_Box_rel(x, y);
+}
+
+/*!
+ * \brief set text size
+ *
+ * Sets text pixel width and height to <b>width</b> and <b>height.</b>
+ *
+ * \param width
+ * \param height
+ * \return int
+ */
+
+void R_text_size(int width, int height)
+{
+ COM_Text_size(width, height);
+}
+
+void R_text_rotation(float rotation)
+{
+ COM_Text_rotation(rotation);
+}
+
+/*!
+ * \brief set text clipping frame
+ *
+ * Subsequent calls to <i>R_text</i> will have text strings
+ * clipped to the screen frame defined by <b>top, bottom, left, right.</b>
+ *
+ * \param t top
+ * \param b bottom
+ * \param l left
+ * \param r right
+ * \return int
+ */
+
+void R_set_window(int t, int b, int l, int r)
+{
+ COM_Set_window(t, b, l, r);
+}
+
+/*!
+ * \brief write text
+ *
+ * Writes <b>text</b> in the current color and font, at the current text
+ * width and height, starting at the current screen location.
+ *
+ * \param sometext
+ * \return int
+ */
+
+void R_text(const char *text)
+{
+ COM_Text(text);
+}
+
+/*!
+ * \brief get text extents
+ *
+ * The extent of the area enclosing the <b>text</b>
+ * is returned in the integer pointers <b>top, bottom, left</b>, and
+ * <b>right.</b> No text is actually drawn. This is useful for capturing the
+ * text extent so that the text location can be prepared with proper background
+ * or border.
+ *
+ * \param sometext
+ * \param t top
+ * \param b bottom
+ * \param l left
+ * \param r right
+ * \return int
+ */
+
+void R_get_text_box(const char *text, int *t, int *b, int *l, int *r)
+{
+ COM_Get_text_box(text, t, b, l, r);
+}
+
+/*!
+ * \brief choose font
+ *
+ * Set current font to <b>font name</b>.
+ *
+ * \param name
+ * \return int
+ */
+
+void R_font(const char *name)
+{
+ COM_Font_get(name);
+}
+
+void R_charset(const char *name)
+{
+ COM_Font_init_charset(name);
+}
+
+void R_font_list(char ***list, int *count)
+{
+ COM_Font_list(list, count);
+}
+
+void R_font_info(char ***list, int *count)
+{
+ COM_Font_info(list, count);
+}
+
+void R_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
+{
+ COM_begin_scaled_raster(mask, src, dst);
+}
+
+int R_scaled_raster(int n, int row,
+ const unsigned char *red, const unsigned char *grn,
+ const unsigned char *blu, const unsigned char *nul)
+{
+ return COM_scaled_raster(n, row, red, grn, blu, nul);
+}
+
+void R_end_scaled_raster(void)
+{
+ COM_end_scaled_raster();
+}
+
+void R_bitmap(int ncols, int nrows, int threshold, const unsigned char *buf)
+{
+ COM_Bitmap(ncols, nrows, threshold, buf);
+}
Deleted: grass/trunk/lib/raster/rem_get.c
===================================================================
--- grass/trunk/lib/raster/rem_get.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/rem_get.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,98 +0,0 @@
-#include <grass/config.h>
-
-#ifdef HAVE_SOCKET
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "transport.h"
-
-/*!
- * \brief get mouse location using a box
- *
- * Identical to <i>R_get_location_with_line</i> except a rubber-band box is
- * used instead of a rubber-band line.
- * <b>button</b> is set to: 1 - left, 2 - middle, 3 - right
- *
- * \param cx
- * \param cy
- * \param wx
- * \param wy
- * \param button
- * \return ~
- */
-
-void REM_get_location_with_box(int cx, int cy, int *wx, int *wy, int *button)
-{
- _send_ident(GET_LOCATION_WITH_BOX);
- _send_int(&cx);
- _send_int(&cy);
- _send_int(wx);
- _send_int(wy);
- _get_int(wx);
- _get_int(wy);
- _get_int(button);
-}
-
-/*!
- * \brief get mouse location using a line
- *
- * Similar to <i>R_get_location_with_pointer</i> except the pointer is
- * replaced by a line which has one end fixed at the coordinate identified
- * by the <b>x,y</b> values. The other end of the line is initialized at the
- * coordinate identified by the <b>nx,ny</b> pointers. This end then tracks
- * the mouse until a button is pressed. The mouse button (1 for left, 2 for
- * middle, and 3 for right) is returned in the <b>button</b> pointer.
- *
- * \param cx
- * \param cy
- * \param wx
- * \param wy
- * \param button
- * \return ~
- */
-
-void REM_get_location_with_line(int cx, int cy, int *wx, int *wy, int *button)
-{
- _send_ident(GET_LOCATION_WITH_LINE);
- _send_int(&cx);
- _send_int(&cy);
- _send_int(wx);
- _send_int(wy);
- _get_int(wx);
- _get_int(wy);
- _get_int(button);
-}
-
-/*!
- * \brief get mouse location using pointer
- *
- * A cursor is put on the screen at the location specified by the coordinate
- * found at the <b>wx,wy</b> pointers. This cursor tracks the mouse (or
- * other pointing device) until one of three mouse buttons are pressed. Upon
- * pressing, the cursor is removed from the screen, the current mouse
- * coordinates are returned by the <b>wx</b> and <b>wy</b> pointers, and the
- * mouse button (1 for left, 2 for middle, and 3 for right) is returned in
- * the <b>button</b> pointer.
- *
- * \param wx
- * \param wy
- * \param button
- * \return ~
- */
-
-void REM_get_location_with_pointer(int *wx, int *wy, int *button)
-{
- *button = 0; /* ?, how button = -1 is used (see driver) */
-
- _send_ident(GET_LOCATION_WITH_POINTER);
- _send_int(wx);
- _send_int(wy);
- _send_int(button);
- _get_int(wx);
- _get_int(wy);
- _get_int(button);
-}
-
-#endif /* HAVE_SOCKET */
Deleted: grass/trunk/lib/raster/rem_io.c
===================================================================
--- grass/trunk/lib/raster/rem_io.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/rem_io.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,335 +0,0 @@
-#include <grass/config.h>
-
-#ifdef HAVE_SOCKET
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "transport.h"
-#include "open.h"
-
-#define BUFFERSIZ 2048
-
-int _rfd, _wfd;
-int _quiet;
-
-extern int unlock_driver(int);
-
-int sync_driver(char *);
-
-static unsigned char outbuf[BUFFERSIZ];
-static int cursiz;
-static volatile int no_mon;
-
-static RETSIGTYPE dead(int);
-
-static int _get(char *buf, int n)
-{
- int x;
-
- while (n > 0) {
- x = read(_rfd, buf, n);
- if (x <= 0) {
- fprintf(stderr, _("ERROR %s from graphics driver.\n"),
- x ? "reading" : "eof");
- exit(1);
- }
- n -= x;
- buf += x;
- }
-
- return 0;
-}
-
-static int flushout(void)
-{
- if (cursiz) {
- write(_wfd, outbuf, (size_t) cursiz);
- cursiz = 0;
- }
-
- return 0;
-}
-
-int _send_ident(int anint)
-{
- unsigned char achar;
-
- achar = anint;
-
- if ((cursiz + 2) >= BUFFERSIZ)
- flushout();
- outbuf[cursiz++] = COMMAND_ESC;
- outbuf[cursiz++] = achar;
-
- return 0;
-}
-
-int _send_char(const unsigned char *achar)
-{
- if ((cursiz + 2) >= BUFFERSIZ)
- flushout();
- outbuf[cursiz++] = *achar;
- if (*achar == COMMAND_ESC)
- outbuf[cursiz++] = 0;
-
- return 0;
-}
-
-int _send_char_array(int num, const unsigned char *achar)
-{
- while (num-- > 0)
- _send_char(achar++);
-
- return 0;
-}
-
-int _send_int_array(int num, const int *anint)
-{
- return _send_char_array(num * sizeof(int), (const unsigned char *)anint);
-}
-
-int _send_float_array(int num, const float *afloat)
-{
- return _send_char_array(num * sizeof(float),
- (const unsigned char *)afloat);
-}
-
-int _send_int(const int *anint)
-{
- return _send_char_array(sizeof(int), (const unsigned char *)anint);
-}
-
-int _send_float(const float *afloat)
-{
- return _send_char_array(sizeof(float), (const unsigned char *)afloat);
-}
-
-int _send_text(const char *text)
-{
- return _send_char_array(1 + strlen(text), (const unsigned char *)text);
-}
-
-int _get_char(char *achar)
-{
- flushout();
- _get(achar, 1);
-
- return 0;
-}
-
-int _get_int(int *anint)
-{
- flushout();
- _get((char *)anint, sizeof(int));
-
- return 0;
-}
-
-int _get_float(float *afloat)
-{
- flushout();
- _get((char *)afloat, sizeof(float));
-
- return 0;
-}
-
-int _get_text(char *buf)
-{
- char *b;
-
- b = buf;
- do
- _get_char(b);
- while (*b++ != 0);
-
- return 0;
-}
-
-char *_get_text_2(void)
-{
- static char *buf;
- static int len;
- int i;
-
- for (i = 0;; i++) {
- if (i >= len) {
- len += 1000;
- buf = G_realloc(buf, len);
- if (!buf) {
- fprintf(stderr, _("Unable to allocate memory\n"));
- exit(1);
- }
- }
- _get_char(&buf[i]);
- if (!buf[i])
- break;
- }
-
- return buf;
-}
-
-int REM__open_quiet(void)
-{
- _quiet = 1;
-
- return 0;
-}
-
-int sync_driver(char *name)
-{
-#ifndef __MINGW32__
- RETSIGTYPE(*sigalarm) (int);
-#endif
- int try;
- int count;
- unsigned char c;
-
- _send_ident(BEGIN);
- flushout();
-
- /*
- * look for at least BEGIN_SYNC_COUNT zero bytes
- * then look for COMMAND_ESC
- *
- * try twice. first timeout is warning, second is fatal
- */
- count = 0;
-#ifndef __MINGW32__
- sigalarm = signal(SIGALRM, dead);
-#endif
- for (try = 0; try < 2; try++) {
- no_mon = 0;
-#ifndef __MINGW32__
- alarm(try ? 10 : 5);
-#endif
- while (no_mon == 0) {
- if (read(_rfd, &c, (size_t) 1) != 1) {
- if (no_mon)
- break; /* from while */
- fprintf(stderr, _("ERROR - eof from graphics monitor.\n"));
- exit(-1);
- }
- if (c == 0)
- count++;
- else if (c == COMMAND_ESC && count >= BEGIN_SYNC_COUNT)
- break;
- else
- count = 0; /* start over */
- }
-#ifndef __MINGW32__
- alarm(0);
- signal(SIGALRM, sigalarm);
-#endif
- if (no_mon == 0)
- return 1; /* ok! */
- if (try)
- break;
-
- fprintf(stderr,
- _("Warning - no response from graphics monitor <%s>.\n"),
- name);
- fprintf(stderr, _("Check to see if the mouse is still active.\n"));
-#ifndef __MINGW32__
- signal(SIGALRM, dead);
-#endif
- }
- fprintf(stderr, _("ERROR - no response from graphics monitor <%s>.\n"),
- name);
- exit(-1);
-}
-
-static RETSIGTYPE dead(int sig)
-{
- no_mon = 1;
-}
-
-void _hold_signals(int hold)
-{
- static RETSIGTYPE(*sigint) (int);
-
-#ifdef SIGQUIT
- static RETSIGTYPE(*sigquit) (int);
-#endif
-
- if (hold) {
- sigint = signal(SIGINT, SIG_IGN);
-#ifdef SIGQUIT
- sigquit = signal(SIGQUIT, SIG_IGN);
-#endif
- }
- else {
- signal(SIGINT, sigint);
-#ifdef SIGQUIT
- signal(SIGQUIT, sigquit);
-#endif
- }
-}
-
-/*!
- * \brief synchronize graphics
- *
- * Send all pending graphics commands to the graphics driver and cause
- * all pending graphics to be drawn (provided the driver is written to
- * comply). This function is called automatically when the graphics driver
- * closes (<i>R_close_driver()</i>). Otherwise it only needs to be used
- * within a module for flushing interactive graphics.
- *
- * \param void
- * \return int
- */
-
-void REM_stabilize(void)
-{
- char c;
-
- flushout();
- _send_ident(RESPOND);
- _get_char(&c);
-}
-
-void REM_kill_driver(void)
-{
- char dummy;
-
- _send_ident(GRAPH_CLOSE);
- flushout();
- read(_rfd, &dummy, 1);
- R_release_driver();
-}
-
-/*!
- * \brief terminate graphics
- *
- * This routine breaks the connection with the graphics driver opened by R_open_driver().
- *
- * \param void
- * \return int
- */
-
-void REM_close_driver(void)
-{
- R_stabilize();
-
- close(_rfd);
- close(_wfd);
- _wfd = _rfd = -1;
-}
-
-void REM_release_driver(void)
-{
- close(_rfd);
- close(_wfd);
- _wfd = _rfd = -1;
-}
-
-#endif /* HAVE_SOCKET */
Deleted: grass/trunk/lib/raster/rem_pad.c
===================================================================
--- grass/trunk/lib/raster/rem_pad.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/rem_pad.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,215 +0,0 @@
-#include <grass/config.h>
-
-#ifdef HAVE_SOCKET
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "transport.h"
-
-/* PAD FUNCTIONS
- The monitor has a very simple database management capabil
- ity which supports the windowing. There are scratch pads
- to be written on. Each scratch pad can contain items, and
- each item can have a list of values. These are NOT to be
- used by the programmer. They are used indirectly through
- the displaylib library calls.
- */
-
-static void _get_list(char ***list, int *count)
-{
- char **a;
- int n;
- char *buf;
-
- *list = NULL;
- *count = 0;
-
- buf = _get_text_2();
-
- for (n = 0; *buf; n++) {
- if (n == 0)
- a = G_malloc(sizeof(char *));
- else
- a = G_realloc(a, (n + 1) * sizeof(char *));
-
- a[n] = G_strdup(buf);
-
- buf = _get_text_2();
- }
-
- *list = a;
- *count = n;
-}
-
-int REM_pad_create(const char *pad)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_CREATE);
- _send_text(pad);
- _get_char(&result);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_current(char *name)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_CURRENT);
- _get_char(&result);
- _get_text(name);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_delete(void)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_DELETE);
- _get_char(&result);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_invent(char *pad)
-{
- _hold_signals(1);
-
- _send_ident(PAD_INVENT);
- _get_text(pad);
-
- _hold_signals(0);
-
- return 0;
-}
-
-int REM_pad_list(char ***list, int *count)
-{
- _hold_signals(1);
-
- _send_ident(PAD_LIST);
- _get_list(list, count);
-
- _hold_signals(0);
-
- return 0;
-}
-
-int REM_pad_select(const char *pad)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_SELECT);
- _send_text(pad);
- _get_char(&result);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_append_item(const char *item, const char *value, int replace)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_APPEND_ITEM);
- _send_text(item);
- _send_text(value);
- _send_int(&replace);
- _get_char(&result);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_delete_item(const char *name)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_DELETE_ITEM);
- _send_text(name);
- _get_char(&result);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_get_item(const char *item, char ***list, int *count)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_GET_ITEM);
- _send_text(item);
- _get_char(&result);
-
- if (result == OK)
- _get_list(list, count);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_list_items(char ***list, int *count)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_LIST_ITEMS);
- _get_char(&result);
- if (result == OK)
- _get_list(list, count);
-
- _hold_signals(0);
-
- return result;
-}
-
-int REM_pad_set_item(const char *item, const char *value)
-{
- char result;
-
- _hold_signals(1);
-
- _send_ident(PAD_SET_ITEM);
- _send_text(item);
- _send_text(value);
- _get_char(&result);
-
- _hold_signals(0);
-
- return result;
-}
-
-#endif /* HAVE_SOCKET */
Deleted: grass/trunk/lib/raster/rem_proto.c
===================================================================
--- grass/trunk/lib/raster/rem_proto.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/rem_proto.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,639 +0,0 @@
-#include <grass/config.h>
-
-#ifdef HAVE_SOCKET
-
-#include <stdio.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/graphics.h>
-
-#include "transport.h"
-
-/*!
- * \brief screen left edge
- *
- * Returns the coordinate of the left edge of the screen.
- *
- * \param void
- * \return int
- */
-
-int REM_screen_left(void)
-{
- int l;
-
- _send_ident(SCREEN_LEFT);
- _get_int(&l);
- return l;
-}
-
-/*!
- * \brief screen right edge
- *
- * Returns the coordinate of the right edge of the screen.
- *
- * \param void
- * \return int
- */
-
-int REM_screen_rite(void)
-{
- int r;
-
- _send_ident(SCREEN_RITE);
- _get_int(&r);
- return r;
-}
-
-
-/*!
- * \brief bottom of screen
- *
- * Returns the coordinate of the bottom of the screen.
- *
- * \param void
- * \return int
- */
-
-int REM_screen_bot(void)
-{
- int b;
-
- _send_ident(SCREEN_BOT);
- _get_int(&b);
- return b;
-}
-
-
-/*!
- * \brief top of screen
- *
- * Returns the coordinate of the top of the screen.
- *
- * \param void
- * \return int
- */
-
-int REM_screen_top(void)
-{
- int t;
-
- _send_ident(SCREEN_TOP);
- _get_int(&t);
- return t;
-}
-
-void REM_get_num_colors(int *n)
-{
- _send_ident(GET_NUM_COLORS);
- _get_int(n);
-}
-
-/*!
- * \brief select standard color
- *
- * Selects the
- * standard <b>color</b> to be used in subsequent draw commands. The
- * <b>color</b> value is best retrieved using <i>D_translate_color.</i>
- * See Display_Graphics_Library.
- *
- * \param index
- */
-
-void REM_standard_color(int index)
-{
- _send_ident(STANDARD_COLOR);
- _send_int(&index);
-}
-
-/*!
- * \brief select color
- *
- * When in
- * float mode (see <i>R_color_table_float</i>), this call selects the color
- * most closely matched to the <b>red, grn</b>, and <b>blue</b> intensities
- * requested. These values must be in the range of 0-255.
- *
- * \param red
- * \param grn
- * \param blue
- */
-
-void REM_RGB_color(unsigned char red, unsigned char grn, unsigned char blu)
-{
- _send_ident(RGB_COLOR);
- _send_char(&red);
- _send_char(&grn);
- _send_char(&blu);
-}
-
-/*!
- * \brief change the width of line
- *
- * Changes the <b>width</b> of line to be used in subsequent draw commands.
- *
- * \param width
- */
-
-void REM_line_width(int width)
-{
- _send_ident(LINE_WIDTH);
- _send_int(&width);
-}
-
-/*!
- * \brief erase screen
- *
- * Erases the entire screen to black.
- *
- * \param void
- */
-
-void REM_erase(void)
-{
- _send_ident(ERASE);
-}
-
-/*!
- * \brief move current location
- *
- * Move the current location to the absolute screen coordinate <b>x,y.</b>
- * Nothing is drawn on the screen.
- *
- * \param x
- * \param y
- */
-
-void REM_move_abs(int x, int y)
-{
- _send_ident(MOVE_ABS);
- _send_int(&x);
- _send_int(&y);
-}
-
-/*!
- * \brief move current location
- *
- * Shift the current screen location by the values in <b>dx</b> and <b>dy</b>:
- \code
- Newx = Oldx + dx;
- Newy = Oldy + dy;
- \endcode
- * Nothing is drawn on the screen.
- *
- * \param x dx
- * \param y dy
- */
-
-void REM_move_rel(int x, int y)
-{
- _send_ident(MOVE_REL);
- _send_int(&x);
- _send_int(&y);
-}
-
-/*!
- * \brief draw line
- *
- * Draw a line using the current color, selected via <i>R_color</i>, from the
- * current location to the location specified by <b>x,y.</b> The current location
- * is updated to <b>x,y.</b>
- *
- * \param x
- * \param y
- */
-
-void REM_cont_abs(int x, int y)
-{
- _send_ident(CONT_ABS);
- _send_int(&x);
- _send_int(&y);
-}
-
-/*!
- * \brief draw line
- *
- * Draw a line using the
- * current color, selected via <i>R_color</i>, from the current location to
- * the relative location specified by <b>x</b> and <b>y.</b> The current
- * location is updated:
- \code
- Newx = Oldx + x;
- Newy = Oldy + y;
- \endcode
- *
- * \param x
- * \param y
- */
-
-void REM_cont_rel(int x, int y)
-{
- _send_ident(CONT_REL);
- _send_int(&x);
- _send_int(&y);
-}
-
-/*!
- * \brief draw a series of dots
- *
- * Pixels at the <b>num</b> absolute positions in the <b>x</b> and
- * <b>y</b> arrays are turned to the current color. The current location is
- * left updated to the position of the last dot.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- */
-
-void REM_polydots_abs(const int *xarray, const int *yarray, int number)
-{
- _send_ident(POLYDOTS_ABS);
- _send_int(&number);
- _send_int_array(number, xarray);
- _send_int_array(number, yarray);
-}
-
-/*!
- * \brief draw a series of dots
- *
- * Pixels at the <b>number</b> relative positions in the <b>x</b> and
- * <b>y</b> arrays are turned to the current color. The first position is
- * relative to the starting current location; the succeeding positions are then
- * relative to the previous position. The current location is updated to the
- * position of the last dot.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- */
-
-void REM_polydots_rel(const int *xarray, const int *yarray, int number)
-{
- _send_ident(POLYDOTS_REL);
- _send_int(&number);
- _send_int_array(number, xarray);
- _send_int_array(number, yarray);
-}
-
-/*!
- * \brief draw an open polygon
- *
- * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b>
- * arrays are used to generate a multisegment line (often curved). This line is
- * drawn with the current color. The current location is left updated to the
- * position of the last point.
- * <b>Note.</b> It is not assumed that the line is closed, i.e., no line is
- * drawn from the last point to the first point.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- */
-
-void REM_polyline_abs(const int *xarray, const int *yarray, int number)
-{
- _send_ident(POLYLINE_ABS);
- _send_int(&number);
- _send_int_array(number, xarray);
- _send_int_array(number, yarray);
-}
-
-/*!
- * \brief draw an open polygon
- *
- * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
- * arrays are used to generate a multisegment line (often curved). The first
- * position is relative to the starting current location; the succeeding
- * positions are then relative to the previous position. The current location is
- * updated to the position of the last point. This line is drawn with the current
- * color.
- * <b>Note.</b> No line is drawn between the last point and the first point.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- */
-
-void REM_polyline_rel(const int *xarray, const int *yarray, int number)
-{
- _send_ident(POLYLINE_REL);
- _send_int(&number);
- _send_int_array(number, xarray);
- _send_int_array(number, yarray);
-}
-
-/*!
- * \brief draw a closed polygon
- *
- * The <b>number</b> absolute positions in the <b>x</b> and <b>y</b> arrays
- * outline a closed polygon which is filled with the current color. The current
- * location is undefined afterwards.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- */
-
-void REM_polygon_abs(const int *xarray, const int *yarray, int number)
-{
- _send_ident(POLYGON_ABS);
- _send_int(&number);
- _send_int_array(number, xarray);
- _send_int_array(number, yarray);
-}
-
-/*!
- * \brief draw a closed polygon
- *
- * The <b>number</b> relative positions in the <b>x</b> and <b>y</b>
- * arrays outline a closed polygon which is filled with the current color. The
- * first position is relative to the starting current location; the succeeding
- * positions are then relative to the previous position. The current location is
- * undefined afterwards.
- *
- * \param xarray x
- * \param yarray y
- * \param number
- */
-
-void REM_polygon_rel(const int *xarray, const int *yarray, int number)
-{
- _send_ident(POLYGON_REL);
- _send_int(&number);
- _send_int_array(number, xarray);
- _send_int_array(number, yarray);
-}
-
-/*!
- * \brief fill a box
- *
- * A box is drawn in the current color using the coordinates <b>x1,y1</b> and
- * <b>x2,y2</b> as opposite corners of the box. The current location is undefined
- * afterwards
- *
- * \param x1
- * \param y1
- * \param x2
- * \param y2
- */
-
-void REM_box_abs(int x1, int y1, int x2, int y2)
-{
- _send_ident(BOX_ABS);
- _send_int(&x1);
- _send_int(&y1);
- _send_int(&x2);
- _send_int(&y2);
-}
-
-
-/*!
- * \brief fill a box
- *
- * A box is drawn in the current color using the current location as one corner
- * and the current location plus <b>x</b> and <b>y</b> as the opposite corner
- * of the box. The current location is undefined afterwards.
- *
- * \param x
- * \param y
- */
-
-void REM_box_rel(int x, int y)
-{
- _send_ident(BOX_REL);
- _send_int(&x);
- _send_int(&y);
-}
-
-/*!
- * \brief set text size
- *
- * Sets text pixel width and height to <b>width</b> and <b>height.</b>
- *
- * \param width
- * \param height
- */
-
-void REM_text_size(int width, int height)
-{
- _send_ident(TEXT_SIZE);
- _send_int(&width);
- _send_int(&height);
-}
-
-void REM_text_rotation(float rotation)
-{
- _send_ident(TEXT_ROTATION);
- _send_float(&rotation);
-}
-
-/*!
- * \brief set text clipping frame
- *
- * Subsequent calls to <i>R_text</i> will have text strings
- * clipped to the screen frame defined by <b>top, bottom, left, right.</b>
- *
- * \param t top
- * \param b bottom
- * \param l left
- * \param r right
- */
-
-void REM_set_window(int t, int b, int l, int r)
-{
- _send_ident(SET_WINDOW);
- _send_int(&t);
- _send_int(&b);
- _send_int(&l);
- _send_int(&r);
-}
-
-/*!
- * \brief write text
- *
- * Writes <b>text</b> in the current color and font, at the current text
- * width and height, starting at the current screen location.
- *
- * \param sometext
- */
-
-void REM_text(const char *sometext)
-{
- _send_ident(TEXT);
- _send_text(sometext);
-}
-
-/*!
- * \brief get text extents
- *
- * The extent of the area enclosing the <b>text</b>
- * is returned in the integer pointers <b>top, bottom, left</b>, and
- * <b>right.</b> No text is actually drawn. This is useful for capturing the
- * text extent so that the text location can be prepared with proper background
- * or border.
- *
- * \param sometext
- * \param t top
- * \param b bottom
- * \param l left
- * \param r right
- */
-
-void REM_get_text_box(const char *sometext, int *t, int *b, int *l, int *r)
-{
- _send_ident(GET_TEXT_BOX);
- _send_text(sometext);
- _get_int(t);
- _get_int(b);
- _get_int(l);
- _get_int(r);
-}
-
-/*!
- * \brief choose font
- *
- * Set current font to <b>font name</b>. Available fonts are:
- *
- <table>
- <tr><td><b>Font Name</b></td><td><b>Description</b></td></tr>
- <tr><td>cyrilc </td><td> cyrillic</td></tr>
- <tr><td>gothgbt </td><td> Gothic Great Britain triplex</td></tr>
- <tr><td>gothgrt </td><td> Gothic German triplex</td></tr>
- <tr><td>gothitt </td><td> Gothic Italian triplex</td></tr>
- <tr><td>greekc </td><td> Greek complex</td></tr>
- <tr><td>greekcs </td><td> Greek complex script</td></tr>
- <tr><td>greekp </td><td> Greek plain</td></tr>
- <tr><td>greeks </td><td> Greek simplex</td></tr>
- <tr><td>italicc </td><td> Italian complex</td></tr>
- <tr><td>italiccs </td><td> Italian complex small</td></tr>
- <tr><td>italict </td><td> Italian triplex</td></tr>
- <tr><td>romanc </td><td> Roman complex</td></tr>
- <tr><td>romancs </td><td> Roman complex small</td></tr>
- <tr><td>romand </td><td> Roman duplex</td></tr>
- <tr><td>romanp </td><td> Roman plain</td></tr>
- <tr><td>romans </td><td> Roman simplex</td></tr>
- <tr><td>romant </td><td> Roman triplex</td></tr>
- <tr><td>scriptc </td><td> Script complex</td></tr>
- <tr><td>scripts </td><td> Script simplex</td></tr>
- </table>
- *
- * \param name
- */
-
-void REM_font(const char *name)
-{
- _send_ident(FONT);
- _send_text(name);
-}
-
-void REM_charset(const char *name)
-{
- _send_ident(CHARSET);
- _send_text(name);
-}
-
-static void font_list(char ***list, int *count, int op)
-{
- char **fonts;
- int num_fonts;
- int i;
-
- _send_ident(op);
- _get_int(&num_fonts);
-
- fonts = G_malloc(num_fonts * sizeof(char *));
- for (i = 0; i < num_fonts; i++)
- fonts[i] = G_store(_get_text_2());
-
- *list = fonts;
- *count = num_fonts;
-}
-
-void REM_font_list(char ***list, int *count)
-{
- font_list(list, count, FONT_LIST);
-}
-
-void REM_font_info(char ***list, int *count)
-{
- font_list(list, count, FONT_INFO);
-}
-
-void REM_panel_save(const char *name, int t, int b, int l, int r)
-{
- close(creat(name, 0666));
-
- _send_ident(PANEL_SAVE);
- _send_text(name);
- _send_int(&t);
- _send_int(&b);
- _send_int(&l);
- _send_int(&r);
- R_stabilize();
-}
-
-void REM_panel_restore(const char *name)
-{
- _send_ident(PANEL_RESTORE);
- _send_text(name);
- R_stabilize();
-}
-
-void REM_panel_delete(const char *name)
-{
- _send_ident(PANEL_DELETE);
- _send_text(name);
- R_stabilize();
-
- unlink(name);
-}
-
-void REM_begin_scaled_raster(int mask, int src[2][2], int dst[2][2])
-{
- _send_ident(BEGIN_SCALED_RASTER);
- _send_int(&mask);
- _send_int_array(4, &src[0][0]);
- _send_int_array(4, &dst[0][0]);
-}
-
-int REM_scaled_raster(int n, int row,
- const unsigned char *red, const unsigned char *grn,
- const unsigned char *blu, const unsigned char *nul)
-{
- int z = !!nul;
- int t;
-
- _send_ident(SCALED_RASTER);
- _send_int(&n);
- _send_int(&row);
- _send_char_array(n, red);
- _send_char_array(n, grn);
- _send_char_array(n, blu);
- _send_char_array(n, nul ? nul : red);
- _send_int(&z);
- _get_int(&t);
- return t;
-}
-
-void REM_end_scaled_raster(void)
-{
- _send_ident(END_SCALED_RASTER);
-}
-
-void REM_bitmap(int ncols, int nrows, int threshold, const unsigned char *buf)
-{
- _send_ident(BITMAP);
- _send_int(&ncols);
- _send_int(&nrows);
- _send_int(&threshold);
- _send_char_array(ncols * nrows, buf);
-}
-
-#endif /* HAVE_SOCKET */
Deleted: grass/trunk/lib/raster/transport.h
===================================================================
--- grass/trunk/lib/raster/transport.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/lib/raster/transport.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -1,215 +0,0 @@
-
-#ifndef _TRANSPORT_H
-#define _TRANSPORT_H
-
-extern void LOC_get_location_with_box(int cx, int cy, int *wx, int *wy,
- int *button);
-extern void LOC_get_location_with_line(int cx, int cy, int *wx, int *wy,
- int *button);
-extern void LOC_get_location_with_pointer(int *wx, int *wy, int *button);
-extern int LOC_open_driver(void);
-extern int LOC__open_quiet(void);
-extern void LOC_stabilize(void);
-extern void LOC_kill_driver(void);
-extern void LOC_close_driver(void);
-extern void LOC_release_driver(void);
-extern int LOC_pad_create(const char *pad);
-extern int LOC_pad_current(char *name);
-extern int LOC_pad_delete(void);
-extern int LOC_pad_invent(char *pad);
-extern int LOC_pad_list(char ***list, int *count);
-extern int LOC_pad_select(const char *pad);
-extern int LOC_pad_append_item(const char *item, const char *value,
- int replace);
-extern int LOC_pad_delete_item(const char *name);
-extern int LOC_pad_get_item(const char *name, char ***list, int *count);
-extern int LOC_pad_list_items(char ***list, int *count);
-extern int LOC_pad_set_item(const char *name, const char *value);
-extern int LOC_screen_left(void);
-extern int LOC_screen_rite(void);
-extern int LOC_screen_bot(void);
-extern int LOC_screen_top(void);
-extern void LOC_get_num_colors(int *n);
-extern void LOC_standard_color(int index);
-extern void LOC_RGB_color(unsigned char red, unsigned char grn,
- unsigned char blu);
-extern void LOC_line_width(int width);
-extern void LOC_erase(void);
-extern void LOC_move_abs(int x, int y);
-extern void LOC_move_rel(int x, int y);
-extern void LOC_cont_abs(int x, int y);
-extern void LOC_cont_rel(int x, int y);
-extern void LOC_polydots_abs(const int *xarray, const int *yarray,
- int number);
-extern void LOC_polydots_rel(const int *xarray, const int *yarray,
- int number);
-extern void LOC_polyline_abs(const int *xarray, const int *yarray,
- int number);
-extern void LOC_polyline_rel(const int *xarray, const int *yarray,
- int number);
-extern void LOC_polygon_abs(const int *xarray, const int *yarray, int number);
-extern void LOC_polygon_rel(const int *xarray, const int *yarray, int number);
-extern void LOC_box_abs(int x1, int y1, int x2, int y2);
-extern void LOC_box_rel(int x, int y);
-extern void LOC_text_size(int width, int height);
-extern void LOC_text_rotation(float rotation);
-extern void LOC_set_window(int t, int b, int l, int r);
-extern void LOC_text(const char *text);
-extern void LOC_get_text_box(const char *text, int *t, int *b, int *l,
- int *r);
-extern void LOC_font(const char *name);
-extern void LOC_charset(const char *name);
-extern void LOC_font_list(char ***list, int *count);
-extern void LOC_font_info(char ***list, int *count);
-extern void LOC_panel_save(const char *name, int t, int b, int l, int r);
-extern void LOC_panel_restore(const char *name);
-extern void LOC_panel_delete(const char *name);
-extern void LOC_begin_scaled_raster(int mask, int src[2][2], int dst[2][2]);
-extern int LOC_scaled_raster(int n, int row, const unsigned char *red,
- const unsigned char *grn,
- const unsigned char *blu,
- const unsigned char *nul);
-extern void LOC_end_scaled_raster(void);
-extern void LOC_bitmap(int ncols, int nrows, int threshold,
- const unsigned char *buf);
-
-extern void REM_get_location_with_box(int cx, int cy, int *wx, int *wy,
- int *button);
-extern void REM_get_location_with_line(int cx, int cy, int *wx, int *wy,
- int *button);
-extern void REM_get_location_with_pointer(int *wx, int *wy, int *button);
-extern int REM_open_driver(void);
-extern int REM__open_quiet(void);
-extern void REM_stabilize(void);
-extern void REM_kill_driver(void);
-extern void REM_close_driver(void);
-extern void REM_release_driver(void);
-extern int REM_pad_create(const char *pad);
-extern int REM_pad_current(char *name);
-extern int REM_pad_delete(void);
-extern int REM_pad_invent(char *pad);
-extern int REM_pad_list(char ***list, int *count);
-extern int REM_pad_select(const char *pad);
-extern int REM_pad_append_item(const char *item, const char *value,
- int replace);
-extern int REM_pad_delete_item(const char *name);
-extern int REM_pad_get_item(const char *name, char ***list, int *count);
-extern int REM_pad_list_items(char ***list, int *count);
-extern int REM_pad_set_item(const char *name, const char *value);
-extern int REM_screen_left(void);
-extern int REM_screen_rite(void);
-extern int REM_screen_bot(void);
-extern int REM_screen_top(void);
-extern void REM_get_num_colors(int *n);
-extern void REM_standard_color(int index);
-extern void REM_RGB_color(unsigned char red, unsigned char grn,
- unsigned char blu);
-extern void REM_line_width(int width);
-extern void REM_erase(void);
-extern void REM_move_abs(int x, int y);
-extern void REM_move_rel(int x, int y);
-extern void REM_cont_abs(int x, int y);
-extern void REM_cont_rel(int x, int y);
-extern void REM_polydots_abs(const int *xarray, const int *yarray,
- int number);
-extern void REM_polydots_rel(const int *xarray, const int *yarray,
- int number);
-extern void REM_polyline_abs(const int *xarray, const int *yarray,
- int number);
-extern void REM_polyline_rel(const int *xarray, const int *yarray,
- int number);
-extern void REM_polygon_abs(const int *xarray, const int *yarray, int number);
-extern void REM_polygon_rel(const int *xarray, const int *yarray, int number);
-extern void REM_box_abs(int x1, int y1, int x2, int y2);
-extern void REM_box_rel(int x, int y);
-extern void REM_text_size(int width, int height);
-extern void REM_text_rotation(float rotation);
-extern void REM_set_window(int t, int b, int l, int r);
-extern void REM_text(const char *text);
-extern void REM_get_text_box(const char *text, int *t, int *b, int *l,
- int *r);
-extern void REM_font(const char *name);
-extern void REM_charset(const char *name);
-extern void REM_font_list(char ***list, int *count);
-extern void REM_font_info(char ***list, int *count);
-extern void REM_panel_save(const char *name, int t, int b, int l, int r);
-extern void REM_panel_restore(const char *name);
-extern void REM_panel_delete(const char *name);
-extern void REM_begin_scaled_raster(int mask, int src[2][2], int dst[2][2]);
-extern int REM_scaled_raster(int n, int row, const unsigned char *red,
- const unsigned char *grn,
- const unsigned char *blu,
- const unsigned char *nul);
-extern void REM_end_scaled_raster(void);
-extern void REM_bitmap(int ncols, int nrows, int threshold,
- const unsigned char *buf);
-
-struct transport
-{
- int (*open_driver) (void);
- int (*open_quiet) (void);
- void (*stabilize) (void);
- void (*kill_driver) (void);
- void (*close_driver) (void);
- void (*release_driver) (void);
-
- int (*screen_left) (void);
- int (*screen_rite) (void);
- int (*screen_bot) (void);
- int (*screen_top) (void);
- void (*get_num_colors) (int *);
- void (*standard_color) (int);
- void (*RGB_color) (unsigned char, unsigned char, unsigned char);
- void (*line_width) (int);
- void (*erase) (void);
- void (*move_abs) (int, int);
- void (*move_rel) (int, int);
- void (*cont_abs) (int, int);
- void (*cont_rel) (int, int);
- void (*polydots_abs) (const int *, const int *, int);
- void (*polydots_rel) (const int *, const int *, int);
- void (*polyline_abs) (const int *, const int *, int);
- void (*polyline_rel) (const int *, const int *, int);
- void (*polygon_abs) (const int *, const int *, int);
- void (*polygon_rel) (const int *, const int *, int);
- void (*box_abs) (int, int, int, int);
- void (*box_rel) (int, int);
- void (*text_size) (int, int);
- void (*text_rotation) (float);
- void (*set_window) (int, int, int, int);
- void (*text) (const char *);
- void (*get_text_box) (const char *, int *, int *, int *, int *);
- void (*font) (const char *);
- void (*charset) (const char *);
- void (*font_list) (char ***, int *);
- void (*font_info) (char ***, int *);
- void (*panel_save) (const char *, int, int, int, int);
- void (*panel_restore) (const char *);
- void (*panel_delete) (const char *);
- void (*begin_scaled_raster) (int, int[2][2], int[2][2]);
- int (*scaled_raster) (int, int, const unsigned char *,
- const unsigned char *, const unsigned char *,
- const unsigned char *);
- void (*end_scaled_raster) (void);
- void (*bitmap) (int, int, int, const unsigned char *);
-
- void (*get_location_with_box) (int, int, int *, int *, int *);
- void (*get_location_with_line) (int, int, int *, int *, int *);
- void (*get_location_with_pointer) (int *, int *, int *);
-
- int (*pad_create) (const char *);
- int (*pad_current) (char *);
- int (*pad_delete) (void);
- int (*pad_invent) (char *);
- int (*pad_list) (char ***, int *);
- int (*pad_select) (const char *);
- int (*pad_append_item) (const char *, const char *, int);
- int (*pad_delete_item) (const char *);
- int (*pad_get_item) (const char *, char ***, int *);
- int (*pad_list_items) (char ***, int *);
- int (*pad_set_item) (const char *, const char *);
-};
-
-extern const struct transport *trans;
-
-#endif /* _TRANSPORT_H */
Modified: grass/trunk/raster/r.profile/local_proto.h
===================================================================
--- grass/trunk/raster/r.profile/local_proto.h 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/raster/r.profile/local_proto.h 2008-08-06 21:50:17 UTC (rev 32584)
@@ -3,8 +3,6 @@
#include <string.h>
#include <math.h>
#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/raster.h>
#include <grass/glocale.h>
/* main.c */
@@ -18,10 +16,5 @@
/* input.c */
int input(char *, char *, char *, char *, char *);
-#ifdef MAIN
-int clr;
-struct Colors colors;
-#else
extern int clr;
extern struct Colors colors;
-#endif
Modified: grass/trunk/raster/r.profile/main.c
===================================================================
--- grass/trunk/raster/r.profile/main.c 2008-08-06 21:37:41 UTC (rev 32583)
+++ grass/trunk/raster/r.profile/main.c 2008-08-06 21:50:17 UTC (rev 32584)
@@ -11,15 +11,12 @@
#include <grass/gis.h>
#include <grass/glocale.h>
-#define MAIN
#include "local_proto.h"
+int clr;
+struct Colors colors;
+
static double dist, e, n;
-static int min_range[5], max_range[5];
-static int which_range;
-static int change_range;
-static int move(int, int);
-static int cont(int, int);
int main(int argc, char *argv[])
@@ -27,7 +24,6 @@
char *name, *outfile, *mapset;
int fd, projection;
FILE *fp;
- int screen_x, screen_y, button;
double res;
char *null_string;
char ebuf[256], nbuf[256], label[512], formatbuff[256];
@@ -41,7 +37,7 @@
struct
{
struct Option *opt1, *profile, *res, *output, *null_str;
- struct Flag *i, *g, *c;
+ struct Flag *g, *c;
}
parm;
struct GModule *module;
@@ -88,10 +84,6 @@
parm.null_str->answer = "*";
parm.null_str->description = _("Character to represent no data cell");
- parm.i = G_define_flag();
- parm.i->key = 'i';
- parm.i->description = _("Interactively select End-Points");
-
parm.g = G_define_flag();
parm.g->key = 'g';
parm.g->description =
@@ -126,8 +118,6 @@
/* Do average of EW and NS res */
res = (window.ew_res + window.ns_res) / 2;
}
- screen_x = ((int)D_get_d_west() + (int)D_get_d_east()) / 2;
- screen_y = ((int)D_get_d_north() + (int)D_get_d_south()) / 2;
G_message(_("Using resolution [%g]"), res);
@@ -162,18 +152,6 @@
data_type = G_get_raster_map_type(fd);
/* Done with file */
- /* Get coords */
- if (parm.i->answer) {
- R_open_driver();
- D_setup(0);
-
- G_setup_plot(D_get_d_north(),
- D_get_d_south(),
- D_get_d_west(), D_get_d_east(), move, cont);
-
- R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
- }
-
/* Show message giving output format */
G_message(_("Output Format:"));
if (coords == 1)
@@ -186,7 +164,7 @@
G_message(formatbuff);
/* Get Profile Start Coords */
- if (!parm.profile->answer && !parm.i->answer) {
+ if (!parm.profile->answer) {
/* Assume input from stdin */
for (n = 1; input(b1, ebuf, b2, nbuf, label); n++) {
G_debug(4, "stdin line %d: ebuf=[%s] nbuf=[%s]", n, ebuf, nbuf);
@@ -202,50 +180,6 @@
havefirst = TRUE;
}
}
- else if (parm.i->answer) {
- /* Select points interactively */
-
- dist = 0;
-
- fprintf(stderr, "\n\n");
- fprintf(stderr, _("Use mouse to select Start Point\n"));
- R_get_location_with_pointer(&screen_x, &screen_y, &button);
- e1 = D_d_to_u_col((double)screen_x);
- n1 = D_d_to_u_row((double)screen_y);
-
- fprintf(stderr, _("\nUse mouse to draw profile line\n"));
- fprintf(stderr, _("Buttons:\n"));
- fprintf(stderr, _("Left: Mark next point\n"));
- fprintf(stderr, _("Middle: Mark next point\n"));
- fprintf(stderr, _("Right: Finish profile and exit\n\n"));
-
- while (button != 3) {
- R_get_location_with_line((int)(0.5 + D_u_to_d_col(e1)),
- (int)(0.5 + D_u_to_d_row(n1)), &screen_x,
- &screen_y, &button);
-
- if (button == 1 || button == 2) {
- e2 = D_d_to_u_col((double)screen_x);
- n2 = D_d_to_u_row((double)screen_y);
- }
- else {
- break;
- }
-
- /* draw line from p1 to p2 */
- G_plot_line(e1, n1, e2, n2);
-
- /* Get profile info */
- do_profile(e1, e2, n1, n2, name, coords, res, fd, data_type, fp,
- null_string);
-
- n1 = n2;
- e1 = e2;
- R_stabilize();
- }
-
- R_close_driver();
- }
else {
/* Coords from Command Line */
for (i = 0; parm.profile->answers[i]; i += 2) {
@@ -402,32 +336,3 @@
return 0;
} /* done with do_profile */
-static int move(int x, int y)
-{
- D_move_abs(x, y);
-
- return 0;
-}
-
-static int cont(int x, int y)
-{
- if (D_cont_abs(x, y)) { /* clipped */
- change_range = 1;
- }
- else { /* keep track of left,right x for lines drawn in window */
-
- if (change_range) {
- which_range++;
- min_range[which_range] = max_range[which_range] = x;
- change_range = 0;
- }
- else {
- if (x < min_range[which_range])
- min_range[which_range] = x;
- else if (x > max_range[which_range])
- max_range[which_range] = x;
- }
- }
-
- return 0;
-}
More information about the grass-commit
mailing list