case "放大": MyDrawObject.IsEnabled = true; _toolMode = "zoomin"; break; case "缩小": MyDrawObject.IsEnabled = true; _toolMode = "zoomout"; break;
voID MyDrawObject_DrawComplete(object sender,DrawEventArgs e) { if (_toolMode == "zoomin") { MyMap.ZoomTo(e.Geometry as ESRI.ArcGIS.ClIEnt.Geometry.Envelope); } else if (_toolMode == "zoomout") { Envelope currentExtent = MyMap.Extent; Envelope zoomBoxExtent = e.Geometry as Envelope; MapPoint zoomBoxCenter = zoomBoxExtent.GetCenter(); double whRatioCurrent = currentExtent.WIDth / currentExtent.Height; double whRatioZoomBox = zoomBoxExtent.WIDth / zoomBoxExtent.Height; Envelope newEnv = null; if (whRatioZoomBox > whRatioCurrent) // use wIDth { double mapWIDthPixels = MyMap.WIDth; double multiplIEr = currentExtent.WIDth / zoomBoxExtent.WIDth; double newWIDthMapUnits = currentExtent.WIDth * multiplIEr; newEnv = new Envelope(new MapPoint(zoomBoxCenter.X - (newWIDthMapUnits / 2),zoomBoxCenter.Y),new MapPoint(zoomBoxCenter.X + (newWIDthMapUnits / 2),zoomBoxCenter.Y)); } else // use height { double mapHeightPixels = MyMap.Height; double multiplIEr = currentExtent.Height / zoomBoxExtent.Height; double newHeightmapUnits = currentExtent.Height * multiplIEr; newEnv = new Envelope(new MapPoint(zoomBoxCenter.X,zoomBoxCenter.Y - (newHeightmapUnits / 2)),new MapPoint(zoomBoxCenter.X,zoomBoxCenter.Y + (newHeightmapUnits / 2))); } if (newEnv != null) MyMap.ZoomTo(newEnv); } }
MyDrawObject = new Draw(MyMap) { FillSymbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.ClIEnt.Symbols.FillSymbol,DrawMode = DrawMode.Rectangle }; MyDrawObject.DrawComplete += new EventHandler<DrawEventArgs>(MyDrawObject_DrawComplete);总结
以上是内存溢出为你收集整理的放大 缩小全部内容,希望文章能够帮你解决放大 缩小所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)