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

Radim Blazek blazek at itc.it
Mon Feb 3 07:48:33 EST 2003


On Friday 31 January 2003 03:44 pm, John Gillette wrote:
> Radim,
>   What is the cat of Map.Line[1]?
>   In other words,  I want
>   to also print the line category number.
>
>   Would it be:
>   linecat = Map.Att[Lines->att].cat
>   (which I think is equvalent to
>             Map.Att[Map.Line[i].att].cat

I'm not sure, but I believe it should be so.

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

No documentation for internals. Negative is for isle,
correct should be:
if (Lines->left != 0) {
   if (Lines->left > 0) {
       lcat = Map.Att[Map.Area[Lines->left].att].cat;
       larea = Lines->left;
   } else {
       larea = abs(Lines->left);
       l_isle = Map.Isle[larea].area;
       lcat = Map.Att[Map.Area[l_isle].att].cat;
       larea = l_isle;
   }
}

(taken from src/mapdev/v.reclass/cmd/rclas_area.c)

Radim




More information about the grass-user mailing list