From ccc0d2319b71cc41f4d9d2f86dff28da918987da Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期四, 06 六月 2024 13:51:37 +0800
Subject: [PATCH] 主页菜单功能替换

---
 WinfrmUI/Hydro.WinfrmUI.Browser/Viewer.cs | 1010 ++++++++++++++++++++++-------------------------------------
 1 files changed, 377 insertions(+), 633 deletions(-)

diff --git a/WinfrmUI/Hydro.WinfrmUI.Browser/Viewer.cs b/WinfrmUI/Hydro.WinfrmUI.Browser/Viewer.cs
index 88e8cb3..feda5c1 100644
--- a/WinfrmUI/Hydro.WinfrmUI.Browser/Viewer.cs
+++ b/WinfrmUI/Hydro.WinfrmUI.Browser/Viewer.cs
@@ -1,9 +1,4 @@
-锘� 
-using Hydro.CommonBase; 
-using Hydro.MapView;
-using Hydro.MapView.Common;
-using Newtonsoft.Json; 
-using System;
+锘縰sing System;
 using System.Collections;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -13,11 +8,15 @@
 using System.Drawing;
 using System.IO;
 using System.Linq;
-using System.Numerics; 
-using System.Text; 
-using System.Windows.Forms; 
-using static Hydro.MapView.MapViewEnum; 
-using Cursor = System.Windows.Forms.Cursor;
+using System.Numerics;
+using System.Text;
+using System.Windows.Forms;
+using static Hydro.MapView.MapViewEnum;
+using Hydro.CommonBase;
+using Hydro.MapView;
+using Hydro.MapView.Common;
+using Newtonsoft.Json;
+using DevExpress.Utils;
 
 namespace Hydro.WinfrmUI
 {
@@ -25,19 +24,19 @@
     {
         public static bool LockSelect = false;
         public static bool ApplyFilter = false;
+
         #region 涓�銆佸叏灞�
 
-
         #region 鍒濆鍖�
- 
-        private bool _showToolBar = true;
-        [DisplayName("鏄剧ず宸ュ叿鏍�")]
 
+        private bool _showToolBar = true;
+
+        [DisplayName("鏄剧ず宸ュ叿鏍�")]
         public bool showToolBar
         {
             get
             {
-                return _showToolBar;// this.panel1==null?true:Visible; 
+                return _showToolBar;// this.panel1==null?true:Visible;
             }
             set
             {
@@ -46,26 +45,21 @@
             }
         }
 
-
- 
- 
-        public ViewBrowser() 
+        public ViewBrowser()
         {
-
             this.showToolBar = false;
             InitializeComponent();
 
             MapCenter = PointF.Empty;
             zoom = 1.0f;
-            
+
             SetStyle(ControlStyles.SupportsTransparentBackColor, true);
             BackColor = Color.Transparent;
-
         }
+
         private void MapViewer_Load(object sender, EventArgs e)
         {
             this.panel1.Visible = _showToolBar;
- 
 
             cb_Node_Colour.Items.Clear();
             cb_Link_Colour.Items.Clear();
@@ -85,26 +79,19 @@
                 i++;
             }
 
-
             cb_Node_Colour.SelectedIndex = 0;
 
             cb_Link_Colour.SelectedIndex = 0;
 
-            map.Init(TC,new DrawDelegate[] { Draw, Draw, DrawH },new MouseDelegate[] { mapMouseDown, mapMouseMove, mapMouseUp, mapMouseWheel });
-
-            
-
-
+            map.Init(TC, new DrawDelegate[] { Draw, Draw, DrawH }, new MouseDelegate[] { mapMouseDown, mapMouseMove, mapMouseUp, mapMouseWheel });
         }
 
-        #endregion
-
+        #endregion 鍒濆鍖�
 
         #region 瀵瑰寮�鏀撅紝鍏ㄥ眬鎺у埗鏂规硶
 
         public bool LoadData(bool isDelCache = false)
         {
-            
             if (_Template == null) return false;
             if (isDelCache || _Template.network == null)
             {
@@ -124,7 +111,6 @@
                     if (param == null)
                         param = new dict<string, dynamic>();
                     _Template.network.LoadRepeaters(_Template.MaxLevel, param, _ViewModel, !_IsEditMode);
-
                 }
                 else
                 {
@@ -140,7 +126,6 @@
                     if (param == null)
                         param = new dict<string, dynamic>();
                     _Template.network.LoadRepeaters(_Template.MaxLevel, param, _ViewModel, !_IsEditMode);
-
                 }
                 else
                 {
@@ -148,7 +133,6 @@
                         param = new dict<string, dynamic>();
                     _Template.network.LoadRepeaters(_Template.MaxLevel, param, null, !_IsEditMode);
                 }
-
             }
             //if (GlobalObject.PropertyForm != null)
             //{
@@ -157,15 +141,14 @@
             //    //_Template.network.MapObjects.AddUndoRedoSupport(GlobalObject.PropertyForm.propertyGrid);
             //}
 
-
             SetStartEndPoint(_Template.Node1, _Template.Node2);
 
             ResumeLayout(false);
             return true;
         }
 
+        private Dictionary<TemplateType, bool> _ViewModel = null;
 
-        Dictionary<TemplateType, bool> _ViewModel = null;
         public void Clear()
         {
             _Template = null;
@@ -175,15 +158,15 @@
             RotationF = 90;
             SetMapInvalidate();
         }
+
         public void SetData(Template template, dict<string, dynamic> param = null, Dictionary<TemplateType, bool> viewMode = null)
         {
             this.param = param;
             bool reLoad = _Template == template;
             this._Template = template;
             this._ViewModel = viewMode;
- 
+
             if (!LoadData()) return;
- 
 
             if (!reLoad)
             {
@@ -199,8 +182,6 @@
                     SetMapInvalidate();
                 }
             }
-           
-            鍒锋柊妤煎眰ToolStripMenuItem_Click(1, new EventArgs());
 
             if (OnChangeViewCenter != null)
             {
@@ -210,15 +191,15 @@
             {
                 OnChangeViewZoom.Invoke(zoom);
             }
-            if(OnChangeViewRotation != null)
+            if (OnChangeViewRotation != null)
             {
                 OnChangeViewRotation.Invoke(Rotation, RotationF);
             }
- 
         }
-        public Action<PointF> OnChangeViewCenter = null;// 
+
+        public Action<PointF> OnChangeViewCenter = null;//鏀瑰彉瑙嗗浘涓績鐨勫鎵�
         public Action<double> OnChangeViewZoom = null;//
