[mapguide-users] Re: How to get selection with fusion??

lzzgeo lzzgeo at yahoo.cn
Mon May 17 04:56:32 EDT 2010


I find the way to get selection through map widget, here are the source
codes:

var themap;
var fusionInitialized = function() {
    $('AppContainer').resize({forceResize: true});
	
	 themap = Fusion.getWidgetById('Map');
	 themap.registerForEvent(Fusion.Event.MAP_SELECTION_ON, selectionOn);
}
var selectionOn = function()
{
	 var maps = themap.getAllMaps(); 
	 var map = maps[0];
	 map.getSelection(displaySelection);
}
function displaySelection(res){
 	 var layer = res.getLayer(0);
         var propNames = layer.getPropertyNames();
         var msg;
	 for (var j=0; j<layer.getNumElements(); j++) {
		 for (var k=0; k<propNames.length; k++) 		 
		      msg += ("\n" + propNames[k] +"  "+ layer.getElementValue(j, k));
	  }
	  alert(msg);
}



-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-get-selection-with-fusion-tp5044598p5064176.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list