cloudflight
2024-11-25 2aa98318a41ddfb42d723810ff6dfb7bc3f9b79e
WinFrmUI/Yw.WinFrmUI.Hydro.Q3d.Core/Map/Drawer.Model.cs
@@ -1,8 +1,5 @@
//using CloudWaterNetwork.Magnifier;
//using dict_py_Inner;
using Yw.WinFrmUI.Q3d;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -20,13 +17,14 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//using System.Windows.Forms.DataVisualization.Charting;
using static Yw.WinFrmUI.Q3d.MapViewEnum;
using Yw.WinFrmUI.Q3d;
using static System.Net.Mime.MediaTypeNames;
using static System.Windows.Forms.AxHost;
using static System.Windows.Forms.LinkLabel;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
//using System.Windows.Forms.DataVisualization.Charting;
using static Yw.WinFrmUI.Q3d.MapViewEnum;
using Cursor = System.Windows.Forms.Cursor;
namespace Yw.WinFrmUI.Q3d
@@ -40,7 +38,7 @@
        public MapDimensions mapOption = new MapDimensions();
        public Settings newTemplate  = null;
        public Settings newTemplate = null;
        public Settings settings = null;
@@ -55,7 +53,7 @@
        /// <summary>
        /// 地图选项
        /// </summary>
        public MapDimensions mapOption
        public MapDimensions mapOption
        {
            get { return TC.mapOption; }
            set { TC.mapOption = value; }
@@ -78,7 +76,7 @@
        [Browsable(false)]
        private Settings _Template
        {
            get {return TC.settings; }
            get { return TC.settings; }
            set
            {
                TC.settings = value;
@@ -116,7 +114,7 @@
        bool _isDragging;
        bool _isRotating;
        bool _isPainting;
        PointF mousePosition;
        // control+鼠标中间按下缩放
@@ -152,14 +150,14 @@
        [Browsable(false)]
        public bool IsEditMode
        {
            get { return this.mapOption?.isEditMode??true; }
            get { return this.mapOption?.isEditMode ?? true; }
            set
            {
                if (this.mapOption!=null) this.mapOption.isEditMode = value;
                if (this.mapOption != null) this.mapOption.isEditMode = value;
            }
        }
        [Browsable(false)]
        private float Link_multiply
        {
@@ -170,7 +168,7 @@
            }
            set
            {
                if (_Template == null || _Template.mapOption == null) return;_Template.mapOption.Link_multiply = value;
                if (_Template == null || _Template.mapOption == null) return; _Template.mapOption.Link_multiply = value;
            }
        }
        [Browsable(false)]
@@ -183,7 +181,7 @@
            }
            set
            {
                if (_Template == null || _Template.mapOption == null) return;_Template.mapOption.junction_multiply = value;
                if (_Template == null || _Template.mapOption == null) return; _Template.mapOption.junction_multiply = value;
            }
        }
        [DisplayName("显示阀门")]
@@ -197,7 +195,7 @@
            }
            set
            {
                if (_Template == null || _Template.mapOption == null) return;_Template.mapOption._ShowValve = value;
                if (_Template == null || _Template.mapOption == null) return; _Template.mapOption._ShowValve = value;
            }
        }
        [DisplayName("显示节点")]
@@ -210,8 +208,8 @@
            }
            set
            {
                if (_Template == null || _Template.mapOption == null) return;_Template.mapOption._ShowJunction = value;
                if (_Template == null || _Template.mapOption == null) return; _Template.mapOption._ShowJunction = value;
            }
        }
        string _filePath
@@ -220,7 +218,7 @@
            {
                if (string.IsNullOrEmpty(_Template?.filePath))
                    return null;
            string path=_Template.filePath.TrimStart('\\');
                string path = _Template.filePath.TrimStart('\\');
                return
                    Path.Combine(Directory.GetCurrentDirectory(), path);
            }
@@ -243,15 +241,15 @@
        #endregion
        #region 管网属性(辅助)
        [Browsable(false)]
        public List<Q3DNodeCalcModel> _Nodes
        public NodeViewModelList _Nodes
        {
            get { return Network?.Nodes??new List<Q3DNodeCalcModel>(); }
            get { return Network?.Nodes ?? new NodeViewModelList(); }
        }
        [Browsable(false)]
        public List<Q3DLinkCalcModel> _Links
        public LinkViewModelList _Links
        {
            get { return Network?.Links??new List<Q3DLinkCalcModel>(); }
            get { return Network?.Links ?? new LinkViewModelList(); }
        }
@@ -265,34 +263,34 @@
        #endregion
        #region 视角设置(辅助)
        private const float MinZoom = 0.1f;
        private const float MaxZoom = 1000.0f;
        [DisplayName("缩放系数")]
        public float zoom
        {
        public float zoom
        {
            get
            {
            {
                return mapOption.zoom;
            }
            set
            {
                ZoomChanged?.Invoke(this, zoom.ToString("0.000"));
                mapOption.zoom = value;
            }
                mapOption.zoom = value;
            }
        }
        [DisplayName("旋转角度")]
        private double Rotation
        private double Rotation
        {
            get
            {
                return mapOption.rotation;
            }
            set
                return mapOption.rotation;
            }
            set
            {
                //将旋转角度转换为-180~180
@@ -300,26 +298,26 @@
                if (value > 180)
                    value -= 360;
                else if (value < -180)
                    value += 360;
                mapOption.rotation = value;
            }
                    value += 360;
                mapOption.rotation = value;
            }
        }
        private double Rotation0 = 0;
        [Browsable(false)]
        public PointF3D MapCenter
        {
            get
        public PointF3D MapCenter
        {
            get
            {
                if (mapOption?.Center == null) return new PointF3D(0, 0, 0);
                return mapOption.Center;
            }
            set
            }
            set
            {
                //将$"{MapCenter.X.ToString("0.00")},{MapCenter.Y.ToString("0.00")}"通过CenterChanged传出
                CenterChanged?.Invoke(this, $"{MapCenter.X.ToString("0.00")},{MapCenter.Y.ToString("0.00")}");
                mapOption.Center = value;
            }
            }
        }
        private PointF3D MapCenter0;
        private bool is3Dview = false;
@@ -344,16 +342,16 @@
        /// 俯视线与底面的夹角,投影用sin
        /// </summary>
        [DisplayName("俯视角度")]
        private double RotationF
        {
            get
        private double RotationF
        {
            get
            {
                return mapOption.rotationF;
            }
            set
            {
                return mapOption.rotationF;
            }
            set
            {
                mapOption.rotationF = value;
            }
            }
        }
        [Browsable(false)]
        private double 俯视弧度
@@ -410,7 +408,7 @@
                return _Template?.Colours?.FirstOrDefault(cl => cl.isChoosed && cl.Type == mapOption.ColourLink);
            }
        }
        //private bool __isOrtho = true;
        #endregion