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

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 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
     

(attachments)

main.c (2.48 KB)
Gmakefile (228 Bytes)

On Sat, Feb 01, 2003 at 07:16:37PM -0500, John Gillette wrote:

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.

Positive/Negative indicates direction. Take the absolute value of the
number and test it is not zero. There is no documentation other than
the source ;-(

--
echo ">gra.fcw@2ztr< eryyvZ .T pveR" | rot13 | reverse