private void btnCreatPrj_Click(object sender, EventArgs e) { PrjCoordinateDefine prjCoordinateDefine = new PrjCoordinateDefine(_spatialReference, enumControlType.Creat); prjCoordinateDefine.Text = "新建投影坐标系"; TryApplyPrj(prjCoordinateDefine); if (prjCoordinateDefine.DialogResult == System.Windows.Forms.DialogResult.OK) { NeedSaveToFile(); } }
private void TryApplyPrj(PrjCoordinateDefine prjCoordinateDefine) { prjCoordinateDefine.ShowDialog(); if (prjCoordinateDefine.DialogResult == System.Windows.Forms.DialogResult.OK) { if (prjCoordinateDefine.SpatialReference != null) { _spatialReference = prjCoordinateDefine.SpatialReference; txtSpatialRefInfo.Text = _spatialReference.ToString(); } } }
private void btnModify_Click(object sender, EventArgs e) { if (_spatialReference == null) { return; } _preSpatialReference = _spatialReference; if (_spatialReference.ProjectionCoordSystem == null) { GeoCoordinateDefine geoCoordinateDefine = new GeoCoordinateDefine(_spatialReference, enumControlType.Modify); geoCoordinateDefine.Text = "地理坐标系属性"; TryApplyGeo(geoCoordinateDefine); if (geoCoordinateDefine.DialogResult == System.Windows.Forms.DialogResult.OK) { //IsSame()函数中没有对名字进行比较 if (!_spatialReference.IsSame(_preSpatialReference) || (_spatialReference.GeographicsCoordSystem.Name != _preSpatialReference.GeographicsCoordSystem.Name)) { NeedSaveToFile(); } } } else { PrjCoordinateDefine prjCoordinateDefine = new PrjCoordinateDefine(_spatialReference, enumControlType.Modify); prjCoordinateDefine.Text = "投影坐标系属性"; TryApplyPrj(prjCoordinateDefine); if (prjCoordinateDefine.DialogResult == System.Windows.Forms.DialogResult.OK) { if (!_spatialReference.IsSame(_preSpatialReference) || (_spatialReference.GeographicsCoordSystem.Name != _preSpatialReference.GeographicsCoordSystem.Name) || (_spatialReference.Name != _preSpatialReference.Name)) { NeedSaveToFile(); } } } }