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@itc.it]
Sent: Friday, January 31, 2003 3:07 AM
To: Jeff D. Hamann; grasslist@baylor.edu
Subject: [GRASSLIST:5414] Re: please help me generate an adjaceny listYou 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