[GRASS-dev] Re: bug in Vect_cidx_find_next() ?
Radim Blazek
radim.blazek at gmail.com
Tue Oct 10 04:47:48 EDT 2006
On 10/10/06, Moritz Lennert <mlennert at club.worldonline.be> wrote:
>
> Would this similar function look like below ? If yes, why make this into a
> separate function and not simply add a 'type' parameter to above function
> which we could then call Vect_cidx_find_ojects_by_cat or something like
> that ?
Yes, you are right, it can be one function, it is your
decision.
Radim
> ***proposal for Vect_cidx_find_areas**********
>
> void Vect_cidx_find_areas ( struct Map_info *Map, int layer, int cat,
> struct ilist *areas )
> {
> int type, line;
> struct Cat_index *ci;
>
> Vect_reset_list ( areas );
> int field_index = Vect_cidx_get_field_index ( Map, layer );
> ci = &(Map->plus.cidx[field_index]);
>
> int idx = Vect_cidx_find_next ( Map, field_index, cat,
> GV_AREA, 0, &type, &line );
>
> if ( idx == -1 )
> {
> return;
> }
>
> do {
> if ( !(ci->cat[idx][1] & GV_AREA)
> || ci->cat[idx][0] != cat )
> {
> break;
> }
> Vect_list_append ( areas, ci->cat[idx][2] );
> idx++;
> } while ( idx < ci->n_cats );
> return;
> }
>
> Moritz
>
>
More information about the grass-dev
mailing list