Просмотр исходного кода

remove obsolete i.class

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62464 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 лет назад
Родитель
Сommit
60431d26d5
43 измененных файлов с 0 добавлено и 3912 удалено
  1. 0 10
      imagery/i.class/Makefile
  2. 0 43
      imagery/i.class/add_point.c
  3. 0 48
      imagery/i.class/analyze_sig.c
  4. 0 42
      imagery/i.class/band_files.c
  5. 0 22
      imagery/i.class/cellhd.c
  6. 0 22
      imagery/i.class/complete_reg.c
  7. 0 41
      imagery/i.class/conv.c
  8. 0 258
      imagery/i.class/curses.c
  9. 0 32
      imagery/i.class/define_reg.c
  10. 0 111
      imagery/i.class/defs.h
  11. 0 40
      imagery/i.class/del_point.c
  12. 0 59
      imagery/i.class/draw_cell.c
  13. 0 103
      imagery/i.class/draw_reg.c
  14. 0 54
      imagery/i.class/driver.c
  15. 0 28
      imagery/i.class/edge.c
  16. 0 19
      imagery/i.class/edge_order.c
  17. 0 12
      imagery/i.class/edge_point.c
  18. 0 16
      imagery/i.class/erase_reg.c
  19. 0 28
      imagery/i.class/g_init.c
  20. 0 77
      imagery/i.class/globals.h
  21. 0 111
      imagery/i.class/graphics.c
  22. 0 235
      imagery/i.class/histograms.c
  23. 0 414
      imagery/i.class/i.class.html
  24. 0 23
      imagery/i.class/init_reg.c
  25. 0 260
      imagery/i.class/input.c
  26. 0 102
      imagery/i.class/input_color.c
  27. 0 105
      imagery/i.class/input_std.c
  28. 0 185
      imagery/i.class/local_proto.h
  29. 0 307
      imagery/i.class/main.c
  30. 0 66
      imagery/i.class/mouse.c
  31. 0 161
      imagery/i.class/outline.c
  32. 0 14
      imagery/i.class/point.h
  33. 0 14
      imagery/i.class/readbands.c
  34. 0 64
      imagery/i.class/redisplay.c
  35. 0 18
      imagery/i.class/remove_mask.c
  36. 0 28
      imagery/i.class/restore_reg.c
  37. 0 25
      imagery/i.class/save_reg.c
  38. 0 33
      imagery/i.class/set_signals.c
  39. 0 8
      imagery/i.class/sigalarm.c
  40. 0 401
      imagery/i.class/signature.c
  41. 0 41
      imagery/i.class/title.c
  42. 0 50
      imagery/i.class/view.c
  43. 0 182
      imagery/i.class/zoom_box.c

+ 0 - 10
imagery/i.class/Makefile

@@ -1,10 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = i.class
-
-LIBES     = $(IMAGERYLIB) $(DISPLAYLIB) $(GISLIB) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(DISPLAYDEP) $(GISDEP) $(GMATHDEP)
-
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd

+ 0 - 43
imagery/i.class/add_point.c

@@ -1,43 +0,0 @@
-
-/*************************************************************
-add_point: add point to region point list
-
-returns: TRUE (1) point added ok, FALSE (0) could not add, list full
-*************************************************************/
-
-#include "globals.h"
-#include <grass/display.h>
-#include <grass/glocale.h>
-
-
-int add_point(int x, int y)
-{
-    int last;
-
-    if ((last = Region.npoints - 1) >= 0
-	&& x == Region.point[last].x && y == Region.point[last].y)
-	return (1);
-
-    if (Region.npoints >= MAX_VERTEX) {
-	G_warning(_("Can't mark another point.  Only %d points allowed.  Sorry."),
-		  MAX_VERTEX);
-	return (0);
-    }
-
-    last++;
-    Region.point[last].x = x;
-    Region.point[last].y = y;
-    Region.npoints++;
-
-    /* draw the added line in yellow */
-    if (Region.npoints > 1) {
-	R_standard_color(RED);
-	R_move_abs(Region.point[last - 1].x, Region.point[last - 1].y);
-	R_cont_abs(Region.point[last].x, Region.point[last].y);
-	/*    if (Region.view == VIEW_MAP1_ZOOM)
-	   line_in_map1(Region.point[last-1].x, Region.point[last-1].y,
-	   Region.point[last].x, Region.point[last].y, RED); */
-    }
-
-    return (1);
-}

+ 0 - 48
imagery/i.class/analyze_sig.c

@@ -1,48 +0,0 @@
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int analyze_sig(void)
-{
-    int nbands;
-
-    if (!Region.area.completed) {
-	G_warning(_("Cannot analyze until region is completed."));
-	return (0);
-    }
-
-    Menu_msg("");
-
-    /* allocate row buffers and open raster maps */
-    Rast_set_window(&Band_cellhd);
-    nbands = Refer.nfiles;
-    open_band_files();
-
-    /* gather all points which fall within the polygon */
-    /* perform a signature of the area */
-
-    signalflag.interrupt = 0;
-    if (!outline())
-	goto done;
-    if (!prepare_signature(nbands)) {
-	close_band_files();
-	goto done;
-    }
-    close_band_files();
-
-    show_signature(nbands, 1.5);
-    save_signature();
-
-  done:
-    /* clean up after analysis */
-    if (Region.perimeter) {
-	G_free(Region.perimeter);
-	Region.perimeter = 0;
-    }
-    erase_region();
-    Menu_msg("");
-
-    return (0);
-}

+ 0 - 42
imagery/i.class/band_files.c

@@ -1,42 +0,0 @@
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-
-
-/* open and allocate space for the subgroup band files */
-int open_band_files(void)
-{
-    int n, nbands;
-    char *name, *mapset;
-
-    /* allocate row buffers and open raster maps */
-    nbands = Refer.nfiles;
-    Bandbuf = (CELL **) G_malloc(nbands * sizeof(CELL *));
-    Bandfd = (int *)G_malloc(nbands * sizeof(int));
-    for (n = 0; n < nbands; n++) {
-	Bandbuf[n] = Rast_allocate_c_buf();
-	name = Refer.file[n].name;
-	mapset = Refer.file[n].mapset;
-	Bandfd[n] = Rast_open_old(name, mapset);
-    }
-
-    return 0;
-}
-
-
-/* close and free space for the subgroup band files */
-int close_band_files(void)
-{
-    int n, nbands;
-
-    nbands = Refer.nfiles;
-    for (n = 0; n < nbands; n++) {
-	G_free(Bandbuf[n]);
-	Rast_close(Bandfd[n]);
-    }
-    G_free(Bandbuf);
-    G_free(Bandfd);
-
-    return 0;
-}

+ 0 - 22
imagery/i.class/cellhd.c

@@ -1,22 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-
-int Outline_cellhd(View * view, struct Cell_head *cellhd)
-{
-    int row, col;
-    int top, bottom, left, right;
-
-    row = Rast_northing_to_row(cellhd->north, &view->cell.head) + .5;
-    top = row_to_view(view, row);
-    col = Rast_easting_to_col(cellhd->west, &view->cell.head) + .5;
-    left = col_to_view(view, col);
-    row = Rast_northing_to_row(cellhd->south, &view->cell.head) + .5;
-    bottom = row_to_view(view, row);
-    col = Rast_easting_to_col(cellhd->east, &view->cell.head) + .5;
-    right = col_to_view(view, col);
-
-    Outline_box(top, bottom, left, right);
-
-    return 0;
-}

+ 0 - 22
imagery/i.class/complete_reg.c

@@ -1,22 +0,0 @@
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-
-/* This routine completes the region by adding a line from the last
-   point to the first point. */
-int complete_region(void)
-{
-    if (Region.npoints < 3)
-	G_warning(_("Too few points for region.  Must have at least 3 points."));
-    else if (Region.area.completed)
-	G_warning(_("Area already completed."));
-    else {
-	add_point(Region.point[0].x, Region.point[0].y);
-	Region.area.completed = 1;
-	save_region();
-    }
-    Menu_msg("");
-    return (0);
-}

+ 0 - 41
imagery/i.class/conv.c

@@ -1,41 +0,0 @@
-#include "globals.h"
-
-
-/* conversion routines to convert from view x,y to cell col,row
- * as well as cell col,row to cell east,north
- */
-int view_to_col(View * view, int x)
-{
-    return x - view->cell.left;
-}
-
-int view_to_row(View * view, int y)
-{
-    return y - view->cell.top;
-}
-
-int col_to_view(View * view, int col)
-{
-    return view->cell.left + col;
-}
-
-int row_to_view(View * view, int row)
-{
-    return view->cell.top + row;
-}
-
-/* in these next 2 routines, location determines if we are
- * converting from center of the cell (location == .5)
- * top or left edge (location == 0.0)
- * bottom or right edge (location == 1.0)
- */
-
-double row_to_northing(struct Cell_head *cellhd, int row, double location)
-{
-    return cellhd->north - (row + location) * cellhd->ns_res;
-}
-
-double col_to_easting(struct Cell_head *cellhd, int col, double location)
-{
-    return cellhd->west + (col + location) * cellhd->ew_res;
-}

+ 0 - 258
imagery/i.class/curses.c

@@ -1,258 +0,0 @@
-#include <curses.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static int inited = 0;
-
-static WINDOW *save;
-WINDOW *newwin();
-
-
-static Window *make_window(int top, int bottom, int left, int right)
-{
-    Window *window;
-
-    if (top < 0 || bottom >= LINES || left < 0 || right >= COLS
-	|| bottom - top <= 1 || right - left <= 1) {
-	End_curses();
-	G_warning(_("make_window(%d,%d,%d,%d): illegal screen values."),
-		  top, bottom, left, right);
-	G_sleep(3);
-	exit(EXIT_SUCCESS);
-    }
-
-    window = (Window *) G_malloc(sizeof(Window));
-    window->top = top;
-    window->bottom = bottom;
-    window->left = left;
-    window->right = right;
-    Curses_clear_window(window);
-    return window;
-}
-
-
-/* should only be called once at program outset */
-int Begin_curses(void)
-{
-    Window *INFO_WINDOW;
-    Window *MENU_WINDOW;
-
-    initscr();			/* initialize curses standard screens   */
-    raw();			/* set tty modes via curses calls       */
-    noecho();
-    nonl();
-
-    inited = 1;
-
-    /* make a window to save stdscr */
-    save = newwin(LINES, COLS, 0, 0);
-
-    /* make_window (nrows, ncols, start_row, start_col) */
-    INFO_WINDOW = make_window(0, LINES - 4, COLS / 2, COLS - 1);
-    MENU_WINDOW = make_window(0, LINES - 4, 0, COLS / 2);
-    PROMPT_WINDOW = make_window(LINES - 4, LINES - 1, 0, COLS - 1);
-    refresh();
-
-    return 0;
-}
-
-int End_curses(void)
-{
-    /* should only be called upon program exit */
-
-    clear();			/* clear the screen */
-    refresh();
-    endwin();			/* let curses reset the tty now */
-
-    return 0;
-}
-
-int Suspend_curses(void)
-{
-    overwrite(stdscr, save);
-    clear();
-    refresh();
-    endwin();
-
-    return 0;
-}
-
-int Resume_curses(void)
-{
-    clear();
-    refresh();
-    overwrite(save, stdscr);
-    refresh();
-    return 0;
-}
-
-int Curses_allow_interrupts(int ok)
-{
-    refresh();
-    if (ok)
-	noraw();
-    else
-	raw();
-    return 0;
-}
-
-int Curses_clear_window(Window * window)
-{
-    int y, x;
-
-    if (!inited)
-	return 1;
-    for (y = window->top + 1; y < window->bottom; y++) {
-	move(y, x = window->left + 1);
-	while (x++ < window->right)
-	    addch(' ');
-    }
-    Curses_outline_window(window);
-    refresh();
-    return 0;
-}
-
-int Curses_outline_window(Window * window)
-{
-    int x, y;
-
-    move(window->top, x = window->left + 1);
-    while (x++ < window->right)
-	addch('-');
-    move(window->bottom, x = window->left + 1);
-    while (x++ < window->right)
-	addch('-');
-    for (y = window->top + 1; y < window->bottom; y++) {
-	move(y, window->left);
-	addch('|');
-	move(y, window->right);
-	addch('|');
-    }
-    move(window->top, window->left);
-    addch('+');
-    move(window->top, window->right);
-    addch('+');
-    move(window->bottom, window->left);
-    addch('+');
-    if (window->bottom < LINES - 1 || window->right < COLS - 1) {
-	move(window->bottom, window->right);
-	addch('+');
-    }
-    return 0;
-}
-
-int Curses_write_window(Window * window, int line, int col, char *message)
-{
-    int y, x, i;
-
-    if (!inited) {
-	G_message(_("%s"), message);
-	return 1;
-    }
-    if (line <= 0 || line >= window->bottom - window->top)
-	return 1;
-    if (col <= 0 || col >= window->right - window->left)
-	return 1;
-    move(y = window->top + line, x = window->left + col);
-    while (*message != 0 && *message != '\n' && x < window->right) {
-	addch(*message);
-	message++;
-	x++;
-    }
-    if (*message == '\n')
-	for (i = x; i < window->right; i++)
-	    addch(' ');
-    move(y, x);
-    refresh();
-    return 0;
-}
-
-
-int Curses_replot_screen(void)
-{
-    int x, y;
-
-    getyx(stdscr, y, x);
-    wrefresh(curscr);
-    move(y, x);
-    refresh();
-    return 0;
-}
-
-int Curses_prompt_gets(char *prompt, char *answer)
-{
-    char c;
-    int n;
-    int y, x;
-
-    *answer = 0;
-    n = 0;
-
-    Curses_write_window(PROMPT_WINDOW, 1, 1, "\n");
-    Curses_write_window(PROMPT_WINDOW, 1, 1, prompt);
-
-    for (;;) {
-	refresh();
-	c = Curses_getch(0);
-	if (c == '\n' || c == '\r')
-	    break;
-
-	getyx(stdscr, y, x);
-	if (c > '\037' && c < '\177') {	/* octal codes: accept space to '~' */
-	    if (x < PROMPT_WINDOW->right) {
-		*answer++ = c;
-		*answer = 0;
-		addch(c);
-		n++;
-	    }
-	    continue;
-	}
-	if (c == '\b' || c == '\177') {	/* backspace or DEL (decimal 8,127) */
-	    if (n > 0) {
-		answer--;
-		*answer = 0;
-		move(y, x - 1);
-		addch(' ');
-		move(y, x - 1);
-		n--;
-	    }
-	    continue;
-	}
-    }
-    return 0;
-}
-
-int Curses_getch(int with_echo)
-{
-    char achar;
-    int c;
-    int kill;
-
-    if (!inited)
-	return 0;
-    kill = 0;
-    while (1) {
-	c = getch() & 0177;
-	if (c == G_intr_char()) {
-	    if (kill++ >= 3) {
-		End_curses();
-		exit(EXIT_SUCCESS);
-	    }
-	    continue;
-	}
-	kill = 0;
-	if (c != 18)
-	    break;
-	Curses_replot_screen();
-    }
-    if (with_echo) {
-	achar = c;
-	addch(achar);
-	refresh();
-    }
-    return c;
-}

