VEMap.GetCenter 方法

不再支持该地图控件

返回 VELatLong 类对象,该对象代表当前地图视图中心处的位置。

VEMap.GetCenter();

返回值

一个 VELatLong 类对象。

备注

地图样式设置为 VEMapStyle.BirdseyeVEMapStyle.BirdseyeHybrid 时,返回该方法。

示例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://dev.ditu.live.com/mapcontrol/mapcontrol.ashx?v=6.2"></script>

      <script type="text/javascript">
         var map = null;
         var pinID = 1;
         
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap();
         }   
         
         function AddPin()
         {  
            var center = map.GetCenter();
            var pin = map.AddPushpin(center);
            pin.SetTitle('This is the title text');
            pin.SetDescription('This is the description text.');
         }   
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <a href="#" onclick="AddPin();">Add a pushpin to the center of the map</a>
   </body>
</html>

另请参阅

参考

VEMap.SetCenter 方法
VEMapStyle 枚举