-        public Action<double,double> OnChangeViewRotation = null;//
+        public Action<double, double> OnChangeViewRotation = null;//
 
         private void InitCenter()
         {
@@ -245,7 +226,6 @@
             Rotation = 0;
             RotationF = 90;
 
-
             if (_Nodes.Count > 0)
             {
                 p.X /= _Nodes.Count;
@@ -256,13 +236,10 @@
 
         public void SetMapInvalidate()
         {
-
             _needPaintAll = true;
             PMin_Show = ScreenToMap(new PointF(0, this.map.Height));
             PMax_Show = ScreenToMap(new PointF(this.map.Width, 0));
             _timerDraw = true;
-
-
         }
 
         public void SetStartEndPoint(String node1, string node2)
@@ -271,6 +248,7 @@
             _EndPoint = node2;
             SetMapInvalidate();
         }
+
         public void Set3DView(bool is3Dview, double 淇瑙掑害)
 
         {
@@ -279,23 +257,18 @@
             SetMapInvalidate();
         }
 
-
-
         public void SetRotation(double d)
         {
             this.Rotation = d;
             SetMapInvalidate();
         }
 
-        #endregion
-
-
-
+        #endregion 瀵瑰寮�鏀撅紝鍏ㄥ眬鎺у埗鏂规硶
 
         #region 閲嶇粯鍑芥暟
 
-        bool _needPaintAll 
-        { 
+        private bool _needPaintAll
+        {
             get
             {
                 return __needpaintall;
@@ -305,6 +278,7 @@
                 __needpaintall = value;
             }
         }
+
         //protected override void OnPaint(PaintEventArgs e)
         //{
         //    base.OnPaint(e);
@@ -320,10 +294,7 @@
         //    int heightOfBar = showToolBar ? 24 : 0;
         //    if (!showToolBar) heightOfBar = 0;
 
-
-
         //    if (e.ClipRectangle != new Rectangle(this.Left, heightOfBar, this.map.Width, this.map.Height - heightOfBar - statusStrip1.Height)) return;
-
 
         //    _needPaintAll = false;
         //    if (buffer == null || buffer.Width != Width || buffer.Height != Height)
@@ -355,14 +326,12 @@
         //        //BookMark    锛氱粯鍒跺湴鍥句簨浠�
         //        Draw(bufferG, _Template);
 
-
-
         //        if (_newTemplate?.network != null) Draw(bufferG, _newTemplate);
 
         //        var r = 2f / zoom;
         //        if (_isDragging && DragStartPos!=new PointF(0,0) && mousePosition!=new PointF(0,0))
         //        {
-        //            label_center.Text = $"S:{DragStartPos.X}:{DragStartPos.Y} E:{mousePosition.X}:{mousePosition.Y}"; 
+        //            label_center.Text = $"S:{DragStartPos.X}:{DragStartPos.Y} E:{mousePosition.X}:{mousePosition.Y}";
         //            var _lastMousePosition = DragStartPos;
         //            // 缁樺埗鐭╁舰
         //            var start = new PointF((float)Math.Min(mousePosition.X, _lastMousePosition.X), (float)Math.Min(mousePosition.Y, _lastMousePosition.Y));
@@ -408,7 +377,6 @@
         //        }
         //        if (_isSettingBackGroundPictur)
         //        {
-                   
         //            var _lastMousePosition = DragStartPos;
         //            // 缁樺埗鐭╁舰
         //            var start = new PointF((float)Math.Min(mousePosition.X, _lastMousePosition.X), (float)Math.Min(mousePosition.Y, _lastMousePosition.Y));
@@ -441,7 +409,7 @@
 
         //}
 
-        PointF[] getCurclePoints(int num)
+        private PointF[] getCurclePoints(int num)
         {
             PointF[] points = new PointF[num + 1];
             float angle = 0;
@@ -456,11 +424,6 @@
             return points;
         }
 
-        
-           
-
-       
-        
         private void timer_draw_Tick(object sender, EventArgs e)
         {
             _mouseHoverCheckFlag = true;
@@ -475,38 +438,32 @@
 
             // 褰撴帶浠跺昂瀵告敼鍙樻椂锛岃Е鍙戦噸缁�
             this.SetMapInvalidate();
-
         }
 
-        #endregion
-
+        #endregion 閲嶇粯鍑芥暟
 
         #region 榧犳爣浜嬩欢
-        
-        void mapMouseDown(MouseEventArgs e)
+
+        private void mapMouseDown(MouseEventArgs e)
         {
             base.OnMouseDown(e);
 
             _ClickStartPos = new PointF(e.X, e.Y);
-            DragStartPos= ScreenToMap(new PointF(e.X, e.Y));
+            DragStartPos = ScreenToMap(new PointF(e.X, e.Y));
             mousePosition = _MousePosition = ScreenToMap(new PointF(e.X, e.Y));
             if (e.Button == MouseButtons.Left && _isInsertingObject)
             {
-
             }
             else
             if (e.Button == MouseButtons.Middle || e.Button == MouseButtons.XButton2)
             {
-
                 if (ModifierKeys == Keys.Control || ModifierKeys == Keys.Shift)//鎸変笅妗嗛�夋斁澶�
                 {
                     DragStartPos = ScreenToMap(new PointF(e.X, e.Y));
                     _isDragging = true;
                 }
-
                 else
                 {
-
                     _lastCursor = this.Cursor;
                     this.Cursor = Cursors.SizeAll;
                     MapCenter0 = MapCenter;
@@ -516,8 +473,6 @@
             }
             else if (e.Button == MouseButtons.Left && _mouseState == MouseState.鏃�)
             {
-
-
                 if (ModifierKeys == Keys.Shift)
                 {
                     var point = ScreenToMap(new PointF(e.X, e.Y));
@@ -545,14 +500,10 @@
                     List<NodeViewModel> nodes = selectedNodes;
                     foreach (NodeViewModel node in nodes)
                     {
-
-
                         PointF mapPos = WorldPointToMapPoint(node);
                         PointF currentPoint = MapToScreen(mapPos);
                         if (Get_dist(new PointF(e.X, e.Y), currentPoint) < 15f)
                         {
-
-
                             _NewNet.Nodes.AddRange(selectedNodes);
                             _NewNet.Links.AddRange(selectedLinks);
                             _isMovingObject = true;
@@ -563,15 +514,12 @@
                     }
                 }
 
-
                 if (!_isMovingObject)//鎷栨嫿閫夋嫨
                 {
                     DragStartPos = ScreenToMap(new PointF(e.X, e.Y));
                     _isDragging = true;
                 }
-
             }
-
             else if (e.Button == MouseButtons.Left && _mouseState == MouseState.璁剧疆搴曞浘鑼冨洿)
             {
                 _mouseState = MouseState.鏃�;
@@ -590,8 +538,8 @@
                 mapOption0 = mapOption.Copy();
                 _isRotating = true;
             }
-
         }
+
         private bool IsPointInPolygon(PointF point, List<PointF> polygon)
         {
             int count = polygon.Count;
@@ -622,9 +570,10 @@
             //if (_OperaNode == null) _OperaNode=_NewNet.Nodes[0];
         }
 
-        bool controlDown = false;
-        PointF _MousePosition = new PointF(0, 0);
-        void mapMouseMove(MouseEventArgs e)
+        private bool controlDown = false;
+        private PointF _MousePosition = new PointF(0, 0);
+
+        private void mapMouseMove(MouseEventArgs e)
         {
             //base.OnMouseMove(e);
             bool needInvalidate = false;
@@ -635,36 +584,30 @@
                 var oldP = (PointF3D)_undoOldValue;
                 if (!float.IsInfinity(p.X) && !float.IsInfinity(p.Y)) _newTemplate.OffSet = new PointF3D(p.X - oldP.X, p.Y - oldP.Y, 0); //_OperaNode.Position = p;
 
-               // GlobalObject.PropertyForm.propertyGrid.Refresh();
+                // GlobalObject.PropertyForm.propertyGrid.Refresh();
 
                 needInvalidate = true;
             }
-
-
             else if (_isPainting)
             {
                 needInvalidate = true;
-
-
             }
             else if (_isPanning)
             {
                 var vector = GetRotateVector(new PointF(e.X, e.Y), new PointF(_lastMouseX, _lastMouseY));
                 MapCenter = new PointF(MapCenter.X - vector.X / Zoom.X, MapCenter.Y - vector.Y / Zoom.Y);
 
-
                 if (OnChangeViewCenter != null)
                 {
                     OnChangeViewCenter.Invoke(MapCenter);
                 }
-          
-                needInvalidate = true;
 
+                needInvalidate = true;
             }
             else if (_isDragging || _isDrawingPolygon || _isSettingBackGroundPictur)
             {
                 mousePosition = _MousePosition;
-                // 缁樺埗閫夋嫨妗�                                                                     
+                // 缁樺埗閫夋嫨妗�
                 // Rectangle selectionRect = new Rectangle(
                 //    Math.Min((int)DragStartPos.X, (int)MP.X),
                 //    Math.Min((int)DragStartPos.Y, (int)MP.Y),
@@ -672,7 +615,6 @@
                 //    Math.Abs((int)DragStartPos.Y - (int)MP.Y));
                 //DrawSelectionRect(selectionRect);
                 needInvalidate = true;
-                 
             }
             else if (_isRotating)
             {
@@ -683,7 +625,6 @@
                 if (RotationF > 90) RotationF = 90;
                 if (RotationF < 0) RotationF = 0;
                 needInvalidate = true;
-
             }
             else
 
@@ -695,8 +636,6 @@
 
                 //GlobalObject.PropertyForm.propertyGrid.Refresh();
                 needInvalidate = true;
-
-
             }
             //else
             /*鍒ゆ柇鏄惁瑙︾鍒板璞�*/
@@ -706,7 +645,7 @@
                 // 閬嶅巻鎵�鏈夊璞�,鎵惧嚭鑼冨洿鍐呯殑瀵硅薄
                 PointF clickedPoint = new PointF(e.X, e.Y);  //ScreenToMap(new PointF(e.X, e.Y));
                 var obj = GetObj_by_ScreenPoint(clickedPoint);
-                if (hoveredObjs.Count > 0 && hoveredObjs[0] == obj || hoveredObjs.Count==0 && obj==null)
+                if (hoveredObjs.Count > 0 && hoveredObjs[0] == obj || hoveredObjs.Count == 0 && obj == null)
                 {
                     //needInvalidate = false;
                 }
@@ -715,34 +654,28 @@
                     needInvalidate = true;
                     hoveredObjs.ForEach(o => o.Hovered = false);
                     hoveredObjs.Clear();
-                    if (obj!=null)
+                    if (obj != null)
                     {
                         obj.Hovered = true;
                         hoveredObjs.Add(obj);
                     }
-                    
-                   
                 }
-                
-
             }
-            
-
 
             if (needInvalidate) this.SetMapInvalidate();
-            if(OnChangeMonseClickPostion != null)
+            if (OnChangeMonseClickPostion != null)
             {
                 OnChangeMonseClickPostion(e.X, e.Y, _MousePosition);
             }
             _lastMouseX = e.X;
             _lastMouseY = e.Y;
         }
-        public Action<int,int,PointF> OnChangeMonseClickPostion = null;
 
-        bool RectangContain(RectangleF r, PointF p)
+        public Action<int, int, PointF> OnChangeMonseClickPostion = null;
+
+        private bool RectangContain(RectangleF r, PointF p)
         {
             var x = p.X; var y = p.Y;
-
 
             if (r.X <= x && x < r.X + r.Width && r.Y <= y)
             {
@@ -755,12 +688,14 @@
         /// <summary>
         /// 鐢ㄤ簬缁樺埗绠$嚎
         /// </summary>
-        NodeViewModel _select_junction1 = null;
-        NodeViewModel _select_junction2 = null;
-        DateTime _lastMouseUp = DateTime.Now;
-        int doubleClick_Delay = 500;//姣
-        bool recordView = false;
-        void mapMouseUp(MouseEventArgs e)
+        private NodeViewModel _select_junction1 = null;
+
+        private NodeViewModel _select_junction2 = null;
+        private DateTime _lastMouseUp = DateTime.Now;
+        private int doubleClick_Delay = 500;//姣
+        private bool recordView = false;
+
+        private void mapMouseUp(MouseEventArgs e)
         {
             //BookMark    锛氶紶鏍囨姮璧蜂簨浠�
             base.OnMouseUp(e);
@@ -805,7 +740,6 @@
                 _isDragging = false;
 
                 this.Cursor = _lastCursor;
-
 
                 var _lastMousePosition = DragStartPos;
 
@@ -868,8 +802,6 @@
                 NodeViewModel minNode = null;
                 foreach (NodeViewModel node in nodes)
                 {
-
-
                     PointF mapPos = WorldPointToMapPoint(node);
                     PointF currentPoint = MapToScreen(mapPos);
                     float currentDist = 0;
@@ -884,16 +816,12 @@
 
                 if (ModifierKeys != Keys.Alt && minNode != null)
                 {
-
                     var p1 = (PointF3D)_undoOldValue;
                     var p2 = minNode.Position3D;
                     var dd = _newTemplate.OffSet;
                     dx = p2.X - p1.X;
                     dy = p2.Y - p1.Y;
                     dz = p2.Z - p1.Z;
-
-
-
                 }
                 else
                 {
@@ -909,9 +837,7 @@
                     dx = dd.X; //p2.X - p1.X;
                     dy = dd.Y;// p2.Y - p1.Y;
                     dz = dd.Z;// p2.Z - p1.Z;
-
                 }
-
 
                 net.Nodes.ForEach(n => { ((NodeViewModel)n).Position3D = new PointF3D(n.X + dx, n.Y + dy, n.Elev + dz); });
 
@@ -937,7 +863,7 @@
                 //_OperaNode = null;
                 //_Network.Nodes.AddRange(net.Nodes);
                 //_Network.Links.AddRange(net.Links);
-            
+
                 SetMapInvalidate();
                 return;
             }
@@ -964,7 +890,6 @@
                             n.Selected = true;
                         }
                     });
-
                 }
                 SetMapInvalidate();
                 // 缁撴潫缁樺埗澶氳竟褰�
@@ -977,8 +902,6 @@
                 NodeViewModel minNode = null;
                 foreach (NodeViewModel node in nodes)
                 {
-
-
                     PointF mapPos = WorldPointToMapPoint(node);
                     PointF currentPoint = MapToScreen(mapPos);
                     float currentDist = 0;
@@ -989,7 +912,6 @@
                         break;
                     }
                 }