+ 0 - 32
imagery/i.class/define_reg.c

@@ -1,32 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-
-static int use = 1;
-
-/* function prototypes */
-static int done(void);
-
-
-int define_region(void)
-{
-    static Objects objects[] = {
-	INFO("Region Menu:", &use),
-	MENU(" Erase region ", erase_region, &use),
-	MENU(" Draw region ", draw_region, &use),
-	MENU(" Restore last region ", restore_region, &use),
-	MENU(" Complete region ", complete_region, &use),
-	MENU(" Done ", done, &use),
-	{0}
-    };
-
-    Input_pointer(objects);
-
-    return (0);
-}
-
-
-static int done(void)
-{
-    return (-1);
-}

+ 0 - 111
imagery/i.class/defs.h

@@ -1,111 +0,0 @@
-#ifndef __DEFS_H__
-#define __DEFS_H__
-
-#include <grass/gis.h>
-#include <curses.h>
-#include <grass/imagery.h>
-#include "point.h"
-
-/* this is a curses structure */
-typedef struct
-{
-    int top, left, bottom, right;
-} Window;
-
-/* this is a graphics structure */
-typedef struct
-{
-    int top, bottom, left, right;
-    int nrows, ncols;
-    struct
-    {
-	int configured;
-	struct Cell_head head;
-	char name[GNAME_MAX];
-	char mapset[GMAPSET_MAX];
-	int top, bottom, left, right;
-	double ew_res, ns_res;	/* original map resolution */
-    } cell;
-} View;
-
-
-typedef struct
-{
-    int type;			/* object type */
-    int (*handler) ();		/* routine to handle the event */
-    char *label;		/* label to display if MENU or OPTION */
-    int binding;		/* OPTION bindings */
-    int *status;		/* MENU,OPTION status */
-    int top, bottom, left, right;
-} Objects;
-
-#define MENU_OBJECT 1
-#define OPTION_OBJECT 2
-#define INFO_OBJECT 3
-#define OTHER_OBJECT 4
-
-
-#define MENU(label,handler,status) \
-	{MENU_OBJECT,handler,label,0,status,0,0,0,0}
-#define OPTION(label,binding,status) \
-	{OPTION_OBJECT,NULL,label,binding,status,0,0,0,0}
-#define INFO(label,status) \
-	{INFO_OBJECT,NULL,label,0,status,0,0,0,0}
-#define OTHER(handler,status) \
-	{OTHER_OBJECT,handler,NULL,0,status,0,0,0,0}
-
-
-struct signalflag
-{
-    int interrupt;
-    int alarm;
-};
-
-#define OVER_WRITE 1
-#define OVER_LAY 0
-
-#define MAX_VERTEX 100
-struct region
-{
-    struct
-    {
-	int define;
-	int completed;
-	int filled;
-	int saved;
-    } area;
-
-    int npoints;
-    POINT point[MAX_VERTEX];
-    View *view;
-
-    int saved_npoints;
-    POINT saved_point[MAX_VERTEX];
-    View *saved_view;
-
-    int vertex_npoints;
-    POINT vertex[MAX_VERTEX];
-
-    int perimeter_npoints;
-    POINT *perimeter;
-
-};
-extern int edge_order(const void *, const void *);
-
-/* the mouse buttons and the numbers they return */
-#define LEFT_BUTTON 1
-#define MIDDLE_BUTTON 2
-#define RIGHT_BUTTON 3
-
-#define MAX_CATS 256
-
-#define NORMAL_FONT "romans"
-#define GREEK_FONT "greeks"
-#define NORMAL_TEXT_SIZE 15
-
-#define AFTER_STD 1
-#define BEFORE_STD 0
-
-#define MASK "MASK"
-
-#endif /* __DEFS_H__ */

+ 0 - 40
imagery/i.class/del_point.c

@@ -1,40 +0,0 @@
-
-#include "globals.h"
-#include <grass/display.h>
-
-
-
-/*************************************************************
-del_point: delete last point from Region point list
-
-returns: TRUE point deleted ok, FALSE list empty
-*************************************************************/
-
-int del_point(void)
-{
-    int last;
-
-    if (Region.npoints <= 0) {
-	Region.npoints = 0;	/* for safety */
-	return (0);
-    }
-
-    last = --Region.npoints;
-    if (Region.npoints == 0) {
-	Region.area.define = 0;
-	Region.view = NULL;
-    }
-    Region.area.completed = 0;
-
-    /* draw the removed line in grey */
-    if (Region.npoints > 0) {
-	R_standard_color(GREY);
-	R_move_abs(Region.point[last].x, Region.point[last].y);
-	R_cont_abs(Region.point[last - 1].x, Region.point[last - 1].y);
-	/*    if (Region.view == VIEW_MAP1_ZOOM)
-	   line_in_map1(Region.point[last-1].x, Region.point[last-1].y,
-	   Region.point[last].x, Region.point[last].y, GREY); */
-    }
-
-    return (1);
-}

+ 0 - 59
imagery/i.class/draw_cell.c

@@ -1,59 +0,0 @@
-#include <stdlib.h>
-#include <grass/gis.h>
-#include "globals.h"
-#include <grass/display.h>
-#include "local_proto.h"
-
-int draw_cell(View * view, int overlay)
-{
-    int fd;
-    int left, top;
-    int ncols, nrows;
-    int row;
-    DCELL *dcell;
-    struct Colors colr;
-    char msg[100];
-
-
-    if (!view->cell.configured)
-	return 0;
-    if (Rast_read_colors(view->cell.name, view->cell.mapset, &colr) < 0)
-	return 0;
-
-    if (overlay == OVER_WRITE)
-	display_title(view);
-
-    Rast_set_window(&view->cell.head);
-    nrows = Rast_window_rows();
-    ncols = Rast_window_cols();
-
-    left = view->cell.left;
-    top = view->cell.top;
-
-    R_standard_color(BLUE);
-    Outline_box(top, top + nrows - 1, left, left + ncols - 1);
-
-    if (getenv("NO_DRAW")) {
-	Rast_free_colors(&colr);
-	return 1;
-    }
-
-    fd = Rast_open_old(view->cell.name, view->cell.mapset);
-    dcell = Rast_allocate_d_buf();
-    
-    sprintf(msg, "Plotting %s ...", view->cell.name);
-    Menu_msg(msg);
-
-    D_set_overlay_mode(!overlay);
-    D_cell_draw_setup(top, top + nrows, left, left + ncols);
-    for (row = 0; row < nrows; row++) {
-	Rast_get_d_row_nomask(fd, dcell, row);
-	D_draw_d_raster(row, dcell, &colr);
-    }
-    D_cell_draw_end();
-    Rast_close(fd);
-    G_free(dcell);
-    Rast_free_colors(&colr);
-
-    return row == nrows;
-}

+ 0 - 103
imagery/i.class/draw_reg.c

@@ -1,103 +0,0 @@
-#include <grass/display.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-#define NP Region.npoints
-#define PT Region.point
-
-
-int draw_region(void)
-{
-    int x = 0, y = 0, button = 0;
-
-    /* If this is new polygon get init and get first point */
-    if (!Region.area.define) {
-	Region.view = NULL;
-	Region.npoints = 0;
-
-	/* get first point */
-	Menu_msg("Mouse: (Left=Select Point) (Right=Quit)");
-	while (Region.view == NULL) {
-	    Mouse_pointer(&x, &y, &button);
-
-	    if (In_view(VIEW_MAP1, x, y))
-		Region.view = VIEW_MAP1;
-	    else if (In_view(VIEW_MAP1_ZOOM, x, y))
-		Region.view = VIEW_MAP1_ZOOM;
-
-	    if (button == RIGHT_BUTTON)
-		return (0);
-	}
-	Region.area.define = 1;
-	add_point(x, y);
-	R_stabilize();
-    }
-    /* if the area is completed have to delete before adding */
-    else if (Region.area.completed) {
-	Menu_msg("Mouse: (Middle=Backup Point) (Right=Quit)");
-	while (button != MIDDLE_BUTTON) {
-	    Mouse_pointer(&x, &y, &button);
-	    if (button == RIGHT_BUTTON)
-		return (0);
-	    if (button == MIDDLE_BUTTON) {
-		del_point();
-		R_stabilize();
-		if (NP <= 0)
-		    return (0);
-	    }
-	}
-    }
-
-    /* now get as many points as they want */
-    Menu_msg("Mouse: (Left=Select Pt) (Middle=Backup Pt) (Right=Quit)");
-    while (!signalflag.interrupt) {
-	R_standard_color(WHITE);
-	Mouse_line_anchored(PT[NP - 1].x, PT[NP - 1].y, &x, &y, &button);
-	switch (button) {
-	case LEFT_BUTTON:
-	    if (!In_view(Region.view, x, y))
-		continue;
-	    add_point(x, y);
-	    R_stabilize();
-	    break;
-	case MIDDLE_BUTTON:
-	    if (!In_view(Region.view, x, y))
-		continue;
-	    del_point();
-	    R_stabilize();
-	    if (NP <= 0)
-		return (0);
-	    break;
-	case RIGHT_BUTTON:
-	    return (0);
-	}
-    }
-
-    return 0;
-}
-
-
-int line_in_map1(int x1, int y1, int x2, int y2, int color)
-{
-    int c1, r1, c2, r2;
-
-    c1 = view_to_col(VIEW_MAP1_ZOOM, x1);
-    r1 = view_to_row(VIEW_MAP1_ZOOM, y1);
-    c2 = view_to_col(VIEW_MAP1_ZOOM, x2);
-    r2 = view_to_row(VIEW_MAP1_ZOOM, y2);
-    G_message(_("\nOrig:(x1 y1), (x2 y2) = (%d %d), (%d %d)"),
-	      x1, y1, x2, y2);
-
-    x1 = col_to_view(VIEW_MAP1, c1);
-    y1 = row_to_view(VIEW_MAP1, r1);
-    x2 = col_to_view(VIEW_MAP1, c2);
-    y2 = row_to_view(VIEW_MAP1, r2);
-
-    G_message(_("\nNew:(x1 y1), (x2 y2) = (%d %d), (%d %d)"), x1, y1, x2, y2);
-    R_standard_color(color);
-    R_move_abs(x1, y1);
-    R_cont_abs(x2, y2);
-
-    return 0;
-}

+ 0 - 54
imagery/i.class/driver.c

@@ -1,54 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-
-static int use = 1;
-static int stop(void);
-static int really_quit(void);
-static int dont_stop(void);
-
-
-int driver(void)
-{
-    static Objects objects[] = {
-	INFO("Command Menu:", &use),
-	MENU(" Zoom ", zoom_box, &use),
-	MENU(" Define region ", define_region, &use),
-	MENU(" Redisplay map ", redisplay, &use),
-	MENU(" Analyze region ", analyze_sig, &use),
-	MENU(" Quit ", really_quit, &use),
-	{0}
-    };
-
-    Input_pointer(objects);
-    Menu_msg("");
-
-    return 0;
-}
-
-
-static int really_quit(void)
-{
-    static Objects objects[] = {
-	INFO("really quit? ", &use),
-	MENU(" No ", dont_stop, &use),
-	MENU(" Yes ", stop, &use),
-	{0}
-    };
-    if (Input_pointer(objects) < 0)
-	return -1;
-
-    return 0;			/* don't quit */
-}
-
-
-static int dont_stop(void)
-{
-    return 1;
-}
-
-
-static int stop(void)
-{
-    return -1;
-}

+ 0 - 28
imagery/i.class/edge.c

@@ -1,28 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-
-int edge(int x0, int y0, int x1, int y1)
-{
-    float m;
-    float x;
-
-    if (y0 == y1)
-	return 0;
-
-    x = x0;
-    m = (float)(x0 - x1) / (float)(y0 - y1);
-
-    if (y0 < y1)
-	while (++y0 < y1) {
-	    x0 = (x += m) + .5;
-	    edge_point(x0, y0);
-	}
-    else
-	while (--y0 > y1) {
-	    x0 = (x -= m) + .5;
-	    edge_point(x0, y0);
-	}
-
-    return 0;
-}

+ 0 - 19
imagery/i.class/edge_order.c

@@ -1,19 +0,0 @@
-#include "defs.h"
-
-int edge_order(const void *aa, const void *bb)
-{
-    const POINT *a = aa;
-    const POINT *b = bb;
-
-    if (a->y < b->y)
-	return (-1);
-    if (a->y > b->y)
-	return (1);
-
-    if (a->x < b->x)
-	return (-1);
-    if (a->x > b->x)
-	return (1);
-
-    return (0);
-}

+ 0 - 12
imagery/i.class/edge_point.c

@@ -1,12 +0,0 @@
-#include "globals.h"
-
-int edge_point(register int x, register int y)
-{
-    register int n;
-
-    n = Region.perimeter_npoints++;
-    Region.perimeter[n].x = x;
-    Region.perimeter[n].y = y;
-
-    return 0;
-}

+ 0 - 16
imagery/i.class/erase_reg.c

@@ -1,16 +0,0 @@
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-
-int erase_region(void)
-{
-    if (!Region.area.define)
-	G_warning(_("Can not erase an undefined region."));
-    else {
-	while (del_point()) ;
-	return (0);
-    }
-    return 0;
-}

+ 0 - 28
imagery/i.class/g_init.c

@@ -1,28 +0,0 @@
-#include <curses.h>
-#include <grass/gis.h>
-#include "globals.h"
-#include "local_proto.h"
-
-
-int g_init(void)
-{
-
-    /* initialize graphics processor, define viewports */
-    Init_graphics();
-
-    /* load the color table 
-       set_colors ();
-       set_plane10 ();
-     */
-    /* clear both frames                    */
-    /* select frame 1 to show and to modify 
-       select_frame (1,3);
-       clear ();
-       select_frame (1,1);
-     */
-    /* select map_window 
-       map_window();
-     */
-
-    return 0;
-}

+ 0 - 77
imagery/i.class/globals.h

