瀏覽代碼

remove v.convert

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@63931 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 年之前
父節點
當前提交
93f8878b1c

+ 0 - 1
vector/Makefile

@@ -12,7 +12,6 @@ SUBDIRS = \
 	v.clean \
 	v.clean \
 	v.colors \
 	v.colors \
 	v.colors.out \
 	v.colors.out \
-	v.convert \
 	v.db.connect \
 	v.db.connect \
 	v.db.select \
 	v.db.select \
 	v.delaunay \
 	v.delaunay \

+ 0 - 14
vector/v.convert/Makefile

@@ -1,14 +0,0 @@
-
-MODULE_TOPDIR = ../..
-
-PGM=v.convert
-
-LIBES = $(VECTORLIB) $(DIG2LIB) $(DBMILIB) $(RASTERLIB) $(GISLIB)
-DEPENDENCIES = $(VECTORDEP) $(DIG2DEP) $(DBMIDEP) $(RASTERDEP) $(GISDEP)
-EXTRA_INC = $(VECT_INC)
-EXTRA_CFLAGS = $(VECT_CFLAGS)
- 
-include $(MODULE_TOPDIR)/include/Make/Module.make
-
-default: cmd	
-

+ 0 - 118
vector/v.convert/att.c

@@ -1,118 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/raster.h>
-#include <grass/dbmi.h>
-#include <grass/vector.h>
-#include <grass/glocale.h>
-
-/* *  convert dig_cats to database table
- *  return: number of records inserted
- *          -1 error */
-int attributes(char *in, struct Map_info *Out)
-{
-    int i, cat, count;
-    const char *mapset;
-    struct Categories Cats;
-    char buf[1024];
-    dbString sql, lab;
-    dbDriver *driver;
-    dbHandle handle;
-    struct field_info *fi;
-    int len, clen;
-
-    db_init_string(&sql);
-    db_init_string(&lab);
-
-    /* Find vector mapset */
-    if (NULL == (mapset = G_find_file("dig", in, ""))) {
-	G_warning(_("Vector map <%s> not found"), in);	/* Should not happen */
-	return 0;
-    }
-
-    /* Find dig_cats if exists */
-    if (NULL == G_find_file("dig_cats", in, mapset)) {
-	G_message(_("No category labels (dig_cats) found, no table created"));
-	return 0;
-    }
-
-    if (Rast_read_vector_cats(in, mapset, &Cats) == -1) {
-	G_warning(_("Unable to open dig_cats file"));
-	return -1;
-    }
-
-    fi = Vect_default_field_info(Out, 1, NULL, GV_1TABLE);
-    Vect_map_add_dblink(Out, 1, NULL, fi->table, GV_KEY_COLUMN, fi->database,
-			fi->driver);
-
-    /* Get maximum column length */
-    clen = 0;
-    for (i = 0; i < Cats.ncats; i++) {
-	len = strlen(Cats.labels[i]);
-	if (len > clen)
-	    clen = len;
-    }
-    clen += 10;
-
-    /* Create new table */
-    sprintf(buf, "create table %s ( cat integer, label varchar(%d) )",
-	    fi->table, clen);
-    db_append_string(&sql, buf);
-
-    G_debug(1, db_get_string(&sql));
-
-    driver = db_start_driver(fi->driver);
-    if (driver == NULL)
-	G_fatal_error(_("Unable to open driver <%s>"),
-		      fi->driver);
-    db_init_handle(&handle);
-    db_set_handle(&handle, Vect_subst_var(fi->database, Out), NULL);
-    if (db_open_database(driver, &handle) != DB_OK) {
-	db_shutdown_driver(driver);
-	G_fatal_error(_("Unable to open database <%s>"),
-		      fi->database);
-    }
-    db_set_error_handler_driver(driver);
-
-    if (db_execute_immediate(driver, &sql) != DB_OK) {
-	G_fatal_error(_("Unable to create table: '%s'"),
-		      db_get_string(&sql));
-    }
-
-    if (db_create_index2(driver, fi->table, GV_KEY_COLUMN) != DB_OK)
-	G_warning(_("Unable to create index for table <%s>, key <%s>"),
-		  fi->table, GV_KEY_COLUMN);
-
-    if (db_grant_on_table
-	(driver, fi->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK)
-	G_fatal_error(_("Unable to grant privileges on table <%s>"),
-		      fi->table);
-
-
-    G_debug(1, "ncats = %d", Cats.ncats);
-    count = 0;
-    for (i = 0; i < Cats.ncats; i++) {
-	cat = (int)Cats.q.table[i].dLow;	/* cats are in dLow/High not in cLow/High !!! */
-	G_debug(3, "%d cat = %d label = %s", i, cat, Cats.labels[i]);
-
-	db_set_string(&lab, Cats.labels[i]);
-	db_double_quote_string(&lab);
-	sprintf(buf, "insert into %s values ( %d, '%s')", fi->table, cat,
-		db_get_string(&lab));
-	db_set_string(&sql, buf);
-	G_debug(3, db_get_string(&sql));
-
-	if (db_execute_immediate(driver, &sql) != DB_OK) {
-	    G_fatal_error(_("Unable to insert new record: '%s'"),
-			  db_get_string(&sql));
-	}
-	count++;
-    }
-
-    db_close_database(driver);
-    db_shutdown_driver(driver);
-
-    return count;
-}

+ 0 - 37
vector/v.convert/conv.h

@@ -1,37 +0,0 @@
-/* Head */
-#define DIG4_ORGAN_LEN       30
-#define DIG4_DATE_LEN        20
-#define DIG4_YOUR_NAME_LEN   20
-#define DIG4_MAP_NAME_LEN    41
-#define DIG4_SOURCE_DATE_LEN 11
-#define DIG4_LINE_3_LEN      53	/* see below */
-
-#define VERS_4_DATA_SIZE 20
-
-#define OLD_LINE_3_SIZE 73
-#define NEW_LINE_3_SIZE 53
-
-/* old file format element type codes */
-#define FILE_LINE               0
-#define FILE_AREA               1
-#define FILE_DOT                2
-
-#define FILE_DEAD_LINE          4
-#define FILE_DEAD_AREA          5
-#define FILE_DEAD_DOT           6
-
-struct Line
-{
-    int type;
-    int n_points;
-    int cat;			/* attached category */
-    double *x, *y;
-};
-
-struct Categ
-{
-    double x;			/* x location point */
-    double y;			/* y location point */
-    int cat;			/* Category Number */
-    int type;			/* type (new vector5) */
-};

+ 0 - 27
vector/v.convert/dist.c

@@ -1,27 +0,0 @@
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/vector.h>
-#include "conv.h"
-#include "local_proto.h"
-
-double ldist(double x, double y, struct Line *p)
-{
-    int i;
-    double dist, ndist;
-
-    i = (p->n_points == 1) ? 0 : 1;
-    dist = dig_distance2_point_to_line(x, y, 0, p->x[0], p->y[0], 0,
-				       p->x[i], p->y[i], 0,
-				       0, NULL, NULL, NULL, NULL, NULL);
-
-    for (i = 1; i < p->n_points - 1; i++) {
-	ndist = dig_distance2_point_to_line(x, y, 0, p->x[i], p->y[i], 0,
-					    p->x[i + 1], p->y[i + 1], 0,
-					    0, NULL, NULL, NULL, NULL, NULL);
-
-	if (ndist < dist) {
-	    dist = ndist;
-	}
-    }
-    return (dist);
-}

+ 0 - 7
vector/v.convert/local_proto.h

@@ -1,7 +0,0 @@
-int read_dig(FILE *, struct Map_info *, struct Line **, int, int);
-int read_att(FILE *, struct Categ **);
-double ldist(double, double, struct Line *);
-int old2new(char *, char *, int);
-int new2old(char *, char *);
-char dig_old_to_new_type(char);
-int attributes(char *in, struct Map_info *Out);

+ 0 - 78
vector/v.convert/main.c

@@ -1,78 +0,0 @@
-
-/*****************************************************************
- *
- * MODULE:       v.convert
- * 
- * AUTHOR(S):    Radim Blazek - Radim.Blazek@dhv.cz
- *               
- * PURPOSE:      Convert GRASS vector maps versions:
- *               from 3 or 4 to 5.0
- *               
- * COPYRIGHT:    (C) 2001 by the GRASS Development Team
- *
- *               This program is free software under the 
- *               GNU General Public License (>=v2). 
- *               Read the file COPYING that comes with GRASS
- *               for details.
- *
- ****************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <grass/gis.h>
-#include <grass/vector.h>
-#include <grass/glocale.h>
-#include "conv.h"
-#include "local_proto.h"
-
-int main(int argc, char *argv[])
-{
-    struct Option *opt_in, *opt_out, *opt_end;
-    int endian;
-    char *output;
-    struct GModule *module;
-
-    module = G_define_module();
-    G_add_keyword(_("vector"));
-    G_add_keyword(_("import"));
-    G_add_keyword(_("conversion"));
-    module->description = _("Imports older versions of GRASS vector maps.");
-
-    /* input vector map */
-    opt_in = G_define_standard_option(G_OPT_V_INPUT);
-    opt_in->gisprompt = "old,dig,vector";
-
-    /* output vector map */
-    opt_out = G_define_standard_option(G_OPT_V_OUTPUT);
-    opt_out->required = NO;
-
-    /* endian of input vector map */
-    opt_end = G_define_option();
-    opt_end->key = "endian";
-    opt_end->type = TYPE_STRING;
-    opt_end->required = NO;
-    opt_end->multiple = NO;
-    opt_end->options = "big,little";
-    opt_end->description = _("Endian of input vector map");
-    opt_end->answer = "big";
-
-    G_gisinit(argv[0]);
-
-    if (G_parser(argc, argv))
-	exit(EXIT_FAILURE);
-
-    /* Numbers in portable format files are saved as big endians */
-    if (opt_end->answer[0] == 'l')
-	endian = ENDIAN_LITTLE;
-    else
-	endian = ENDIAN_BIG;
-
-    if (opt_out->answer)
-	output = G_store(opt_out->answer);
-    else
-	output = G_store(opt_in->answer);
-
-    old2new(opt_in->answer, output, endian);
-
-    exit(EXIT_SUCCESS);
-}

