//if (_firstZoom) //{ // MyMap.ZoomToResolution(MyMap.Resolution / 6, pt); // _firstZoom = false; //} //else // MyMap.PanTo(pt); centerAndZoom(MyMap, pt, MyMap.MinimumResolution * 4);
private void centerAndZoom(ESRI.ArcGIS.Client.Map map, ESRI.ArcGIS.Client.Geometry.MapPoint mapPoint, double resolution) { double ratio = 1.0; if (map.Resolution != 0.0) ratio = resolution / map.Resolution; if (ratio == 1.0) map.PanTo(mapPoint); else { ESRI.ArcGIS.Client.Geometry.MapPoint mapCenter = map.Extent.GetCenter(); double X = (mapPoint.X - ratio * mapCenter.X) / (1 - ratio); double Y = (mapPoint.Y - ratio * mapCenter.Y) / (1 - ratio); map.ZoomToResolution(resolution, new ESRI.ArcGIS.Client.Geometry.MapPoint(X, Y)); } }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.