qin
2024-05-24 ba1e9fbc5c16652b7c1309fdbe1bb2818f2b9a4a
优化加载背景逻辑
已修改2个文件
72 ■■■■■ 文件已修改
Hydraulic/Hydro.MapUI/Map/MapViewer.Draw.cs 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Hydraulic/Hydro.MapView/Common/MapDimensions.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Hydraulic/Hydro.MapUI/Map/MapViewer.Draw.cs
@@ -64,33 +64,50 @@
                //var gs = bufferG.Save();
                // 应用矩阵变换以抵消之前的翻转效果
                //bufferG.ScaleTransform(1 / Zoom.X, 1 / Zoom.Y);
                List<PointF> p = new List<PointF>();
                if (!this.mapOption.isAutoBackgroundImage)
                {
                    var Cps = new List<PointF>
                    {
                        template.BackGroundPoint1,
                        new PointF(template.BackGroundPoint2.X,template.BackGroundPoint1.Y),
                        new PointF(template.BackGroundPoint1.X,template.BackGroundPoint2.Y),
                        //template.BackGroundPoint2,
                    };
                    Cps.ForEach(cp => p.Add(WorldPointToMapPoint(cp, template.BackGroundElev, template.OffSet)));
                }
                else
                {
                // 恢复之前保存的绘图状态
                    // 恢复之前保存的绘图状态
                //var Cps = new List<PointF>
                //{
                //    template.BackGroundPoint1,
                //    new PointF(template.BackGroundPoint2.X,template.BackGroundPoint1.Y),
                //    new PointF(template.BackGroundPoint1.X,template.BackGroundPoint2.Y),
                //    //template.BackGroundPoint2,
                    //var Cps = new List<PointF>
                    //{
                    //    template.BackGroundPoint1,
                    //    new PointF(template.BackGroundPoint2.X,template.BackGroundPoint1.Y),
                    //    new PointF(template.BackGroundPoint1.X,template.BackGroundPoint2.Y),
                    //    //template.BackGroundPoint2,
                //};
                var p1 = new PointF(template.BackGroundImgX, template.BackGroundImgY);
                var p2 = new PointF(template.BackGroundImgX + template.BackGroundImgWidth, template.BackGroundImgY + template.BackGroundImgHeight);
                    //};
                    var p1 = new PointF(template.BackGroundImgX, template.BackGroundImgY);
                    var p2 = new PointF(template.BackGroundImgX + template.BackGroundImgWidth, template.BackGroundImgY + template.BackGroundImgHeight);
                var f = template.BackGroundImgRotaAngle / 180 * Math.PI;
                var djx = Math.Sqrt((Math.Pow(template.BackGroundImgWidth, 2) + Math.Pow(template.BackGroundImgHeight, 2)));
                var p3 = new PointF(p1.X + (float)(Math.Cos(f) * template.BackGroundImgWidth), p1.Y + (float)(Math.Sin(f) * template.BackGroundImgWidth));
                var p4 = new PointF(p1.X - (float)(Math.Sin(f) * template.BackGroundImgHeight), p1.Y + (float)(Math.Cos(f) * template.BackGroundImgHeight));
                var Cps = new List<PointF>
                    var f = template.BackGroundImgRotaAngle / 180 * Math.PI;
                    var djx = Math.Sqrt((Math.Pow(template.BackGroundImgWidth, 2) + Math.Pow(template.BackGroundImgHeight, 2)));
                    var p3 = new PointF(p1.X + (float)(Math.Cos(f) * template.BackGroundImgWidth), p1.Y + (float)(Math.Sin(f) * template.BackGroundImgWidth));
                    var p4 = new PointF(p1.X - (float)(Math.Sin(f) * template.BackGroundImgHeight), p1.Y + (float)(Math.Cos(f) * template.BackGroundImgHeight));
                    p3.Y = p4.Y;
                    //p4.Y = -p4.Y;
                    var Cps = new List<PointF>
                {
                    //template.BackGroundPoint1,
                    //new PointF(template.BackGroundImgX,template.BackGroundImgY),
                    p1,
                    p3,p4
                    p4,
                    p3,p1
                    //template.BackGroundPoint2,
                    
                 
@@ -98,8 +115,9 @@
                List<PointF> p = new List<PointF>();
                Cps.ForEach(cp => p.Add(WorldPointToMapPoint(cp, template.BackGroundElev, template.OffSet)));
                    //List<PointF> p = new List<PointF>();
                    Cps.ForEach(cp => p.Add(WorldPointToMapPoint(cp, template.BackGroundElev, template.OffSet)));
                }
                //bufferG.DrawImage(System.Drawing.Image.FromFile(@"C:\Users\cloud\Pictures\GenshinImpactCloudGame\QQ截图20230919105637.png"), p[0]);
                try
Hydraulic/Hydro.MapView/Common/MapDimensions.cs
@@ -11,7 +11,7 @@
    [Serializable]
    public class MapDimensions
    {
        [Category("视角")]
        [DisplayName("中心")]
@@ -33,18 +33,18 @@
        [Category("视角")]
        [DisplayName("俯视角度")]
        [Browsable(true)]
        public double rotationF
        public double rotationF
        {
            get
            get
            {
                if (Lock2DView) _rotationF = 90;
                return _rotationF;
            }
            set
            {
            set
            {
                _rotationF = value;
                if (Lock2DView) _rotationF = 90;
            }
            }
        }
        [Category("视角")]
@@ -56,6 +56,8 @@
        [DisplayName("显示背景")]
        [Browsable(true)]
        public bool isShowPic { get; set; } = true;
        public bool isAutoBackgroundImage = false;
        [Category("视角")]
        [DisplayName("显示最不利点")]
@@ -71,7 +73,7 @@
        [Category("视角")]
        [DisplayName("锁定平面视角")]
        [Browsable(true)]
        public bool Lock2DView { get; set; }=false;
        public bool Lock2DView { get; set; } = false;
        /// <summary>
        /// 编辑模式true,浏览模式false;默认值:true;浏览模式下,不能编辑模型