[GRASS5] Re: [GRASS-CVS] david: grass/src/mapdev/v.in.shape
Markus Neteler
neteler at itc.it
Wed Jun 12 01:56:54 EDT 2002
Below fixes from David suggest further testing. Since v.in.shape is
an important module this seems to be another indicator for pre5 (as
well as the r.proj/datum issues).
Markus
On Wed, Jun 12, 2002 at 02:03:10AM +0200, grass at intevation.de wrote:
> Author: david
>
> Update of /grassrepository/grass/src/mapdev/v.in.shape
> In directory doto:/tmp/cvs-serv8535
>
> Modified Files:
> basename.c lines.c main.c polygon.c vmap_import.c
> Log Message:
>
> Final cleanup, preparing for release. Now considered ready for release. Most
> significantly the 'sliver' option is removed as it is not required in
> the current (or future) versions.
>
>
>
> Index: basename.c
> ===================================================================
> RCS file: /grassrepository/grass/src/mapdev/v.in.shape/basename.c,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -d -r1.1 -r1.2
> --- basename.c 27 Mar 2002 21:41:00 -0000 1.1
> +++ basename.c 12 Jun 2002 00:03:08 -0000 1.2
> @@ -52,7 +52,7 @@
> chptr1 = strtok(exts1, ":");
> strncpy(ec1->extensions[0], chptr1, 10);
>
> - while( chptr1 = strtok(NULL, ":") ) {
> + while( (chptr1 = strtok(NULL, ":")) ) {
> strncpy(ec1->extensions[n_exts++], chptr1, 10);
> }
>
>
> Index: lines.c
> ===================================================================
> RCS file: /grassrepository/grass/src/mapdev/v.in.shape/lines.c,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -d -r1.3 -r1.4
> --- lines.c 1 Apr 2002 01:54:30 -0000 1.3
> +++ lines.c 12 Jun 2002 00:03:08 -0000 1.4
> @@ -23,6 +23,7 @@
>
> #include <stdlib.h>
> #include <stdio.h>
> +#include <unistd.h>
> #include <string.h>
> #include <math.h>
> #include "lines.h"
> @@ -38,11 +39,10 @@
> static param_import_ctrl *paric1 = NULL;
>
> static long v_old = -1;
> -static fp_epsilon = 0.0;
>
> -static false_easting;
> -static false_northing;
> -static n_decs;
> +static double false_easting;
> +static double false_northing;
> +static int n_decs;
>
> /* Static routines */
>
> @@ -184,7 +184,7 @@
> char *vk1;
> char *data1;
> long *offs1;
> - int fres, fres2, sres, rres, vres, wres, ures;
> + int fres, sres, rres, vres, wres, ures;
> int old_link;
> vertex vt1, *vptr1;
>
> @@ -354,6 +354,8 @@
>
> }
> }
> +
> + return (0);
> }
>
>
> @@ -553,10 +555,8 @@
> vertex *vptr1, *vptr2;
> long idx1, idx2;
> int res1;
> - int n_extra;
> - int missing_links = 0;
> int idx_located;
> -
> +
> /* loop */
>
> int i, ix;
> @@ -603,7 +603,7 @@
>
> if(idx_located < 0) {
> if(paric1->verbose_level > 1) {
> - fprintf(paric1->logptr, " WARNING: Link from vertex %d to vertex %d absent. Not deleted.\n",
> + fprintf(paric1->logptr, " WARNING: Link from vertex %ld to vertex %ld absent. Not deleted.\n",
> idx1, idx2);
> }
> continue;
> @@ -615,7 +615,7 @@
>
> if(res1) {
> if(paric1->verbose_level > 1) {
> - fprintf(paric1->logptr, " WARNING: Could not delete link %d to vertex %d.\n",
> + fprintf(paric1->logptr, " WARNING: Could not delete link %ld to vertex %ld.\n",
> idx1, idx2);
> }
> }
> @@ -630,6 +630,8 @@
> int vertex_delete_link(vertex *vt0, int idl0) {
>
> /* Still to implement */
> +
> + return (0);
> }
>
> repository *get_repository_ptr(void) {
> @@ -677,7 +679,7 @@
>
> /* loop */
>
> - int ia, ib;
> + int ia;
>
> /* local */
> char *key1, *data1;
> @@ -1057,7 +1059,7 @@
> fprintf(fp0, "A %d\n", lp0->n_points);
>
> for(ia = 0; ia < lp0->n_points; ia++) {
> - fprintf(fp0, "%16.6lf %16.6lf\n", lp0->y[ia], lp0->x[ia]);
> + fprintf(fp0, "%16.6f %16.6f\n", lp0->y[ia], lp0->x[ia]);
> }
> }
>
> @@ -1083,7 +1085,6 @@
> double xtmp, ytmp;
> char xbuf[128], ybuf[128];
> char *retbuf;
> - int indx;
> char *indx_ptr;
> int idigits;
>
>
> Index: main.c
> ===================================================================
> RCS file: /grassrepository/grass/src/mapdev/v.in.shape/main.c,v
> retrieving revision 1.29
> retrieving revision 1.30
> diff -u -d -r1.29 -r1.30
> --- main.c 27 May 2002 14:45:59 -0000 1.29
> +++ main.c 12 Jun 2002 00:03:08 -0000 1.30
> @@ -26,12 +26,14 @@
> #include <string.h>
> #include "gis.h"
> #include "import.h"
> +#include "basename.h"
> #include "shapefil.h"
> +#include "vmap_import.h"
>
> int main(int argc, char *argv[]) {
>
> struct Option *iput, *oput, *lfile, *verbose;
> - struct Option *snapd, *minangle, *mscale, *attribute, *catlabel;
> + struct Option *snapd, *mscale, *attribute, *catlabel;
> struct Flag *oflag, *fleflag, *uflag, *listflag;
> struct GModule *module;
>
> @@ -44,7 +46,7 @@
> int print_to_error = 0, ires = 0, verbosity = 1, do_overwrite = 0, force_le = 0;
> int u_val = 0;
>
> - FILE *lf, *sf;
> + FILE *lf;
> DBFHandle hDBF;
>
> int scale1;
> @@ -89,12 +91,14 @@
> snapd->description= "Snap distance in ground units (Default = 10^-10)";
> snapd->answer = "1.0e-10";
>
> + /*
> minangle = G_define_option() ;
> minangle->key = "sliver";
> minangle->type = TYPE_STRING;
> minangle->required = NO;
> minangle->description= "Min. angle subtended by a wedge at node (degrees - default 0.0001)";
> minangle->answer = "0.0001";
> + */
>
> mscale = G_define_option() ;
> mscale->key = "scale";
> @@ -178,7 +182,7 @@
> /* Process editing parameters */
>
> snap1 = atof(snapd->answer);
> - sliver1 = atof(minangle->answer);
> + sliver1 = 0.0001;
> scale1 = atoi(mscale->answer);
>
>
> @@ -245,7 +249,7 @@
> } /* -d list */
>
>
> - if(ms0 = G_find_file("dig", vmap, "")) {
> + if((ms0 = G_find_file("dig", vmap, ""))) {
>
> /* Is this in the current mapset. If so we can only continue
> if over-write is allowed
> @@ -295,21 +299,27 @@
> case -1:
> {
> fprintf(stderr, "\n\nFATAL ERROR: There was a problem importing the map.\n");
> - fprintf(stderr, "Please consult the log file `%s' for details.\n", log_file);
> + if(! print_to_error) {
> + fprintf(stderr, "Please consult the log file `%s' for details.\n", log_file);
> + }
> break;
> }
>
> case -2:
> {
> fprintf(stderr, "\n\nWARNING. Map `%s' imported, but there were problems.\n", vmap);
> - fprintf(stderr, "Please consult the log file `%s' for details.\n", log_file);
> + if(! print_to_error) {
> + fprintf(stderr, "Please consult the log file `%s' for details.\n", log_file);
> + }
> break;
> }
>
> default:
> {
> - fprintf(stderr, "\n\nWARNING. Map `%s' imported, apparently without problems.\n", vmap);
> - fprintf(stderr, "Please consult the log file `%s' for details.\n", log_file);
> + fprintf(stderr, "\n\nMap `%s' imported, apparently without problems.\n", vmap);
> + if(! print_to_error) {
> + fprintf(stderr, "Please consult the log file `%s' for details.\n", log_file);
> + }
> }
> }
>
>
> Index: polygon.c
> ===================================================================
> RCS file: /grassrepository/grass/src/mapdev/v.in.shape/polygon.c,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -d -r1.2 -r1.3
> --- polygon.c 30 Mar 2002 12:00:43 -0000 1.2
> +++ polygon.c 12 Jun 2002 00:03:08 -0000 1.3
> @@ -45,7 +45,6 @@
> else if((A)<(-M_PI)){(A)+=2*M_PI;}}
>
> static double phi_old = 0.0;
> -static int check_paranoid = 0;
>
> static int polygon_init_alloc_blocksize(int ix);
> static int polygon_next_alloc_blocksize(int ix, int jx);
> @@ -77,7 +76,6 @@
>
> void polygon_ctrl_destroy(polygon_ctrl * pgc0) {
>
> - struct line_pnts *lp1;
> int ja; /* loop */
>
> if(pgc0->alloc_hulls > 0) {
> @@ -653,17 +651,14 @@
> if(pgc0->struct_status & POLY_WITH_CATS)
> fprintf(lf0, " Polygon has attributes provided.\n");
> if(pgc0->struct_status & POLY_WITH_CENTROID)
> - fprintf(lf0, " An area point is supplied at %16.6lf | %16.6lf.\n",
> + fprintf(lf0, " An area point is supplied at %16.6f | %16.6f.\n",
> pgc0->centroid_x, pgc0->centroid_y);
> else
> - fprintf(lf0, " Area point is not provided.\n",
> - pgc0->centroid_x, pgc0->centroid_y);
> + fprintf(lf0, " Area point is not provided.\n");
> if(pgc0->struct_status & POLY_WITH_Z)
> - fprintf(lf0, " Height co-ordinates are supplied for the vertices.\n",
> - pgc0->centroid_x, pgc0->centroid_y);
> + fprintf(lf0, " Height co-ordinates are supplied for the vertices.\n");
> else
> - fprintf(lf0, " No height co-ordinates are supplied for the vertices.\n",
> - pgc0->centroid_x, pgc0->centroid_y);
> + fprintf(lf0, " No height co-ordinates are supplied for the vertices.\n");
>
> for(ia = 0; ia < pgc0->n_hulls; ia++) {
> fprintf(lf0, "\n Main ring %d has %d holes ", ia + 1, pgc0->holes_per_hull[ia]);
> @@ -711,6 +706,8 @@
> rs1->alloc_rings = rs1->n_rings = nr0;
> return rs1;
> }
> +
> + return (NULL);
> }
>
> void ringset_destroy(ringset *rs0) {
>
> Index: vmap_import.c
> ===================================================================
> RCS file: /grassrepository/grass/src/mapdev/v.in.shape/vmap_import.c,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -d -r1.3 -r1.4
> --- vmap_import.c 11 Jun 2002 16:53:49 -0000 1.3
> +++ vmap_import.c 12 Jun 2002 00:03:08 -0000 1.4
> @@ -58,7 +58,6 @@
> int res1, res2;
> int go_out = 0;
> int null_recs = 0;
> - int vert_cnt = 0;
> int part_cnt = 0;
> int no_atts = 0;
> int verb = pic0->verbose_level;
> @@ -72,7 +71,6 @@
> struct Map_info Map1;
> polygon_ctrl *pgc1 = NULL;
> ringset *prings;
> - repository *vrep;
>
> /* loop */
> int ia, ib, ic;
> @@ -733,9 +731,7 @@
> const double x_coord0, const double y_coord0, char cov_type) {
>
> int no_atts = 0, no_cats = 0;
> - int attval;
> DBFFieldType dbft;
> - int go_out = 0;
>
> int f_size, f_decs;
> char buffer1[64] = "";
>
>
> _______________________________________________
> grass-commit mailing list
> grass-commit at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-commit
More information about the grass-dev
mailing list