[GRASS5] Re: [GRASS-CVS] eric: grass/src/mapdev/v.out.shape extract.c,1.9,1.10

Thanks, Eric,

now my map looks much better. The GRASS no-data island is also a
no-data island in SHAPE/ArcExplorer-Linux.

One day maybe a v.in.shape/v.out.shape loop will work :slight_smile:

Thanks for the fix,

Markus

On Sat, Oct 05, 2002 at 06:21:40AM +0200, grass@intevation.de wrote:

Author: eric

Update of /grassrepository/grass/src/mapdev/v.out.shape
In directory doto:/tmp/cvs-serv24527

Modified Files:
  extract.c
Log Message:
Skip unlabelled areas, reverse direction of islands w/in areas (holes).
Think this is right, but v.in.shape doesn't give me back what I started
with...

Index: extract.c

RCS file: /grassrepository/grass/src/mapdev/v.out.shape/extract.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- extract.c 4 Oct 2002 05:34:03 -0000 1.9
+++ extract.c 5 Oct 2002 04:21:37 -0000 1.10
@@ -163,7 +163,16 @@
   cindx = curr_indx + 1;
   if( curr_indx >= Map->n_areas ) return 0;

-
+ if (!V2_area_att(Map, cindx)) {
+ fprintf ( lfp, "Skipping unlabeled area (hole?) #%d\n", cindx);
+ return -1;
+ }
+
+ if( V2_get_area( Map, cindx, &Area ) != 0 ) {
+ fprintf( lfp, "Area %d unassigned\n", cindx );
+ return -1;
+ }
+
   logfile_name = (char *)malloc(128);

   proc_logfile( GET_VAL, logfile_name );
@@ -177,12 +186,7 @@
   Points->n_points = 0;
   Points->x = NULL;
   Points->y = NULL;
-
- if( V2_get_area( Map, cindx, &Area ) != 0 ) {
- fprintf( lfp, "Area %d unassigned\n", cindx );
- return 1;
- }
-
+
   /* fprintf(lfp, "\nArea %d has %d isles: \n", cindx, Area->n_isles ); */
   
   /* Determine initial information on shape */
@@ -193,7 +197,6 @@
     return 1;
   }

-
   partoffsets = (int *)malloc( numparts * sizeof(int) );

   /* Set first offset (of main ring) */
@@ -237,10 +240,10 @@
     listX = (double *)realloc( listX, totalvertices * sizeof(double) );
     listY = (double *)realloc( listY, totalvertices * sizeof(double) );
     
- k1 = 0;
+ k1 = numvertices - 1;
     for( k = startOffset; k <= endOffset; ++k ) {
       listX[k] = Points->x[k1];
- listY[k] = Points->y[k1++];
+ listY[k] = Points->y[k1--];
     }
   }

_______________________________________________
grass-commit mailing list
grass-commit@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-commit