@@ -1,77 +0,0 @@
-#ifndef __GLOBALS_H__
-#define __GLOBALS_H__
-
-#include "defs.h"
-
-extern Window *PROMPT_WINDOW;
-
-extern int SCREEN_TOP;
-extern int SCREEN_BOTTOM;
-extern int SCREEN_LEFT;
-extern int SCREEN_RIGHT;
-
-extern View *VIEW_MAP1;
-extern View *VIEW_TITLE1;
-extern View *VIEW_MAP1_ZOOM;
-extern View *VIEW_TITLE1_ZOOM;
-
-extern View *VIEW_MASK1;
-extern View *VIEW_MENU;
-extern View *VIEW_HISTO;
-
-extern int THE_COLORS[10];
-
-#define BLACK	THE_COLORS[0]
-#define BLUE	THE_COLORS[1]
-#define BROWN	THE_COLORS[2]
-#define GREEN	THE_COLORS[3]
-#define GREY	THE_COLORS[4]
-#define ORANGE	THE_COLORS[5]
-#define PURPLE	THE_COLORS[6]
-#define RED	THE_COLORS[7]
-#define WHITE	THE_COLORS[8]
-#define YELLOW	THE_COLORS[9]
-
-#define NUM_BLACK	0
-#define NUM_BLUE	1
-#define NUM_BROWN	2
-#define NUM_GREEN	3
-#define NUM_GREY	4
-#define NUM_ORANGE	5
-#define NUM_PURPLE	6
-#define NUM_RED 	7
-#define NUM_WHITE	8
-#define NUM_YELLOW	9
-
-#define NAME_BLACK	"Black"
-#define NAME_BLUE	"Blue"
-#define NAME_BROWN	"Brown"
-#define NAME_GREEN	"Green"
-#define NAME_GREY	"Grey"
-#define NAME_ORANGE	"Orange"
-#define NAME_PURPLE	"Purple"
-#define NAME_RED 	"Red"
-#define NAME_WHITE	"White"
-#define NAME_YELLOW	"Yellow"
-
-struct Color_table
-{
-    int red, grn, blue;
-};
-
-extern struct Color_table Color_table[10];
-
-extern struct Ref Refer;
-extern FILE *outsig_fd;
-extern struct Signature Sigs;
-extern struct Cell_head Band_cellhd;
-
-extern int *Bandfd;
-extern struct region Region;
-extern struct signalflag signalflag;
-extern CELL **Bandbuf;
-
-extern double row_to_northing(struct Cell_head *, int, double);
-extern double col_to_easting(struct Cell_head *, int, double);
-
-#endif /* __GLOBALS_H__ */

+ 0 - 111
imagery/i.class/graphics.c

@@ -1,111 +0,0 @@
-#include "globals.h"
-#include <grass/display.h>
-#include "local_proto.h"
-
-static View *makeview(double bottom, double top, double left, double right)
-{
-    View *view;
-
-    view = (View *) G_malloc(sizeof(View));
-
-    top = 100 - top;
-    bottom = 100 - bottom;
-
-    view->top = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * top / 100.0;
-    view->bottom = SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP) * bottom / 100.0;
-    view->left = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * left / 100.0;
-    view->right = SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT) * right / 100.0;
-
-    if (view->top < SCREEN_TOP)
-	view->top = SCREEN_TOP;
-    if (view->bottom > SCREEN_BOTTOM)
-	view->bottom = SCREEN_BOTTOM;
-    if (view->left < SCREEN_LEFT)
-	view->left = SCREEN_LEFT;
-    if (view->right > SCREEN_RIGHT)
-	view->right = SCREEN_RIGHT;
-
-    Outline_box(view->top, view->bottom, view->left, view->right);
-
-    view->top++;
-    view->bottom--;
-    view->left++;
-    view->right--;
-
-    view->nrows = view->bottom - view->top + 1;
-    view->ncols = view->right - view->left + 1;
-    view->cell.configured = 0;
-
-    return view;
-}
-
-int Init_graphics(void)
-{
-    R_font("romans");
-    R_text_size(3 * NORMAL_TEXT_SIZE / 4, NORMAL_TEXT_SIZE);
-
-    D_full_screen();
-
-    SCREEN_TOP = R_screen_top();
-    SCREEN_BOTTOM = R_screen_bot();
-    SCREEN_LEFT = R_screen_left();
-    SCREEN_RIGHT = R_screen_rite();
-
-
-    BLACK = D_translate_color("black");
-    BLUE = D_translate_color("blue");
-    BROWN = D_translate_color("brown");
-    GREEN = D_translate_color("green");
-    GREY = D_translate_color("grey");
-    ORANGE = D_translate_color("orange");
-    PURPLE = D_translate_color("purple");
-    RED = D_translate_color("red");
-    WHITE = D_translate_color("white");
-    YELLOW = D_translate_color("yellow");
-
-    R_standard_color(BLACK);
-
-    VIEW_TITLE1 = makeview(97.5, 100.0, 50.0, 100.0);
-    VIEW_MAP1 = makeview(51.0, 97.5, 50.0, 100.0);
-    VIEW_TITLE1_ZOOM = makeview(48.5, 51.0, 50.0, 100.0);
-    VIEW_MAP1_ZOOM = makeview(2.5, 48.5, 50.0, 100.0);
-    VIEW_MASK1 = makeview(51.0, 97.5, 50.0, 100.0);	/*same as map1 */
-    VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
-    VIEW_HISTO = makeview(2.5, 100.0, 0.0, 50.0);
-
-    return 0;
-}
-
-int Outline_box(int top, int bottom, int left, int right)
-{
-    R_move_abs(left, top);
-    R_cont_abs(left, bottom);
-    R_cont_abs(right, bottom);
-    R_cont_abs(right, top);
-    R_cont_abs(left, top);
-
-    return 0;
-}
-
-
-int Text_width(char *text)
-{
-    double top, bottom, left, right;
-
-    R_get_text_box(text, &top, &bottom, &left, &right);
-
-    if (right > left)
-	return right - left + 1;
-    else
-	return left - right + 1;
-}
-
-int Text(char *text, int top, int bottom, int left, int right, int edge)
-{
-    R_set_window(top, bottom, left, right);
-    R_move_abs(left + edge, bottom - edge);
-    R_text(text);
-    R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
-    return 0;
-}

+ 0 - 235
imagery/i.class/histograms.c

@@ -1,235 +0,0 @@
-#include <math.h>
-#include "globals.h"
-#include <grass/display.h>
-#include "local_proto.h"
-
-#define MU	'l'		/* these are the characters that are printed as  */
-#define SIGMA	'r'		/* mu and sigma in the greek simplex font */
-#define RANGE_MIN "R1"
-#define RANGE_MAX "R2"
-#define MIN "min"
-#define MAX "max"
-
-#define MEAN(b)		(sum[b]/np)
-#define STD_DEV(b)	((float) sqrt ((double) VAR(b,b) / np))
-#define VAR(b1,b2)	(product[b1][b2] - sum[b1]*sum[b2]/np)
-
-#define BORDER 10
-#define MAX_HISTO_WIDTH 11	/* should be odd number */
-#define MIN_HISTO_WIDTH 1	/* should be an odd number */
-#define LEGEND_SPACE 3*TEXT_HEIGHT
-#define NUM_CHARS 30
-#define TEXT_HEIGHT (width/NUM_CHARS)
-
-static int old_range = 1;
-
-int histograms(int nbands, float *sum, float **product, int **histo,
-	       int np, int *min, int *max, double in_nstd, int b_or_a)
-{
-    int h_top, h_bottom, h_left, h_right;
-    int b;
-    int nrows, ncols;
-    int height;
-    int width;
-    char msg[200];
-    float mean;
-    float std_dev;
-    int x1, y1;
-    int x2, y2;
-    int nbars, bar;
-    int cat;
-    float scale;
-    int grand_max;
-    int max_range, histo_width;
-
-    /*    Get_window (MAP_WINDOW, &w);  */
-
-    Erase_view(VIEW_HISTO);
-    Outline_box(VIEW_HISTO->top, VIEW_HISTO->bottom, VIEW_HISTO->left,
-		VIEW_HISTO->right);
-    R_set_window(VIEW_HISTO->top, VIEW_HISTO->bottom, VIEW_HISTO->left,
-		 VIEW_HISTO->right);
-
-    nrows = VIEW_HISTO->nrows;
-    ncols = VIEW_HISTO->ncols;
-
-    /* get maximum range */
-    if (b_or_a == BEFORE_STD) {
-	max_range = 1;
-	for (b = 0; b < nbands; b++)
-	    if (max[b] - min[b] > max_range)
-		max_range = max[b] - min[b];
-	old_range = max_range;
-    }
-    else
-	max_range = old_range;
-
-    /* calculate the width (in pixels) for each histogram bar */
-    histo_width = (ncols - BORDER * 2) / max_range;
-    if (histo_width % 2 == 0)
-	histo_width = histo_width - 1;
-    if (histo_width < MIN_HISTO_WIDTH)
-	histo_width = MIN_HISTO_WIDTH;
-    else if (histo_width > MAX_HISTO_WIDTH)
-	histo_width = MAX_HISTO_WIDTH;
-
-    height = (nrows - BORDER * 2) / nbands;
-    width = (ncols - BORDER * 2) / histo_width * histo_width;
-    nbars = width / histo_width;
-
-    /* Set text size based on legend length */
-    R_text_size(3 * TEXT_HEIGHT / 4, TEXT_HEIGHT);
-
-    h_top = VIEW_HISTO->top + BORDER;
-    h_left = VIEW_HISTO->left + BORDER;
-    h_right = h_left + width - 1;
-
-    grand_max = 0;
-    for (b = 0; b < nbands; b++)
-	for (x1 = 0; x1 < MAX_CATS; x1++)
-	    if (histo[b][x1] > grand_max)
-		grand_max = histo[b][x1];
-
-    if (grand_max > 0)
-	scale = (float)(height - LEGEND_SPACE) / (float)grand_max;
-    else
-	scale = 0;
-
-    R_standard_color(BLACK);
-
-    /* print header message */
-    if (b_or_a == BEFORE_STD)
-	sprintf(msg, "Region Sample Size: %d", np);
-    else
-	sprintf(msg, "Histograms with Range = %5.2f *", in_nstd);
-    R_move_abs(VIEW_HISTO->left + 3, VIEW_HISTO->top + TEXT_HEIGHT);
-    R_text(msg);
-    if (b_or_a == AFTER_STD) {
-	R_font(GREEK_FONT);
-	sprintf(msg, "                                %c", SIGMA);
-	R_move_abs(VIEW_HISTO->left + 3, VIEW_HISTO->top + TEXT_HEIGHT);
-	R_text(msg);
-	R_font(NORMAL_FONT);
-    }
-
-    /* draw the histograms */
-    for (b = 0; b < nbands; b++) {
-	int bottom_adjusted;
-
-	h_bottom = h_top + height - 1;
-	bottom_adjusted = h_bottom - 2 * LEGEND_SPACE / 3;
-
-	mean = MEAN(b);
-	std_dev = STD_DEV(b);
-
-	/* print legend info under the histogram */
-	if (b_or_a == BEFORE_STD)
-	    sprintf(msg, "%-14s                    %s=%-3d  %s=%-3d",
-		    Refer.file[b].name, MIN, min[b], MAX, max[b]);
-	else
-	    sprintf(msg, "%-14s                    %s=%-3d  %s=%-3d",
-		    Refer.file[b].name, RANGE_MIN, min[b], RANGE_MAX, max[b]);
-	R_move_abs(h_left, h_bottom);
-	R_text(msg);
-	sprintf(msg, "                %c=%-5.1f  %c=%-5.2f", MU, mean,
-		SIGMA, std_dev);
-	R_move_abs(h_left, h_bottom);
-	R_font(GREEK_FONT);
-	R_text(msg);
-	R_font(NORMAL_FONT);
-
-	/* draw the actual histogram */
-	cat = mean - (nbars - 1) / 2;
-	y1 = y2 = bottom_adjusted;
-	x1 = h_left;
-	x2 = h_left + histo_width - 1;
-
-	R_move_abs(x1, y1);
-	for (bar = 0; bar < nbars && cat < MAX_CATS;
-	     bar++, cat++, x2 += histo_width) {
-	    if (cat >= 0)
-		y2 = bottom_adjusted - (histo[b][cat] * scale + .5);
-	    R_cont_abs(x1, y2);
-	    R_cont_abs(x2, y2);
-	    y1 = y2;
-	    x1 = x2;
-	}
-	R_cont_abs(x1, bottom_adjusted);
-	R_cont_abs(h_right, bottom_adjusted);
-
-	/* put sigma and mu on the histogram */
-	cat = mean - (nbars - 1) / 2;
-	x1 = h_left;
-	R_font(GREEK_FONT);
-	for (bar = 0; bar < nbars && cat < MAX_CATS;
-	     bar++, cat++, x1 += histo_width) {
-	    float x;
-	    int mp;
-	    int top_adjusted;
-	    float vh;
-	    int color;
-
-	    if (cat < 0)
-		continue;
-
-	    if (cat == (int)(x = mean + .5)) {
-		sprintf(msg, "%c", MU);
-		vh = .5;
-		color = GREY;
-	    }
-	    else if (cat == (int)(x = mean + std_dev + .5)) {
-		sprintf(msg, "%c", SIGMA);
-		vh = .25;
-		color = GREY;
-	    }
-	    else if (cat == (int)(x = mean - std_dev + .5)) {
-		sprintf(msg, "%c", SIGMA);
-		vh = .25;
-		color = GREY;
-	    }
-	    else if (cat == (int)(x = (float)max[b] + .5)) {
-		if (b_or_a == AFTER_STD)
-		    sprintf(msg, "%s", RANGE_MAX);
-		else
-		    sprintf(msg, "%s", MAX);
-		vh = .5;
-		color = RED;
-	    }
-	    else if (cat == (int)(x = (float)min[b] + .5)) {
-		if (b_or_a == AFTER_STD)
-		    sprintf(msg, "%s", RANGE_MIN);
-		else
-		    sprintf(msg, "%s", MIN);
-		vh = .5;
-		color = RED;
-	    }
-	    else
-		continue;
-
-	    top_adjusted = bottom_adjusted - (bottom_adjusted - h_top) * vh;
-	    mp = x1 + (x - cat) * histo_width;
-	    R_move_abs(mp - 2, bottom_adjusted + TEXT_HEIGHT);
-	    if (color == RED) {
-		R_standard_color(color);
-		R_font(NORMAL_FONT);
-		R_text(msg);
-		R_font(GREEK_FONT);
-	    }
-	    else {
-		R_text(msg);
-		R_standard_color(color);
-	    }
-	    R_move_abs(mp, bottom_adjusted);
-	    R_cont_abs(mp, top_adjusted);
-	    R_standard_color(BLACK);
-	}
-	R_font(NORMAL_FONT);
-
-	h_top = h_bottom + 1;
-    }
-    R_standard_color(BLACK);
-    R_text_size(3 * NORMAL_TEXT_SIZE / 4, NORMAL_TEXT_SIZE);
-    R_set_window(SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, SCREEN_RIGHT);
-
-    return 0;
-}

