[mapguide-internals] Problems with cached/optimized legend
Kenneth, GEOGRAF A/S
ks at geograf.dk
Wed Apr 18 16:17:14 EDT 2007
When using the server API for altering layer visibility, a call to the
GetMapFrame().Refresh() is not sufficient to refresh the legend.
Pseudocode:
$map.Open(...);
$map.Layers('layername').setVisibility(true);
$map.Save();
Calling the GetMapFrame().Refresh() after this, will update the map to
display the new layer.
However the Legend does not reflect this change.
The problem can be solved with two changes:
1. In ajaxmappane.templ, the Refresh() function should also call
ResetVisLayers()
2. In legendctrl.templ, the Refresh call should be changed, so it does
not call with the summary parameter
The problem only occurs in the AJAX viewer.
When retrieving the legend script, using the summary parameter, the
visibility does not change.
Removing the summary parameter is a bad fix, as it also disables the
optimizations that the summary parameter gives.
If the above mentioned fix 1, is not implemented, a lot of features will
fail after modifying the map.
For instance tooltips for the layers will not work.
I think this is a problem with a design flaw in the way the viewer is
implemented.
Keeping state data solely on the client is a very bad idea.
This happens with layerstates and current zoom in the AJAX viewer, and
the Selection in the DWF viewer.
To allow modifications to the map from the server API, all data should
be written to the server.
To provide caching the client should fetch a change list, rather than
sporadically caching data.
Using a sequence number, the client can skip multiple update cycles, and
still be synced correctly.
Using a generic format would allow the DWF and ajax viewer to work on
exactly the same data, thus reducing duplicate code.
--
Regards. Kenneth, GEOGRAF A/S
More information about the mapguide-internals
mailing list