-
 
                 if (ModifierKeys != Keys.Alt && minNode != null)
                 {
@@ -1056,21 +978,25 @@
                         n = _Network.AddJunction(p, z);
                         MapObjectExtensions.AddCommand(_Network, "Add", null, new List<IBaseViewModel>() { n });
                         break;
+
                     case MouseState.鏂板缓姘磋〃:
                         getPointAndHeight(e, out p, out z);
                         n = _Network.AddMeter(p);
                         MapObjectExtensions.AddCommand(_Network, "Add", null, new List<IBaseViewModel>() { n });
                         break;
+
                     case MouseState.鏂板缓姘村簱:
                         getPointAndHeight(e, out p, out z);
                         n = _Network.AddReservoir(p);
                         MapObjectExtensions.AddCommand(_Network, "Add", null, new List<IBaseViewModel>() { n });
                         break;
+
                     case MouseState.鏂板缓姘存睜:
                         getPointAndHeight(e, out p, out z);
                         n = _Network.AddTank(p);
                         MapObjectExtensions.AddCommand(_Network, "Add", null, new List<IBaseViewModel>() { n });
                         break;
+
                     case MouseState.鏂板绠$嚎:
                     case MouseState.鏂板绔嬬:
                     case MouseState.鏂板缓姘存车:
@@ -1078,7 +1004,7 @@
                     case MouseState.鏂板缓閲嶅鍣�:
                         if (_select_junction1 == null)
                         {
-                            if (_mouseState==MouseState.鏂板绔嬬)
+                            if (_mouseState == MouseState.鏂板绔嬬)
                             {
                                 var m = ScreenToVMap(new PointF(e.X, e.Y));
                                 z = m.Y;
@@ -1090,19 +1016,18 @@
                                 getPointAndHeight(e, out p, out z);
                                 Set_junction1(e);
                             }
-                            
                         }
                         else
                         {
                             if (_mouseState == MouseState.鏂板绔嬬)
                             {
                                 //闇�瑕佹妸榧犳爣浣嶇疆杞崲涓虹珛绠$殑浣嶇疆锛岃幏鍙栭紶鏍囦綅缃殑楂樼▼
-                                
+
                                 var wPos = GetZZWorldPoint(_select_junction1.Position3D, _MousePosition, new Vector3(0, 0, 1));
                                 //var m = ScreenToVMap(new PointF(e.X, e.Y));
                                 //z = m.Y;
                                 p = new PointF(wPos.X, wPos.Y);
-                                var l = AddLink(new PointF( e.X,e.Y), true, p, wPos.Z);
+                                var l = AddLink(new PointF(e.X, e.Y), true, p, wPos.Z);
                                 if (l.Count > 0) MapObjectExtensions.AddCommand(_Network, "Add", null, l);
                             }
                             else
@@ -1110,9 +1035,7 @@
                                 getPointAndHeight(e, _select_junction1, out p, out z);
                                 var l = AddLink(new PointF(e.X, e.Y), isdoubleClick, p, z);
                                 if (l.Count > 0) MapObjectExtensions.AddCommand(_Network, "Add", null, l);
-
                             }
-                            
                         }
                         break;
                 }
@@ -1135,11 +1058,10 @@
                     if (isJunction) _OperaNode = (NodeViewModel)obj;
                     mousePosition = new PointF(0, 0);
                     SetMapInvalidate();
-
                 }
                 else
                 {
-                   // GlobalObject.PropertyForm.SetObjs(new List<IBaseViewModel>() { });
+                    // GlobalObject.PropertyForm.SetObjs(new List<IBaseViewModel>() { });
                     _OperaNode = null;
                     mousePosition = new PointF(0, 0);
                     SetMapInvalidate();
@@ -1160,7 +1082,6 @@
                 var selectedObjs = new List<IBaseViewModel>();
                 for (int i = 0; i < _Nodes.Count; i++)
                 {
-
                     var node = _Nodes[i] as NodeViewModel;
                     if (!node.Visible) continue;
                     PointF p = WorldPointToMapPoint(node);
@@ -1168,7 +1089,6 @@
                     if (RectangContain(rectangle0, p))
                     {
                         selectedObjs.Add(node);
-
                     }
                 }
 
@@ -1192,7 +1112,6 @@
             }
             if /*鍙犲姞妗嗛��*/(isMouseMoved && _mouseState == MouseState.鏃� && e.Button == MouseButtons.Left && ModifierKeys == Keys.Control)
             {
-
                 _isDragging = false;
                 Cursor = Cursors.Default;
 
@@ -1204,7 +1123,6 @@
                 var rectangle0 = new RectangleF(start, size);
                 for (int i = 0; i < _Nodes.Count; i++)
                 {
-
                     var node = _Nodes[i] as NodeViewModel;
                     if (!node.Visible) continue;
                     PointF p = WorldPointToMapPoint(node);
@@ -1221,7 +1139,6 @@
                             node.Selected = true;
                             selectedObjs.Add(node);
                         }
-
                     }
                 }
 
@@ -1314,11 +1231,8 @@
                     //    GlobalObject.PropertyForm.SetObjs(selectedObjs);
                     _OperaNode = null;
 
-
                     SetMapInvalidate();
                     mousePosition = new PointF(0, 0);
-
-
                 }
                 else
                 {
@@ -1334,8 +1248,6 @@
                     SetMapInvalidate();
                 }
                 return;
-
-
             }
 
             if (/*鍙犲姞鐐归��*/!isMouseMoved && _mouseState == MouseState.鏃� && e.Button == MouseButtons.Left && ModifierKeys == Keys.Control)
@@ -1389,13 +1301,13 @@
                 }
             }
         }
+
         private void getPointAndHeight(MouseEventArgs e, out PointF p, out float z)
         {
             z = 0;
             if (RotationF != 0)
             {
                 p = MapPointToWorldPoint(ScreenToMap(new PointF(e.X, e.Y), z));
-
             }
             else
             {
@@ -1404,13 +1316,13 @@
                 p = new PointF(m.X, 0);
             }
         }
+
         private void getPointAndHeight(MouseEventArgs e, NodeViewModel j, out PointF p, out float z)
         {
             z = j.Elev;
             if (RotationF != 0)
             {
                 p = MapPointToWorldPoint(ScreenToMap(new PointF(e.X, e.Y), j.Elev), j.Elev);
-
             }
             else
             {
@@ -1419,10 +1331,11 @@
                 p = new PointF(j.X, j.Y);
             }
         }
-        IBaseViewModel GetObj_by_ScreenPoint(PointF clickedPoint, float DistLimit = 15f)
+
+        private IBaseViewModel GetObj_by_ScreenPoint(PointF clickedPoint, float DistLimit = 15f)
         {
             float minDist = float.MaxValue;
-           
+
             int minIndex = -1;
             bool isJunction = true;
             IBaseViewModel obj = null;
@@ -1466,14 +1379,14 @@
             return obj;
         }
 
-        List<IBaseViewModel> GetObjs_by_ScreenPoint(PointF clickedPoint, float DistLimit = 15f)
+        private List<IBaseViewModel> GetObjs_by_ScreenPoint(PointF clickedPoint, float DistLimit = 15f)
         {
             float minDist = float.MaxValue;
 
             int minIndex = -1;
-       
+
             IBaseViewModel obj = null;
-            List < IBaseViewModel > objs = new List<IBaseViewModel>();
+            List<IBaseViewModel> objs = new List<IBaseViewModel>();
             for (int i = 0; i < _Nodes.Count; i++)
             {
                 var node = _Nodes[i] as NodeViewModel;
@@ -1502,8 +1415,6 @@
                 //float dist = Get_dist(clickedPoint, currentPoint);
                 if (dist < minDist && dist <= DistLimit)
                 {
-                    
-
                     objs.Add(link);
                 }
             }
@@ -1514,7 +1425,7 @@
         /// 榧犳爣婊氳疆浜嬩欢
         /// </summary>
         /// <param name="e"></param>
-        void mapMouseWheel(MouseEventArgs e)
+        private void mapMouseWheel(MouseEventArgs e)
         {
             base.OnMouseWheel(e);
             mapOption0 = mapOption.Copy();
@@ -1528,14 +1439,15 @@
 
         private int _lastMouseX;
         private int _lastMouseY;
-        #endregion
+
+        #endregion 榧犳爣浜嬩欢
 
         #endregion 涓�銆佸叏灞�
 
         #region 浜屻�佸伐鍏锋爮
 
-
         #region 瑙嗚宸ュ叿
+
         // 鏄剧ず鐐瑰睘鎬�
         private void ShowProperties(IBaseViewModel obj)
         {
@@ -1548,9 +1460,11 @@
 
         private void label_center_Click(object sender, EventArgs e)
         {
-          //  GlobalObject.PropertyForm.SetObj(MapCenter);
+            //  GlobalObject.PropertyForm.SetObj(MapCenter);
         }
-        double 淇瑙掑害_bak = 45;
+
+        private double 淇瑙掑害_bak = 45;
+
         private void tool瑙嗚_ButtonClick(object sender, EventArgs e)
         {
             mapOption0 = mapOption.Copy();
@@ -1562,25 +1476,23 @@
             {
                 淇瑙掑害_bak = RotationF;
                 RotationF = 90;
-
             }
             if (recordView) MapObjectExtensions.AddCommand(mapOption, "Map", mapOption0, mapOption);
             SetMapInvalidate();
         }
 
-        private void tool璁剧疆淇瑙掑害_Click(object sender, EventArgs e)
+        public void tool璁剧疆淇瑙掑害(string text)
         {
             mapOption0 = mapOption.Copy();
             double jiaodu = 45;
-            var tool = sender as ToolStripItem;
-            jiaodu = Convert.ToDouble(tool.Text);
+            // var tool = sender as ToolStripItem;
+            jiaodu = Convert.ToDouble(text);
             RotationF = jiaodu;
             if (recordView) MapObjectExtensions.AddCommand(mapOption, "Map", mapOption0, mapOption);
             SetMapInvalidate();
-
         }
 
-        public void 閲嶇疆瑙嗚ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 閲嶇疆瑙嗚ToolStripMenu()
         {
             mapOption0 = mapOption.Copy();
 
@@ -1590,6 +1502,7 @@
             if (recordView) MapObjectExtensions.AddCommand(mapOption, "Map", mapOption0, mapOption);
             SetMapInvalidate();
         }
+
         private void 姝h鍥綯oolStripMenuItem_Click(object sender, EventArgs e)
         {
             mapOption0 = mapOption.Copy();
@@ -1598,6 +1511,7 @@
 
             SetMapInvalidate();
         }
+
         private void 淇鍥綯oolStripMenuItem_Click(object sender, EventArgs e)
         {
             mapOption0 = mapOption.Copy();
@@ -1606,12 +1520,11 @@
 
             SetMapInvalidate();
         }
+
         private void 榛樿瑙嗚ToolStripMenuItem_Click(object sender, EventArgs e)
         {
-       
-
             mapOption0 = mapOption.Copy();
-            
+
             InitCenter();
             RotationF = 45;
             Rotation = -45;
@@ -1619,6 +1532,7 @@
 
             SetMapInvalidate();
         }
+
         private void 璁句负闅愯棌ToolStripMenuItem_Click(object sender, EventArgs e)
         {
             selectedObjs.ForEach(v =>
@@ -1628,11 +1542,11 @@
                     MapObjectExtensions.AddCommand(v, "Visible", v.Visible, false);
                     v.Visible = false;
                 }
-
             });
 
             this.SetMapInvalidate();
         }
+
         private void 璁剧疆闀垮害ToolStripMenuItem_Click(object sender, EventArgs e)
         {
             //double length = 0;
@@ -1642,7 +1556,6 @@
             //{
             //    if (double.TryParse(input.ShowDialog(), out length))
             //    {
-
             //        var count1 = _Links.FindAll(ll => ll.Node1 == l.StartNode.ID || ll.Node2 == l.StartNode.ID).Count;
             //        var count2 = _Links.FindAll(ll => ll.Node1 == l.EndNode.ID || ll.Node2 == l.EndNode.ID).Count;
             //        if (count1 > 1 && count2 <= 1)
@@ -1664,15 +1577,11 @@
 
             //}
 
-
-
-
-
             //this.SetMapInvalidate();
         }
-        void MovePointbyLength(NodeViewModel node1, NodeViewModel node2, float Length)
-        {
 
+        private void MovePointbyLength(NodeViewModel node1, NodeViewModel node2, float Length)
+        {
             float distance = Vector3.Distance(new Vector3(node1.X, node1.Y, node1.Elev), new Vector3(node2.X, node2.Y, node2.Elev));
 
             if (distance > 0)
@@ -1698,6 +1607,7 @@
                 //Console.WriteLine("绉诲姩鍚庣偣 B 鐨勫潗鏍囦负 ({0}, {1}, {2})", x2, y2, z2);
             }
         }
+
         private void 鍏ㄩ儴鏄剧ずToolStripMenuItem_Click(object sender, EventArgs e)
         {
             _Nodes.Select(n => (NodeViewModel)n).ToList().ForEach(v =>
@@ -1719,13 +1629,25 @@
             });
             this.SetMapInvalidate();
         }
