[GRASS-dev] ps.map: raster always under vector map?

Glynn Clements glynn at gclements.plus.com
Mon May 7 07:44:14 EDT 2007

Hamish wrote:

> >  display/d.vect.chart/OBJ.i686-pc-linux-gnu/bar.o    | G_plot_polygon
> >  display/d.vect.chart/OBJ.i686-pc-linux-gnu/pie.o    | G_plot_polygon
> is R_polygon_abs() an easy drop-in replacement here?

Use D_polygon().

[Or possibly D_polygon_cull() or D_polygon_clip() if a lot of the
output is likely to lie outside the frame. Clipping to the current
frame will always get performed somewhere, but the _clip/_cull
versions do it earlier, which can provide a performance gain if most
of the data lies outside of the frame. OTOH, if most of the data lies
within the frame, the _clip/_cull versions will probably be slower.]

R_polygon_abs() takes integer coordinates in the monitor's base
coordinate system, while D_polygon() etc take floating-point
coordinates in the coordinate system established by D_do_conversions()
etc (typically, the current region is mapped to the bounds of the
current frame).

G_plot_polygon() performs the same coordinate translations as the D_*
functions, so the D_* versions are a better match.

[I suspect that this is why some modules use G_plot_polygon() for
display. lib/display/draw2.c is a recent addition; previously, if you
wanted to use geographic coordinates or honour display frames, you had
to do the work yourself.]

> >  display/d.what.vect/OBJ.i686-pc-linux-gnu/flash.o   | G_plot_polygon
> again, R_polygon_abs()? (flashheart strikes again)

D_polygon() etc.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list