+ 0 - 414
imagery/i.class/i.class.html

@@ -1,414 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>i.class</em>
-performs the first pass in the GRASS two-pass supervised image
-classification process;
-the GRASS program 
-<em><a href="i.maxlik.html">i.maxlik</a></em> executes the second pass.
-Both programs must be run to generate a classified map in GRASS
-raster format.
-
-<p>
-<em>i.class</em> is an interactive program that allows the user to outline
-a region on the screen and calculate the spectral signature based on the
-cells that are within that region.  During this process the user will be
-shown a histogram of the region for each image band.  The user can also
-display the cells of the image bands which fall within a user-specified
-number of standard deviations from the means in the spectral signature.
-By doing this, the user can see how much of the image
-is likely to be put into the class associated with the current signature.
-
-
-<p>
-The spectral signatures that result are composed of region means and
-covariance matrices.  These region means and covariance matrices are used in
-the second pass (<em><a href="i.maxlik.html">i.maxlik</a></em>) to classify
-the image.
-
-
-<p>
-Alternatively, the spectral signatures generated by <em>i.class</em> can be
-used for seed means for the clusters in the
-<em><a href="i.cluster.html">i.cluster</a></em> program.
-
-
-<h2>USER INPUTS</h2>
-
-At the command line the user is asked to enter the name of the raster map
-to be displayed during the process of outlining regions.
-Typically, the user will want to enter the name of a color
-composite previously created by
-<em><a href="r.composite.html">r.composite</a></em>.
-
-However, the user can enter the name of any existing raster
-map.  This leaves the potential for using a raster map not
-directly derived from the image as a backdrop on which the
-user can outline the classes of interest.
-
-<p>
-The first screen in the program <em>i.class</em> asks the user for the
-<a href="i.group.html">imagery</a> <em>group</em> and <em>subgroup</em>
-to be analyzed:
-
-
-<div class="code"><pre>
-LOCATION: location    SUPERVISED CLASSIFIER     MAPSET: demo
-
-     Please select the group and subgroup to be analyzed
-
-GROUP:      spot_______   (list will show available groups)
-SUBGROUP:   123________   (list will show available subgroups)
-
-
-     AFTER COMPLETING ALL ANSWERS, HIT &lt;ESC&gt; TO CONTINUE
-                   (OR &lt;Ctrl-C&gt; TO CANCEL)
-</pre></div>
-
-<p>
-The <em>group</em> should contain the 
-imagery bands that the user wishes
-to classify.  The <em>subgroup</em> is a subset of this group.
-The user must create a group and a subgroup by running the GRASS program
-
-<em><a href="i.group.html">i.group</a></em> 
-before running <em>i.class</em>.  The subgroup should contain
-only the image bands that the user wishes to classify.
-Note that this subgroup must contain more than one band.
-
-<p>
-After the first screen, the program asks the user for the name of the
-resulting signature file.  The signature file is both the output file for
-<em>i.class</em> and the required input file for the GRASS 
-<em><a href="i.maxlik.html">i.maxlik</a></em> module.
-It contains the region means and covariance matrices that are used to
-classify an image in  <em><a href="i.maxlik.html">i.maxlik</a></em>.
-The signature file will be saved in the
-<tt>$MAPSET/group/$GROUP/subgroup/$SUBGROUP/sig/</tt> directory.
-
-<p>
-After entering the resulting signature file name, the user
-is asked to enter the name of a seed signature file.  This
-is optional.  A "seed" signature file is a previously
-created signature file.  Such a seed signature file may be
-the result of an earlier run of <em>i.class</em>.  The seed
-signature file is copied into the new resulting signature
-file before any new signatures are added by
-<em>i.class</em>.  In this way, you can collect the work
-from several sessions with <em>i.class</em> into one
-signature file.
-
-<p>
-At this point the <em>i.class</em> graphics screen will be
-drawn on the graphics monitor and the user will be directed
-to use the mouse.  From this point on the user will
-primarily work with the mouse, selecting options from the
-menus and outlining regions on the screen.  The only time
-that the user will need to return to the text terminal is
-to enter names for the signatures created.
-
-<h2>THE DISPLAY FRAMES</h2>
-
-The display frame layout that <em>i.class</em> uses is
-represented below for reference.
-
-<div class="code"><pre>
-+-----------------------+---------------------------+
-|                       |                           |
-|                       |    Map Display Frame      |
-|                       |                           |
-|                       |                           |
-|   Histogram Display   |                           |
-|        Frame          |                           |
-|                       |                           |
-|                       |                           |
-|                       |                           |
-|                       +---------------------------+
-|                       |                           |
-|                       |    Zoom Display Frame     |
-|                       |                           |
-|                       |                           |
-|                       |                           |
-|                       |                           |
-|                       |                           |
-|                       |                           |
-+-----------------------+---------------------------+
-|        Menu Frame                                 |
-+---------------------------------------------------+
-</pre></div>
-
-
-<h2>THE MENUS</h2>
-
-All of the menus in the <em>i.class</em> program are
-displayed across the bottom of the graphics monitor in the
-Menu Frame.  To select an option from one of these menus,
-simply place the cursor over your selection and press any
-button on the mouse.  Each of the menus is discussed in the
-following paragraphs.
-
-
-<A NAME="commandmenu"></a>
-<h3>The Command Menu</h3>
-
-The Command Menu includes the following selections:
-
-<dl>
-
-<dt><em>Zoom</em> 
-
-<dd>This command allows the user to outline a rectangular
-region in either the Map or Zoom Display Frames and the
-region is displayed, magnified, to fit in the Zoom Display
-Frame.  A red rectangle is drawn in the Map Display Frame,
-indicating what area the Zoom Display Frame shows.
-
-<p>
-To outline the rectangular region simply use any mouse button to anchor
-the first corner of the border and then use any button to choose the
-other corner.
-
-
-
-<dt><em>Define region</em>  
-
-<dd>This selection takes the user to the
-<a href="#regionmenu">Region Menu</a>.
-This menu includes the
-options that allow the user to outline a region of interest
-on the displayed raster map.
-
-
-<dt><em>Redisplay map</em> 
-
-<dd>This selection takes the user to the Redisplay Menu.
-The 
-<a href="#redisplaymenu">Redisplay Menu</a> 
-allows the user to redraw map display
-frames.
-
-<dt><em>Analyze region</em>  
-
-<dd>This selection starts the process of analyzing the
-currently defined region.  A histogram of the defined
-region will be displayed for each band.  On the histogram
-for each band, the mean, standard deviation, minimum cell
-value and maximum cell value are marked.  The histograms
-are automatically scaled in an attempt to fit the data into
-the space available, but it is possible that all of the
-data will not fit.  In this case, as much of the data as
-possible, centered around the mean, will be displayed.
-After the histograms are displayed, the user will be given
-the 
-<a href="#signaturemenu">Signature Menu</a>.
-
-<dt><em>Quit</em> 
-<dd>The user should make this selection 
-to end the session with <em>i.class</em>.
-
-</dl>
-
-<A NAME="regionmenu"></a>
-<h3>The Region Menu</h3>
-
-The Region Menu contains the following selections:
-
-<dl>
-
-<dt><em>Erase region</em>  
-<dd>This selection erases any currently defined
-region.
-
-<dt><em>Draw region</em>  
-<dd>This selection allows the user to use the mouse to
-draw a region on either the Map or Zoom Display Frame.  An
-explanation of which mouse buttons to use is displayed in the Menu
-Frame.  The user does not need to try to complete the region boundary.  The
-last line of the region will be added when the user selects the
-Complete region option on the Region Menu.
-
-
-<dt><em>Restore last region</em> 
-<dd>This selection restores the last region
-that was drawn.  After a region is completed, it will be saved to be
-restored later.  Only one previous region is saved.
-
-<dt><em>Complete region</em> 
-<dd>This selection completes the region that is
-currently being drawn.  As noted above, it saves the complete
-region to be restored later, if needed.  Once the user has made a
-complete region, it can be analyzed with the Analyze Region
-selection on the <a href="#commandmenu">Command Menu</a>.
-
-<dt><em>Done</em> 
-<dd>Use this selection to return to the 
-<a href="#commandmenu">Command Menu</a>.
-
-</dl>
-
-<A NAME="redisplaymenu"></a>
-<h3>The Redisplay Map Menu</h3>
-
-The Redisplay Map Menu has the following selections, which are useful
-to redraw the raster maps displayed in the Map and Zoom Display Frames.
-
-<dl>
-
-<dt><em>Map geographic region</em> 
-<dd>This selection causes the raster map in the Map
-Display Frame to be redrawn.
-
-<dt><em>Zoom region</em> 
-<dd>This selection causes the Zoom Display Frame to
-be redrawn.
-
-
-<dt><em>Both</em> 
-<dd>This selection causes both the Map and Zoom Display
-Frames to be redrawn.
-
-<dt><em>Cancel</em> 
-<dd>Use this selection if you do not want to redisplay
-either of the above regions.  The user will be returned to the 
-<a href="#commandmenu">Command Menu</a>.
-
-</dl>
-
-<A NAME="signaturemenu"></a>
-<h3>The Analyze Region Menu</h3>
-
-The Analyze Region Menu contains the Signature Menu, which
-allows the user to set the number of standard deviations
-and the display color, and then to display (as an overlay)
-the cells that match the signature within the number of
-standard deviations specified.  Note that once the matching
-cells are displayed, the Map Display Frame must be
-redisplayed to see only the original raster map again.  The
-following selections are available on the Signature Menu:
-
-
-<dl>
-
-<dt><em>Set std dev's</em> 
-
-<dd>This selection allows the user to set the number of
-standard deviations from the mean for the maximum and
-minimum range.  The maximum and minimum range is used when
-finding the cells that "match" the signature.  The user is
-presented with a menu of typical choices and an "Other"
-option.  If the "Other" option is selected, enter the
-number of standard deviations from the keyboard on the text
-terminal.  Otherwise, the selected option will be used.
-When the number of standard deviations is set, the
-histograms for each band will be redrawn with the maximum
-and minimum range marked.
-
-
-<p>
-Note that the number in parentheses on this
-selection is the current number of standard deviations.
-
-
-<dt><em>Set color</em> 
-
-<dd>This selection allows the user to set the color for the
-display of cells that "match" the current signature.  The
-user is presented with a menu of color choices.  The color
-selected will be used when the Display Matches Menu
-selection is made.
-
-<p>
-Note that the color in parentheses on this selection is the current
-color for display.
-
-<dt><em>Display matches</em> 
-
-<dd>This selection displays the cells that "match" the
-current signature in the current color.  A cell "matches"
-the current signature if the cell value in each band is
-between the minimum range and maximum range for that band
-defined by the number of standard deviations currently
-set.
-
-<dt><em>Done</em> 
-
-<dd>When this selection is chosen, the user will be asked
-whether or not he/she would like to save the current
-signature.  If the user answers with the "Yes" selection,
-he/she will be asked to enter a description for the
-resultant signature file on the text terminal keyboard.
-The saved signature file description will be used by <em>
-<a href="i.maxlik.html">i.maxlik</a></em> to name the
-category that is created from the current signature.  After
-either a "No" answer or the signature description is
-entered, the user is returned to the Command Menu.
-
-</dl>
-
-
-<h2>NOTES</h2>
-
-<em>i.class</em> uses the current MASK to generate the
-overlay for cells that match a signature.  As a result, if
-a MASK already exists it will be removed during the
-execution of this program.
-
-<p>The cell values in the image bands cannot fall outside of
-the range of 0 to 255.  <em>i.class</em> will report an
-error if they do.
-
-<p><em>i.class</em>, like some of the other 
-<a href="imagery.html">imagery</a> programs, does not use the
-
-standard GRASS display frames.  After running
-<em>i.class</em>, you will need to create a display frame
-(e.g., using
-
-<em><a href="d.frame.html">d.frame</a></em> or 
-
-<em><a href="d.erase.html">d.erase</a></em>)
-before you can use most of the GRASS display (d.) commands.
-
-<p><em><a href="i.group.html">i.group</a></em>
-must be run before <em>i.class</em> to create an 
-<a href="i.group.html">imagery</a> group and a subgroup
-containing the image bands to be classified.
-
-<p>The user can perform a supervised image classification by
-running <em>i.class</em> followed by
-
-<em><a href="i.maxlik.html">i.maxlik</a></em>.  
-
-The user can perform an unsupervised classification
-by running 
-
-<em><a href="i.cluster.html">i.cluster</a></em> followed by 
-
-<em><a href="i.maxlik.html">i.maxlik</a></em>.
-
-<p><em>i.class</em> is interactive and requires the user to be running 
-a graphics display monitor (see <em><a href="d.mon.html">d.mon</a></em>)
-to run this program.
-
-
-<h2>SEE ALSO</h2>
-
-The GRASS 4 <em>
-<a href="http://grass.itc.it/gdp/imagery/grass4_image_processing.pdf">Image
-Processing manual</a></em>
-
-<p><em><a href="d.frame.html">d.frame</a>, 
-<a href="d.mon.html">d.mon</a>, 
-<a href="g.region.html">g.region</a>, 
-<a href="i.cca.html">i.cca</a>,
-<a href="i.cluster.html">i.cluster</a>, 
-<a href="r.composite.html">r.composite</a>, 
-<a href="i.group.html">i.group</a>, 
-<a href="i.maxlik.html">i.maxlik</a>, 
-<a href="r.mapcalc.html">r.mapcalc</a></em>
-
-<h2>AUTHOR</h2>
-
-David Satnik, 
-Central Washington University
-
-<p><i>Last changed: $Date$</i>

+ 0 - 23
imagery/i.class/init_reg.c

@@ -1,23 +0,0 @@
-#include <grass/gis.h>
-#include "globals.h"
-
-
-int init_region(struct region Region)
-{
-    Region.area.define = 0;
-    Region.area.completed = 0;
-    Region.area.filled = 0;
-    Region.area.saved = 0;
-
-    Region.npoints = 0;
-    Region.view = NULL;
-
-    Region.saved_npoints = 0;
-    Region.saved_view = NULL;
-
-    Region.vertex_npoints = 0;
-    Region.perimeter_npoints = 0;
-
-
-    return 0;
-}

+ 0 - 260
imagery/i.class/input.c