-        #endregion
 
+        #endregion 瑙嗚宸ュ叿
 
         #region 鏂囦欢宸ュ叿
+
+        public void OpenFile(string filePath)
+        {
+            _Template = new Template();
+            _Template.network = new MapViewNetWork();
+
+            // 璇诲彇鏂囦欢鍐呭
+            _Network.BuildFromInp(filePath);
+            _Template.filePath = filePath;
+            //_filePath = filePath;
+            SetData(_Template);
+        }
+
         private void tool鎵撳紑_ButtonClick(object sender, EventArgs e)
         {
-
             // 鍒涘缓鎵撳紑鏂囦欢瀵硅瘽妗�
             OpenFileDialog openFileDialog = new OpenFileDialog();
             openFileDialog.Filter = "INP Files (*.inp)|*.inp|All Files (*.*)|*.*";
@@ -1734,8 +1656,7 @@
             {
                 _Template = new Template();
                 _Template.network = new MapViewNetWork();
-               
-                
+
                 //_Template.network.use_old = false;
                 // 鑾峰彇閫変腑鏂囦欢鐨勬枃浠惰矾寰�
                 string filePath = openFileDialog.FileName;
@@ -1748,58 +1669,26 @@
                 }
             }
         }
-        public void OpenFile(string filePath)
-        {
-            _Template = new Template();
-            _Template.network = new MapViewNetWork();
 
+        //private void 鏃х増鎵撳紑ToolStripMenuItem_Click(object sender, EventArgs e)
+        //{
+        //    // 鍒涘缓鎵撳紑鏂囦欢瀵硅瘽妗�
 
- 
-            {
-                // 璇诲彇鏂囦欢鍐呭
-                _Network.BuildFromInp(filePath);
-                _Template.filePath = filePath;
-                //_filePath = filePath;
-                SetData(_Template);
-            }
-        }
-        private void 鏃х増鎵撳紑ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            // 鍒涘缓鎵撳紑鏂囦欢瀵硅瘽妗�
-            OpenFileDialog openFileDialog = new OpenFileDialog();
-            openFileDialog.Filter = "INP Files (*.inp)|*.inp|All Files (*.*)|*.*";
+        //        _Template = new Template();
+        //        _Template.network = new MapViewNetWork();
+        //        //_Template.network.use_old = true;
+        //        // 鑾峰彇閫変腑鏂囦欢鐨勬枃浠惰矾寰�
+        //        string filePath = openFileDialog.FileName;
+        //        {
+        //            // 璇诲彇鏂囦欢鍐呭
+        //            _Network.BuildFromInp(filePath);
+        //            _Template.filePath = filePath;
+        //            //_filePath = filePath;
+        //            SetData(_Template);
+        //        }
 
-            if (openFileDialog.ShowDialog() == DialogResult.OK)
-            {
-                _Template = new Template();
-                _Template.network = new MapViewNetWork();
-                //_Template.network.use_old = true;
-                // 鑾峰彇閫変腑鏂囦欢鐨勬枃浠惰矾寰�
-                string filePath = openFileDialog.FileName;
-                {
-                    // 璇诲彇鏂囦欢鍐呭
-                    _Network.BuildFromInp(filePath);
-                    _Template.filePath = filePath;
-                    //_filePath = filePath;
-                    SetData(_Template);
-                }
-            }
-        }
+        //}
 
-        private void 鎵撳紑鏂囦欢浣嶇疆ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            if (_filePath == null) return;
-            FileInfo fi = new FileInfo(_filePath);
-            Process.Start("explorer.exe", $"/select,\"{_filePath}\"");
-            //System.Diagnostics.Process.Start("explorer.exe", fi.Directory.FullName);
-        }
-        private void EPA涓墦寮�ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            if (_filePath == null) return;
-
-
-            Process.Start(@"epanetH\Epanet2wH.exe", _filePath);
-        }
         private void 淇濆瓨ToolStripMenuItem_Click(object sender, EventArgs e)
         {
             if (!_IsEditMode)
@@ -1807,7 +1696,6 @@
                 if (message.show("鎻愰啋", "娴忚妯″紡鏃犳硶淇濆瓨锛屾槸鍚︽仮澶嶄负缂栬緫妯″紡"))
                 {
                     _IsEditMode = true;
-
                 }
                 else
                     return;
@@ -1818,52 +1706,43 @@
 
         private void toolStripButton_save_Click(object sender, EventArgs e)
         {
-
-
-
-
-
         }
 
         private void 鍙﹀瓨ToolStripMenuItem_Click(object sender, EventArgs e)
         {
-
         }
 
         private void 瀵煎嚭褰㈢姸ToolStripMenuItem_Click(object sender, EventArgs e)
         {
-
         }
-        #endregion
 
+        #endregion 鏂囦欢宸ュ叿
 
         #region 缁樺浘宸ュ叿
 
-
-        
-        public void toolStripButton_鏂板缓鑺傜偣_Click(object sender, EventArgs e)
+        public void NewNode()
         {
             _mouseState = MouseState.鏂板鑺傜偣;
             Cursor = Cursors.Cross;
         }
 
-        public void toolStripButton_鏅�歘Click(object sender, EventArgs e)
-        {
-            _mouseState = MouseState.鏃�;
-            Cursor = Cursors.Default;
-        }
-
-        public void toolStripButton_鏂板缓绠$嚎_Click(object sender, EventArgs e)
+        public void NewLink()
         {
             _mouseState = MouseState.鏂板绠$嚎;
             Cursor = Cursors.Cross;
         }
-        public void toolStripButton_鏂板缓绔嬬_Click(object sender,EventArgs e)
+
+        public void NewVerticalLink()
         {
             _mouseState = MouseState.鏂板绔嬬;
             Cursor = Cursors.Cross;
         }
 
+        public void ResetOperateStatus()
+        {
+            _mouseState = MouseState.鏃�;
+            Cursor = Cursors.Cross;
+        }
 
         private List<IBaseViewModel> AddLink(PointF e, bool isdoubleClick, PointF p, float z)
         {
@@ -1881,7 +1760,7 @@
                     l.Add(_select_junction2);
                 }
 
-                if (_mouseState == MouseState.鏂板绠$嚎 || _mouseState==MouseState.鏂板绔嬬)
+                if (_mouseState == MouseState.鏂板绠$嚎 || _mouseState == MouseState.鏂板绔嬬)
                     l.Add(_Network.AddPipe(_select_junction1, _select_junction2));
                 else if (_mouseState == MouseState.鏂板缓闃�闂�)
                     l.Add(_Network.AddValve(_select_junction1, _select_junction2));
@@ -1893,8 +1772,6 @@
                 _select_junction1 = null;
                 _select_junction2 = null;
                 _isPainting = false;
-
-
             }
             return l;
         }
@@ -1910,43 +1787,70 @@
             }
         }
 
-        public void toolStripButton_娣诲姞姘磋〃_Click(object sender, EventArgs e)
+        public void NewWaterMeter()
         {
             _mouseState = MouseState.鏂板缓姘磋〃;
             Cursor = Cursors.Cross;
         }
 
-        public void toolStripButton_娣诲姞闃�闂╛Click(object sender, EventArgs e)
-        {
-            _mouseState = MouseState.鏂板缓闃�闂�;
-            Cursor = Cursors.Cross;
-        }
-        public void toolStripButton_娣诲姞姘存车_Click(object sender, EventArgs e)
-        {
-            _mouseState = MouseState.鏂板缓姘存车;
-            Cursor = Cursors.Cross;
-        }
-        public void toolStripButton_娣诲姞姘村簱_Click(object sender, EventArgs e)
+        public void NewTask()
         {
             _mouseState = MouseState.鏂板缓姘村簱;
             Cursor = Cursors.Cross;
         }
 
-        public void toolStripButton_娣诲姞姘存睜_Click(object sender, EventArgs e)
+        public void NewPool()
         {
             _mouseState = MouseState.鏂板缓姘存睜;
             Cursor = Cursors.Cross;
         }
-        public void toolStripButton_閲嶅鍣╛Click(object sender, EventArgs e)
+
+        public void NewPump()
+        {
+            _mouseState = MouseState.鏂板缓姘存车;
+            Cursor = Cursors.Cross;
+        }
+
+        public void NewValve()
+        {
+            _mouseState = MouseState.鏂板缓闃�闂�;
+            Cursor = Cursors.Cross;
+        }
+
+        public void NewRepeater()
         {
             _mouseState = MouseState.鏂板缓閲嶅鍣�;
             Cursor = Cursors.Cross;
         }
 
