We're updating the issue view to help you get more done. 

Layers titles are being lost during rendering.

Description

The problem occurs during layers rendering. I set the title for the layers I put inside mapContent, but eventually layers without a title are being rendered. This can be seen when errors occur. The name of the layer that was affected by the error is always null in the exception description. When I print out the problem I can see what happened but I have no idea which layer did this affect.

The source of the issue is in the class org.geotools.renderer.lite.CompositingGroup. There is a method

public static List<CompositingGroup> splitOnCompositingBase(Graphics2D graphics, Rectangle screenSize, MapContent mc)
In this class (line 79) a layer is being cloned. Unfortunately the title is not being passed to the cloned layer.
I think that calling a different constructor:
public FeatureLayer(FeatureSource featureSource, Style style, String title)
instead of
public FeatureLayer(FeatureSource featureSource, Style style)
would solve the problem.

Environment

OS: Windows 7 Professional
Java: 8

Status

Assignee

Unassigned

Reporter

mroguski@poczta.fm

Triage

Components

Affects versions

21.0
21.2
20.2

Priority

Medium