@@ -1,260 +0,0 @@
-#include "globals.h"
-#include <grass/display.h>
-#include "local_proto.h"
-
-static int active = 0;
-static int replot;
-
-static int visible(Objects *);
-static int draw_option_boxes(Objects *);
-static int select_option(Objects *, Objects *);
-static Objects *find(Objects *, int, int);
-static int draw_objects(Objects *);
-static int mouse(Objects *, int, int, int);
-
-#define TEXT_COLOR BLACK
-#define FILL_COLOR GREY
-#define OUTLINE_COLOR BLACK
-
-/* Input: drive mouse. returns status of handler that returns != 0 */
-int Input_pointer(Objects * objects)
-{
-    return mouse(objects, 0, 0, 0);
-}
-
-int Input_box(Objects * objects, int ax, int ay)
-{
-    return mouse(objects, ax, ay, 1);
-}
-
-int Input_other(int (*function) (), char *type)
-{
-    int stat;
-    char msg[1024];
-
-    sprintf(msg, "%s input required", type);
-    Menu_msg(msg);
-    stat = (*function) ();
-    if (active)
-	use_mouse_msg();
-
-    Menu_msg("");
-    return stat;
-}
-
-static int mouse(Objects * objects, int ax, int ay, int box)
-{
-    int first;
-    int stat;
-    int x, y, button;
-    Objects *obj;
-
-    first = !active;
-    active = 1;
-    if (first)
-	use_mouse_msg();
-
-    if (box) {
-	x = ax + 20;
-	y = ay + 20;
-    }
-    stat = 0;
-    replot = 1;
-    while (stat == 0) {
-	if (replot) {
-	    replot = 0;
-	    draw_objects(objects);
-	}
-	if (box)
-	    Mouse_box_anchored(ax, ay, &x, &y, &button);
-	else
-	    Mouse_pointer(&x, &y, &button);
-
-	if (!(obj = find(objects, x, y)))
-	    continue;
-
-	switch (obj->type) {
-	case MENU_OBJECT:
-	case OTHER_OBJECT:
-	    stat = (*obj->handler) (x, y, button);
-	    break;
-	case OPTION_OBJECT:
-	    select_option(objects, obj);
-	    draw_option_boxes(objects);
-	    break;
-	}
-    }
-
-    /* if we are first call, mark not active
-     * indicate that objects above use must be replotted.
-     */
-    if (first)
-	active = 0;
-    Menu_msg("");
-
-    return stat;
-}
-
-
-int use_mouse_msg(void)
-{
-    Curses_write_window(PROMPT_WINDOW, 1, 1, "Use mouse now ...\n");
-
-    return 0;
-}
-
-static int draw_objects(Objects * objects)
-{
-    Objects *obj;
-    int top, bottom, left, right;
-    int size, edge;
-
-
-    /* erase the menu window */
-    Erase_view(VIEW_MENU);
-    R_flush();
-
-    /* determine sizes and text indentation */
-    size = VIEW_MENU->nrows - 4;
-    edge = 2;
-
-    R_text_size(size, size);
-
-    left = VIEW_MENU->left;
-    top = VIEW_MENU->top;
-    bottom = VIEW_MENU->bottom;
-
-
-    /* put the (boxed) text on the menu view */
-    for (obj = objects; obj->type; obj++) {
-	if (!visible(obj))
-	    continue;
-	switch (obj->type) {
-	case OPTION_OBJECT:
-	case MENU_OBJECT:
-	    right = left + 2 * edge + Text_width(obj->label);
-	    obj->left = left;
-	    obj->right = right;
-	    obj->top = top;
-	    obj->bottom = bottom;
-
-	    R_standard_color(FILL_COLOR);
-	    R_box_abs(left, top, right, bottom);
-
-	    R_standard_color(TEXT_COLOR);
-	    Text(obj->label, top, bottom, left, right, edge);
-
-	    R_standard_color(OUTLINE_COLOR);
-	    Outline_box(top, bottom, left, right);
-
-	    left = right;
-	    break;
-
-	case INFO_OBJECT:
-	    if (*obj->label == 0)
-		break;
-	    if (*obj->status < 0)
-		break;
-	    right = left + 2 * edge + Text_width(obj->label);
-	    R_standard_color(BLACK);
-	    Text(obj->label, top, bottom, left, right, edge);
-
-	    left = right;
-	    break;
-	}
-    }
-    draw_option_boxes(objects);
-    R_flush();
-
-    return 0;
-}
-
-static Objects *find(Objects * objects, int x, int y)
-{
-    Objects *other;
-
-    other = NULL;
-    for (; objects->type; objects++) {
-	if (!visible(objects))
-	    continue;
-	switch (objects->type) {
-	case MENU_OBJECT:
-	case OPTION_OBJECT:
-	    if (x >= objects->left && x <= objects->right
-		&& y >= objects->top && y <= objects->bottom)
-		return objects;
-	    break;
-	case OTHER_OBJECT:
-	    other = objects;
-	    break;
-	}
-    }
-    return other;
-}
-
-static int select_option(Objects * objects, Objects * obj)
-{
-    while (objects->type) {
-	if (objects->type == OPTION_OBJECT && *objects->status >= 0 &&
-	    objects->binding == obj->binding)
-	    *objects->status = 0;
-	objects++;
-    }
-    *obj->status = 1;
-
-    return 0;
-}
-
-static int draw_option_boxes(Objects * objects)
-{
-    Objects *x;
-
-    R_standard_color(OUTLINE_COLOR);
-    for (x = objects; x->type; x++) {
-	if (x->type == OPTION_OBJECT && *x->status == 0)
-	    Outline_box(x->top, x->bottom, x->left, x->right);
-    }
-    R_standard_color(GREEN);
-    for (x = objects; x->type; x++) {
-	if (x->type == OPTION_OBJECT && *x->status > 0)
-	    Outline_box(x->top, x->bottom, x->left, x->right);
-    }
-
-    return 0;
-}
-
-static int visible(Objects * object)
-{
-    if (object->type == OPTION_OBJECT)
-	return (*object->status >= 0);
-    return (*object->status > 0);
-}
-
-int Menu_msg(char *msg)
-{
-    int size, edge;
-
-    size = VIEW_MENU->nrows - 4;
-    edge = 2;
-
-    Erase_view(VIEW_MENU);
-
-    if (*msg) {
-	R_text_size(size, size);
-	R_standard_color(BLACK);
-	Text(msg, VIEW_MENU->top, VIEW_MENU->bottom,
-	     VIEW_MENU->left, VIEW_MENU->right, edge);
-    }
-    R_flush();
-    replot = 1;
-
-    return 0;
-}
-
-int Start_mouse_in_menu(void)
-{
-    Set_mouse_xy((VIEW_MENU->left + 2 * VIEW_MENU->right) / 3,
-		 (VIEW_MENU->top + VIEW_MENU->bottom) / 2);
-
-    return 0;
-}

+ 0 - 102
imagery/i.class/input_color.c

@@ -1,102 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-#define INP_COLOR 2
-
-int Display_color = NUM_GREEN;
-char *Display_color_name = NAME_GREEN;
-static int use = 1;
-
-int input_color(void)
-{
-    static Objects objects[] = {
-	INFO("Display Color: ", &use),
-	MENU(" Green ", green, &use),
-	MENU(" Red ", red, &use),
-	MENU(" Blue ", blue, &use),
-	MENU(" Yellow ", yellow, &use),
-	MENU(" Orange ", orange, &use),
-	MENU(" Brown ", brown, &use),
-	MENU(" Purple ", purple, &use),
-	MENU(" White ", white, &use),
-	MENU(" Grey ", grey, &use),
-	MENU(" Black ", black, &use),
-	{0}
-    };
-
-    Input_pointer(objects);
-    Menu_msg("");
-    return (INP_COLOR);
-}
-
-
-
-int green(void)
-{
-    Display_color = NUM_GREEN;
-    Display_color_name = NAME_GREEN;
-    return (1);
-}
-
-int red(void)
-{
-    Display_color = NUM_RED;
-    Display_color_name = NAME_RED;
-    return (1);
-}
-
-int blue(void)
-{
-    Display_color = NUM_BLUE;
-    Display_color_name = NAME_BLUE;
-    return (1);
-}
-
-int yellow(void)
-{
-    Display_color = NUM_YELLOW;
-    Display_color_name = NAME_YELLOW;
-    return (1);
-}
-
-int orange(void)
-{
-    Display_color = NUM_ORANGE;
-    Display_color_name = NAME_ORANGE;
-    return (1);
-}
-
-int brown(void)
-{
-    Display_color = NUM_BROWN;
-    Display_color_name = NAME_BROWN;
-    return (1);
-}
-
-int purple(void)
-{
-    Display_color = NUM_PURPLE;
-    Display_color_name = NAME_PURPLE;
-    return (1);
-}
-
-int white(void)
-{
-    Display_color = NUM_WHITE;
-    Display_color_name = NAME_WHITE;
-    return (1);
-}
-
-int grey(void)
-{
-    Display_color = NUM_GREY;
-    Display_color_name = NAME_GREY;
-    return (1);
-}
-
-int black(void)
-{
-    Display_color = NUM_BLACK;
-    Display_color_name = NAME_BLACK;
-    return (1);
-}

+ 0 - 105
imagery/i.class/input_std.c

@@ -1,105 +0,0 @@
-#include "globals.h"
-#include "local_proto.h"
-
-#define INP_STD 1
-
-float Nstd;
-static int use = 1;
-
-int input_std(void)
-{
-    static Objects objects[] = {
-	INFO("Number of Std Deviations: ", &use),
-	MENU(" 0.5 ", nstd050, &use),
-	MENU(" 0.75 ", nstd075, &use),
-	MENU(" 1.0 ", nstd100, &use),
-	MENU(" 1.25 ", nstd125, &use),
-	MENU(" 1.5 ", nstd150, &use),
-	MENU(" 1.75 ", nstd175, &use),
-	MENU(" 2.0 ", nstd200, &use),
-	MENU(" 2.25 ", nstd225, &use),
-	MENU(" 2.5 ", nstd250, &use),
-	MENU(" Other ", other, &use),
-	{0}
-    };
-
-    Input_pointer(objects);
-    Menu_msg("");
-    return (INP_STD);
-}
-
-
-
-int other(void)
-{
-    char tmpstr[50];
-    float tempflt;
-    int good;
-
-    Menu_msg("Use Keyboard on Text Terminal...");
-
-    do {
-	Curses_prompt_gets("Enter Number of Standard Deviations: ", tmpstr);
-	good = sscanf(tmpstr, " %f ", &tempflt);
-	if (tempflt <= 0.0)
-	    good = 0;
-    } while (good != 1);
-
-    Nstd = tempflt;
-    use_mouse_msg();
-    return (1);
-}
-
-int nstd050(void)
-{
-    Nstd = 0.50;
-    return (1);
-}
-
-int nstd075(void)
-{
-    Nstd = 0.75;
-    return (1);
-}
-
-int nstd100(void)
-{
-    Nstd = 1.0;
-    return (1);
-}
-
-int nstd125(void)
-{
-    Nstd = 1.25;
-    return (1);
-}
-
-int nstd150(void)
-{
-    Nstd = 1.50;
-    return (1);
-}
-
-int nstd175(void)
-{
-    Nstd = 1.75;
-    return (1);
-}
-
-int nstd200(void)
-{
-    Nstd = 2.00;
-    return (1);
-}
-
-int nstd225(void)
-{
-    Nstd = 2.25;
-    return (1);
-}
-
-int nstd250(void)
-{
-    Nstd = 2.50;
-    return (1);
-}

+ 0 - 185
imagery/i.class/local_proto.h

@@ -1,185 +0,0 @@
-#ifndef __LOCAL_PROTO_H__
-#define __LOCAL_PROTO_H__
-
-#include <grass/gis.h>
-
-
-/* add_point.c */
-int add_point(int, int);
-
-/* analyze_sig.c */
-int analyze_sig(void);
-
-/* band_files.c */
-int open_band_files(void);
-int close_band_files(void);
-
-/* cellhd.c */
-int Outline_cellhd(View *, struct Cell_head *);
-
-/* complete_reg.c */
-int complete_region(void);
-
-/* conv.c */
-int view_to_col(View *, int);
-int view_to_row(View *, int);
-int col_to_view(View *, int);
-int row_to_view(View *, int);
-double row_to_northing(struct Cell_head *, int, double);
-double col_to_easting(struct Cell_head *, int, double);
-
-/* curses.c */
-int Begin_curses(void);
-int End_curses(void);
-int Suspend_curses(void);
-int Resume_curses(void);
-int Curses_allow_interrupts(int);
-int Curses_clear_window(Window *);
-int Curses_outline_window(Window *);
-int Curses_write_window(Window *, int, int, char *);
-int Curses_replot_screen(void);
-int Curses_prompt_gets(char *, char *);
-int Curses_getch(int);
-
-/* define_reg.c */
-int define_region(void);
-
-/* del_point.c */
-int del_point(void);
-
-/* draw_cell.c */
-int draw_cell(View *, int);
-
-/* draw_match.c */
-int draw_cell(View *, int);
-
-/* draw_reg.c */
-int draw_region(void);
-int line_in_map1(int, int, int, int, int);
-
-/* driver.c */
-int driver(void);
-
-/* edge.c */
-int edge(register int, register int, int, int);
-
-/* edge_point.c */
-int edge_point(register int, register int);
-
-/* erase_reg.c */
-int erase_region(void);
-
-/* g_init.c */
-int g_init(void);
-
-/* graphics.c */
-int Init_graphics(void);
-int Outline_box(int, int, int, int);
-int Text_width(char *);
-int Text(char *, int, int, int, int, int);
-
-/* histograms.c */
-int histograms(int, float *, float **, int **, int, int *, int *, double,
-	       int);
-/* init_reg.c */
-int init_region(struct region Region);
-
-/* input.c */
-int Input_pointer(Objects *);
-int Input_box(Objects *, int, int);
-int Input_other(int (*)(), char *);
-int use_mouse_msg(void);
-int Menu_msg(char *);
-int Start_mouse_in_menu(void);
-
-/* input_color.c */
-int input_color(void);
-int green(void);
-int red(void);
-int blue(void);
-int yellow(void);
-int orange(void);
-int brown(void);
-int purple(void);
-int white(void);
-int grey(void);
-int black(void);
-
-/* input_std.c */
-int input_std(void);
-int other(void);
-int nstd050(void);
-int nstd075(void);
-int nstd100(void);
-int nstd125(void);
-int nstd150(void);
-int nstd175(void);
-int nstd200(void);
-int nstd225(void);
-int nstd250(void);
-
-/* main.c */
-#ifdef __GNUC_MINOR__
-void quit(void) __attribute__ ((__noreturn__));
-#else
-void quit(void);
-#endif
-int error(const char *, int);
-
-/* mouse.c */
-int Mouse_pointer(int *, int *, int *);
-int Mouse_line_anchored(int, int, int *, int *, int *);
-int Mouse_box_anchored(int, int, int *, int *, int *);
-int Get_mouse_xy(int *, int *);
-int Set_mouse_xy(int, int);
-
-/* outline.c */
-int outline(void);
-
-/* readbands.c */
-int readbands(int, int);
-
-/* redisplay.c */
-int redisplay(void);
-int redisplay_both(void);
-int redisplay_map(void);
-int redisplay_zoom(void);
-int cancel_redisplay(void);
-
-/* remove_mask.c */
-int remove_mask(void);
-
-/* restore_reg.c */
-int restore_region(void);
-
-/* save_reg.c */
-int save_region(void);
-
-/* set_signals.c */
-int set_signals(void);
-
-/* sigalarm.c */
-void sigalarm(int);
-
-/* signature.c */
-int init_sig_routines(size_t);
-int prepare_signature(int);
-int show_signature(int, double);
-int display_signature(void);
-int have_signature(void);
-int save_signature(void);
-int write_signatures(void);
-
-/* title.c */
-int display_title(View *);
-
-/* view.c */
-int Configure_view(View *, char *, char *, double, double);
-int In_view(View *, int, int);
-int Erase_view(View *);
-double magnification(View *);
-
-/* zoom_box.c */
-int zoom_box(void);
-
-#endif /* __LOCAL_PROTO_H__ */