-        bool Buzylock = false;
+        public void toolStripButton_娣诲姞姘磋〃_Click(object sender, EventArgs e)
+        {
+        }
+
+        public void toolStripButton_娣诲姞闃�闂╛Click(object sender, EventArgs e)
+        {
+        }
+
+        public void toolStripButton_娣诲姞姘存车_Click(object sender, EventArgs e)
+        {
+        }
+
+        public void toolStripButton_娣诲姞姘村簱_Click(object sender, EventArgs e)
+        {
+        }
+
+        public void toolStripButton_娣诲姞姘存睜_Click(object sender, EventArgs e)
+        {
+        }
+
+        public void toolStripButton_閲嶅鍣╛Click(object sender, EventArgs e)
+        {
+        }
+
+        private bool Buzylock = false;
+
         private void MapViewer_KeyDown(object sender, KeyEventArgs e)
         {
-
             if (e.KeyCode == Keys.Escape)
             {
                 Cursor = _lastCursor;
@@ -1996,11 +1900,7 @@
                     _Links.ForEach(o => ((LinkViewModel)o).Selected = false);
                     selectedObjs.Clear();
                     SetMapInvalidate();
-
-
                 }
-
-
             }
             if (e.KeyCode == Keys.Delete)
             {
@@ -2016,33 +1916,30 @@
 
             if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
             {
-                澶嶅埗ToolStripMenuItem_Click(1, new EventArgs());
+                澶嶅埗ToolStripMenuItem();
             }
             if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control)
             {
                 _ClickStartPos = Cursor.Position;
-                绮樿创ToolStripMenuItem1_Click(1, new EventArgs());
+                绮樿创ToolStripMenuItem();
             }
             if (e.KeyCode == Keys.D1 && e.Modifiers == Keys.Control)
             {
-                鍗楀寳瀵归綈ToolStripMenuItem_Click(1, new EventArgs());
-
+                鍗楀寳瀵归綈ToolStripMenuItem();
             }
             if (e.KeyCode == Keys.Oemtilde && e.Modifiers == Keys.Control)
             {
-                涓滆タ瀵归綈ToolStripMenuItem_Click(1, new EventArgs());
+                涓滆タ瀵归綈ToolStripMenuItem();
             }
             if (e.KeyCode == Keys.D2 && e.Modifiers == Keys.Control)
             {
-                绔栫洿瀵归綈ToolStripMenuItem_Click(1, new EventArgs());
+                绔栫洿瀵归綈ToolStripMenuItem();
             }
             if (e.KeyCode == Keys.D3 && e.Modifiers == Keys.Control)
             {
-                鑷姩瀵归綈ToolStripMenuItem_Click(1, new EventArgs());
+                鑷姩瀵归綈ToolStripMenuItem();
             }
         }
-
-
 
         private void MapViewer_KeyPress(object sender, KeyPressEventArgs e)
         {
@@ -2074,6 +1971,7 @@
                 e.Handled = true;
             }
         }
+
         private void MapViewer_PreKeyPress(object sender, PreviewKeyDownEventArgs e)
         {
             if (e.Control && e.KeyCode == Keys.Z)
@@ -2081,23 +1979,21 @@
                 ctrlPressed = true;
                 // 闃叉榛樿鎿嶄綔
                 e.IsInputKey = true;
-
             }
             if (e.Control && e.KeyCode == Keys.Y)
             {
                 ctrlPressed = true;
                 // 闃叉榛樿鎿嶄綔
                 e.IsInputKey = true;
-
             }
             if (e.Control && e.KeyCode == Keys.R)
             {
                 ctrlPressed = true;
                 // 闃叉榛樿鎿嶄綔
                 e.IsInputKey = true;
-
             }
         }
+
         public void setCenter(IBaseViewModel obj)
         {
             PointF position;
@@ -2113,12 +2009,11 @@
             MapCenter.Y - vector.Y / Zoom.Y);
         }
 
-        bool ctrlPressed = false;
-        #endregion
+        private bool ctrlPressed = false;
 
+        #endregion 缁樺浘宸ュ叿
 
         #region 鍙抽敭鑿滃崟
-
 
         private void 杞崲ToolStripMenuItem_Click(object sender, EventArgs e)
         {
@@ -2143,6 +2038,7 @@
                         }
                         junc.ID = ID;
                         break;
+
                     case "鍩烘湰鑺傜偣":
 
                         junc = _Network.AddJunction(obj.Position, obj.Elev);
@@ -2155,6 +2051,7 @@
                         }
                         junc.ID = ID;
                         break;
+
                     case "姘村簱":
                         junc = _Network.AddReservoir(obj.Position);
                         i = 0;
@@ -2166,6 +2063,7 @@
                         }
                         junc.ID = ID;
                         break;
+
                     case "姘存睜":
                         junc = _Network.AddTank(obj.Position);
                         i = 0;
@@ -2184,14 +2082,12 @@
                 junc.Elev = obj.Elev;
                 junc.Demand = obj.Demand;
 
-
                 junc.Selected = true;
                 foreach (var p in _Links)
                 {
                     if (p.StartNode == obj)
                     {
                         p.StartNode = junc;
-
                     }
                     else if (p.EndNode == obj)
                     {
@@ -2204,28 +2100,20 @@
                 _Nodes.Remove(obj);
             }
 
-
             SetMapInvalidate();
         }
 
-        public void 鍒犻櫎ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            DeleteChoosedObj();
-        }
-
-        private void DeleteChoosedObj()
+        public void DeleteChoosedObj()
         {
             var list = _Network.Remove(selectedObjs);
             MapObjectExtensions.AddCommand(_Network, "Remove", null, list);
             selectedObjs.Clear();
             SetMapInvalidate();
         }
-        #endregion
 
+        #endregion 鍙抽敭鑿滃崟
 
         #region 缂栬緫妯″紡/娴忚妯″紡鍒囨崲宸ュ叿
-
-
 
         private void toolStripComboBox_expandRepeater_ButtonClick(object sender, EventArgs e)
         {
@@ -2241,7 +2129,8 @@
             //toolStripComboBox_娴忚妯″紡.Text = isEditMode ? "缂栬緫妯″紡" : "娴忚妯″紡";
             LoadData(true);
         }
-        #endregion
+
+        #endregion 缂栬緫妯″紡/娴忚妯″紡鍒囨崲宸ュ叿
 
         /// <summary>
         /// 宸ュ叿鏍忓彲鐢�
@@ -2277,13 +2166,12 @@
 
         #region 鍒嗘瀽宸ュ叿
 
-        private void 姘村钩鏃嬭浆ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 姘村钩鏃嬭浆ToolStripMenuItem()
         {
- 
             //var objs = GlobalObject.PropertyForm.selectionSet.selectedObjects;
             //var selectobjs = objs.FindAll(o => o is NodeViewModel); //GlobalObject.PropertyForm.listBox1.SelectedItems;
             //if (selectobjs.Count <= 0) return;
- 
+
             //if (!(selectobjs[0] as IBaseViewModel).isNode())
             //{
             //    MessageBox.Show("鍥寸粫閫変腑鑺傜偣杩涜骞抽潰鏃嬭浆锛岃鍦ㄥ睘鎬у垪琛ㄤ腑閫変腑涓�涓妭鐐圭被瀵硅薄");
@@ -2304,7 +2192,6 @@
             //MapObjectExtensions.AddCommand(nodes, "Position", OldPositions, NewPositions);
 
             //SetMapInvalidate();
-
         }
 
         public List<PointF> GetRotatedPoints(List<PointF> points, PointF origin, float angle)
@@ -2338,7 +2225,6 @@
 
             return result;
         }
-
 
         public List<PointF3D> GetRotatedPoints(List<PointF3D> points, Vector3 line, float angle)
         {
@@ -2383,13 +2269,12 @@
             return result;
         }
 
-        private void 缂╂斁ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 缂╂斁ToolStripMenuItem()
         {
-          
             //var objs = GlobalObject.PropertyForm.selectionSet.selectedObjects;
             //var list = objs.FindAll(o => o is NodeViewModel); //GlobalObject.PropertyForm.listBox1.SelectedItems;
             //if (list.Count <= 0) return;
- 
+
             //if (list.Count >= 1 && !list[0].isNode())
             //{
             //    MessageBox.Show("鍥寸粫閫変腑鑺傜偣杩涜涓夌淮缂╂斁锛岃鍦ㄥ睘鎬у垪琛ㄤ腑閫変腑涓�涓猍鑺傜偣绫籡缂╂斁涓績瀵硅薄");
@@ -2452,20 +2337,15 @@
             return result;
         }
 
-
-        
-
         public void toolStripButton_璁$畻_Click(object sender, EventArgs e)
         {
             //LoadData();
-            _Network.Calc(_Template.FullPath, GlobalPath.configPath+ "config_calc.wdb");
         }
 
-        public void 鍏抽榾鎼滅储ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 鍏抽榾鎼滅储ToolStripMenuItem()
         {
             if (selectedObjs.Count > 0)//&& selectedObjs[0] is Link l
             {
-
                 var objs = selectedObjs.ToList();
                 var selectsValve = objs.FindAll(o => o is ValveViewModel);
                 selectedObjs.ForEach(o => o.Selected = false);
@@ -2474,18 +2354,17 @@
                 selectsValve.ForEach(o => o.Selected = false);
                 this.SetMapInvalidate();
             }
-
         }
+
         /// <summary>
         /// 鍏抽榾鍒嗘瀽锛堣�冭檻姘存簮鐨勬儏鍐碉級
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void 鍏抽榾鎼滅储鑰冭檻姘存簮ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 鍏抽榾鎼滅储鑰冭檻姘存簮ToolStripMenuItem()
         {
             if (selectedObjs.Count > 0)//&& selectedObjs[0] is Link l
             {
-
                 var objs = selectedObjs.ToList();
                 var selectsValve = objs.FindAll(o => o is ValveViewModel);
                 selectedObjs.ForEach(o => o.Selected = false);
@@ -2493,16 +2372,17 @@
                 TraversePipeNetwork(objs, null);
                 selectsValve.ForEach(o => o.Selected = false);
                 this.SetMapInvalidate();
-
             }
         }
+
         //Queue<Link> queue2 = null;
