[GRASS5] [bug #825] (grass) r.poly doesn't write label points correctly

this bug's URL: http://intevation.de/rt/webrt?serial_num=825
-------------------------------------------------------------------------

Subject: r.poly doesn't write label points correctly

Platform: Linux/Intel
grass downloaded at: CVS Server, Germany
grass sources source: yes, I am using the latest GRASS from CVS

Hi,

obviously r.poly doesn't calculate the label point positions
correctly (stored in dig_att) which leads to label problems.

It even fails with a simple test pattern:

Generate test pattern:
r.mapcalc testpat="if( (10*sin(2*row()) + 10*sin(2*col())) > 0.,null(),1)"
d.rast testpat
r.poly in=testpat out=testpat
v.support testpat
-> warning PNT_IN_AREA appears which shouldn't

When converting the dig_att/testpat to a sites list, the
label positions are quite strange.
I would expect the centers of the pattern.

d.erase
v.to.rast in=testpat out=testpat2
d.rast testpat2

-> one pattern is missing

It would be nice to have that fixed...

Markus

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

When converting the dig_att/testpat to a sites list, the
label positions are quite strange.
I would expect the centers of the pattern.

It uses the horizontal midpoint of the widest part of the polygon:

  write_att(lab_digit, (char) dig_new_to_old_type(type),
      cell_head.west + (p->col + (p->width / 2.0)) * cell_head.ew_res,
      cell_head.north - (p->row + 0.5) * cell_head.ns_res,
      cat);

At first glance, the obvious change would seem to be to change:

      cell_head.north - (p->row + 0.5) * cell_head.ns_res,
to:
      cell_head.north - (p->row + (p->height / 2.0)) * cell_head.ns_res,

However, "struct area_table" doesn't have a height field. That would
need to be added (to extr_areas.h), and bounds.c would need to be
updated to record the height as well as the width.

"cvs log" suggests that all of the recent non-trivial changes have
been done by Andrea Aime, so he would be the obvious "volunteer" :wink:

--
Glynn Clements <glynn.clements@virgin.net>