[mapguide-internals] Fix for low performance while generating legend

Arthur Liu arthur.liu at autodesk.com
Tue Jul 14 23:25:09 EDT 2009

Hi all,

I've fixed the issue for the low performance while generating legend(Ticket #1023<https://trac.osgeo.org/mapguide/ticket/1023>). Would you please review it at https://trac.osgeo.org/mapguide/attachment/ticket/1023/Dynamic%20Legend.patch? Thanks.

Some comments:

The original implementation is generate all legend images for layers in the legend after the map loaded at one time. This will bring some performance issue(too many http requests).
To resolve this problem, we could generate the legend on demand. Generate a legend picture only when
1. The corresponding layer is visible in current scale.
2. The legend node is visible in the legend tree. (If any parent node of a legend node is collapsed, then the legend node is invisible).

I added a new property " iconWasRequested" for LayerItem and ScaleRangeItem (used for organize theme) in legend.js.  This is a flag to mark whether the legend image has been requested or not. The default value is false.  If the item displayed in the legend, the value will be set to true.  If the  item's legend image changed but the item is in a collapsed item, then the value will be set back to false, the HTTP request to generate the legend image will be sent out while the parent node expanded.

Arthur Liu
Software Development Engineer,
Office: 86-21-38664317
Mobile: 86-138-1658-3400
Address: No 399, Pudian Road,  Pudong New District,
Shanghai, 200122 China

More information about the mapguide-internals mailing list