-        List<LinkViewModel> LinksToFindSource = null;
-        Dictionary<LinkViewModel, List<IBaseViewModel>> Sets = null;
-        Dictionary<LinkViewModel, bool> Sets_hasSource = null;
+        private List<LinkViewModel> LinksToFindSource = null;
+
+        private Dictionary<LinkViewModel, List<IBaseViewModel>> Sets = null;
+        private Dictionary<LinkViewModel, bool> Sets_hasSource = null;
+
         private void TraversePipeNetwork(List<IBaseViewModel> startObjs, HashSet<NodeViewModel> visitedNodes = null, bool consider = true)
         {
-
             LinksToFindSource = new List<LinkViewModel>();
 
             if (visitedNodes == null)
@@ -2517,7 +2397,6 @@
                 else if (o is NodeViewModel n)
                 {
                     n.Links.Select(oo => oo as LinkViewModel).ToList().ForEach(link => TraversePipeNetwork(link, visitedNodes));
-
                 }
             });
             if (!consider) return;
@@ -2539,20 +2418,16 @@
                             o.Selected = true;
                             selectedObjs.Add(o);
                         }
-
                     });
                 }
             }
             //if (GlobalObject.PropertyForm != null)
             //    GlobalObject.PropertyForm.SetObjs(selectedObjs);
-
         }
+
         private void TraversePipeNetwork(LinkViewModel startLink, HashSet<NodeViewModel> visitedNodes = null)
         {
-
             Queue<LinkViewModel> queue = new Queue<LinkViewModel>();
-
-
 
             queue.Enqueue(startLink);
             if (visitedNodes == null)
@@ -2581,35 +2456,24 @@
                                 link.Selected = true;
                                 selectedObjs.Add(link);
 
-
                                 if (!(link is ValveViewModel))
                                 {
                                     queue.Enqueue(link);
-
                                 }
                                 else
                                 {
                                     LinksToFindSource.Add(link);
                                 }
-
-
                             }
                         }
                     }
                 }
-
             }
-
-
-
         }
+
         private void TraversePipeNetwork_Set(LinkViewModel startLink, HashSet<NodeViewModel> visitedNodes = null)
         {
-
             Queue<LinkViewModel> queue = new Queue<LinkViewModel>();
-
-
-
 
             queue.Enqueue(startLink);
             if (visitedNodes == null)
@@ -2661,19 +2525,13 @@
                         }
                     }
                 }
-
             }
-
-
-
         }
+
         private bool FindSouce(LinkViewModel startLink, HashSet<LinkViewModel> visitedLinks, HashSet<LinkViewModel> visitedLinks2, Dictionary<IBaseViewModel, bool> hasSource = null)
         {
-
-
             foreach (var node in new NodeViewModel[] { startLink.StartNode, startLink.EndNode })
             {
-
                 if (!hasSource.ContainsKey(node))
                 {
                     //hasSource.Add(node, false);
@@ -2681,17 +2539,12 @@
                 }
 
                 if (hasSource[node] == true) return true;
-
-
             }
             return false;
-
-
-
         }
+
         private bool FindSouce(NodeViewModel startNode, HashSet<LinkViewModel> visitedLinks, HashSet<LinkViewModel> visitedLinks2, Dictionary<IBaseViewModel, bool> hasSource = null)
         {
-
             foreach (var link in startNode.ViewLinks)
             {
                 if (hasSource.ContainsKey(link) && hasSource[link] == true) return true;
@@ -2703,43 +2556,30 @@
                     visitedLinks2.Add(link);
                 if (!hasSource.ContainsKey(link))
                 {
-
                     //hasSource.Add(link,false);
                     hasSource[link] = FindSouce(link, visitedLinks, visitedLinks2, hasSource);
                 }
 
                 if (hasSource[link] == true) return true;
-
-
             }
             return false;
-
-
         }
-
-
-
 
         //private void 鑱旈�氭�oolStripMenuItem_Click(object sender, EventArgs e)
         //{
         //    if (selectedObjs.Count > 0)//&& selectedObjs[0] is Link l
         //    {
-
         //        var objs = selectedObjs.FindAll(o => o is LinkViewModel).Select(o => o as LinkViewModel).ToList();
         //        var visitedNodes = new HashSet<NodeViewModel>();
         //        objs.ForEach(o => TraversePipeNetworkALL(o, visitedNodes));
-
 
         //        this.SetInvalidated();
 
         //    }
         //}
-        private void TraversePipeNetworkALL(LinkViewModel startLink, HashSet<NodeViewModel> visitedNodes = null,int direction=0)
+        private void TraversePipeNetworkALL(LinkViewModel startLink, HashSet<NodeViewModel> visitedNodes = null, int direction = 0)
         {
-
             Queue<LinkViewModel> queue = new Queue<LinkViewModel>();
-
-
 
             queue.Enqueue(startLink);
             if (visitedNodes == null)
@@ -2770,96 +2610,48 @@
                                 link.Selected = true;
                                 selectedObjs.Add(link);
                                 queue.Enqueue(link);
-
-
-
-
                             }
                         }
                     }
                 }
-
             }
-
-
-
         }
-        #endregion
 
+        #endregion 鍒嗘瀽宸ュ叿
 
         #region 鏄剧ず閫夐」
 
-        private void 鏄剧ず鑺傜偣ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 鏄剧ず鑺傜偣ToolStripMenuItem()
         {
             _ShowJunction = true;
             SetMapInvalidate();
         }
 
-        private void 闅愯棌鑺傜偣ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 闅愯棌鑺傜偣ToolStripMenuItem()
         {
             _ShowJunction = false;
             SetMapInvalidate();
         }
 
-        private void 澶oolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            var item = sender as ToolStripItem;
-            if (item.Text == "澶�")
-            {
-                junction_multiply = 1f;
-            }
-            else if (item.Text == "涓�")
-            {
-                junction_multiply = 0.6667f;
-            }
-            else
-            {
-                junction_multiply = 0.4f;
-            }
-            SetMapInvalidate();
-        }
-
-        private void 鏄剧ず闃�闂═oolStripMenuItem_Click(object sender, EventArgs e)
+        public void 鏄剧ず闃�闂═oolStripMenuItem()
         {
             _ShowValve = true;
             SetMapInvalidate();
-
         }
 
-        private void 闅愯棌闃�闂═oolStripMenuItem_Click(object sender, EventArgs e)
+        public void 闅愯棌闃�闂═oolStripMenuItem()
         {
             _ShowValve = false;
             SetMapInvalidate();
-
-
         }
 
-        private void 澶oolStripMenuItem1_Click(object sender, EventArgs e)
-        {
-            var item = sender as ToolStripItem;
-            if (item.Text == "澶�")
-            {
-                Link_multiply = 1f;
-            }
-            else if (item.Text == "涓�")
-            {
-                Link_multiply = 0.6667f;
-            }
-            else
-            {
-                Link_multiply = 0.4f;
-            }
-            SetMapInvalidate();
-        }
-
-
-        #endregion
-
+        #endregion 鏄剧ず閫夐」
 
         #endregion 浜屻�佸伐鍏锋爮
 
         #region 鏂规硶
-        private void 鏍囬珮鎺ㄦ祴ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鏍囬珮鎺ㄦ祴ToolStripMenuItem()
         {
             int num = UpdateNodesEle();
             if (num > 0)
@@ -2869,9 +2661,9 @@
             else
             {
                 MessageBox.Show($"娌℃湁闇�瑕佹洿鏂扮殑鑺傜偣");
-
             }
         }
+
         public int UpdateNodesEle()
         {
             int num = 0;
@@ -2917,7 +2709,6 @@
                 if (link.StartNode == node)
                 {
                     neighbor = link.EndNode;
-
                 }
                 else
                 {
@@ -2935,7 +2726,8 @@
                 }
             }
         }
-        private void 鏍囬珮瀵煎嚭ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鏍囬珮瀵煎嚭ToolStripMenuItem()
         {
             DataTable dt = new DataTable();
             dt.Columns.Add("ID");
@@ -2950,9 +2742,9 @@
                 }
             }
             dtToSql(dt);
-
         }
-        void dtToCsv(DataTable dt)
+
+        private void dtToCsv(DataTable dt)
         {
             // 鍒涘缓 SaveFileDialog 瀵硅薄
             SaveFileDialog saveFileDialog = new SaveFileDialog();
@@ -2996,12 +2788,12 @@
                 MessageBox.Show("鏂囦欢淇濆瓨鎴愬姛锛�", "鎻愮ず", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
-        void dtToSql(DataTable dt)
+
+        private void dtToSql(DataTable dt)
         {
             // 鍒涘缓 SaveFileDialog 瀵硅薄
             SaveFileDialog saveFileDialog = new SaveFileDialog();
             saveFileDialog.Filter = "Txt Files (*.txt)|*.txt";
-
 
             // 濡傛灉鐢ㄦ埛閫夋嫨浜嗕繚瀛樹綅缃拰鏂囦欢鍚嶏紝鍒欐墽琛屼繚瀛樻搷浣�
             if (saveFileDialog.ShowDialog() == DialogResult.OK)
@@ -3025,19 +2817,15 @@
     );
 END
 
-
 ";
                 // 鏋勫缓 CSV 瀛楃涓�
                 StringBuilder csvContent = new StringBuilder();
 
                 csvContent.AppendLine(tableString);
 
-
-
                 //// 鍐欏叆琛ㄥご
                 //foreach (DataColumn column in dt.Columns)
                 //{
-
                 //    csvContent.Append(column.ColumnName);
                 //    csvContent.Append(",");
                 //}
@@ -3047,7 +2835,6 @@
                 int j = 0;
                 while (i < dt.Rows.Count)
                 {
-
                     if (j == 0) csvContent.AppendLine("INSERT INTO Elev (ID, Elev) VALUES");
                     // 鍐欏叆鏁版嵁琛�
 
@@ -3058,11 +2845,7 @@
                     i++;
                     j++;
                     if (j == 1000) j = 0;
-
-
-
                 }
-
 
                 // 灏� CSV 鍐呭鍐欏叆鏂囦欢
                 File.WriteAllText(filePath, csvContent.ToString());
@@ -3087,18 +2870,29 @@
                 LoadData();
             }
         }
-        public void buttonUndo_Click(object sender, EventArgs e)
+
+        public void Undo()
         {
             SetMapInvalidate();
             //GlobalObject.PropertyForm.propertyGrid.Refresh();
             MapObjectExtensions.Undo();
         }
-        public void buttonRedo_Click(object sender, EventArgs e)
+
+        public void Redo()
         {
             SetMapInvalidate();
             //GlobalObject.PropertyForm.propertyGrid.Refresh();
             MapObjectExtensions.Redo();
         }
