SuperMap iClient for Silverlight開發筆記(不斷補充中)

暖楓無敵發表於2013-01-28

1、當滑鼠在地圖上移動時,顯示滑鼠經過地點的經緯度座標?

 MyMap.MouseMove += new System.Windows.Input.MouseEventHandler(MyMap_MouseMove);

void MyMap_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)

{
            this.cor.Text = MyMap.ScreenToMap(e.GetPosition(MyMap)).ToString();
}


2、當放大或縮小地圖時,觸發視野改變事件,獲取地圖當前的比例尺、中心點座標和當前視野數值?


MyMap.ViewBoundsChanged += new System.EventHandler<SuperMap.Web.Mapping.ViewBoundsEventArgs>(MyMap_ViewBoundsChanged);


void MyMap_ViewBoundsChanged(object sender, SuperMap.Web.Mapping.ViewBoundsEventArgs e)
{
            this.scale.Text = "Scale:" + MyMap.Scale.ToString();
            this.center.Text = "Center:" + MyMap.Center.ToString();
            this.viewbounds.Text = "ViewBounds:" + MyMap.ViewBounds.ToString();
}


相關文章