[GRASSLIST:5436] Re: please help me generate an adjaceny list

John Gillette JGillette at rfmd.com
Sat Feb 1 19:16:37 EST 2003


I tried this. It turns out
Lines->left  and  Lines->right
can return negative numbers (which crashes the program).
So I test for >0 instead of !=

Is there any documentation on the vector format 
(besides the programming manual and dig_structs.h)?
I assume the negative numbers are related to either
islands or direction flow.

I have included the program and the make file
in case it's useful.

John 


> -----Original Message-----
> From: Radim Blazek [mailto:blazek at itc.it]
> Sent: Friday, January 31, 2003 3:07 AM
> To: Jeff D. Hamann; grasslist at baylor.edu
> Subject: [GRASSLIST:5414] Re: please help me generate an adjaceny list
>  
>
> You must use topology, so export + script does not help.
> If topology is built (v.support), each boundary has information
> about area on left/right side. Code may be like this:
> for (i=1; i <= Map.n_lines; i++) {
>     Line = &(Map.Line[i]);
>     if (Lines->type != AREA)   continue;
>     lcat = rcat = 0;
>     if (Lines->left != 0) 
>         lcat = Map.Att[Map.Area[Lines->left].att].cat;
>     if (Lines->right != 0)
>         rcat = Map.Att[Map.Area[Lines->right].att].cat;
>     fprintf (stdout, "%d %d", lcat, rcat);
> }
> 
> Radim
>      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: application/octet-stream
Size: 2538 bytes
Desc: main.c
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20030201/75227495/main.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gmakefile
Type: application/octet-stream
Size: 228 bytes
Desc: Gmakefile
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20030201/75227495/Gmakefile.obj


More information about the grass-user mailing list