/// <summary> /// Set an initial map extent after all map layers are initialized /// </summary> private void InitializeMapExtent() { MapConfig mapConfig = CurrentApp.AppConfig.MapConfig; if (mapConfig.InitialExtent != null) { InitMapExtent = mapConfig.InitialExtent.ToEnvelope(this.MapSRWKID); } if (mapConfig.FullExtent != null) { FullMapExtent = mapConfig.FullExtent.ToEnvelope(this.MapSRWKID); } // If OverviewMap exits, initialize Map extent here, otherwise in OverviewMapWidget if (string.IsNullOrEmpty(this.CurrentApp.AppConfig.OverviewMapConfigFile)) { if (InitMapExtent != null) { myMap.Extent = InitMapExtent; } else if (FullMapExtent != null) { myMap.Extent = FullMapExtent; } // Initial set does not fire ExtentChange event double ratioScaleResolution = GeometryTool.RatioScaleResolution(myMap.Extent.GetCenter().Y, this.MapSRWKID, this.MapUnits); MapScale = ratioScaleResolution * myMap.Resolution; } }
private void MyMap_ExtentChanged(object sender, ExtentEventArgs e) { this.CurrentApp.SetWindowStatus(string.Format("Map Extent: [{0:f}, {1:f}] - [{2:f}, {3:f}]", e.NewExtent.XMin, e.NewExtent.YMin, e.NewExtent.XMax, e.NewExtent.YMax)); double ratioScaleResolution = GeometryTool.RatioScaleResolution(e.NewExtent.GetCenter().Y, this.MapSRWKID, this.MapUnits); this.MapScale = ratioScaleResolution * myMap.Resolution; }