duheng
2025-03-21 c0be7c001375f73e2c3b49a1b1d447b6fc297bdd
WinFrmUI/PBS.WinFrmUI.Hydro/01-model-template/00-core/ModelTemplatePage.cs
@@ -1,4 +1,6 @@
using Hydro;
using DevExpress.Drawing.Internal.Fonts.Interop;
using DevExpress.XtraPrinting.Native;
using Hydro;
namespace PBS.WinFrmUI.Hydro
{
@@ -309,19 +311,7 @@
            this.modelTemplateTreeListCtrl1.SaveModelTemplate(_modelTemplate);
        }
        private void SetZoom()
        {
            if (_template != null)
            {
                if (_template.view == null) _template.view = new MapDimensions();
                _template.view.Center = _mapView.MapCenter;
                _template.view.zoom = _mapView.zoom;
                _template.view.rotation = _mapView.Rotation;
                _template.view.rotationF = _mapView.RotationF;
            }
        }
        private void barBtnSaveModelTemplate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
@@ -488,17 +478,21 @@
            _mapView.重置视角ToolStripMenuItem_Click(1, new EventArgs());
        }
        private void SetZoom()
        {
            if (_template == null) return;
            _template.view ??= new MapDimensions();
            _template.view.Center = _mapView.MapCenter;
            _template.view.zoom = _mapView.zoom;
            _template.view.rotation = _mapView.Rotation;
            _template.view.rotationF = _mapView.RotationF;
        }
        private void SaveView()
        {
            //if (_mapDimensions == null)
            //    _mapDimensions = new MapDimensions();
            //_mapDimensions.Center = map.MapCenter;
            //_mapDimensions.zoom = map.zoom;
            //_mapDimensions.rotation = map.Rotation;
            //_mapDimensions.rotationF = map.RotationF;
            if (_template == null) return;
            if (_template.view == null) _template.view = new MapDimensions();
            _template.view ??= new MapDimensions();
            _template.view.Center = _mapView.MapCenter;
            _template.view.zoom = _mapView.zoom;
            _template.view.rotation = _mapView.Rotation;