[GRASS-dev] d.vect -a shows only some elements
Martin Landa
landa.martin at gmail.com
Fri Oct 20 15:37:43 EDT 2006
Hi Moritz,
2006/10/20, Moritz Lennert <mlennert at club.worldonline.be>:
[snip]
> I have done some testing, and the problem seems to be in line 224 of
> display/d.vect/area.c:
>
> if (db_CatValArray_get_value (&cvarr_rgb, cat, &cv_rgb) != DB_OK)
>
> db_CatValArray_get_value returns 'not found' for many of the cat values.
>
> I am wondering whether this might be due to the fact that the bsearch in
> db_CatValArray_get_value needs a sorted array, but that the array is not
> sorted as db_select_CatValArray() which creates the array on line 67 of
> the same file only sorts lists of ints or doubles, but not of strings...
you are right (if I understand well), adding
db_CatValArray_sort (&cvarr_rgb);
should solve the problem. I wonder why db_select_CatValArray sorts
cvarr->value by category number only for data type int or double...
(?), see
00300 if ( type == DB_C_TYPE_INT )
00301 qsort( (void *) cvarr->value, nrows, sizeof(dbCatVal), cmpcat);
00302 else if ( type == DB_C_TYPE_DOUBLE )
00303 qsort( (void *) cvarr->value, nrows, sizeof(dbCatVal), cmpcat);
Best regards, Martin
____________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>
--
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
More information about the grass-dev
mailing list