| | |
| | | using Yw.WinFrmUI.Q3d; |
| | | using Newtonsoft.Json; |
| | | //using Hydro.Inp; |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Numerics; |
| | | using System.Runtime.InteropServices; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using static Yw.WinFrmUI.Q3d.ObjectEnum; |
| | | |
| | | using static Yw.WinFrmUI.Q3d.MapViewEnum; |
| | | using System.Xml.Linq; |
| | | using Yw.WinFrmUI.Q3d; |
| | | using System.Runtime.InteropServices; |
| | | using Yw.WinFrmUI.Q3d; |
| | | //using Hydro.HydraulicOptimizer; |
| | | using Yw.WinFrmUI.Q3d; |
| | | using System.Xml.Linq; |
| | | using static Yw.WinFrmUI.Q3d.MapViewEnum; |
| | | using static Yw.WinFrmUI.Q3d.ObjectEnum; |
| | | |
| | | namespace Yw.WinFrmUI.Q3d |
| | | { |
| | | [Serializable] |
| | | public partial class NetworkViewModel |
| | | public partial class NetworkViewModel |
| | | { |
| | | bool use_old = false; |
| | | public string Name; |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | //构造一个List<LinkViewModel>类,能够实现List的所有功能 |
| | | [Serializable] |
| | | public class LinkViewModelList:List<Q3DLinkCalcModel> |
| | | public class LinkViewModelList : List<LinkViewModel> |
| | | { |
| | | |
| | | |
| | | Dictionary<string, LinkViewModel> dict; |
| | | public LinkViewModelList() : base() |
| | | { |
| | | this.dict = new Dictionary<string, LinkViewModel>(); |
| | | } |
| | | |
| | | |
| | | public List<LinkViewModel> ViewLinks |
| | | { |
| | | get |
| | |
| | | /// </summary> |
| | | public void UpdateDict() |
| | | { |
| | | this.dict= new Dictionary<string, LinkViewModel>(); |
| | | this.dict = new Dictionary<string, LinkViewModel>(); |
| | | base.ForEach(link => |
| | | { |
| | | if (!dict.ContainsKey(link.ID)) |
| | |
| | | /// </summary> |
| | | /// <param name="oldID"></param> |
| | | /// <param name="newID"></param> |
| | | public void ChangeID(string oldID,string newID) |
| | | public void ChangeID(string oldID, string newID) |
| | | { |
| | | if (dict.ContainsKey(oldID)) |
| | | { |
| | | dict[oldID].ID = newID; |
| | | dict.Add(newID, dict[oldID]); |
| | | dict.Remove(oldID); |
| | | dict.Remove(oldID); |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | dict.Add(link.ID, link); |
| | | }); |
| | | } |
| | | |
| | | |
| | | public bool RemoveAt(int index) |
| | | { |
| | | if (index < 0 || index >= base.Count) return false; |
| | |
| | | { |
| | | if (dict.ContainsKey(ID)) |
| | | return dict[ID]; |
| | | else |
| | | else |
| | | return (LinkViewModel)base.Find(l => l.ID == ID); |
| | | } |
| | | } |
| | |
| | | //构造一个List<NodeViewModel>类,能够实现List的所有功能 |
| | | [Serializable] |
| | | |
| | | public class NodeViewModelList : List<Q3DNodeCalcModel> |
| | | public class NodeViewModelList : List<NodeViewModel> |
| | | { |
| | | //List<NodeCalcModel> base; |
| | | Dictionary<string, Q3DNodeCalcModel> dict;//=new Dictionary<string, NodeCalcModel>();// |
| | | public NodeViewModelList():base() |
| | | Dictionary<string, NodeViewModel> dict;//=new Dictionary<string, NodeCalcModel>();// |
| | | public NodeViewModelList() : base() |
| | | { |
| | | this.dict = new Dictionary<string, Q3DNodeCalcModel>(); |
| | | this.dict = new Dictionary<string, NodeViewModel>(); |
| | | } |
| | | //public NodeViewModelList(List<NodeCalcModel> nodes) |
| | | //{ |
| | |
| | | /// </summary> |
| | | public void UpdateDict() |
| | | { |
| | | this.dict = new Dictionary<string, Q3DNodeCalcModel>(); |
| | | this.dict = new Dictionary<string, NodeViewModel>(); |
| | | base.ForEach(node => |
| | | { |
| | | if (!dict.ContainsKey(node.ID)) |