/// <summary> /// Init default map project /// </summary> public void InitMap() { MapSpatRef = CoordinateSystems.SphericalMercatorCS; var defPath = string.IsNullOrEmpty(BaseSettings.DefaultMapProject) ? MapProjectsStorage.DefaultMapPath : BaseSettings.DefaultMapProject; LoadMap(defPath); MapSelector.UpdateValue(GisInterface.GetMapName(defPath)); }
protected override void OnShown(EventArgs e) { base.OnShown(e); using (new TemporaryWaitCursor()) { //create ok/cancel buttons var okButton = new BarButtonItem(mapControl.barManager, Resources.gis_SetCaseMapForm_Ok);// "OK"); okButton.ItemClick += okButton_Click; okButton.Border = BorderStyles.Default; okButton.Appearance.Font = new Font(okButton.Appearance.Font, FontStyle.Bold); var cancelButton = new BarButtonItem(mapControl.barManager, Resources.gis_SetCaseMapForm_Cancel); cancelButton.ItemClick += cancelButton_Click; cancelButton.Border = BorderStyles.Default; cancelButton.Appearance.Font = new Font(cancelButton.Appearance.Font, FontStyle.Bold); mapControl.barManager.Bars["StatusBar"].AddItem(okButton).BeginGroup = true; mapControl.barManager.Bars["StatusBar"].AddItem(cancelButton); //IT IS UGLY HACK! mapControl.RemoveUglyButton(); //set default tool mapControl.InputTool.IsActive = true; //init map mapControl.MapSpatRef = CoordinateSystems.SphericalMercatorCS; DateTime start = DateTime.Now; //mapControl.LoadMap(MapProjectsStorage.DefaultMapPath); //var defPath = BaseSettings.DefaultMapProject ?? MapProjectsStorage.DefaultMapPath; var defPath = string.IsNullOrEmpty(BaseSettings.DefaultMapProject) ? MapProjectsStorage.DefaultMapPath : BaseSettings.DefaultMapProject; mapControl.LoadMap(defPath); mapControl.MapSelector.UpdateValue(GisInterface.GetMapName(defPath)); Debug.WriteLine("Loaded:" + (DateTime.Now - start).TotalMilliseconds); Debug.WriteLine("Loaded:" + DateTime.Now); //set case point, if exists if (InitWgsPoint != null) { var point = InitWgsPoint.Clone(); if (mapControl.MapSpatRef != CoordinateSystems.WGS84) { point = GeometryTransform.TransformPoint(point, CoordinateSystems.WGS84, mapControl.MapSpatRef); } mapControl.InputTool.Point = point; } //zoom to box if (InitAdminBBox != null) { var adminBox = InitAdminBBox.Clone(); //reproject if need. NotNeed!!!! if (mapControl.MapSpatRef != CoordinateSystems.WGS84) { adminBox = GeometryTransform.TransformBox(adminBox, CoordinateSystems.WGS84, mapControl.MapSpatRef); } mapControl.Map.ZoomToBox(adminBox); } } }