+ 0 - 161
vector/v.convert/old2new.c

@@ -1,161 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/vector.h>
-#include <grass/glocale.h>
-#include "conv.h"
-#include "local_proto.h"
-
-int old2new(char *in, char *out, int endian)
-{
-    int i, j, nlines, ncats, sline, att;
-    const char *mapset;
-    FILE *Digin, *Attin;
-    struct Line *lines;		/* array of points and lines */
-    struct Categ *cats;		/* array of categories */
-    struct Map_info Mapout;
-    double dist, sdist;
-    struct line_cats *cat_out;
-    struct line_pnts *pnt_out;
-
-    cats = NULL;
-
-    /* open in map */
-    if (NULL == (mapset = G_find_file("dig", in, ""))) {
-	G_fatal_error(_("Vector map <%s> not found"), in);
-    }
-
-    /* open input dig file */
-    if ((Digin = G_fopen_old("dig", in, mapset)) == NULL) {
-	G_fatal_error(_("Failed opening input dig file."));
-    }
-
-    /* open new output file */
-    if (Vect_open_new(&Mapout, out, WITHOUT_Z) < 0) {
-	fclose(Digin);
-	exit(EXIT_FAILURE);
-    }
-
-    Vect_hist_command(&Mapout);
-
-    /* open input dig_att file if exists */
-    att = FALSE;
-    if (NULL == G_find_file("dig_att", in, mapset)) {
-	G_warning(_("dig_att file doesn't exist."));
-    }
-    else {
-	if (NULL == (Attin = G_fopen_old("dig_att", in, mapset))) {
-	    G_warning(_("Failed opening input dig_att file."));
-	}
-	else {
-	    att = TRUE;
-	}
-    }
-
-    /* read old dig file */
-    nlines = read_dig(Digin, &Mapout, &lines, endian, att);
-
-    /* read old dig_att file */
-    ncats = 0;
-    if (att) {
-	ncats = read_att(Attin, &cats);
-	fclose(Attin);
-    }
-
-    /* Attach categories to lines and points.
-     * Walk through all cats and always find nearest line.
-     * If cat is already attached but new one is nearer
-     * set cat to new one.  */
-
-    G_message(_("Attaching categories..."));
-
-    for (i = 0; i < ncats; i++) {
-	G_percent(i, ncats - 1, 1);
-	if (cats[i].type & (GV_POINT | GV_LINE)) {
-	    sline = -1;
-	    for (j = 0; j < nlines; j++) {
-		if (lines[j].type == cats[i].type) {
-		    dist = ldist(cats[i].x, cats[i].y, &(lines[j]));
-
-		    if (sline == -1 || dist < sdist) {
-			sline = j;
-			sdist = dist;
-		    }
-		}
-	    }
-	    if (sline == -1) {
-		G_warning(_("Failed to attach an attribute (category %d) to a line."),
-			  cats[i].cat);
-	    }
-	    else {
-		if (lines[sline].cat > -1) {
-		    G_warning(_("Line %d label: %d matched another label: %d."),
-			      sline, lines[sline].cat, cats[i].cat);
-		}
-		lines[sline].cat = cats[i].cat;
-	    }
-	}
-    }
-
-    /* Write to new file */
-    G_message(_("Writing new file..."));
-
-    pnt_out = Vect_new_line_struct();
-    cat_out = Vect_new_cats_struct();
-
-    j = 0;
-    /* Write all points and lines if dig_att exists */
-    if (att) {
-	for (i = 0; i < nlines; i++) {
-	    if (lines[i].cat > 0) {
-		Vect_cat_set(cat_out, 1, lines[i].cat);
-	    }
-	    dig_alloc_points(pnt_out, lines[i].n_points);
-	    memcpy((void *)pnt_out->x, (void *)lines[i].x,
-		   lines[i].n_points * sizeof(double));
-	    memcpy((void *)pnt_out->y, (void *)lines[i].y,
-		   lines[i].n_points * sizeof(double));
-	    pnt_out->n_points = lines[i].n_points;
-	    Vect_write_line(&Mapout, lines[i].type, pnt_out, cat_out);
-	    j++;
-	    Vect_reset_cats(cat_out);
-	}
-	G_message(_("[%d] points and lines written to output file."), j);
-    }
-    /* Write centroids */
-    j = 0;
-    for (i = 0; i < ncats; i++) {
-	if (cats[i].type == GV_CENTROID) {
-	    Vect_append_point(pnt_out, cats[i].x, cats[i].y, 0.0);
-	    Vect_cat_set(cat_out, 1, cats[i].cat);
-	    Vect_write_line(&Mapout, GV_CENTROID, pnt_out, cat_out);
-	    j++;
-	    Vect_reset_line(pnt_out);
-	    Vect_reset_cats(cat_out);
-	}
-    }
-    G_message(_("[%d] centroids written to output file."), j);
-
-    /* Convert dig_cats to table */
-    attributes(in, &Mapout);
-
-    Vect_build(&Mapout);
-    Vect_close(&Mapout);
-
-    fclose(Digin);
-
-    /* free memory */
-    for (i = 0; i < nlines; i++) {
-	G_free(lines[i].x);
-	G_free(lines[i].y);
-    }
-    G_free(lines);
-    if (att)
-	G_free(cats);
-
-    Vect_destroy_cats_struct(cat_out);
-    Vect_destroy_line_struct(pnt_out);
-
-    return (1);
-}

