| MGMap.getSelection |
|
MGSelection getSelection()
Gets the currently selected map features.
MGSelection - The current selection.
none
The following example is designed to work with the Tutorial.mwf file that is included with Autodesk MapGuide Author. It zooms to the selected feature or features. If nothing is selected, an alert displays:
function zoomToSelected()
{
var map = getMap();
// Assign collection of selected features to variable
var selected = map.getSelection().getMapObjectsEx(null);
// If collection is not empty, zoom to its members...
if (selected.size() > 0)
map.zoomSelected();
// ...otherwise, display alert
else
alert("Please make a selection first.");
}