+
+        public void buttonUndo_Click(object sender, EventArgs e)
+        {
+        }
+
+        public void buttonRedo_Click(object sender, EventArgs e)
+        {
+        }
+
         public void toolStripButton_save_ButtonClick(object sender, EventArgs e)
         {
             if (_Template == null) return;
@@ -3121,6 +2915,41 @@
 
         private void 浠ュ綋鍓嶈瑙掑彟瀛楾oolStripMenuItem_Click(object sender, EventArgs e)
         {
+        }
+
+        private void 鍙﹀瓨涓篢oolStripMenuItem_Click(object sender, EventArgs e)
+        {
+        }
+
+        public void SaveAs(string filePath)
+        {
+            bool isReplace = false;
+            _Network.BuildToInp(filePath, null, _filePath, isReplace);
+        }
+
+        public void Save()
+        {
+            if (_Template == null) return;
+
+            if (!_IsEditMode)
+            {
+                if (message.show("鎻愰啋", "娴忚妯″紡鏃犳硶淇濆瓨锛屾槸鍚︽仮澶嶄负缂栬緫妯″紡"))
+                {
+                    _IsEditMode = true;
+                }
+                else
+                    return;
+            }
+            else
+            {
+                bool isReplace = true;
+                //isReplace = !message.show("妯℃澘閫夋嫨", "浣跨敤妯℃澘鏂板/鏇挎崲褰撳墠鏂囦欢", MessageBoxButtons.YesNo);
+                _Network.BuildToInp(_filePath, null, null, false);
+            }
+        }
+
+        public void SaveAsByView(string filePath)
+        {
             if (_Template == null) return;
 
             StringBuilder sb = new StringBuilder();
@@ -3130,86 +2959,51 @@
             {
                 var p = WorldPointToMapPoint((NodeViewModel)n);
                 sb.AppendLine($"{n.ID} {p.X} {p.Y}");
-
             });
 
-
-            SaveFileDialog saveFileDialog = new SaveFileDialog();
-            saveFileDialog.Filter = "Inp Files (*.inp)|*.inp";
-            saveFileDialog.InitialDirectory = Directory.GetCurrentDirectory() + $@"\template\";
-            if (_filePath != null) saveFileDialog.FileName = _filePath;
-            if (saveFileDialog.ShowDialog() == DialogResult.OK)
-            {
-                string filePath = saveFileDialog.FileName;
-                // 浣跨敤 filePath 鍙橀噺鏉ヤ繚瀛樻枃浠�
-                //temp.璺緞 = filePath;
-                _Network.BuildToInp(filePath, sb.ToString(), _filePath);
-                //_filePath = filePath;
-
-
-            }
+            _Network.BuildToInp(filePath, sb.ToString(), _filePath);
         }
-        private void 鍙﹀瓨涓篢oolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void Calc()
         {
-
-            bool isReplace = false;
-            //isReplace = !message.show("妯℃澘閫夋嫨", "浣跨敤妯℃澘鏂板/鏇挎崲褰撳墠鏂囦欢", MessageBoxButtons.YesNo);
-
-            SaveFileDialog saveFileDialog = new SaveFileDialog();
-            saveFileDialog.Filter = "Inp Files (*.inp)|*.inp";
-            saveFileDialog.InitialDirectory = Directory.GetCurrentDirectory() + $@"\template\";
-            if (_filePath != null) saveFileDialog.FileName = _filePath;
-            if (saveFileDialog.ShowDialog() == DialogResult.OK)
-            {
-                string filePath = saveFileDialog.FileName;
-                // 浣跨敤 filePath 鍙橀噺鏉ヤ繚瀛樻枃浠�
-                //temp.璺緞 = filePath;
-
-
-                _Network.BuildToInp(filePath, null, _filePath, isReplace);
-                //_filePath = filePath;
-
-
-            }
+            _Network.Calc(_Template.FullPath, GlobalPath.configPath + "config_calc.wdb");
         }
-        private void 杩為�氭�ф鏌oolStripMenuItem1_Click(object sender, EventArgs e)
+
+        public void 杩為�氭�ф鏌oolStripMenuItem()
         {
             if (selectedObjs.Count > 0)//&& selectedObjs[0] is Link l
             {
-
                 var objs = selectedObjs.FindAll(o => o is LinkViewModel).Select(o => o as LinkViewModel).ToList();
-                if (objs.Count == 0) selectedObjs.FindAll(o => o is NodeViewModel).Select(o => o as NodeViewModel).ToList().ForEach(o=>objs.AddRange(o.Links.Select(l=>l as LinkViewModel).ToList()));
+                if (objs.Count == 0) selectedObjs.FindAll(o => o is NodeViewModel).Select(o => o as NodeViewModel).ToList().ForEach(o => objs.AddRange(o.Links.Select(l => l as LinkViewModel).ToList()));
                 //objs鍘绘帀閲嶅鐨勫厓绱�
                 objs = objs.Distinct().ToList();
                 var visitedNodes = new HashSet<NodeViewModel>();
                 objs.ForEach(o => TraversePipeNetworkALL(o, visitedNodes));
 
-
                 this.SetMapInvalidate();
-
             }
         }
-        private void 涓嬫父杩為�氭�oolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 涓嬫父杩為�氭�oolStripMenuItem()
         {
             if (selectedObjs.Count > 0)//&& selectedObjs[0] is Link l
             {
-
                 var objs = selectedObjs.FindAll(o => o is LinkViewModel).Select(o => o as LinkViewModel).ToList();
-                if (objs.Count == 0) selectedObjs.FindAll(o => o is NodeViewModel).Select(o => o as NodeViewModel).ToList().ForEach(o => 
+                if (objs.Count == 0) selectedObjs.FindAll(o => o is NodeViewModel).Select(o => o as NodeViewModel).ToList().ForEach(o =>
                 {
-                    objs.AddRange(o.Links.Select(oo => oo as LinkViewModel).ToList().FindAll(oo=>oo.StartNode==o?oo.EN_FLOW>0:oo.EN_FLOW<0));
+                    objs.AddRange(o.Links.Select(oo => oo as LinkViewModel).ToList().FindAll(oo => oo.StartNode == o ? oo.EN_FLOW > 0 : oo.EN_FLOW < 0));
                 });
                 //objs鍘绘帀閲嶅鐨勫厓绱�
                 objs = objs.Distinct().ToList();
                 var visitedNodes = new HashSet<NodeViewModel>();
-                objs.ForEach(o => TraversePipeNetworkALL(o, visitedNodes,1));
+                objs.ForEach(o => TraversePipeNetworkALL(o, visitedNodes, 1));
                 this.SetMapInvalidate();
-
             }
         }
-        public void 澶嶅埗ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 澶嶅埗ToolStripMenuItem()
         {
-            if(hoveredObjs.Count<=0 || !(hoveredObjs[0] is NodeViewModel))
+            if (hoveredObjs.Count <= 0 || !(hoveredObjs[0] is NodeViewModel))
             {
                 MessageBox.Show("璇峰皢榧犳爣鎮仠鍦ㄤ竴涓妭鐐瑰璞′笂,浣滀负鍩哄噯鐐�");
                 return;
@@ -3219,7 +3013,7 @@
                 MessageBox.Show("璇烽�夋嫨瑕佸鍒剁殑瀵硅薄");
                 return;
             }
-           
+
             _OperaNode = hoveredObjs[0] as NodeViewModel;
 
             MapViewNetWork net = new MapViewNetWork();
@@ -3236,12 +3030,10 @@
             catch
             {
                 //鎻愰啋
-
             }
-
-
         }
-        public void 绮樿创ToolStripMenuItem1_Click(object sender, EventArgs e)
+
+        public void 绮樿创ToolStripMenuItem()
         {
             {
                 var net = new MapViewNetWork();
@@ -3269,40 +3061,25 @@
                 SetMapInvalidate();
             }
         }
+
         private void 澧為噺淇濆瓨ToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            if (_Template == null) return;
-
-            if (!_IsEditMode)
-            {
-                if (message.show("鎻愰啋", "娴忚妯″紡鏃犳硶淇濆瓨锛屾槸鍚︽仮澶嶄负缂栬緫妯″紡"))
-                {
-                    _IsEditMode = true;
-                }
-                else
-                    return;
-            }
-            else
-            {
-                bool isReplace = true;
-                //isReplace = !message.show("妯℃澘閫夋嫨", "浣跨敤妯℃澘鏂板/鏇挎崲褰撳墠鏂囦欢", MessageBoxButtons.YesNo);
-                _Network.BuildToInp(_filePath, null, null, false);
-
-
-            }
         }
+
         private void 璁句负鍏抽棴ToolStripMenuItem_Click(object sender, EventArgs e)
         {
-            selectedObjs.ForEach(obj => { if (obj is LinkViewModel link) link.Status =Hydro.Core.ObjectEnum. StatusType.CLOSED; });
+            selectedObjs.ForEach(obj => { if (obj is LinkViewModel link) link.Status = Hydro.Core.ObjectEnum.StatusType.CLOSED; });
             SetMapInvalidate();
         }
-        private void 鏄剧ず鍏ㄩ儴妤煎眰ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鏄剧ず鍏ㄩ儴妤煎眰ToolStripMenuItem()
         {
             //this.mapOption.ShowFloor = int.MinValue;
             _Network.MapObjects.ForEach(o => o.Visible = true);
             this.SetMapInvalidate();
         }
-        private void 淇濆瓨妤煎眰瑙嗚ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 淇濆瓨妤煎眰瑙嗚ToolStripMenuItem()
         {
             //if (_Template?.Floors!=null)
             //{
@@ -3310,7 +3087,8 @@
             //    if (fl!=null)fl.MapView = this.mapOption.Copy();
             //}
         }
-        public void 鍗楀寳瀵归綈ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鍗楀寳瀵归綈ToolStripMenuItem()
         {
             if (selectedNodes.Count < 1) return;
             List<float> list = new List<float>();
@@ -3319,7 +3097,8 @@
             MapObjectExtensions.AddCommand(selectedNodes, "X", list, list1);
             this.SetMapInvalidate();
         }
-        public void 涓滆タ瀵归綈ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 涓滆タ瀵归綈ToolStripMenuItem()
         {
             if (selectedNodes.Count < 1) return;
             List<float> list = new List<float>();
@@ -3328,7 +3107,8 @@
             MapObjectExtensions.AddCommand(selectedNodes, "Y", list, list1);
             this.SetMapInvalidate();
         }
-        public void 绔栫洿瀵归綈ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 绔栫洿瀵归綈ToolStripMenuItem()
         {
             if (selectedNodes.Count < 1) return;
             List<PointF> list = new List<PointF>();
@@ -3337,7 +3117,8 @@
             MapObjectExtensions.AddCommand(selectedNodes, "Position", list, list1);
             this.SetMapInvalidate();
         }
-        public void 鑷姩瀵归綈ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鑷姩瀵归綈ToolStripMenuItem()
         {
             if (selectedNodes.Count < 3) return;
             List<PointF3D> OldPosition3Ds = selectedNodes.Select(n => n.Position3D).ToList();
@@ -3350,7 +3131,8 @@
             MapObjectExtensions.AddCommand(selectedNodes, "Position3D", OldPosition3Ds, NewPosition3Ds);
             this.SetMapInvalidate();
         }