+ 0 - 308
vector/v.convert/read.c

@@ -1,308 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grass/gis.h>
-#include <grass/vector.h>
-#include <grass/glocale.h>
-#include "conv.h"
-#include "local_proto.h"
-
-int read_line(struct gvfile *, struct line_pnts *);
-
-/* read old 3.0 or 4.0 dig file into array 
-   returns number of elements read into array
-   or -1 on error */
-int read_dig(FILE * Digin, struct Map_info *Mapout,
-	     struct Line **plines, int endian, int att)
-{
-    char buf[100];
-    struct Plus_head *In_plus;
-    struct dig_head In_head;
-    int lalloc, line = 0, type, portable = 1;
-    int npoints = 0, nlines = 0, nbounds = 0;
-    int ndpoints = 0, ndlines = 0, ndbounds = 0, nunknown = 0;
-    struct Line *lines;
-    struct line_pnts *nline;
-    struct line_cats *cat_out;
-    double dbuf;
-    int ibuf;
-    long lbuf;
-    struct gvfile gvf;
-
-    dig_file_init(&gvf);
-    gvf.file = Digin;
-
-    Vect__init_head(Mapout);
-    /* set conversion matrices */
-    dig_init_portable(&(In_head.port), endian);
-
-    In_plus = &(Mapout->plus);
-    
-    /* Version 3 dig files were not portable and some version 4 
-     * files may be also non portable */
-
-    G_message(_("Reading dig file..."));
-
-    /* read and copy head */
-    dig_fseek(&gvf, 0L, SEEK_SET);	/* set to beginning */
-
-    if (0 >= dig__fread_port_C(buf, DIG4_ORGAN_LEN, &gvf))
-	return -1;
-    buf[DIG4_ORGAN_LEN - 1] = '\0';
-    Vect_set_organization(Mapout, buf);
-
-    if (0 >= dig__fread_port_C(buf, DIG4_DATE_LEN, &gvf))
-	return -1;
-    buf[DIG4_DATE_LEN - 1] = '\0';
-    Vect_set_date(Mapout, buf);
-
-    if (0 >= dig__fread_port_C(buf, DIG4_YOUR_NAME_LEN, &gvf))
-	return -1;
-    buf[DIG4_YOUR_NAME_LEN - 1] = '\0';
-    Vect_set_person(Mapout, buf);
-
-    if (0 >= dig__fread_port_C(buf, DIG4_MAP_NAME_LEN, &gvf))
-	return -1;
-    buf[DIG4_MAP_NAME_LEN - 1] = '\0';
-    Vect_set_map_name(Mapout, buf);
-
-    if (0 >= dig__fread_port_C(buf, DIG4_SOURCE_DATE_LEN, &gvf))
-	return -1;
-    buf[DIG4_SOURCE_DATE_LEN - 1] = '\0';
-    Vect_set_map_date(Mapout, buf);
-
-    if (0 >= dig__fread_port_C(buf, DIG4_LINE_3_LEN, &gvf))
-	return -1;
-    buf[DIG4_LINE_3_LEN - 1] = '\0';
-    Vect_set_comment(Mapout, buf);
-
-    if (0 >= dig__fread_port_C(buf, VERS_4_DATA_SIZE, &gvf))
-	return -1;
-
-    if (buf[0] != '%' || buf[1] != '%') {	/* Version3.0 */
-	In_head.coor_version.major = 3;
-	portable = 0;		/* input vector is not portable format */
-	G_message(_("Input file is version 3."));
-    }
-    else {
-	In_head.coor_version.major = 4;
-	G_message(_("Input file is version 4."));
-	/* determine if in portable format or not */
-	if (buf[6] == 1 && (~buf[6] & 0xff) == (buf[7] & 0xff)) {	/* portable ? */
-	    portable = 1;	/* input vector is portable format */
-	}
-	else {
-	    portable = 0;	/* input vector is not portable format */
-	}
-    }
-    if (portable == 1) {
-	G_message(_("Input file is portable."));
-    }
-    else {
-	G_warning(_("Input file is not portable. "
-		    "We will attempt to convert anyway but conversion may fail. "
-		    "Please read manual for detail information."));
-    }
-
-    /* set Cur_Head because it is used by dig__*_convert()
-       called by dig__fread_port_*() */
-    dig_set_cur_port(&(In_head.port));
-
-    if (0 >= dig__fread_port_L(&lbuf, 1, &gvf))
-	return -1;
-    Vect_set_scale(Mapout, (int)lbuf);
-    if (0 >= dig__fread_port_I(&ibuf, 1, &gvf))
-	return -1;
-    Vect_set_zone(Mapout, ibuf);
-    if (0 >= dig__fread_port_D(&dbuf, 1, &gvf))
-	return -1;		/* W */
-    if (0 >= dig__fread_port_D(&dbuf, 1, &gvf))
-	return -1;		/* E */
-    if (0 >= dig__fread_port_D(&dbuf, 1, &gvf))
-	return -1;		/* S */
-    if (0 >= dig__fread_port_D(&dbuf, 1, &gvf))
-	return -1;		/* N */
-    if (0 >= dig__fread_port_D(&dbuf, 1, &gvf))
-	return -1;
-    Vect_set_thresh(Mapout, dbuf);
-
-    /* reading dig file body (elements) */
-    nline = Vect_new_line_struct();
-    cat_out = Vect_new_cats_struct();
-
-    lalloc = 0;
-    lines = NULL;
-
-    line = 0;
-    while (1) {
-	type = read_line(&gvf, nline);
-	G_debug(3, "read line = %d, type = %d", line, type);
-	if (type == -2)
-	    break;		/* EOF */
-	switch (type) {
-	case GV_POINT:
-	    npoints++;
-	    break;
-	case GV_LINE:
-	    nlines++;
-	    break;
-	case GV_BOUNDARY:
-	    nbounds++;
-	    break;
-	case 0:		/* dead */
-	    break;
-	default:
-	    nunknown++;
-	    break;
-	}
-	if (!(type & (GV_POINT | GV_LINE | GV_BOUNDARY)))
-	    continue;
-
-	if ((type & GV_BOUNDARY) || !att) {
-	    Vect_write_line(Mapout, type, nline, cat_out);
-	    /* reset In_head */
-	    dig_set_cur_port(&(In_head.port));
-	}
-	else {			/* GV_POINT or GV_LINE */
-	    if (line >= lalloc) {
-		lalloc += 10000;
-		lines =
-		    (struct Line *)G_realloc(lines,
-					     lalloc * sizeof(struct Line));
-	    }
-	    lines[line].type = type;
-	    lines[line].n_points = nline->n_points;
-	    lines[line].cat = -1;
-	    lines[line].x =
-		(double *)G_malloc(nline->n_points * sizeof(double));
-	    lines[line].y =
-		(double *)G_malloc(nline->n_points * sizeof(double));
-	    memcpy((void *)lines[line].x, (void *)nline->x,
-		   nline->n_points * sizeof(double));
-	    memcpy((void *)lines[line].y, (void *)nline->y,
-		   nline->n_points * sizeof(double));
-	    line++;
-	}
-    }
-    if (att) {
-	G_message(_("[%d] points read to memory"), npoints);
-	G_message(_("[%d] lines read to memory"), nlines);
-    }
-    else {
-	G_message(_("[%d] points read and written to output"), npoints);
-	G_message(_("[%d] lines read and written to output"), nlines);
-    }
-    G_message(_("[%d] area boundaries read and written to output"), nbounds);
-    G_message(_("[%d] dead points skipped"), ndpoints);
-    G_message(_("[%d] dead lines skipped"), ndlines);
-    G_message(_("[%d] dead area boundaries skipped"), ndbounds);
-    G_message(_("[%d] elements of unknown type skipped"), nunknown);
-
-    G_message(_("[%d] elements read to memory"), line);
-
-    *plines = lines;
-    return (line);
-}
-
-/* read_line() reads element from file
-   returns element type
- */
-int read_line(struct gvfile * Gvf, struct line_pnts *nline)
-{
-    int n_points;
-    long itype;
-
-    if (0 >= dig__fread_port_L(&itype, 1, Gvf))
-	return (-2);
-    itype = dig_old_to_new_type((char)itype);
-
-    if (0 >= dig__fread_port_I(&n_points, 1, Gvf))
-	return (-2);
-
-    if (0 > dig_alloc_points(nline, n_points))
-	G_fatal_error("Cannot allocate points");
-
-    nline->n_points = n_points;
-    if (0 >= dig__fread_port_D(nline->x, n_points, Gvf))
-	return (-2);
-    if (0 >= dig__fread_port_D(nline->y, n_points, Gvf))
-	return (-2);
-
-    return ((int)itype);
-}
-
-/* read old 3.0, 4.0 dig_att file into array */
-int read_att(FILE * Attin, struct Categ **pcats)
-{
-    int ctalloc = 0, cat = 0, type, ret, rcat;
-    int npoints = 0, nlines = 0, ncentroids = 0;
-    int ndpoints = 0, ndlines = 0, ndcentroids = 0, nunknown = 0;
-    char buf[201], ctype;
-    double x, y;
-    struct Categ *cats;
-
-    G_message(_("Reading dig_att file..."));
-
-    ctalloc = 0;
-    cats = NULL;
-
-    while (fgets(buf, 200, Attin) != NULL) {
-	ret = sscanf(buf, "%c %lf %lf %d", &ctype, &x, &y, &rcat);
-	if (ret != 4) {
-	    G_warning(_("Error: %s"), buf);
-	    continue;
-	}
-	switch (ctype) {
-	case 'P':
-	    type = GV_POINT;
-	    npoints++;
-	    break;
-	case 'L':
-	    type = GV_LINE;
-	    nlines++;
-	    break;
-	case 'A':
-	    type = GV_CENTROID;
-	    ncentroids++;
-	    break;
-	case 'p':
-	case 'l':
-	case 'a':
-	    type = 0;		/* dead */
-	default:
-	    G_warning(_("Unknown type: %c"), ctype);
-	    type = 0;
-	    nunknown++;
-	    break;
-	}
-	if (!(type & (GV_POINT | GV_LINE | GV_CENTROID))) {
-	    continue;
-	}
-
-	if (cat >= ctalloc) {
-	    ctalloc += 10000;
-	    cats =
-		(struct Categ *)G_realloc(cats,
-					  ctalloc * sizeof(struct Categ));
-	}
-	cats[cat].type = type;
-	cats[cat].x = x;
-	cats[cat].y = y;
-	cats[cat].cat = rcat;
-	cat++;
-
-    }
-
-    G_message(_("[%d] point categories read"), npoints);
-    G_message(_("[%d] line categories read"), nlines);
-    G_message(_("[%d] centroids read"), ncentroids);
-    G_message(_("[%d] dead point categories skipped"), ndpoints);
-    G_message(_("[%d] dead line categories skipped"), ndlines);
-    G_message(_("[%d] dead centroids skipped"), ndcentroids);
-    G_message(_("[%d] categories of unknown type skipped"), nunknown);
-
-    G_message(_("[%d] categories read into memory"), cat);
-
-    *pcats = cats;
-    return (cat);
-}

