[mapguide-users] URL in Legend

Jason Birch Jason.Birch at nanaimo.ca
Wed Jan 16 13:54:39 EST 2008


Hi Keith,

I know this doesn't help right now, but Fusion has the concept of layer
and group information built-in.  The Legend widget has functions that
are called getLayerInfoUrl and getGroupInfoUrl that are called to add
hyperlinked images when constructing the legend.  
 
Look around lines 504 and 515 of this file:
 
http://trac.osgeo.org/mapguide/browser/trunk/MgDev/Oem/fusionframework/f
usion/trunk/widgets/Legend.js
 
You can trace this back to the ApplicationDefinition file which builds
the links property of the map, filling it with name/url pairs for layers
and groups (around line 426)
 
http://trac.osgeo.org/mapguide/browser/trunk/MgDev/Oem/fusionframework/f
usion/trunk/lib/ApplicationDefinition.js
 
Which means you can just add a structure like this to the Extension
section of the map definition in your ApplicationDefinition file
 
<Links>
  <Group>
    <Name>Roads</Name>
    <Url>http://example.com/metadata/roads.html</Url>
  </Group>
  <Layer>
    <Name>Highway</Name>
    <Url>http://example.com/roads_hwy.html</Url>
  </Layer>
  <Layer>
    <Name>Arterial</Name>
    <Url>http://example.com/roads_art.html</Url>
  </Layer>
</Links>

And it _should_ get picked up by the legend.  

Two things:

- I haven't actually tested this to make sure it works.
- I cheated; I knew that this functionality was probably there (DMSG
implemented it for my project) but got distracted into tracking it down.

Jason
 
________________________________

From: Campbell, Keith A
Subject: [mapguide-users] URL in Legend



I'd like to add a link in the legend from each layer / group to some
information about the layer (in a new window). Has anybody done this
successfully and if so, would you mind sharing how you did it?



More information about the mapguide-users mailing list