| | |
| | | //using CloudWaterNetwork.Magnifier; |
| | | //using DevExpress.XtraEditors; |
| | | using Hydro.CommonBase; |
| | | using Hydro.Core.Model; |
| | | using Hydro.Inp; |
| | | //using ConfigApp; |
| | | //using DevExpress.Diagram.Core.Layout; |
| | |
| | | //using DevExpress.Utils.Extensions; |
| | | //using dict_py_Inner; |
| | | using Hydro.MapView; |
| | | using Hydro.MapView.Base; |
| | | using Hydro.MapView.Common; |
| | | using Newtonsoft.Json; |
| | | //using ReflectionManager_NameSpace; |
| | |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Data.Common; |
| | | using System.Diagnostics; |
| | | //using System.Diagnostics; |
| | | using System.Drawing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Numerics; |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices.WindowsRuntime; |
| | | using System.Runtime.Remoting.Metadata; |
| | | //using System.Runtime.InteropServices.WindowsRuntime; |
| | | //using System.Runtime.Remoting.Metadata; |
| | | using System.Security.Cryptography; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using System.Windows.Forms.DataVisualization.Charting; |
| | | //using System.Windows.Forms.DataVisualization.Charting; |
| | | //using static Hydro.Core.ObjectEnum; |
| | | using static Hydro.MapView.MapViewEnum; |
| | | using static System.Net.Mime.MediaTypeNames; |
| | |
| | | // DoubleBuffered = true; |
| | | // SetStyle(ControlStyles.SupportsTransparentBackColor, true); |
| | | // BackColor = Color.Transparent; |
| | | |
| | | |
| | | |
| | | //} |
| | | public MapViewer(bool showToolBar = false) |
| | |
| | | |
| | | this.showToolBar = showToolBar; |
| | | InitializeComponent(); |
| | | |
| | | //var propertyForm = new PropertyForm(); |
| | | //propertyForm.Dock = DockStyle.Right; |
| | | //this.Controls.Add(propertyForm); |
| | | MapCenter = PointF.Empty; |
| | | zoom = 1.0f; |
| | | DoubleBuffered = true; |
| | |
| | | |
| | | //if (!showToolBar) this.panel1.Visible = false; |
| | | } |
| | | public MapViewer() |
| | | public MapViewer() |
| | | { |
| | | |
| | | this.showToolBar = false; |
| | |
| | | |
| | | MapCenter = PointF.Empty; |
| | | zoom = 1.0f; |
| | | |
| | | |
| | | SetStyle(ControlStyles.SupportsTransparentBackColor, true); |
| | | BackColor = Color.Transparent; |
| | | |
| | | } |
| | | public void SetEditMode(bool isEditMode) |
| | | { |
| | | _IsEditMode = isEditMode; |
| | | } |
| | | _IsEditMode= isEditMode; |
| | | } |
| | | private void MapViewer_Load(object sender, EventArgs e) |
| | | { |
| | | GlobalObject.PropertyForm = this.propertyForm; |
| | | this.panel1.Visible = _showToolBar; |
| | | this.statusStrip1.Visible = _showStatusBar; |
| | | |
| | |
| | | map.Init(TC,new DrawDelegate[] { Draw, Draw, DrawBackGroud, DrawH },new MouseDelegate[] { mapMouseDown, mapMouseMove, mapMouseUp, mapMouseWheel }); |
| | | |
| | | |
| | | TContainer TCCube = new TContainer(); |
| | | TCCube.template = new Template(); |
| | | TCCube.template.network = new MapViewNetWork(); |
| | | TCCube.template.network.Areas = new List<AreaViewModel>(); |
| | | Cube cb=new Cube(); |
| | | foreach (var item in cb.FacesVertices) |
| | | { |
| | | AreaViewModel area = new AreaViewModel(); |
| | | area.ID = item.Key.ToString(); |
| | | area.InnerNodes = new List<NodeViewModel>(); |
| | | //area.Name= item.Key.ToString(); |
| | | |
| | | //6个面设置不一样的颜色 |
| | | switch (item.Key) |
| | | { |
| | | case 1: |
| | | area.color = Color.Red; |
| | | area.Name = "右"; |
| | | break; |
| | | case 2: |
| | | area.color = Color.SkyBlue; |
| | | area.Name = "左"; |
| | | break; |
| | | case 3: |
| | | area.color = Color.Green; |
| | | area.Name = "后"; |
| | | break; |
| | | case 4: |
| | | area.color = Color.DarkBlue; |
| | | area.Name = "前"; |
| | | break; |
| | | case 5: |
| | | area.color = Color.Purple; |
| | | area.Name = "上"; |
| | | break; |
| | | case 6: |
| | | area.color = Color.Orange; |
| | | area.Name = "下"; |
| | | break; |
| | | default: |
| | | area.color = Color.White; |
| | | break; |
| | | } |
| | | |
| | | foreach (var p in item.Value) |
| | | { |
| | | NodeViewModel node = new NodeViewModel(); |
| | | node.X = p.X; |
| | | node.Y = p.Y; |
| | | node.Elev = p.Z; |
| | | area.InnerNodes.Add(node); |
| | | } |
| | | TCCube.template.network.Areas.Add(area); |
| | | } |
| | | CubeView.Init(TCCube, new DrawDelegate[] { Draw, Draw, DrawBackGroud, DrawH }, new MouseDelegate[] { mapMouseDown, mapMouseMove, mapMouseUp, mapMouseWheel }); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | public bool LoadData(bool isDelCache = false) |
| | | { |
| | | |
| | | |
| | | if (_Template == null) return false; |
| | | if (isDelCache || _Template.network == null) |
| | | { |
| | |
| | | bool reLoad = _Template == template; |
| | | this._Template = template; |
| | | this._ViewModel = viewMode; |
| | | |
| | | |
| | | |
| | | //if ( _Template?.Floors!=null) |
| | | //{ |
| | |
| | | SetMapInvalidate(); |
| | | } |
| | | } |
| | | |
| | | |
| | | 刷新楼层ToolStripMenuItem_Click(1, new EventArgs()); |
| | | label_center.Text = $"center:({MapCenter.X.ToString("0.00")} ,{MapCenter.Y.ToString("0.00")})"; |
| | | label_zoom.Text = $"Zoom:{zoom.ToString("0.000")}"; |
| | |
| | | |
| | | #region 重绘函数 |
| | | |
| | | bool _needPaintAll |
| | | { |
| | | bool _needPaintAll |
| | | { |
| | | get |
| | | { |
| | | return __needpaintall; |
| | |
| | | __needpaintall = value; |
| | | } |
| | | } |
| | | |
| | | |
| | | PointF[] getCurclePoints(int num) |
| | | { |
| | |
| | | return points; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private void timer_draw_Tick(object sender, EventArgs e) |
| | | { |
| | | _mouseHoverCheckFlag = true; |
| | | if (_timerDraw && map.Status==DrawingStatus.Ready) |
| | | { |
| | | this.map.Invalidate(); |
| | | this.CubeView.Invalidate(); |
| | | _timerDraw = false; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | #region 鼠标事件 |
| | | |
| | | |
| | | 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) |
| | | { |
| | |
| | | // Math.Abs((int)DragStartPos.Y - (int)MP.Y)); |
| | | //DrawSelectionRect(selectionRect); |
| | | needInvalidate = true; |
| | | |
| | | |
| | | } |
| | | else if (_isRotating) |
| | | { |
| | |
| | | // 遍历所有对象,找出范围内的对象 |
| | | 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; |
| | | } |
| | |
| | | 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(); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | _newTemplate.network = net0; |
| | | _isInsertingObject = true; |
| | | _undoOldValue = new PointF3D(0, 0, 0); |
| | | _OperaNode = _newTemplate.network.Nodes.Find(node => node.ID == _newTemplate.Node1) as NodeViewModel; |
| | | |
| | | |
| | | SetMapInvalidate(); |
| | | return; |
| | |
| | | NodeViewModel minNode = null; |
| | | foreach (NodeViewModel node in nodes) |
| | | { |
| | | |
| | | |
| | | PointF mapPos = WorldPointToMapPoint(node); |
| | | PointF currentPoint = MapToScreen(mapPos); |
| | | float currentDist = 0; |
| | |
| | | var l = new List<IBaseViewModel>(); |
| | | l.Add(_Network.AddPipe(_OperaNode, minNode)); |
| | | if (l.Count > 0) MapObjectExtensions.AddCommand(_Network, "Add", null, l); |
| | | |
| | | |
| | | _OperaNode = null; |
| | | _NewNet.Clear(); |
| | | } |
| | |
| | | case MouseState.新建重复器: |
| | | if (_select_junction1 == null) |
| | | { |
| | | if (_mouseState == MouseState.新增立管) |
| | | if (_mouseState==MouseState.新增立管) |
| | | { |
| | | var m = ScreenToVMap(new PointF(e.X, e.Y)); |
| | | z = m.Y; |
| | |
| | | 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), isdoubleClick, p, wPos.Z); |
| | | var l = AddLink(new PointF( e.X,e.Y), isdoubleClick, p, wPos.Z); |
| | | if (l.Count > 0) MapObjectExtensions.AddCommand(_Network, "Add", null, l); |
| | | } |
| | | else |
| | |
| | | } |
| | | else |
| | | { |
| | | getPointAndHeight(e, _select_junction1, out p, out z); |
| | | var l = AddLink(new PointF(e.X, e.Y), isdoubleClick, p, z); |
| | | 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; |
| | | } |
| | |
| | | if (!isMouseMoved) |
| | | { |
| | | 右键_Menu.Show(this, e.Location); |
| | | |
| | | 转换为ToolStripMenuItem.Enabled = selectedNodes.Count > 0; //(selectedObjs.Count == 1); |
| | | |
| | | 转换为ToolStripMenuItem.Enabled = selectedNodes.Count > 0; //(selectedObjs.Count == 1); |
| | | 删除ToolStripMenuItem.Enabled = selectedObjs.Count > 0; |
| | | 删除ToolStripMenuItem1.Enabled = selectedObjs.Count > 0; |
| | | |
| | | |
| | | } |
| | | |
| | | if (recordView) MapObjectExtensions.AddCommand(mapOption, "Map", mapOption0, mapOption); |
| | |
| | | IBaseViewModel GetObj_by_ScreenPoint(PointF clickedPoint, float DistLimit = 15f) |
| | | { |
| | | float minDist = float.MaxValue; |
| | | |
| | | |
| | | int minIndex = -1; |
| | | bool isJunction = true; |
| | | IBaseViewModel obj = null; |
| | |
| | | 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; |
| | |
| | | //float dist = Get_dist(clickedPoint, currentPoint); |
| | | if (dist < minDist && dist <= DistLimit) |
| | | { |
| | | |
| | | |
| | | |
| | | objs.Add(link); |
| | | } |
| | |
| | | } |
| | | private void 默认视角ToolStripMenuItem_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | |
| | | |
| | | mapOption0 = mapOption.Copy(); |
| | | |
| | | |
| | | InitCenter(); |
| | | RotationF = 45; |
| | | Rotation = -45; |
| | |
| | | { |
| | | _Template = new Template(); |
| | | _Template.network = new MapViewNetWork(); |
| | | |
| | | |
| | | |
| | | |
| | | //_Template.network.use_old = false; |
| | | // 获取选中文件的文件路径 |
| | | string filePath = openFileDialog.FileName; |
| | |
| | | { |
| | | if (_filePath == null) return; |
| | | FileInfo fi = new FileInfo(_filePath); |
| | | Process.Start("explorer.exe", $"/select,\"{_filePath}\""); |
| | | System.Diagnostics.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); |
| | | System.Diagnostics.Process.Start(@"epanetH\Epanet2wH.exe", _filePath); |
| | | } |
| | | private void 保存ToolStripMenuItem_Click(object sender, EventArgs e) |
| | | { |
| | |
| | | #region 绘图工具 |
| | | |
| | | |
| | | |
| | | |
| | | public void toolStripButton_新建节点_Click(object sender, EventArgs e) |
| | | { |
| | | _mouseState = MouseState.新增节点; |
| | |
| | | _mouseState = MouseState.新增管线; |
| | | Cursor = Cursors.Cross; |
| | | } |
| | | public void toolStripButton_新建立管_Click(object sender, EventArgs e) |
| | | public void toolStripButton_新建立管_Click(object sender,EventArgs e) |
| | | { |
| | | _mouseState = MouseState.新增立管; |
| | | Cursor = Cursors.Cross; |
| | |
| | | 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)); |
| | |
| | | |
| | | private void 缩放ToolStripMenuItem_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | |
| | | var objs = GlobalObject.PropertyForm.selectionSet.selectedObjects; |
| | | var list = objs.FindAll(o => o is NodeViewModel); //GlobalObject.PropertyForm.listBox1.SelectedItems; |
| | | if (list.Count <= 0) return; |
| | |
| | | } |
| | | |
| | | |
| | | private void btn_初分配_Click(object sender, EventArgs e) |
| | | { |
| | | string result = null; |
| | | if ((result=_Template.network.CheckValidate())!=null) |
| | | { |
| | | MessageBox.Show(result); |
| | | return; |
| | | } |
| | | List<WaterEquivalentSettings> settings = new List<WaterEquivalentSettings>(); |
| | | settings.Add(new WaterEquivalentSettings() |
| | | { |
| | | waterEquivalents=new WaterEquivalentTemplate() |
| | | { |
| | | ID="1", |
| | | Name="1", |
| | | WaterEquivalentCollection=new WaterEquivalentCollection() |
| | | { |
| | | new WaterEquivalent() |
| | | { |
| | | ID=1008, |
| | | MinRatedFlow=0.48f, |
| | | RatedFlow=0.72f, |
| | | Count=1, |
| | | }, |
| | | new WaterEquivalent() |
| | | { |
| | | ID=1009, |
| | | MinRatedFlow=0.88f, |
| | | RatedFlow=0.96f, |
| | | Count=2, |
| | | }, |
| | | new WaterEquivalent() |
| | | { |
| | | ID=1010, |
| | | MinRatedFlow=1.08f, |
| | | RatedFlow=1.08f, |
| | | Count=3, |
| | | } |
| | | } |
| | | }, |
| | | Meters=new List<string>() |
| | | { |
| | | //按以下规律生成数组到M10,"M1","M2" |
| | | |
| | | "M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12","M13","M14","M15","M16", |
| | | "M17","M18","M19","M20","M21","M22","M23","M24","M25","M26","M27","M28","M29","M30" |
| | | }, |
| | | }); |
| | | |
| | | |
| | | settings.Add(new WaterEquivalentSettings() |
| | | { |
| | | waterEquivalents = new WaterEquivalentTemplate() |
| | | { |
| | | ID = "1", |
| | | Name = "1", |
| | | WaterEquivalentCollection = new WaterEquivalentCollection() |
| | | { |
| | | new WaterEquivalent() |
| | | { |
| | | ID=2008, |
| | | MinRatedFlow=0.48f, |
| | | RatedFlow=0.48f, |
| | | Count=1, |
| | | }, |
| | | new WaterEquivalent() |
| | | { |
| | | ID=2009, |
| | | MinRatedFlow=0.12f, |
| | | RatedFlow=0.12f, |
| | | Count=5, |
| | | }, |
| | | new WaterEquivalent() |
| | | { |
| | | ID=2010, |
| | | MinRatedFlow=0.16f, |
| | | RatedFlow=0.18f, |
| | | Count=6, |
| | | } |
| | | } |
| | | }, |
| | | Meters = new List<string>() |
| | | { |
| | | //按以下规律生成数组到M10,"M1","M2" |
| | | |
| | | "M31","M32","M33","M34","M35","M36","M37","M38","M39","M40","M41","M42","M43","M44","M45","M46","M47","M48","M49","M50","M51","M52","M53","M54","M55","M56","M57","M58","M59","M60","M61","M62","M63","M64","M65","M66","M67","M68","M69","M70","M71","M72","M73","M74","M75","M76","M77","M78","M79","M80" |
| | | }, |
| | | }); |
| | | var head=_Network.reservoirs.FirstOrDefault().Head; |
| | | _Network.WaterDistribution(_Template.FullPath, GlobalPath.configPath + "config_waterDistri.wdb",settings,40, head); |
| | | |
| | | } |
| | | |
| | | public void toolStripButton_计算_Click(object sender, EventArgs e) |
| | | { |
| | | //LoadData(); |
| | | _Network.Calc(_Template.FullPath, GlobalPath.configPath + "config_calc.wdb"); |
| | | _Network.Calc(_Template.FullPath, GlobalPath.configPath+ "config_calc.wdb"); |
| | | } |
| | | |
| | | public void 关阀搜索ToolStripMenuItem_Click(object sender, EventArgs e) |
| | |
| | | |
| | | // } |
| | | //} |
| | | 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>(); |
| | |
| | | { |
| | | |
| | | 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>(); |
| | |
| | | { |
| | | |
| | | 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) |
| | | { |
| | | if (hoveredObjs.Count <= 0 || !(hoveredObjs[0] is NodeViewModel)) |
| | | if(hoveredObjs.Count<=0 || !(hoveredObjs[0] is NodeViewModel)) |
| | | { |
| | | MessageBox.Show("请将鼠标悬停在一个节点对象上,作为基准点"); |
| | | return; |
| | |
| | | MessageBox.Show("请选择要复制的对象"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | _OperaNode = hoveredObjs[0] as NodeViewModel; |
| | | |
| | | MapViewNetWork net = new MapViewNetWork(); |
| | |
| | | public void 粘贴ToolStripMenuItem1_Click(object sender, EventArgs e) |
| | | { |
| | | { |
| | | |
| | | |
| | | var net = new MapViewNetWork(); |
| | | string json = Clipboard.GetText(); |
| | | net.ReadFromJson(json); |
| | | if (net.StartPoint == null) return; |
| | | string SID = net.StartPoint.ID; |
| | | net.StartPoint = net.Nodes.Find(n => n.ID == SID); |
| | | net.StartPoint=net.Nodes.Find(n => n.ID == SID); |
| | | PointF3D minPoint = net.StartPoint.Position3D;// new PointF(net.StartPoint.X, net.StartPoint.Y); |
| | | Point controlLocation = this.PointToScreen(new Point(0, 0)); |
| | | int offsetX = Cursor.Position.X - controlLocation.X; |
| | |
| | | net.BuildRelation(); |
| | | //var basePoint = MapPointToWorldPoint(ScreenToMap(position, net.StartPoint.Elev), net.StartPoint.Elev); |
| | | var mPos = _MousePosition; |
| | | if (hoveredObjs.Count > 0 && hoveredObjs[0] is NodeViewModel minNode) |
| | | if (hoveredObjs.Count>0 && hoveredObjs[0] is NodeViewModel minNode) |
| | | { |
| | | |
| | | |
| | | var basePoint = minNode.Position3D; |
| | | net.Nodes.ForEach(obj => |
| | | { |
| | |
| | | obj.Y = obj.Y + basePoint.Y - minPoint.Y; |
| | | obj.Elev = obj.Elev + basePoint.Z - minPoint.Z; |
| | | }); |
| | | |
| | | |
| | | selectedObjs.ForEach(o => o.Selected = false); |
| | | selectedObjs.Clear(); |
| | | selectedObjs.AddRange(net.Nodes.Select(n => (NodeViewModel)n)); |
| | | selectedObjs.AddRange(net.Links.ViewLinks); |
| | | var list = _Network.Add(net, null, false, minNode); |
| | | var list = _Network.Add(net,null,false,minNode); |
| | | net.BuildRelation(); |
| | | //list.Add(_Network.AddPipe(Snode, minNode)); |
| | | MapObjectExtensions.AddCommand(_Network, "Add", null, list); |
| | |
| | | SetMapInvalidate(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | private void 增量保存ToolStripMenuItem_Click(object sender, EventArgs e) |
| | |
| | | } |
| | | 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) |
| | |
| | | { |
| | | var backgroundImagePath = openFileDialog.FileName; |
| | | Global.ClearFileReadOnly(_Template.BackGroundImg_FullPath); |
| | | File.Copy(backgroundImagePath, _Template.BackGroundImg_FullPath, true); |
| | | FileCopy.Copy(backgroundImagePath, _Template.BackGroundImg_FullPath, true); |
| | | 设置底图ToolStripMenuItem_Click(1, new EventArgs()); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (_filePath == null) return; |
| | | FileInfo fi = new FileInfo(_filePath); |
| | | Process.Start("explorer.exe", $"/select,\"{_filePath}\""); |
| | | System.Diagnostics.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}\""); |
| | | System.Diagnostics.Process.Start("explorer.exe", $"/select,\"{_filePath}\""); |
| | | } |
| | | private void 设为立管点ToolStripMenuItem_Click(object sender, EventArgs e) |
| | | { |
| | |
| | | string tagstring = i.ToString() + "楼"; |
| | | if (tags.Contains(tagstring)) |
| | | { |
| | | var item = ToolStripMenuItem_Floor.DropDownItems.Add(i.ToString() + "楼"); |
| | | var item=ToolStripMenuItem_Floor.DropDownItems.Add(i.ToString() + "楼"); |
| | | item.Click += (oo, ee) => |
| | | { |
| | | |
| | | |
| | | |
| | | |
| | | mapobjects.ForEach(o => |
| | | { |
| | | if (o.Tags.Contains(tagstring)) |
| | |
| | | { |
| | | _isShowDirection = !_isShowDirection; |
| | | } |
| | | bool _isShowDirection = false; |
| | | bool _isShowDirection=false; |
| | | private void 颜色分级管理ToolStripMenuItem_Click(object sender, EventArgs e) |
| | | { |
| | | Form_Colour form_Colour = new Form_Colour(_Template.Colours,_Template); |
| | | form_Colour.Show(this); |
| | | } |
| | | |
| | | private bool __needpaintall=false; |
| | | |
| | | |
| | | 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; |
| | | mapOption.ColourLink = type; |
| | | var doubles = _Template.network.getMinMax(type); |
| | | var colour = new Colour(type, null, type.ToString()); |
| | | List<ColourItem> colours = Colour.GetColourItems((float)doubles[0], (float)doubles[1], 5, Color.Gray, Color.Red); |
| | | colour.Items = colours; |
| | | LinkColour = colour; |
| | | 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; |
| | | mapOption.ColourNode = type; |
| | | var doubles = _Template.network.getMinMax(type); |
| | | var colour = new Colour(type, null, type.ToString()); |
| | | List<ColourItem> colours = Colour.GetColourItems((float)doubles[0], (float)doubles[1], 5, Color.Gray, Color.Red); |
| | | colour.Items = colours; |
| | | NodeColour = colour; |
| | | this.SetMapInvalidate(); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | private void label_ZZ_Click(object sender, EventArgs e) |
| | |
| | | |
| | | private void 楼层管理ToolStripMenuItem_Click(object sender, EventArgs e) |
| | | { |
| | | if (_Template.Regions == null) |
| | | if (_Template.Regions==null) |
| | | { |
| | | _Template.Regions = new List<TRegion>(); |
| | | } |
| | |
| | | form_EditFloors.Show(this); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | } |
| | | } |