[mapguide-users] Custom layouts...
Kori Maleski
km at pat.ca
Wed Mar 22 12:40:43 EST 2006
Nicely done Alain.
Kori Maleski BSc.
Senior Technical Consultant
Suite 400 - 534 17 Ave. SW Calgary, AB CANADA T2S 0B1
TEL
403.770.1917
FAX
877.691.9149
TOL
877.691.9171
www.pat.ca
________________________________________
From: Alain Lebatard [mailto:alain.lebatard at autodesk.com]
Sent: March 22, 2006 10:21 AM
To: users at mapguide.osgeo.org
Subject: RE: [mapguide-users] Custom layouts...
Jason,
I attached a couple HTML pages that show you a possible approach in
displaying the legend control in another place In this example the legend
control runs in an IFrame at the right of the viewer (see screen snapshot
below
This approach requires no code change in the template files. The main issue
is that the legend control and the viewer call each other, the viewer to set
the scale as the map is navigated, or to refresh the control among other
things, and the legend control to change the visibility of layers and
groups. When the frame hosting the control changes, the way the control and
the viewer reference each other in the code needs to change as well. The
reference to the AJAX viewer in the legend control code was hardcoded. I
changed this and I will submit the change to the mapguide trunk shortly. The
reference to the legend control from the AJAX viewer is hold by a variable
so all needs to be done is changing the content of this variable to point to
the new control.
The sample script legendpane.html shows you how to wait for the map to be
fully initialed, create a new legend control (not the new parameter MAPFRAME
to the LegendCtrl.php request), and when this control is fully initialized,
sets a reference to it in the AJAX viewer. From that point on the AJAX
viewer will interact with the new control.
The drawback of this approach is that the initial legend control is still
there, only not visible. But its not a big deal, the control is inactive
after you attached the new instance to the AJAX viewer. The advantage of
this approach, which to my opinion far outweighs the drawback, is that it
requires no change in the existing surround.
Alain
More information about the Mapguide-users
mailing list