+ 0 - 307
imagery/i.class/main.c

@@ -1,307 +0,0 @@
-
-/****************************************************************************
- *
- * MODULE:       i.class
- * AUTHOR(S):    David Satnik, Central Washington University
- *                      (original contributor)
- *               Markus Neteler <neteler itc.it>,
- *               Bernhard Reiter <bernhard intevation.de>, 
- *               Brad Douglas <rez touchofmadness.com>, 
- *               Glynn Clements <glynn gclements.plus.com>, 
- *               Hamish Bowman <hamish_b yahoo.com>, 
- *               Jan-Oliver Wagner <jan intevation.de>
- * PURPOSE:      define training areas for supervised classification
- * COPYRIGHT:    (C) 1999-2007 by the GRASS Development Team
- *
- *               This program is free software under the GNU General Public
- *               License (>=v2). Read the file COPYING that comes with GRASS
- *               for details.
- *
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/display.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-Window *PROMPT_WINDOW;
-
-int SCREEN_TOP;
-int SCREEN_BOTTOM;
-int SCREEN_LEFT;
-int SCREEN_RIGHT;
-
-View *VIEW_MAP1;
-View *VIEW_TITLE1;
-View *VIEW_MAP1_ZOOM;
-View *VIEW_TITLE1_ZOOM;
-
-View *VIEW_MASK1;
-View *VIEW_MENU;
-View *VIEW_HISTO;
-
-int THE_COLORS[10];
-
-struct Color_table Color_table[10] = {
-    {0,0,0},		/*black*/
-    {50,50,255},	/*blue*/ 
-    {170,200,70},	/*brown*/
-    {0,255,0},		/*green*/
-    {150,150,150},	/*grey*/ 
-    {220,170,0},	/*orange*/
-    {200,0,200},	/*purple*/
-    {255,0,0},		/*red*/	 
-    {255,255,255},	/*white*/
-    {255,255,0}		/*yellow */
-};
-
-struct Ref Refer;
-FILE *outsig_fd;
-struct Signature Sigs;
-struct Cell_head Band_cellhd;
-
-int *Bandfd;
-struct region Region;
-struct signalflag signalflag;
-CELL **Bandbuf;
-
-/* function prototypes */
-static int check_files(char *, char *, char *, char *);
-
-
-int main(int argc, char *argv[])
-{
-    char *mapset;
-    char group[GNAME_MAX], grp_mapset[GMAPSET_MAX];
-
-    struct Cell_head cellhd;
-    struct GModule *module;
-    struct Option *bg_map, *img_grp, *img_subgrp, *out_sig, *in_sig;
-
-    /* must run in a term window */
-    G_putenv("GRASS_UI_TERM", "1");
-
-    /* Initialize the gis library */
-    G_gisinit(argv[0]);
-
-    module = G_define_module();
-    G_add_keyword(_("imagery"));
-    G_add_keyword(_("classification"));
-    G_add_keyword(_("signatures"));
-    G_add_keyword(_("Maximum Likelihood Classification"));
-    module->label =
-	_("Generates spectral signatures for an image by allowing the user "
-	  "to outline regions of interest.");
-    module->description =
-	_("The resulting signature file can be used as input for "
-	  "i.maxlik or as a seed signature file for i.cluster.");
-
-    bg_map = G_define_standard_option(G_OPT_R_MAP);
-    bg_map->description = _("Name of raster map to be displayed");
-
-    img_grp = G_define_standard_option(G_OPT_I_GROUP);
-
-    /* img_subgrp = G_define_standard_option (G_OPT_I_SUBGROUP); *//* not used since gisprompt needs to be deactivated for interactive use */
-    img_subgrp = G_define_option();
-    img_subgrp->key = "subgroup";
-    img_subgrp->type = TYPE_STRING;
-    img_subgrp->key_desc = "name";
-    img_subgrp->required = YES;
-    img_subgrp->description = _("Name of input imagery subgroup");
-
-    out_sig = G_define_standard_option(G_OPT_F_OUTPUT);
-    out_sig->key = "outsig";
-    out_sig->required = YES;
-    out_sig->description = _("File to contain result signatures");
-
-    in_sig = G_define_standard_option(G_OPT_F_INPUT);
-    in_sig->key = "insig";
-    in_sig->required = NO;
-    in_sig->description = _("File containing input signatures (seed)");
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-
-    /* must have a graphics terminal selected */
-    if (R_open_driver() != 0)
-	G_fatal_error(_("No graphics device selected"));
-
-    /* check to see if a MASK is set */
-    if (Rast_maskfd() >= 0)
-	G_fatal_error(_("You have a mask set. Unset mask and run again"));
-
-
-    /* check if current mapset:  (imagery libs are very lacking in this dept)
-       - abort if not,
-       - remove @mapset part if it is
-     */
-    if (G_name_is_fully_qualified(img_grp->answer, group, grp_mapset)) {
-	if (strcmp(grp_mapset, G_mapset()))
-	    G_fatal_error(_("Group must exist in the current mapset"));
-    }
-    else {
-	strcpy(group, img_grp->answer);	/* FIXME for buffer overflow (have the parser check that?) */
-    }
-
-    /* get group/subgroup, and signature files */
-    check_files(group, img_subgrp->answer, out_sig->answer, in_sig->answer);
-
-
-    /* initialize the Region structure */
-    init_region(Region);
-
-    /* initialize the graphics */
-    g_init();
-
-    /* set up signal handling */
-    set_signals();
-
-    /* put out a title */
-    display_title(VIEW_MAP1);
-
-    mapset = G_find_raster(bg_map->answer, "");
-    Rast_get_cellhd(bg_map->answer, mapset, &cellhd);
-
-    G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
-			   VIEW_MAP1->ncols);
-    Configure_view(VIEW_MAP1, bg_map->answer, mapset, cellhd.ns_res,
-		   cellhd.ew_res);
-
-    /* configure the MASK view right over the top of the map1 view */
-    G_adjust_window_to_box(&cellhd, &VIEW_MASK1->cell.head, VIEW_MASK1->nrows,
-			   VIEW_MASK1->ncols);
-    Configure_view(VIEW_MASK1, "MASK", G_mapset(), cellhd.ns_res,
-		   cellhd.ew_res);
-
-    draw_cell(VIEW_MAP1, OVER_WRITE);
-
-    /* Initialize the text terminal */
-    Begin_curses();
-    Curses_clear_window(PROMPT_WINDOW);
-
-    Region.saved_npoints = 0;
-
-    G_set_error_routine(error);
-
-    driver();
-
-    write_signatures();
-    End_curses();
-
-    exit(EXIT_SUCCESS);
-}
-
-
-void quit(void)
-{
-    write_signatures();
-    End_curses();
-    R_close_driver();
-
-    exit(EXIT_SUCCESS);
-}
-
-
-int error(const char *msg, int fatal)
-{
-    char buf[200];
-    int x, y, button;
-
-    Curses_clear_window(PROMPT_WINDOW);
-    Curses_write_window(PROMPT_WINDOW, 1, 1, "LOCATION:\n");
-    Curses_write_window(PROMPT_WINDOW, 1, 12, G_location());
-    Curses_write_window(PROMPT_WINDOW, 2, 1, "MAPSET:\n");
-    Curses_write_window(PROMPT_WINDOW, 2, 12, G_location());
-
-    if (fatal)
-	sprintf(buf, "ERROR: %s", msg);
-    else
-	sprintf(buf, "WARNING: %s (click mouse to continue)", msg);
-    Menu_msg(buf);
-
-    if (fatal) {
-	write_signatures();
-	End_curses();
-
-	exit(EXIT_FAILURE);
-    }
-
-    Mouse_pointer(&x, &y, &button);
-    Curses_clear_window(PROMPT_WINDOW);
-
-    return 0;
-}
-
-
-static int check_files(char *img_group, char *img_subgroup,
-		       char *out_sig, char *in_sig)
-{
-    int n, any;
-
-    I_init_group_ref(&Refer);
-
-    I_get_subgroup_ref(img_group, img_subgroup, &Refer);
-
-    any = 0;
-    for (n = 0; n < Refer.nfiles; n++) {
-	if (G_find_raster(Refer.file[n].name, Refer.file[n].mapset) == NULL) {
-	    if (!any)
-		G_warning(_("** The following raster maps in subgroup "
-			    "[%s] do not exist:"), img_subgroup);
-	    any = 1;
-	    G_message("       %s@%s", Refer.file[n].name,
-		      Refer.file[n].mapset);
-	}
-    }
-
-    if (Refer.nfiles <= 0) {
-	G_warning(_("Subgroup [%s] does not have any files"), img_subgroup);
-	G_fatal_error(_("The subgroup must have at least 2 files to run"));
-    }
-    else if (Refer.nfiles == 1) {
-	G_warning(_("Subgroup [%s] only has 1 file"), img_subgroup);
-	G_fatal_error(_("The subgroup must have at least 2 files to run"));
-    }
-
-    Rast_get_cellhd(Refer.file[0].name, Refer.file[0].mapset, &Band_cellhd);
-
-    /* allocate space for signature routines */
-    init_sig_routines((size_t) Refer.nfiles);
-
-    G_message(_("\nRESULT SIGNATURE"));
-
-    if (!
-	(outsig_fd =
-	 I_fopen_signature_file_new(img_group, img_subgroup, out_sig)))
-	G_fatal_error(_("Unable to open output signature file '%s'"),
-		      out_sig);
-
-    I_init_signatures(&Sigs, Refer.nfiles);
-    if (in_sig) {
-	FILE *insig_fd;
-
-	G_message(_("\nSEED SIGNATURES"));
-
-	if (!
-	    (insig_fd =
-	     I_fopen_signature_file_old(img_group, img_subgroup, in_sig)))
-	    G_warning(_("Unable to read signature file [%s]"), in_sig);
-
-	if ((n = I_read_signatures(insig_fd, &Sigs)) < 0)
-	    G_warning(_("** Unable to read signature file [%s] **"), in_sig);
-
-	fclose(insig_fd);
-
-	if (Sigs.nsigs <= 255)
-	    return 0;
-
-	G_warning(_("%s has too many signatures"), in_sig);
-	I_free_signatures(&Sigs);
-    }
-
-    return 0;
-}

+ 0 - 66
imagery/i.class/mouse.c

@@ -1,66 +0,0 @@
-#include "globals.h"
-#include <grass/display.h>
-
-static int first = 1;
-static int curx, cury;
-
-int Mouse_pointer(int *x, int *y, int *button)
-{
-    if (first) {
-	curx = (SCREEN_LEFT + SCREEN_RIGHT) / 2;
-	cury = (SCREEN_TOP + SCREEN_BOTTOM) / 2;
-	first = 0;
-    }
-    R_get_location_with_pointer(&curx, &cury, button);
-    *x = curx;
-    *y = cury;
-
-#ifdef BUTTON3
-    if (*button == 3)
-	quit();
-#endif
-    return 0;
-}
-
-int Mouse_line_anchored(int x1, int y1, int *x2, int *y2, int *button)
-{
-    R_get_location_with_line(x1, y1, x2, y2, button);
-    curx = *x2;
-    cury = *y2;
-    first = 0;
-
-#ifdef BUTTON3
-    if (*button == 3)
-	quit();
-#endif
-    return 0;
-}
-
-int Mouse_box_anchored(int x1, int y1, int *x2, int *y2, int *button)
-{
-    R_get_location_with_box(x1, y1, x2, y2, button);
-    curx = *x2;
-    cury = *y2;
-    first = 0;
-
-#ifdef BUTTON3
-    if (*button == 3)
-	quit();
-#endif
-    return 0;
-}
-
-int Get_mouse_xy(int *x, int *y)
-{
-    *x = curx;
-    *y = cury;
-    return 0;
-}
-
-int Set_mouse_xy(int x, int y)
-{
-    first = 0;
-    curx = x;
-    cury = y;
-    return 0;
-}

+ 0 - 161
imagery/i.class/outline.c