+ 0 - 55
vector/v.convert/type.c

@@ -1,55 +0,0 @@
-#include <grass/vector.h>
-#include <grass/glocale.h>
-#include "conv.h"
-
-/* conversion of old file format elment type codes to new 
- *
- *  returns: new type
- *           0 - dead element
- *          -1 - error
- */
-char dig_old_to_new_type(char type)
-{
-    switch (type) {
-    case FILE_LINE:
-	type = GV_LINE;
-	break;
-    case FILE_AREA:
-	type = GV_BOUNDARY;
-	break;
-    case FILE_DOT:
-	type = GV_POINT;
-	break;
-    case FILE_DEAD_LINE:
-    case FILE_DEAD_AREA:
-    case FILE_DEAD_DOT:
-	type = 0;
-	break;
-    default:
-	G_warning(_("OLD_T_NEW Got a bad type code [%x]"), type);
-	type = -1;
-	break;
-    }
-    return (type);
-}
-
-/* conversion of new element types to old file format elment type codes */
-char dig_new_to_old_type(char type)
-{
-    switch (type) {
-    case GV_LINE:
-	type = FILE_LINE;
-	break;
-    case GV_BOUNDARY:
-	type = FILE_AREA;
-	break;
-    case GV_POINT:
-	type = FILE_DOT;
-	break;
-    default:
-	G_warning(_("NEW_T_OLD Got a bad type code [%x]"), type);
-	type = 0;
-	break;
-    }
-    return (type);
-}

