VEMap.GetMapMode Method

Returns the current map mode.


VEMap.GetMapMode();

An integer that indicates the enumerator of the VEMapMode Enumeration. A value of 1 represents Mode2D, and a value of 2 represents Mode3D.

<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
      <script>
         var map = null;
         var center = new VELatLong(38.62504326121764, -90.18497586250308);
         var initView = new VEMapViewSpecification(center, 16, 1000, -90, 0);
         
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap();
            map.SetMapMode(VEMapMode.Mode2D);
            map.SetMapStyle("a");
            map.SetMapView(initView);
         }   
         
         function ToggleMode()
         {
            var mode = map.GetMapMode();
            if (mode == 1)
            map.SetMapMode(VEMapMode.Mode3D);
            else if (mode == 2)
            map.SetMapMode(VEMapMode.Mode2D);
         }
         
         function SetMapStyle()
         {
            if (styleForm.styleType[0].checked)
            {
                var style = map.GetMapStyle();
                if (style == "a") alert("The Aerial ('a') style is already set.");
                else
                {
                    map.SetMapStyle("a");
                    alert("Map style has been set to Aerial ('a').");
                }
            }
            else if (styleForm.styleType[1].checked)
            {
                var style = map.GetMapStyle();
                if (style == "o") alert("The Birdseye ('o') style is already set.");
                else
                {
                    map.SetMapStyle("o");
                    alert("Map style has been set to Birdseye ('o').");
                }
            }
            else if (styleForm.styleType[2].checked)
            {
                var style = map.GetMapStyle();
                if (style == "r") alert("The Road ('r') style is already set.");
                else
                {
                    map.SetMapStyle("r");
                    alert("Map style has been set to Road ('r').");
                }
            }
            else if (styleForm.styleType[3].checked)
            {
                var style = map.GetMapStyle();
                if (style == "h") alert("The Hybrid ('h') style is already set.");
                else
                {
                    map.SetMapStyle("h");
                    alert("Map style has been set to Hybrid ('h').");
                }
            }
         }
      
      </script>
   </head>
   <body onload="GetMap();">
    <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
    <INPUT id="btnToggle" type="button" value="Toggle Map Mode" name="btnToggle" 
    onclick="ToggleMode();">
        <form name="styleForm">
            <input id="aerial" type="radio" name="styleType" checked="checked" /> Aerial<br />
            <input id="birdseye" type="radio" name="styleType" /> Birdseye<br /> 
            <input id="road" type="radio" name="styleType" /> Road<br />
            <input id="hybrid" type="radio" name="styleType" /> Hybrid
        </form>
        <INPUT id="btnStyle" type="button" value="Set Selected Map Style" name="btnStyle" 
    onclick="SetMapStyle();">
    <div id="latlon"></div>
   </body>
</html>

표시: