ningshuxia
2025-03-28 b6a00e2fddcf2343b981c30be670aa00b87699dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
using System.Numerics;
 
namespace HydroUI
{
 
 
    [Serializable]
    public class NodeViewModel : NodeCalcModel, IBaseViewModel
    {
        #region 构造函数
        public NodeViewModel()
        {
        }
        public NodeViewModel(PointF position)
        {
            Position = position;
        }
        public NodeViewModel(int X, int Y)
        {
            Position = new PointF(X, Y);
        }
        #endregion
 
        #region 属性
 
 
 
        [DisplayName("编号")]
        [Browsable(true)]
        public new string ID { get { return base.ID; } set { base.ID = value; } }
 
 
        [DisplayName("名称")]
        [Browsable(true)]
        public new string Name { get { return base.Name; } set { base.Name = value; } }
 
 
        public PointF3D Position3D
        {
            get
            {
                return new PointF3D(X, Y, Elev);
            }
            set
            {
                Position = new PointF(value.X, value.Y);
                Elev = value.Z;
            }
 
        }
 
 
        [Description("X坐标")]
        [DisplayName("X坐标")]
        [Browsable(true)]
        public new float X
        {
            get
            {
                return base.X;
            }
            set
            {
                base.X = value;
            }
        }
 
        [Description("Y坐标")]
        [DisplayName("Y坐标")]
        [Browsable(true)]
        public new float Y
        {
            get
            {
                return base.Y;
            }
            set
            {
                base.Y = value;
            }
        }
 
 
        [Description("标高(m)")]
        [DisplayName("标高(m)")]
        [Browsable(true)]
        public new float Elev { get { return base.Elev; } set { base.Elev = value; } }
 
 
 
        public MapObjectType Type { get { return this.GetTypeString(); } }
 
        [Category("计算参数")]
        [Description("最大口径(mm)")]
        [DisplayName("最大口径(mm)")]
 
        public virtual float MaxDiameter { get; set; } = 0;
 
 
 
        [Category("计算参数")]
        [Description("需水量(m³/h)")]
        [DisplayName("需水量(m³/h)")]
        [Browsable(true)]
        public virtual float Demand { get; set; }
 
 
        /// 模式的编号
 
        [Category("计算参数")]
        [Description("用水量模式的编号")]
        [DisplayName("模式编号")]
        [Browsable(true)]
        public virtual string PatternID { get; set; }
 
 
 
 
        [DisplayName("链表清单")]
        [Browsable(true)]
 
        public List<LinkCalcModel> Links
        {
            get
            {
                return base.Links;
            }
            set
            {
                base.Links = value;
            }
 
        }
 
        public List<LinkViewModel> ViewLinks
        {
            get
            {
                return base.Links.Select(oo => oo as LinkViewModel)?.ToList();
            }
 
        }
 
 
 
 
        [DisplayName("位置信息")]
 
        public PointF Position
        {
            get { return new PointF(X, Y); }
            set { if (value != null) X = value.X; Y = value.Y; }
        }
 
 
        [Description("标签")]
        [DisplayName("标签")]
        public TagList Tags { get; set; } = null;
 
 
        public String RegionName { get; set; } = null;
 
 
 
        [Description("对象的等级")]
        [DisplayName("级别")]
 
 
        public int Level { get; set; } = 0;
 
        [Description("对象的等级")]
        [DisplayName("是否显示")]
        public bool Visible { get; set; } = true;
 
 
 
 
 
 
        [Description("ID类型")]
        [DisplayName("ID类型")]
 
        public string IDType => Type.ToString() + "\t" + ID;
 
        #endregion
 
        #region 方法
        public void Move(Vector3 vector)
        {
            X += vector.X;
            Y += vector.Y;
            Elev += vector.Z;
        }
 
 
        public MapObjectType GetTypeString()
        {
            if (this is JunctionViewModel) return MapObjectType.节点;
            if (this is ReservoirViewModel) return MapObjectType.水库;
            if (this is TankViewModel) return MapObjectType.水池;
            if (this is MeterViewModel) return MapObjectType.水表;
            if (this is NozzleViewModel) return MapObjectType.喷头;
            if (this is ValveNodeViewModel) return MapObjectType.阀门点;
 
 
            if (this is PipeViewModel) return MapObjectType.管线;
            if (this is ValveViewModel) return MapObjectType.阀门;
            if (this is RepeaterViewModel) return MapObjectType.重复器;
            if (this is PumpViewModel) return MapObjectType.水泵;
            if (this is PumpNodeViewModel) return MapObjectType.水泵点;
 
            return MapObjectType.节点;
        }
 
        public bool isNode()
        {
            if (this is JunctionViewModel) return true;
            if (this is ReservoirViewModel) return true;
            if (this is TankViewModel) return true;
            if (this is MeterViewModel) return true;
            if (this is NozzleViewModel) return true;
            return false;
        }
        public string ToEmitterString()
        {
            if (this is NozzleViewModel n)
            {
                if (n.FlowCoefficient > 0)
                    return $"{ID}\t{n.FlowCoefficient * Math.Pow(10 / 101.972, 0.5) / 1000 * 60}\r\n";
            }
            return null;
        }
 
        #endregion
 
 
    }
}