[mapguide-users] Fusion and Viewer API Reference
Paul Spencer
pagameba at gmail.com
Tue Jan 22 14:16:04 EST 2008
Jim,
unfortunately we have not developed a compatibility API for the
existing Viewer yet. There will be one that supports a limited set of
Viewer API functions shortly, but it won't include GetLayers.
The code to do this now will be a bit ugly, but it would look
something like this:
function GetLayers() {
var mapWidget = Fusion.getMapById('Map'); //the id of the div
that the map is in
var mapguideMap = mapWidget.aMaps[0]; //
var layers = mapguideMap.aLayers;
for (var i=0; i<layers.length; i++) {
//now you can do something with layers.
var layer = layers[i];
}
}
Each 'layer' object has the following properties:
layer.layerName
layer.uniqueId
layer.resourceId
layer.legendLabel
layer.selectable
layer.selectedFeatureCount
layer.layerTypes
layer.displayInLegend
layer.expandInLegend
layer.visible
layer.actuallyVisible
layer.editable
You can also access the logical structure of groups and layers through
mapguideMap.layerRoot.
Cheers
Paul
On 21-Jan-08, at 2:55 PM, Jim O'Leary wrote:
>
> Is it possible to use the existing Viewer API Reference with Fusion?
> For
> example, if your index.html looks like this:
>
> <div id="main">
> <div id="Toolbar" />
> <div id="Map" />
> <div id="Legend" />
> <div id="OverviewMap" />
> </div>
>
> How would you call the map frame's GetLayers() method?
>
> An example would be great, if you could provide it.
>
> Thanks.
>
> -----
> Jim O’Leary
>
>
> Technical
> Consultant
>
>
> Pacific Alliance
> Technologies
>
> 2nd Floor, 24 East 4th Ave, Vancouver
> BC, Canada
> V5T1E8
>
> TEL 604.676.6000 TOL 877.691.9171 FAX 604.682.0962
>
>
> WEB http://www.pat.ca/ www.pat.ca
>
> --
> View this message in context: http://www.nabble.com/Fusion-and-Viewer-API-Reference-tp15005038s16610p15005038.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
More information about the mapguide-users
mailing list