-        List<PointF3D> ProjectPointsToLine(List<PointF3D> points)
+
+        private List<PointF3D> ProjectPointsToLine(List<PointF3D> points)
         {
             // 浣跨敤鏈�灏忎簩涔樻硶鏋勯�犵洿绾匡紝骞跺皢鐐规姇褰卞埌鐩寸嚎涓�
 
@@ -3404,7 +3186,7 @@
             return projectedPoints;
         }
 
-        public void 娣诲姞搴曞浘ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 娣诲姞搴曞浘ToolStripMenuItem()
         {
             if (_Template == null) return;
             OpenFileDialog openFileDialog = new OpenFileDialog();
@@ -3416,12 +3198,13 @@
                 var backgroundImagePath = openFileDialog.FileName;
                 Global.ClearFileReadOnly(_Template.BackGroundImg_FullPath);
                 File.Copy(backgroundImagePath, _Template.BackGroundImg_FullPath, true);
-                璁剧疆搴曞浘ToolStripMenuItem_Click(1, new EventArgs());
+                璁剧疆搴曞浘ToolStripMenuItem();
             }
         }
-        bool _isSettingBackGroundPictur = false;
 
-        public void 璁剧疆搴曞浘ToolStripMenuItem_Click(object sender, EventArgs e)
+        private bool _isSettingBackGroundPictur = false;
+
+        public void 璁剧疆搴曞浘ToolStripMenuItem()
         {
             string inputValue = "0";// Prompt.ShowDialog("璇疯緭鍏ュ簳鍥炬爣楂�", "");
             float BackGroundElev = 0;
@@ -3439,7 +3222,7 @@
             this.Cursor = Cursors.Cross;
         }
 
-        public void 鏄剧ず闅愯棌搴曞浘ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 鏄剧ず闅愯棌搴曞浘ToolStripMenuItem()
         {
             mapOption.isShowPic = !mapOption.isShowPic;
             SetMapInvalidate();
@@ -3447,7 +3230,7 @@
 
         private dict<string, dynamic> param = null;
 
-        public void 娓呴櫎搴曞浘ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 娓呴櫎搴曞浘ToolStripMenuItem()
         {
             mapOption.isShowPic = false;
             SetMapInvalidate();
@@ -3466,30 +3249,32 @@
             if (float.TryParse(inputValue, out float result))
             {
                 zoom = result;
-
             }
         }
+
         private void label_file_DoubleClick(object sender, EventArgs e)
         {
             if (_filePath == null) return;
             FileInfo fi = new FileInfo(_filePath);
             Process.Start("explorer.exe", $"/select,\"{_filePath}\"");
         }
+
         private void label_file_Click(object sender, EventArgs e)
         {
             if (_filePath == null) return;
             FileInfo fi = new FileInfo(_filePath);
             Process.Start("explorer.exe", $"/select,\"{_filePath}\"");
         }
+
         private void 璁句负绔嬬鐐筎oolStripMenuItem_Click(object sender, EventArgs e)
         {
             if (selectedNodes.Count == 1)
             {
                 _Template.Node2 = _EndPoint = selectedNodes[0].ID;
             }
-
         }
-        private void 鏄剧ず姘存祦ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鏄剧ず姘存祦ToolStripMenuItem()
         {
             _Template.network.MapObjects.ForEach(o => o.Selected = false);
             selectedObjs.Clear();
@@ -3505,13 +3290,11 @@
                     node = link.EndNode;
                     node.Selected = true;
                     if (!selectedObjs.Contains(node)) selectedObjs.Add(node);
-
                 }
-
             });
             this.SetMapInvalidate();
-
         }
+
         private void 鍏ㄩ�塗oolStripMenuItem_Click(object sender, EventArgs e)
         {
             selectedObjs.Clear();
@@ -3522,14 +3305,12 @@
                     o.Selected = true;
                     selectedObjs.Add(o);
                 }
-
             });
             this.SetMapInvalidate();
-
         }
+
         private void 鍙嶉�塗oolStripMenuItem_Click(object sender, EventArgs e)
         {
-
             _Template.network.MapObjects.ForEach(o =>
             {
                 if (o.Visible)
@@ -3544,39 +3325,36 @@
                         o.Selected = true;
                         selectedObjs.Add(o);
                     }
-
                 }
-
             });
             this.SetMapInvalidate();
         }
-        private void 鏄剧ず鐘舵�乀oolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鏄剧ず鐘舵�乀oolStripMenuItem()
         {
             _Template.mapOption._ShowStatus = true;
             this.SetMapInvalidate();
         }
-        private void 闅愯棌鐘舵�乀oolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 闅愯棌鐘舵�乀oolStripMenuItem()
         {
             _Template.mapOption._ShowStatus = false;
             this.SetMapInvalidate();
-
         }
-        private void 鏄剧ず娴佸悜ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鏄剧ず娴佸悜ToolStripMenuItem()
         {
             _Template.mapOption._ShowFlowDirection = true;
             this.SetMapInvalidate();
-
-
-
         }
-        private void 闅愯棌娴佸悜ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 闅愯棌娴佸悜ToolStripMenuItem()
         {
             _Template.mapOption._ShowFlowDirection = false;
             this.SetMapInvalidate();
-
-
         }
-        private void 鏂瑰悜淇ToolStripMenuItem_Click(object sender, EventArgs e)
+
+        public void 鏂瑰悜淇ToolStripMenuItem()
         {
             _Network.Links.ForEach(l =>
             {
@@ -3589,102 +3367,67 @@
                 }
             });
         }
-        private void 鍒锋柊妤煎眰ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            ToolStripMenuItem_Floor.DropDownItems.Clear();
-            var mapobjects = _Network.MapObjects;
-            TagList tags = new TagList();
-            foreach (var item in mapobjects)
-            {
-                if (item.Tags != null)
-                    tags.AddRange(item.Tags);
-            }
-            var t = tags.Distinct().ToList();
-            tags.Clear();
-            tags.AddRange(t);
-            for (int i = -10; i < 1000; i++)
-            {
-                string tagstring = i.ToString() + "妤�";
-                if (tags.Contains(tagstring))
-                {
-                    var item=ToolStripMenuItem_Floor.DropDownItems.Add(i.ToString() + "妤�");
-                    item.Click += (oo, ee) =>
-                    {
-                        
-                        
-                        mapobjects.ForEach(o =>
-                        {
-                            if (o.Tags.Contains(tagstring))
-                            {
-                                o.Visible = true;
-                            }
-                            else
-                            {
-                                o.Visible = false;
-                            }
-                        });
-                        this.SetMapInvalidate();
 
-                    };
-                }
-            }
-            this.SetMapInvalidate();
-        }
-
-        private void 鏄剧ず鎵�鏈夐殣钘忓唴瀹筎oolStripMenuItem_Click(object sender, EventArgs e)
+        public void 鏄剧ず鎵�鏈夐殣钘忓唴瀹筎oolStripMenuItem()
         {
             _Network.MapObjects.ForEach(o => o.Visible = true);
             this.SetMapInvalidate();
         }
+
         public void toolStripButton_CalcMiniLoss_Click(object sender, EventArgs e)
+        {
+        }
+
+        private void toolStripButton_ClearMinor_Click(object sender, EventArgs e)
+        {
+        }
+
+        private void 鏄剧ず娴佸悜ToolStripMenuItem1_Click(object sender, EventArgs e)
+        {
+            _isShowDirection = !_isShowDirection;
+        }
+
+        private bool _isShowDirection = false;
+
+        public void 棰滆壊鍒嗙骇绠$悊ToolStripMenuItem()
+        {
+            //Form_Colour form_Colour = new Form_Colour(_Template.Colours);
+            //form_Colour.Show(this);
+        }
+
+        private bool __needpaintall = false;
+
+        public void CalcLinkMinorLoss()
         {
             _Network.SetNodeDemand();
             _Network.Calc(_Template.FullPath, GlobalPath.configPath + "config_calc.wdb");
             _Network.CalcLinkMinorLoss();
         }
-        private void toolStripButton_ClearMinor_Click(object sender, EventArgs e)
+
+        public void ClearMinorLoss()
         {
             _Network.ClearMinorLoss();
         }
-        private void 鏄剧ず娴佸悜ToolStripMenuItem1_Click(object sender, EventArgs e)
-        {
-            _isShowDirection = !_isShowDirection;
-        }
-        bool _isShowDirection=false;
-        private void 棰滆壊鍒嗙骇绠$悊ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            //Form_Colour form_Colour = new Form_Colour(_Template.Colours);
-            //form_Colour.Show(this);
-        }
-       
-		private bool __needpaintall=false;
-        
 
-   
         private void cb_Link_Colour_SelectedIndexChanged(object sender, EventArgs e)
         {
             if (_Template == null) return;
-            
-            var type = cb_Link_Colour.SelectedItem==null?ColourType.绠$嚎娴侀噺:(ColourType)cb_Link_Colour.SelectedItem;
+
+            var type = cb_Link_Colour.SelectedItem == null ? ColourType.绠$嚎娴侀噺 : (ColourType)cb_Link_Colour.SelectedItem;
             mapOption.ColourLink = type;
             this.SetMapInvalidate();
         }
+
         private void cb_Node_Colour_SelectedIndexChanged(object sender, EventArgs e)
         {
             if (_Template == null) return;
-   
-            var type = cb_Node_Colour.SelectedItem==null?ColourType.鑺傜偣鑷敱鍘嬪姏:(ColourType)cb_Node_Colour.SelectedItem;
+
+            var type = cb_Node_Colour.SelectedItem == null ? ColourType.鑺傜偣鑷敱鍘嬪姏 : (ColourType)cb_Node_Colour.SelectedItem;
             mapOption.ColourNode = type;
             this.SetMapInvalidate();
         }
 
-        private void label_ZZ_Click(object sender, EventArgs e)
-        {
-            //姝d氦妯″紡鐨勫叏灞�鍙橀噺寮�鍏�
-            _isOrtho = !_isOrtho;
-        }
-
-        private void 妤煎眰绠$悊ToolStripMenuItem_Click(object sender, EventArgs e)
+        public void 妤煎眰绠$悊ToolStripMenuItem()
         {
             //if (_Template.Regions==null)
             //{
@@ -3694,9 +3437,10 @@
             //form_EditFloors.Show(this);
         }
 
-       
+        #endregion 鏂规硶
 
-        
-        #endregion
+        private void 涓滆タ瀵归綈ToolStripMenuItem1_Click(object sender, EventArgs e)
+        {
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3