+ 0 - 37
vector/v.convert/v.convert.html

@@ -1,37 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>v.convert</em> converts GRASS 5.0/5.3/5.4 vectors into 5.7/6.x vectors.
-
-<h2>NOTES</h2>
-
-Vector maps from 5.0/5.3/5.4 and 5.7/6.x do not interfere. They are stored in different 
-directories, so you can use the same names. Old vector maps can be listed with
-<em>g.list oldvect</em>.
-<p>If you need to convert back from 5.7/6.x into the 5.0/5.3/5.4 vector format,
-use <em>v.out.ogr</em> (to SHAPE format) and then <em>v.in.shape</em>
-in the old GRASS program.
-Alternatively use "<em>v.out.ascii -o</em>" and <em>v.in.ascii</em>.
-<p>As this GRASS version uses SQL for attribute management, there are
-some <a href=sql.html>SQL restrictings concerning the file names</a>.
-<p>Missing centroids can be added with <em>v.category</em>.
-
-<h2>EXAMPLE</h2>
-<div class="code"><pre>
-v.convert in=vectormap_from_50 out=vectormap_60
-</pre></div>
-
-<h2>SEE ALSO</h2>
-
-<a href="g.list.html">g.list</a>,
-<a href="v.category.html">v.category</a>,
-<a href="v.convert.all.html">v.convert.all</a>,
-<a href="v.out.ascii.html">v.out.ascii</a>,
-<a href="v.in.ascii.html">v.in.ascii</a>,
-<a href="v.out.ogr.html">v.out.ogr</a>
-
-
-<h2>AUTHOR</h2>
-
-Radim Blazek, ITC-Irst, Trento, Italy
-
-<p><i>Last changed: $Date$</i>