@@ -1,161 +0,0 @@
-#define OUTLINE
-
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-
-#define V     Region.vertex	/* converted vertex list */
-#define VN    Region.vertex_npoints
-
-#define P     Region.perimeter	/* perimeter point list */
-#define PN    Region.perimeter_npoints
-
-#define A     Region.point
-#define AN    Region.npoints
-
-#define extrema(x,y,z) (((x<y)&&(z<y))||((x>y)&&(z>y)))
-#define non_extrema(x,y,z) (((x<y)&&(y<z))||((x>y)&&(y>z)))
-
-int outline(void)
-{
-    int first;
-    int skip;			/* boolean */
-    int np;			/* perimeter estimate */
-    POINT tmp[MAX_VERTEX];	/* temp vertex list   */
-    int cur;
-    int prev;
-    int next;
-    double tmp_n, tmp_e;
-    POINT temp;
-
-
-    /* convert alarm area points to data row/col verticies */
-    Menu_msg("Preparing outline...");
-
-    for (cur = 0; cur < AN; cur++) {
-	temp.y = view_to_row(Region.view, A[cur].y);
-	temp.x = view_to_col(Region.view, A[cur].x);
-	tmp_n = row_to_northing(&(Region.view->cell.head), temp.y, 0.5);
-	tmp_e = col_to_easting(&(Region.view->cell.head), temp.x, 0.5);
-	tmp[cur].y = Rast_northing_to_row(tmp_n, &Band_cellhd);
-	tmp[cur].x = Rast_easting_to_col(tmp_e, &Band_cellhd);
-    }
-
-    /* find first edge which is not horizontal */
-
-    first = -1;
-    prev = AN - 1;
-    for (cur = 0; cur < AN; prev = cur++)
-	if (tmp[cur].y != tmp[prev].y) {
-	    first = cur;
-	    break;
-	}
-    if (first < 0) {
-	G_warning(_("Absurd polygon."));
-	return (0);
-    }
-
-    /* copy tmp to vertex list collapsing adjacent horizontal edges */
-
-    skip = 0;
-    VN = 0;
-    cur = first;		/* stmt not necssary */
-
-    do {
-	if (signalflag.interrupt)
-	    return (0);
-	if (!skip) {
-	    V[VN].x = tmp[cur].x;
-	    V[VN].y = tmp[cur].y;
-	    VN++;
-	}
-
-	prev = cur++;
-	if (cur >= AN)
-	    cur = 0;
-	if ((next = cur + 1) >= AN)
-	    next = 0;
-
-	skip = ((tmp[prev].y == tmp[cur].y) && (tmp[next].y == tmp[cur].y));
-    }
-    while (cur != first);
-
-
-    /* count points on the perimeter */
-
-    np = 0;
-    prev = VN - 1;
-    for (cur = 0; cur < VN; prev = cur++)
-	np += abs(V[prev].y - V[cur].y);
-
-
-    /* allocate perimeter list */
-
-    P = (POINT *) G_malloc(np * sizeof(POINT));
-    if (!P) {
-	G_warning(_("Outlined area is too large."));
-	return (0);
-    }
-
-    /* store the perimeter points */
-
-    PN = 0;
-    prev = VN - 1;
-    for (cur = 0; cur < VN; prev = cur++) {
-	if (signalflag.interrupt)
-	    return (0);
-	edge(V[prev].x, V[prev].y, V[cur].x, V[cur].y);
-    }
-
-    /*
-     * now decide which verticies should be included
-     *    local extrema are excluded
-     *    local non-extrema are included
-     *    verticies of horizontal edges which are pseudo-extrema
-     *      are excluded.
-     *    one vertex of horizontal edges which are pseudo-non-extrema
-     *      are included.
-     */
-
-
-    prev = VN - 1;
-    cur = 0;
-    do {
-	if (signalflag.interrupt)
-	    return (0);
-	next = cur + 1;
-	if (next >= VN)
-	    next = 0;
-
-	if (extrema(V[prev].y, V[cur].y, V[next].y))
-	    skip = 1;
-	else if (non_extrema(V[prev].y, V[cur].y, V[next].y))
-	    skip = 0;
-	else {
-	    skip = 0;
-	    if (++next >= VN)
-		next = 0;
-	    if (extrema(V[prev].y, V[cur].y, V[next].y))
-		skip = 1;
-	}
-
-	if (!skip)
-	    edge_point(V[cur].x, V[cur].y);
-
-	cur = next;
-	prev = cur - 1;
-    }
-    while (cur != 0);
-
-
-    /* sort the edge points by row and then by col */
-
-    Menu_msg("Sorting...");
-    qsort(P, (size_t) PN, sizeof(POINT), edge_order);
-
-    Menu_msg("");
-    return (1);
-}

+ 0 - 14
imagery/i.class/point.h

@@ -1,14 +0,0 @@
-#ifndef __POINT_H__
-#define __POINT_H__
-
-#ifndef POINT
-#define POINT struct _point
-
-POINT {
-    int x;
-    int y;
-};
-
-#endif
-
-#endif /* __POINT_H__ */

+ 0 - 14
imagery/i.class/readbands.c

@@ -1,14 +0,0 @@
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-
-
-int readbands(int nbands, int cur)
-{
-    int i;
-
-    for (i = 0; i < nbands; i++)
-	Rast_get_c_row_nomask(Bandfd[i], Bandbuf[i], cur);
-
-    return 0;
-}

+ 0 - 64
imagery/i.class/redisplay.c

@@ -1,64 +0,0 @@
-#include "globals.h"
-#include <grass/display.h>
-#include <grass/glocale.h>
-#include "local_proto.h"
-
-static int use = 1;
-
-
-int redisplay(void)
-{
-    static Objects objects[] = {
-	INFO("Redisplay Map Menu:", &use),
-	MENU(" Map window ", redisplay_map, &use),
-	MENU(" Zoom window ", redisplay_zoom, &use),
-	MENU(" Both ", redisplay_both, &use),
-	MENU(" Cancel ", cancel_redisplay, &use),
-	{0}
-    };
-
-    Input_pointer(objects);
-    Menu_msg("");
-
-    return (0);
-}
-
-int redisplay_both(void)
-{
-    redisplay_map();
-    redisplay_zoom();
-
-    return (-1);
-}
-
-int redisplay_map(void)
-{
-    draw_cell(VIEW_MAP1, OVER_WRITE);
-    if (VIEW_MAP1_ZOOM->cell.configured) {
-	/* Outline the zoom window on the main map */
-	R_standard_color(RED);
-	Outline_cellhd(VIEW_MAP1, &VIEW_MAP1_ZOOM->cell.head);
-    }
-    return (-1);
-}
-
-int redisplay_zoom(void)
-{
-    if (VIEW_MAP1_ZOOM->cell.configured) {
-	draw_cell(VIEW_MAP1_ZOOM, OVER_WRITE);
-	/*
-	 * Outline the zoom window on the main map
-	 */
-	R_standard_color(RED);
-	Outline_cellhd(VIEW_MAP1, &VIEW_MAP1_ZOOM->cell.head);
-    }
-    else
-	G_warning(_("No zoom window is defined."));
-
-    return (-1);
-}
-
-int cancel_redisplay(void)
-{
-    return (-1);
-}

+ 0 - 18
imagery/i.class/remove_mask.c

@@ -1,18 +0,0 @@
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-
-
-int remove_mask(void)
-{
-    static char *elements[] = { "cell", "cellhd", "cats", "colr",
-	"colr2", "hist", "cell_misc", ""
-    };
-    int i = 0;
-
-    while (strcmp(elements[i], "") != 0)
-	if (G_remove(elements[i++], "MASK") < 0)
-	    G_fatal_error(_("Error while removing the old MASK cell map."));
-
-    return 0;
-}

+ 0 - 28
imagery/i.class/restore_reg.c

@@ -1,28 +0,0 @@
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-#define SPT Region.saved_point
-
-
-int restore_region(void)
-{
-    int i;
-
-    if (!Region.area.saved || Region.saved_view == NULL ||
-	Region.saved_npoints <= 0)
-	G_warning(_("No region is saved, can not restore."));
-    else {
-	if (Region.area.define)
-	    erase_region();
-	Region.view = Region.saved_view;
-	Region.area.define = 1;
-	for (i = 0; i < Region.saved_npoints; i++)
-	    add_point(SPT[i].x, SPT[i].y);
-	Region.area.completed = 1;
-    }
-    Menu_msg("");
-
-    return (0);
-}

+ 0 - 25
imagery/i.class/save_reg.c

@@ -1,25 +0,0 @@
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-
-#define PT Region.point
-#define SPT Region.saved_point
-
-
-int save_region(void)
-{
-    int i;
-
-    if (!Region.area.completed || Region.view == NULL || Region.npoints <= 0)
-	G_warning(_("Region is not complete, can not save."));
-    else {
-	for (i = 0; i < Region.npoints; i++) {
-	    SPT[i].x = PT[i].x;
-	    SPT[i].y = PT[i].y;
-	}
-	Region.saved_npoints = Region.npoints;
-	Region.saved_view = Region.view;
-	Region.area.saved = 1;
-    }
-    return (0);
-}

+ 0 - 33
imagery/i.class/set_signals.c

@@ -1,33 +0,0 @@
-#include <signal.h>
-#include <grass/config.h>
-#include "globals.h"
-#include "local_proto.h"
-
-static RETSIGTYPE do_quit(int sig)
-{
-    quit();
-}
-
-static RETSIGTYPE sigint(int sig)
-{
-    signal(sig, sigint);
-    signalflag.interrupt = sig;
-}
-
-int set_signals(void)
-{
-    /* set the ctrlz catch 
-       signal (SIGTSTP, ctrlz);
-     */
-#ifdef SIGTSTP
-    signal(SIGTSTP, SIG_IGN);	/* ignore ctrl-Z */
-#endif
-
-    /* set other signal catches */
-    signalflag.interrupt = 0;
-    signal(SIGINT, sigint);
-
-    signal(SIGTERM, do_quit);
-
-    return 0;
-}

+ 0 - 8
imagery/i.class/sigalarm.c

@@ -1,8 +0,0 @@
-#include <signal.h>
-#include "globals.h"
-
-void sigalarm(int n)
-{
-    signal(n, sigalarm);
-    signalflag.alarm = n;
-}

+ 0 - 401
imagery/i.class/signature.c

@@ -1,401 +0,0 @@
-#include <string.h>
-#include <unistd.h>
-#include <math.h>
-#include <stdio.h>
-#include <signal.h>
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-#define PN Region.perimeter_npoints
-#define P  Region.perimeter
-
-#define SN  Sigs.nsigs
-#define SIG Sigs.sig[SN-1]
-
-#define MEAN(b)		(Band_sum[b]/np)
-#define STD_DEV(b)	((float) sqrt ((double) VAR(b,b) / np))
-#define VAR(b1,b2)	(Band_product[b1][b2] - Band_sum[b1]*Band_sum[b2]/np)
-
-static int *Band_min;
-static int *Band_max;
-static int *Range_max, *Range_min;
-static float *Band_sum;		/* for means, variances */
-static float **Band_product;
-static int **Band_histo;
-static int np;			/* number of points in sample */
-static int usable_signature = 0;
-static int dont_save(void);
-static int yes_save(void);
-static int done(void);
-
-
-/**********************************************************************/
-
-/************************** ###### ************************************/
-
-/**********************************************************************/
-int init_sig_routines(size_t nbands)
-{
-    int i;
-
-    if ((Range_min = (int *)G_calloc(nbands, sizeof(int))) == NULL ||
-	(Range_max = (int *)G_calloc(nbands, sizeof(int))) == NULL ||
-	(Band_min = (int *)G_calloc(nbands, sizeof(int))) == NULL ||
-	(Band_max = (int *)G_calloc(nbands, sizeof(int))) == NULL ||
-	(Band_sum = (float *)G_calloc(nbands, sizeof(float))) == NULL ||
-	(Band_product = (float **)G_calloc(nbands, sizeof(float *))) == NULL
-	|| (Band_histo = (int **)G_calloc(nbands, sizeof(int *))) == NULL)
-	G_fatal_error(_("Unable to allocate space for signature statistics."));
-    for (i = 0; i < nbands; i++) {
-	if ((Band_product[i] =
-	     (float *)G_calloc(nbands, sizeof(float))) == NULL ||
-	    (Band_histo[i] = (int *)G_calloc(MAX_CATS, sizeof(int))) == NULL)
-	    G_fatal_error(_("Unable to allocate space for signature statistics."));
-    }
-
-    return 0;
-}
-
-
-/**********************************************************************/
-
-/************************** ###### ************************************/
-
-/**********************************************************************/
-int prepare_signature(int nbands)
-{
-    char msg[100];
-    int b, b2;
-    int n;
-    int i;
-    int x0, x1;
-    int x;
-    int y;
-    void (*prev_sigalarm) ();
-
-    Menu_msg("Preparing signature...");
-
-    usable_signature = 0;
-    if (PN % 2) {
-	G_warning(_("prepare_signature: outline has odd number of points."));
-	return (0);
-    }
-
-    for (b = 0; b < nbands; b++) {
-	Band_sum[b] = 0.0;
-	for (b2 = 0; b2 < nbands; b2++)
-	    Band_product[b][b2] = 0.0;
-	for (b2 = 0; b2 < MAX_CATS; b2++)
-	    Band_histo[b][b2] = 0;
-    }
-    np = 0;
-
-    signalflag.alarm = 0;
-    prev_sigalarm = signal(SIGALRM, sigalarm);
-    alarm(10);
-    for (i = 1; i < PN; i += 2) {
-	if (signalflag.interrupt)
-	    break;
-
-	if (signalflag.alarm) {
-	    alarm(0);
-	    signalflag.alarm = 0;
-	    sprintf(msg, "Preparing signature... %.0f%% complete",
-		    (float)i / PN * 100.0);
-	    Menu_msg(msg);
-	    alarm(10);
-	}
-
-	y = P[i].y;
-	if (y != P[i - 1].y) {
-	    G_warning(_("prepare_signature: scan line %d has odd number of points."),
-		      (i + 1) / 2);
-	    return (0);
-	}
-	readbands(nbands, y);
-
-	x0 = P[i - 1].x - 1;
-	x1 = P[i].x - 1;
-
-	if (x0 > x1) {
-	    G_warning(_("signature: perimeter points out of order."));
-	    return (0);
-	}
-
-	for (x = x0; x <= x1; x++) {
-	    np++;		/* count interior points */
-	    for (b = 0; b < nbands; b++) {
-		n = Bandbuf[b][x];
-		if (n < 0 || n > MAX_CATS - 1) {
-		    G_warning(_("prepare_signature: data error."));
-		    return (0);
-		}
-		Band_sum[b] += n;	/* sum for means */
-		Band_histo[b][n]++;	/* histogram */
-		if (np == 1)
-		    Band_min[b] = Band_max[b] = n;
-		if (Band_min[b] > n)
-		    Band_min[b] = n;	/* absolute min, max */
-		if (Band_max[b] < n)
-		    Band_max[b] = n;
-
-		for (b2 = 0; b2 <= b; b2++)	/* products for variance */
-		    Band_product[b][b2] += n * Bandbuf[b2][x];
-	    }
-	}
-    }
-    alarm(0);
-    signal(SIGALRM, prev_sigalarm);
-    Menu_msg("");
-
-    return (usable_signature = !signalflag.interrupt);
-}
-
-/**********************************************************************/
-
-/************************** ###### ************************************/
-
-/**********************************************************************/
-
-int first_display;
-extern int Display_color;
-extern char *Display_color_name;
-extern float Nstd;
-
-#define INP_STD 1
-#define INP_COLOR 2
-#define DISPLAY 3
-#define DONE 4
-
-int show_signature(int nbands, double default_nstd)
-{
-    int b;
-    int selection = 0;
-    static int use = 1;
-    char std_str[50], color_str[50];
-    float dist, mean;
-
-    static Objects objects[] = {
-	INFO("Signature Menu:", &use),
-	MENU("", input_std, &use),
-	MENU("", input_color, &use),
-	MENU(" Display matches ", display_signature, &use),
-	MENU(" Done ", done, &use),
-	{0}
-    };
-    objects[1].label = std_str;
-    objects[2].label = color_str;
-
-    Menu_msg("Drawing histograms...");
-    histograms(nbands, Band_sum, Band_product, Band_histo, np,
-	       Band_min, Band_max, Nstd, BEFORE_STD);
-    Nstd = 1.5;
-    for (b = 0; b < nbands; b++) {
-	dist = Nstd * STD_DEV(b);
-	mean = MEAN(b);
-	Range_min[b] = mean - dist + 0.5;
-	Range_max[b] = mean + dist + 0.5;
-    }
-    first_display = 1;
-
-    while (selection != DONE) {
-	sprintf(std_str, " Set std dev's (%5.2f) ", Nstd);
-	sprintf(color_str, " Set color (%s) ", Display_color_name);
-	selection = Input_pointer(objects);
-	switch (selection) {
-	case INP_STD:		/* Input Number of Std. Deviations */
-	    /* set min/max for each band - Nstd standard deviations from mean
-	       not exceed actual min and max */
-	    for (b = 0; b < nbands; b++) {
-		dist = Nstd * STD_DEV(b);
-		mean = MEAN(b);
-		Range_min[b] = mean - dist + 0.5;
-		Range_max[b] = mean + dist + 0.5;
-	    }
-	    Menu_msg("Drawing histograms...");
-	    histograms(nbands, Band_sum, Band_product, Band_histo, np,
-		       Range_min, Range_max, Nstd, AFTER_STD);
-
-	    /* remove the mask file, if it exists */
-	    first_display = 1;
-	    remove_mask();
-	    break;
-	case INP_COLOR:	/* Input Color for Display */
-	    break;
-	case DISPLAY:		/* Display the matching cells */
-	    first_display = 0;
-	    break;
-	case DONE:		/* done here, go back to command menu */
-	    Menu_msg("");
-	    break;
-	default:
-	    G_warning(_("Unknown Menu selection in show_signature()."));
-	}
-
-    }
-
-    /* remove the created mask file */
-    remove_mask();
-
-    return 0;
-}
-
-static int done(void)
-{
-    return (DONE);
-}
-
-/**********************************************************************/
-
-/************************** ###### ************************************/
-
-/**********************************************************************/
-int display_signature(void)
-{
-    int fd;
-    CELL *buffer;
-    struct Cell_head cellhd;
-    register int n;
-    register int col;
-    register int nbands;
-    int row, nrows, ncols;
-    struct Colors mask_colors;
-
-    if (first_display) {
-	Menu_msg("Finding cells that match the signature...");
-
-	nbands = Refer.nfiles;
-
-	/* build new mask based on current signature and Nstd */
-	Rast_set_window(&VIEW_MAP1->cell.head);
-	open_band_files();
-
-	fd = Rast_open_c_new(MASK);
-	buffer = Rast_allocate_c_buf();
-	nrows = Rast_window_rows();
-	ncols = Rast_window_cols();
-
-	for (row = 0; row < nrows; row++) {
-	    readbands(nbands, row);
-	    for (col = 0; col < ncols; col++) {
-		buffer[col] = (CELL) 0;
-		for (n = 0; n < nbands; n++) {
-		    if (Bandbuf[n][col] < Range_min[n] ||
-			Bandbuf[n][col] > Range_max[n])
-			goto past;	/* if not in range jump out past the assignment */
-		}
-		buffer[col] = (CELL) 1;
-	      past:;
-	    }
-	    Rast_put_row(fd, buffer, CELL_TYPE);
-	}
-
-	Rast_close(fd);
-	close_band_files();
-    }				/* end of if first_display */
-
-    /* generate and write the color table for the mask */
-    Rast_init_colors(&mask_colors);
-    Rast_set_c_color((CELL) 1, Color_table[Display_color].red,
-		Color_table[Display_color].grn,
-		Color_table[Display_color].blue, &mask_colors);
-    Rast_write_colors(MASK, G_mapset(), &mask_colors);
-
-    /* display new mask */
-    Rast_get_cellhd(MASK, G_mapset(), &cellhd);
-
-    G_adjust_window_to_box(&cellhd, &VIEW_MASK1->cell.head, VIEW_MASK1->nrows,
-			   VIEW_MASK1->ncols);
-    draw_cell(VIEW_MASK1, OVER_LAY);
-
-    return (DISPLAY);
-}
-
-
-/**********************************************************************/
-
-/************************** ###### ************************************/
-
-/**********************************************************************/
-/* for menu to know if we have a signature */
-int have_signature(void)
-{
-    return (usable_signature);
-}
-
-/**********************************************************************/
-
-/************************** ###### ************************************/
-
-/**********************************************************************/
-/* routine to save the signature into the signature structure */
-static int use2 = 1;
-
-int save_signature(void)
-{
-    static Objects objects[] = {
-	INFO("Do you want to save this Signature?", &use2),
-	MENU(" Yes ", yes_save, &use2),
-	MENU(" No ", dont_save, &use2),
-	{0}
-    };
-
-    Input_pointer(objects);
-    Menu_msg("");
-
-    return 0;
-}
-
-static int yes_save(void)
-{
-    int b, b2;
-    char tempstr[100];
-
-    /* get a new signature */
-    I_new_signature(&Sigs);
-
-    /* get signature name */
-    tempstr[0] = '\0';
-    Menu_msg("Input signature description on keyboard...");
-    Curses_prompt_gets("Signature Description? ", tempstr);
-    strcpy(SIG.desc, tempstr);
-    use_mouse_msg();
-
-    /* save the signature in a Sig structure */
-    SIG.npoints = np;
-    SIG.status = 1;
-    for (b = 0; b < Sigs.nbands; b++) {
-	SIG.mean[b] = MEAN(b);
-	for (b2 = 0; b2 <= b; b2++)
-	    SIG.var[b][b2] = VAR(b, b2) / (np - 1);
-    }
-    Menu_msg("");
-
-    return (1);
-}
-
-
-static int dont_save(void)
-{
-    return (1);
-}
-
-
-/**********************************************************************/
-
-/************************** ###### ************************************/
-
-/**********************************************************************/
-/* routine to write out the signature structure */
-int write_signatures(void)
-{
-    Menu_msg("Saving Signature File...");
-    I_write_signatures(outsig_fd, &Sigs);
-    fclose(outsig_fd);
-    G_sleep(1);
-    Menu_msg("Done.");
-
-    return 0;
-}

