/// <summary> /// Zoom to candidate depends on locator type. /// </summary> /// <param name="mapCtrl">Map control.</param> /// <param name="addressCandidate">Candidate to zoom.</param> /// <param name="locatorType">Type of locator, which return this candidate.</param> private static void _ZoomToCandidate(MapControl mapCtrl, AddressCandidate addressCandidate, LocatorType locatorType) { Debug.Assert(mapCtrl != null); Debug.Assert(addressCandidate != null); double extentInc = 0; // Get extent size. switch (locatorType) { case LocatorType.CityState: { extentInc = ZOOM_ON_CITY_STATE_CANDIDATE; break; } case LocatorType.Zip: { extentInc = ZOOM_ON_ZIP_CANDIDATE; break; } case LocatorType.Street: { extentInc = ZOOM_ON_STREET_CANDIDATE; break; } default: { Debug.Assert(false); break; } } // Make extent rectangle. ESRI.ArcLogistics.Geometry.Envelope rect = new ESRI.ArcLogistics.Geometry.Envelope(); rect.SetEmpty(); rect.Union(addressCandidate.GeoLocation); rect.left -= extentInc; rect.right += extentInc; rect.top += extentInc; rect.bottom -= extentInc; ESRI.ArcGIS.Client.Geometry.Envelope extent = GeometryHelper.CreateExtent(rect, mapCtrl.Map.SpatialReferenceID); mapCtrl.ZoomTo(extent); }
/// <summary> /// Set map extent on point collection. /// </summary> /// <param name="mapCtrl">Map control.</param> /// <param name="points">Points collection.</param> public static void SetExtentOnCollection(MapControl mapCtrl, IList<ESRI.ArcLogistics.Geometry.Point> points) { ESRI.ArcLogistics.Geometry.Envelope? rect = GetCollectionExtent(points); if (rect.HasValue) { ESRI.ArcGIS.Client.Geometry.Envelope extent = GeometryHelper.CreateExtent(rect.Value, mapCtrl.Map.SpatialReferenceID); mapCtrl.ZoomTo(extent); } }