[GRASS-dev] vector display clipping

Glynn Clements glynn at gclements.plus.com
Tue Sep 16 04:59:43 PDT 2014


Anna Petrášová wrote:

> can anyone explain the difference between grass64 and 7 in clipping vector
> data for display? I attached 2 pictures created with d.mon png and cairo
> driver

Which is png and which is cairo?

> (to avoid influences from GUI) and you can see that in 64 the lines
> are clipped to match computational region while in grass7 it seems to
> display all vector features which have at least part in the region. Is this
> bug or feature? I couldn't find any discussion on this topic...

In 7.0, there are two distinct sets of clipping operations.

D_set_clip_mode, D_set_clip and D_clip_to_map control clipping which
is performed within the display library. The default is no clipping. 

Using this functionality for graphical clipping is problematic if you
use thick lines, as clipped lines will be capped at the point where
they're clipped. It would also affect the dash offset for dashed lines
(although that isn't implemented yet).

Additionally, the driver's Set_window function establishes a clip
region (e.g. via cairo_clip() for the cairo driver). This defaults to
the entire "screen", but can be overridden by setting the environment
variable GRASS_FRAME.

Arguably, the code which sets up the coordinate system so that the
current region just fits the display (D_setup) should also set the
clip region to fit the current region.

However, this is complicated slightly be the fact that there's no
distinction between the display "frame" (either the screen or the
frame set by GRASS_FRAME) and the current clip region, so setting a
clip region would lose the only record of the frame.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list