+ 0 - 41
imagery/i.class/title.c

@@ -1,41 +0,0 @@
-#include <grass/display.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int display_title(View * view)
-{
-    View *title;
-    char left[100], center[100];
-    int size;
-    double magnification();
-
-    *left = 0;
-    *center = 0;
-
-    if (view->cell.configured) {
-	sprintf(center, "%s (mag %.1f)",
-		view->cell.name, magnification(view));
-    }
-
-    if (view == VIEW_MAP1) {
-	sprintf(left, "%s", G_location());
-	title = VIEW_TITLE1;
-    }
-    else if (view == VIEW_MAP1_ZOOM) {
-	title = VIEW_TITLE1_ZOOM;
-    }
-
-    Erase_view(title);
-    R_standard_color(BLACK);
-    size = title->nrows - 4;
-    R_text_size(size, size);
-    Text(left, title->top, title->bottom, title->left, title->right, 2);
-    if (*center) {
-	R_standard_color(RED);
-	Text(center, title->top, title->bottom,
-	     (title->left + title->right - Text_width(center)) / 2,
-	     title->right, 2);
-    }
-
-    return 0;
-}

+ 0 - 50
imagery/i.class/view.c

@@ -1,50 +0,0 @@
-#include <string.h>
-#include <grass/display.h>
-#include "globals.h"
-#include "local_proto.h"
-
-int Configure_view(View * view, char *name, char *mapset, double ns_res, double ew_res	/* original map resolution */
-    )
-{
-    Erase_view(view);
-    view->cell.configured = 0;
-
-    /* copy the cell name into the view */
-    strcpy(view->cell.name, name);
-    strcpy(view->cell.mapset, mapset);
-
-    /* determine the map edges */
-    view->cell.left = view->left + (view->ncols - view->cell.head.cols) / 2;
-    view->cell.right = view->cell.left + view->cell.head.cols - 1;
-    view->cell.top = view->top + (view->nrows - view->cell.head.rows) / 2;
-    view->cell.bottom = view->cell.top + view->cell.head.rows - 1;
-
-    /* remember original resolutions */
-    view->cell.ns_res = ns_res;
-    view->cell.ew_res = ew_res;
-
-    view->cell.configured = 1;
-
-    return 0;
-}
-
-int In_view(View * view, int x, int y)
-{
-    return (x >= view->left && x <= view->right && y >= view->top &&
-	    y <= view->bottom);
-}
-
-int Erase_view(View * view)
-{
-    R_standard_color(WHITE);
-    R_box_abs(view->left, view->top, view->right, view->bottom);
-
-    return 0;
-}
-
-double magnification(View * view)
-{
-    if (!view->cell.configured)
-	return ((double)0.0);
-    return (view->cell.ew_res / view->cell.head.ew_res);
-}

+ 0 - 182
imagery/i.class/zoom_box.c

@@ -1,182 +0,0 @@
-#include <grass/display.h>
-#include <grass/glocale.h>
-#include "globals.h"
-#include "local_proto.h"
-
-
-static int x1, y1, x2, y2;
-static View *pick_view, *zoom_view, *main_view;
-
-static int cancel(void);
-static int zoom1(int, int, int);
-static int zoom2(int, int, int);
-
-
-int zoom_box(void)
-{
-    static int use = 1;
-    static Objects objects[] = {
-	MENU("Cancel", cancel, &use),
-	INFO(" Mark first corner of window ", &use),
-	OTHER(zoom1, &use),
-	{0}
-    };
-
-    pick_view = zoom_view = main_view = NULL;
-    Input_pointer(objects);
-    return 0;
-}
-
-static int zoom1(		/* called by Input_pointer */
-		    int x, int y, int b)
-{				/* called by Input_pointer */
-    static int use = 1;
-    static Objects objects[] = {
-	MENU("Cancel", cancel, &use),
-	INFO(" Define the window ", &use),
-	OTHER(zoom2, &use),
-	{0}
-    };
-
-    /* 
-     * user has marked first corner 
-     * this determines which view is being zoomed
-     */
-    G_debug(4, "\nX, Y, B in zoom1 %d %d %d", x, y, b);
-    x1 = x;
-    y1 = y;
-
-    if (In_view(pick_view = VIEW_MAP1, x1, y1)) {
-	main_view = VIEW_MAP1;
-	zoom_view = VIEW_MAP1_ZOOM;
-    }
-    else if (In_view(pick_view = VIEW_MAP1_ZOOM, x1, y1)) {
-	if (!pick_view->cell.configured)
-	    return 0;		/* ignore the mouse event */
-	main_view = VIEW_MAP1;
-	zoom_view = VIEW_MAP1_ZOOM;
-    }
-    else
-	return 0;		/* ignore the mouse event */
-    if (!pick_view->cell.configured)
-	return 0;		/* just to be sure */
-
-    return Input_box(objects, x, y);
-}
-
-static int zoom2(int x, int y, int b)
-{
-    int top, bottom, left, right;
-    int row, col;
-    struct Cell_head cellhd;
-
-    G_debug(4, "\nX, Y, B in zoom2 %d %d %d", x, y, b);
-
-    x2 = x;
-    y2 = y;
-    /* 
-     * user has completed the zoom window.
-     * must be in same view as first corner
-     */
-    if (x1 == x2 || y1 == y2)
-	return 0;		/* ignore event */
-    if (!In_view(pick_view, x2, y2))
-	return 0;
-    /*
-     * ok, erase menu messages
-     */
-    Menu_msg("");
-
-    /*
-     * assign window coordinates to top,bottom,left,right
-     */
-    if (x1 < x2) {
-	left = x1;
-	right = x2;
-    }
-    else {
-	left = x2;
-	right = x1;
-    }
-    if (y1 < y2) {
-	top = y1;
-	bottom = y2;
-    }
-    else {
-	top = y2;
-	bottom = y1;
-    }
-    G_debug(4, "\nleft right top bottom %d %d %d %d",
-	    left, right, top, bottom);
-
-    /* 
-     * Determine the the zoom window (ie, cellhd)
-     * must copy the current view cellhd first, to preserve header info
-     * (such as projection, zone, and other items.)
-     * compute zoom window northings,eastings, rows, cols, and resolution
-     */
-
-    G_copy(&cellhd, &pick_view->cell.head, sizeof(cellhd));
-
-    /* convert top to northing at top edge of cell
-     * left to easting at left edge
-     */
-    col = view_to_col(pick_view, left);
-    row = view_to_row(pick_view, top);
-    cellhd.north = row_to_northing(&pick_view->cell.head, row, 0.0);
-    cellhd.west = col_to_easting(&pick_view->cell.head, col, 0.0);
-    /* convert bottom to northing at bottom edge of cell
-     * right to easting at right edge
-     */
-    col = view_to_col(pick_view, right);
-    row = view_to_row(pick_view, bottom);
-    cellhd.south = row_to_northing(&pick_view->cell.head, row, 1.0);
-    cellhd.east = col_to_easting(&pick_view->cell.head, col, 1.0);
-
-
-    cellhd.rows = bottom - top + 1;
-    cellhd.cols = right - left + 1;
-    cellhd.ns_res = (cellhd.north - cellhd.south) / cellhd.rows;
-    cellhd.ew_res = (cellhd.east - cellhd.west) / cellhd.cols;
-    G_debug(4, "\nnorth,south,east,west,nsres,ewres %f %f %f %f %f %f",
-	    cellhd.north, cellhd.south, cellhd.east, cellhd.west,
-	    cellhd.ns_res, cellhd.ew_res);
-
-    /*
-     * Outline the zoom window on the main map
-     * Turn previous one to grey.
-     */
-    if (zoom_view->cell.configured) {
-	R_standard_color(GREY);
-	Outline_cellhd(main_view, &zoom_view->cell.head);
-    }
-    R_standard_color(RED);
-    Outline_cellhd(main_view, &cellhd);
-
-    /* If a region is drawn in the zoom window erase it and the saved 
-       region, if any */
-    if (Region.area.define && Region.view == VIEW_MAP1_ZOOM) {
-	erase_region();
-	if (Region.area.saved) {
-	    Region.saved_npoints = 0;
-	    Region.area.saved = 0;
-	    Region.saved_view = NULL;
-	}
-    }
-
-    /*
-     * zoom
-     */
-    G_adjust_window_to_box(&cellhd, &zoom_view->cell.head, zoom_view->nrows,
-			   zoom_view->ncols);
-    Configure_view(zoom_view, pick_view->cell.name, pick_view->cell.mapset,
-		   pick_view->cell.ns_res, pick_view->cell.ew_res);
-    draw_cell(zoom_view, OVER_WRITE);
-    return 1;			/* pop back */
-}
-
-
-static int cancel(void)
-{
-    return -1;
-}