Patch for ticket 2380 (GETMAPLEGENDIMAGE should skip groups with no visible layers)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Patch for ticket 2380 (GETMAPLEGENDIMAGE should skip groups with no visible layers)

Jackie Ng
Hi All,

I've attached a patch for ticket 2380 (GETMAPLEGENDIMAGE should skip groups with no visible layers)

http://trac.osgeo.org/mapguide/ticket/2380

This adds a "compilation" step to the legend rendering where we compile the following information about the MgMap to avoid repeated linear searches for this information:

 - The number of visible layers for each group (as a typedef'd std::map<STRING, int> )
 - The list of child groups for each group (as a typedef'd std::map<STRING, std::vector<STRING>> )

Then for each child group we find in MgLegendPlotUtil::ProcessLayersForLegend(), we check if that group has any visible child layers using the above compiled information. If there are no visible layers for that group, we skip the recursive call back into MgLegendPlotUtil::ProcessLayersForLegend() for that particular group.

The net result is that visible groups that have no visible child layers are not drawn into the legend, reducing the clutter of empty groups in the rendered legend.

Please review. Thanks.

- Jackie