duheng
2025-03-28 9be9ba4e159969fb5e32648c2c34e912ccc3ae6d
WinFrmUI/PBS.WinFrmUI.Hydro/99-map-view/MapViewer.cs
@@ -310,9 +310,7 @@
            _needPaintAll = true;
            PMin_Show = ScreenToMap(new PointF(0, this.map.Height));
            PMax_Show = ScreenToMap(new PointF(this.map.Width, 0));
            _timerDraw = true;
            _timerDraw = true;
        }
        public void SetStartEndPoint(String node1, string node2)
@@ -1435,7 +1433,7 @@
            }
            //else
            /*判断是否触碰到对象*/
            if (_mouseHoverCheckFlag)
            {
@@ -1471,6 +1469,7 @@
            _lastMouseX = e.X;
            _lastMouseY = e.Y;
        }
        void CubeViewMouseUp(MouseEventArgs e)
        {
            //BookMark    :鼠标抬起事件
@@ -2176,7 +2175,6 @@
        #region 右键菜单
        private void 转换ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var nodes = selectedNodes;
@@ -2283,55 +2281,19 @@
        #region 编辑模式/浏览模式切换工具
        private void toolStripComboBox_expandRepeater_ButtonClick(object sender, EventArgs e)
        {
            _IsEditMode = !_IsEditMode;
            //toolStripComboBox_浏览模式.Text = isEditMode ? "编辑模式" : "浏览模式";
            //LoadData(true);
        }
        private void 浏览模式ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var obj = sender as ToolStripItem;
            _IsEditMode = obj.Text == "编辑模式";
            //toolStripComboBox_浏览模式.Text = isEditMode ? "编辑模式" : "浏览模式";
            //LoadData(true);
        }
        #endregion
        /// <summary>
        /// 工具栏可用
        /// </summary>
        public void EnableToolBar()
        {
            this.toolStrip1.Enabled = true;
        }
        /// <summary>
        /// 工具栏不可用
        /// </summary>
        public void DisEnableToolBar()
        {
            this.toolStrip1.Enabled = false;
        }
        /// <summary>
        /// 隐藏工具栏
        /// </summary>
        public void HideToolBar()
        {
            this.toolStrip1.Visible = false;
        }
        /// <summary>
        /// 显示工具栏
        /// </summary>
        public void ShowToolBar()
        {
            this.toolStrip1.Visible = true;
        }
         
        #region 分析工具
        private void 水平旋转ToolStripMenuItem_Click(object sender, EventArgs e)
@@ -2408,9 +2370,9 @@
            float z = line.Z;
            float[,] rotationMatrix = new float[,]
            {
        {cos + x * x * (1 - cos), x * y * (1 - cos) - z * sin, x * z * (1 - cos) + y * sin},
        {y * x * (1 - cos) + z * sin, cos + y * y * (1 - cos), y * z * (1 - cos) - x * sin},
        {z * x * (1 - cos) - y * sin, z * y * (1 - cos) + x * sin, cos + z * z * (1 - cos)}
            {cos + x * x * (1 - cos), x * y * (1 - cos) - z * sin, x * z * (1 - cos) + y * sin},
            {y * x * (1 - cos) + z * sin, cos + y * y * (1 - cos), y * z * (1 - cos) - x * sin},
            {z * x * (1 - cos) - y * sin, z * y * (1 - cos) + x * sin, cos + z * z * (1 - cos)}
            };
            // 定义结果集合,并遍历输入点集合进行旋转处理
@@ -2564,13 +2526,7 @@
            {
                MessageBox.Show("拓扑检查通过");
            }
            //if (!string.IsNullOrEmpty(result))
            //{
            //    MessageBox.Show(result);
            //    return;
            //}
              
        }
    
@@ -4280,11 +4236,7 @@
            //背景图绘制
            if (this.mapOption.isShowPic && template != null && File.Exists(template.BackGroundImg_FullPath))
            {
                //var gs = bufferG.Save();
                // 应用矩阵变换以抵消之前的翻转效果
                //bufferG.ScaleTransform(1 / Zoom.X, 1 / Zoom.Y);
            { 
                List<PointF> p = new List<PointF>();
                if (!this.mapOption.isAutoBackgroundImage)
@@ -5121,8 +5073,7 @@
        {
            var pointT = Get俯视角还原Point(point, z, MapCenter);
            pointT = Get平面还原Point(pointT, MapCenter);
            //var n=new PointF((float)pointR.X - Z(z).X, (float)(pointR.Y - Z(z).Y));
             
            return pointT;
        }
   
@@ -5185,14 +5136,14 @@
                    break;
            }
            return flag;
             
        }
        #endregion
        #region 判断可见性
        private float Get_dist(PointF A, PointF B)
        {
            float dx = A.X - B.X;
@@ -5200,6 +5151,7 @@
            float dist = (float)Math.Sqrt(dx * dx + dy * dy);
            return dist;
        }
        //判断A距离线段B和C的距离,如果超出了线段的范围,则返回到最近的端点的距离;距离线段中心点越远,返回的距离越大;
        private float Get_dist(PointF A, PointF B, PointF C, float MaxOff)
        {
@@ -5250,31 +5202,7 @@
            else
                return true;
        }
        /// <summary>
        /// 判断是否在屏幕坐标内
        /// </summary>
        /// <param name="screenPos"></param>
        /// <returns></returns>
        public bool isVisible(List<PointF> list_MapPos)
        {
            bool visible = false;
            foreach (var MapPos in list_MapPos)
            {
                if (MapPos.X < PMin_Show.X || MapPos.X > PMax_Show.X || MapPos.Y < PMin_Show.Y || MapPos.Y > PMax_Show.Y)
                {
                }
                else
                {
                    visible = true;
                    return true;
                }
            }
            return visible;
        }
 
        #endregion 
        #endregion
    }