[GRASS-dev] Vect_get_num_lines() versus Vect_get_num_primitives()
Moritz Lennert
mlennert at club.worldonline.be
Mon Sep 25 07:46:51 EDT 2006
Paul Kelly wrote:
> Hello Moritz
>
> On Mon, 25 Sep 2006, Moritz Lennert wrote:
>
>> When working on a revision of d.vect.chart, I got the feeling that
>> Vect_get_num_lines was used as if it returned the number of _all_ the
>> features in the map, not only the lines (from lines 49+ of
>> display/d.vect.chart/plot.c):
>>
>> nlines = Vect_get_num_lines ( Map );
>> /* loop through each vector feature */
>> for ( line = 1; line <= nlines; line++ ) {
>> G_debug ( 3, "line = %d", line );
>> ltype = Vect_read_line (Map, Points, Cats, line);
>>
>> As you can create charts with vector point, I don't know how this would
>> work, if Vect_get_num_lines returns only number of lines.
>
> My understanding is that a point is represented as a line containing
> only one node. So the number of lines is equivalent to the number of
> points. I have very limited experience with this but in any maps I came
> across while testing recent changes to v.surf.idw to remove it's
> dependency on topology, this is how points where represented.
Thanks Paul, that explains it, and probably also Markus' issue, no ?
A related question: I use Vect_cidx_find_next() which returns an 'id'
value which corresponds to:
id = ci->cat[cat_index][2]
ci being a Cat_index structure in which cat is defined as:
int (*cat)[3]; /* array of cats (cat,type, lines/area) */
is the 'lines/areas' equivalent to the line number used in the above
Vect_read_line() call. It seems to be (at least it seems to work when I
use it), but I just want to make sure.
Moritz
More information about the grass-dev
mailing list