[Qgis-user] Let's discuss on a Mask feature

Vincent Picavet vincent.ml at oslandia.com
Fri Dec 7 04:10:40 PST 2012


Hello,

> > As to solve this, I though of a solution being redrawing a geometrical
> > object in the composer on top of the map, based on the objects to mask.
> > This needs implementation of a polygon object in the composer, which is
> > not yet present.
> > But it would probably be simpler than doing a full mask feature
> > implementation.
> 
> The mask feature is also needed in the main Map Canvas.  It would be better
> to implement a full Mask feature .

Before going into details, I just want to point to the fact that generally 
speaking, I really do not like having a mask as a classic layer. Layers are 
data, and a mask is a graphical artefact that is only intended for 
visualization in a particular map output. Therefore, it should be something 
more like an overlay, if not a composer only feature.
This remark could be relativized if it has some complex implementation 
consequences.

This mask layer feature request is maybe time for a more general question : do 
we want something like «modifier layers» ? 
That would enable to do compositing for example, like in the gimp ? You could 
attach a «modifier» to a specific layer, which would add effects to the layer, 
but would not be a layer by itself, just added rendering options with 
parameters (a mask could be one of those modifiers).
Modifiers would not affect the way the features themselves are drawn, but the 
way the global resulting image is printed on screen for that layer.

> > We could also have a button in the composer to <create a mask for this
> > map based on the currently selected features in the map window>.
> 
> No, because when exporting in batch mode with Atlas can't deal with a
> manual selection. 

When exporting in batch mode for atlas then you have this mask generated 
automatically in the composer, based on the current coverage. That's exactly 
the same than for a mask layer, except that it's a composer geometry object, 
attached to a specific map.

> - When Atlas is not activated, then composer Maps should
> only show current map state (with Mask ON or OFF). IMHO when several maps
> are in the composer, users wish to use mask only on some maps. If we want
> to keep actual workflow, that implies using the "Lock layer for this map"
> to show some layers or not on each map.   Then I see no other choice than
> materializing Mask as a layer. That layer  would have a special behavior: 
> it should be able to mask all labels of layers that lies under it, but not
> those lying on top of it. Options could be using a buffer and its size,
> simplify feature on the fly or not + threshold.

I think the labelling point would be the most tricky to handle, as labels are 
normally drawn for the whole map afterwards. I do not know enough of the 
labelling part to discuss it in depth though, inputs welcome.

> That would allow a user to switch differents masks on and off, and to use
> them or not in different Composer maps. A memory layer would be fine for
> it.. BUT we need a way to save them along with the project. THAT implies
> we need to commit in CORE "Memory Layer Saver" features. (previously
> discussed here [0], but left opened)
> 
>  - When Atlas is activated, the idea is to let Atlas code generate a
> temporary mask layer fo each object of Coverage Layer, and suppress the
> mask layer each time a export iteration is done. Buffer and simplify
> options could be retyped in Atlas Panel and then passed as arguments to
> Mask classes.

Looks complicated to me, generating a data layer each time to have a display 
feature sounds a complex way of handling things. But maybe it is the most 
reasonable one.

> > The only drawback to this approach is that the labels will be covered by
> > the mask, and will appear truncated if part of it lies under the mask. I
> > do not know if this would be a blocker.
> 
> This is a BLOCKER, since this is what Mapinfo does, and this is not
> satisfying at all. People do workarounds like cookie cutter to destroy
> objects outside the mask. We loose the dynamic link with data and batch
> Atlas possibilities. This is why I was asking devs on risks of it, and
> submitting the idea of simplifying the masks polygon. Warnings would be
> welcome if polygons have to much vertices and parts , along with 
> suggestions to mask less layers, and simplifies polygons..

The label issue is again probably the most complicated one. If this is a 
blocker, we should go deeper into the way labelling works, as it's gonna be 
complex.

Before speaking about performance and technical aspect, we should agree on 
where in QGIS this kind of display-oriented «layer» should go : composer, some 
kind of modifier layer, overlay layer, or classic data layer, or another better 
solution ? 
We should generalize the problem, find a global concept, and verify that 
masking is covered by it.
Or is masking the only forseen feature of this kind ?

What do other think of it ?

Vincent

> 
> > Therefore the question is : do we need this in the main map window, or
> > this solution for composer would be enough ?
> > 
> > We'd be glad to implement that in composer and Atlas if this is a good
> > solution for you.
> 
> Sure ;-) but we need to find a global agreement on it, and we previously
> need to act what method is choosen to implement Memory Layer persistency
> in core. I'll be glad to fund this too.
> 
> 
> 
> 
> 
> [0] -
> http://osgeo-org.1560.n6.nabble.com/Memory-data-provider-persistence-td410
> 8012.html



More information about the Qgis-user mailing list