arcgis for silverlight 地图放大到某个点或者几何对象

时间:2022-12-01 19:55:42
 
分类: silverlight王国 GIS王国 2012-07-09 08:50 194人阅读 评论(0) 收藏 举报

查询结果:

GraphicsLayer graphicslayer = null;
            int index = this.listStreet.SelectedIndex;
            if(index>-1)
            {
                Graphic selectedGra = lisRoad[index].RoadGraphic;

if (objCurrentMap.Layers["QueryRoadResult"] != null)
                {
                    graphicslayer = objCurrentMap.Layers["QueryRoadResult"] as GraphicsLayer;
                    graphicslayer.ClearGraphics();

}
                else
                {
                    graphicslayer = new GraphicsLayer() { ID = "QueryRoadResult" };
                }

selectedGra.Symbol = this.CanvasQueryRoad.Resources["DefaultPointSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

放大到某个几何对象(非点状几何)

objCurrentMap.ZoomTo(selectedGra.Geometry);

平移到某个对象

/objCurrentMap.PanTo(selectedGra.Geometry);

放大到某个几何对象(点几何)

MapPoint objMp = new MapPoint();
                objMp =(MapPoint)  selectedGra.Geometry ;

Envelope locatorExtent = new Envelope(float.Parse(objMp.X.ToString()) - 0.001, float.Parse(objMp.Y.ToString()) - 0.001, float.Parse(objMp.X.ToString()) + 0.001, float.Parse(objMp.Y.ToString()) + 0.001);
                objCurrentMap.ZoomDuration = new TimeSpan(0, 0, 2);

this.objCurrentMap.ZoomTo(locatorExtent);