Evening Sebastian:

uDig has the two bits of functionality you describe.

1) for layer transparency, we render each layer into a separate raster 
(allowing rendering to be performed in several threads). As part of a separate 
composition step we can control transparency. For example we can raid out every 
layer except the current layer allowing the user to focus on editing.

So I can confirm that this functionality is not supported by SLD.

If pressed I would prefer you add this "composition" information to the layer 
definition, rather than extend SLD with a vendor specific extension. The 
MapContext / Layer data structure roughly matches the OGC work on "context 
files" which can be shared between applications. Since this design is intended 
to be "over top" of several rendering services it is well suited to collecting 
your layer composition settings.

2) for labels, please just use your own label cache.

As a consequence of uDig using several renderers at the same time, we make use 
of the label cache callback object. You can use the resulting label cache to 
draw labels (or not) overtop of you map. You can either make use of a facility 
like the swing "glass pane", or make a direct draw layer as appropriate.

--  
Jody Garnett


On Monday, 24 September 2012 at 3:28 PM, Sebastian Graca wrote:

> Hello!
>  
> I have created a patch for GeoTools which implements whole layer
> transparency (for layers and labels) and allows to skip label rendering
> for a layer. The patch is submitted as a github pull request
> https://github.com/geotools/geotools/pull/32
>  
> Andrea asked me to explain what I try to do, so I will try to describe
> what is being done and why.
> We had to implement in our product a feature which would allow user to
> easily adjust layer transparency (by using a slider or some other input
> control - this is irrelevant). I think (correct me if I'm wrong) that
> this is not possible to achieve by means of SLD only. The picure "layer
> opacity.png" (which was produced by a patched version of GeoTools)
> shows desired result.
> Trying to mimic it with following SLD style renders output as in "sld
> opacity.png" image.
> =======8<=====================
> <StyledLayerDescriptor xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> xmlns="http://www.opengis.net/sld";
> xsi:schemaLocation="http://www.opengis.net/sld 
> http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";
> version="1.0.0"
> >
> <UserLayer>
> <LayerFeatureConstraints>
> <FeatureTypeConstraint/>
> </LayerFeatureConstraints>
> <UserStyle>
> <FeatureTypeStyle>
> <Rule>
> <PolygonSymbolizer>
> <Fill>
> <CssParameter name="fill">#0000FF</CssParameter>
> <CssParameter name="fill-opacity">0.5</CssParameter>
> </Fill>
> <Stroke>
> <CssParameter name="stroke">#000000</CssParameter>
> <CssParameter name="stroke-opacity">0.5</CssParameter>
> </Stroke>
> </PolygonSymbolizer>
> </Rule>
> </FeatureTypeStyle>
> </UserStyle>
> </UserLayer>
> </StyledLayerDescriptor>
> =======8<=====================
>  
> This is a very simple use case. When layer style contains multiple
> symbolizers using different values for opacity, it would be really
> difficult to adjust them (if possible at all - opacity could be
> specified as a feature property) to achieve desired
> transparency at a layer level. But it would still produce bad output for
> overlapping objects or overlapping symbolizers.
> This feature (whole layer transparency) is present in ArcMap for example.
>  
> We also had to implement a feature allowing for quick switching of
> labels on and off. Theoretically it could be implemented by removing all
> text symbolizers from layer style and restoring them when needed but it
> seems overly complicated and I think this is a very common use case for
> interactive map viewers.
> Removing TextSymbolizers could lead to an invalid style - when a
> TextSymbolizer is the only sybmolizer in a Rule. According to SLD schema
> a Rule is required to have at least one symbolizer. Removing a Rule
> could lead to invalid rendering - when the rule uses a Filter then the
> features which matched the filter would be rendered (after the rule was
> removed) by a rule with ElseFilter.
>  
> Andrea mentioned that he wants to avoid extra API-s for styling layers.
> But I could come up with some other ideas (which we already implemented
> but not in a system which uses GeoTools) for extending GeoTools styling
> capabilities. Like not drawing features when a label for this feature
> was rendered.
> Please see 
> http://msip-mapa.um.gliwice.pl/geoportaltoolkit/map.php?link=2924&skin=gliwice_new_mieszkaniec
> Near the lower right corner there is Stans³awa Moniuszki street with some
> address points marked with a small blue envelope (for those point labels
> could not be placed). But if the label is placed (Dworcowa street in the
> middle), the point icon is not drawn.
>  
> --
> Sebastian Graca
>  
> Institute of Spatial and Cadastral Systems
> tel: +48 32 301 10 74
> fax: +48 32 301 10 77
> e-mail: sgr...@ispik.pl (mailto:sgr...@ispik.pl)
> http://www.ispik.pl
>  
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and  
> threat landscape has changed and how IT managers can respond. Discussions  
> will include endpoint security, mobile security and the latest in malware  
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>  
> _______________________________________________
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net 
> (mailto:GeoTools-Devel@lists.sourceforge.net)
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>  
>  
>  
>  
> Attachments:  
> - layer opacity.png
>  
> - sld opacity.png
>  


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to