[mapguide-users] RE: re: flexible web layouts

GordonL gordon.luckett at arrowgeomatics.com
Fri Jun 4 09:47:18 EDT 2010


The google stuff function just sets the default base layer (in this case
google streets) when the map loads..
(I place it in the INDEX.htm page of one of the Fusion Templates (

var addGoogleStuff = function() {

var mapWidget = Fusion.getWidgetById('Map');
var map = mapWidget.oMapOL;
mapWidget.fractionalZoom = false; //fractionalZoom not permitted with Google
layers
map.setOptions({fractionalZoom: false, numZoomLevels: 30});

var googleStreetsLayer = new OpenLayers.Layer.Google('Google Streets', {type
: G_NORMAL_MAP, isBaseLayer: true, sphericalMercator: true});
map.addLayer(googleStreetsLayer);

var mgLayers = map.getLayersByClass('OpenLayers.Layer.MapGuide');
if(mgLayers.length != 0)
{
var mgLayer = mgLayers[0];
if(mgLayer.isBaseLayer)
{
map.setBaseLayer(googleStreetsLayer);
mgLayer.setIsBaseLayer(false);
mgLayer.setVisibility(true);
}
}
}




don't forget to update the fusionInitialized function:



var fusionInitialized = function() {
 
    $('AppContainer').resize({forceResize: true});
    $('AppContainer').style.visibility = 'visible';
	Fusion.getWidgetById('Map').registerForEvent(Fusion.Event.MAP_LOADED,
addGoogleStuff);
 
}





but, I have found I had to roll back the version of OpenLayers.js that I am
using because 2.9 does not play nicely with FUSION.


<script type="text/javascript"
src="http://openlayers.org/api/2.8/OpenLayers.js"></script>



regards
gordon

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/re-flexible-web-layouts-tp2660073p5139493.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list