|
The SetMapView method is only available from within JavaScript in the current version (v1.00.04) of Web.Maps.VE.
Here's a code example of using it to center the map on all the plotted shapes when the map initially loads:
< Simplovation:Map runat="server" ID="Map1" OnClientMapLoaded="mapLoaded" /> <script type="text/javascript"> // This method is run once the map has completed loading on the page function mapLoaded() { var map = $find("<%=Map1.ClientID%>"); //This code will center the map on all the shapes that are plotted var locations = new Array(); for(var a = 0; a < map.get_Map().GetShapeLayerCount(); a++) { for(var b = 0; b < map.get_Map().GetShapeLayerByIndex(a).GetShapeCount(); b++) { Array.addRange(locations, map.get_Map().GetShapeLayerByIndex(a).GetShapeByIndex(b).GetPoints()); } } if (locations.length != 0) map.get_Map().SetMapView(locations); } </script>
|