duheng
2025-03-28 b266e82b9a377fa35a766f7a3a2f5aa95f3c9125
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
namespace HydroUI
{
    [Serializable]
    public class AreaModel : BaseModel, IBaseViewModel
    {
        public bool Selected { get; set; }
 
 
        [Description("鼠标悬于上方")]
        [DisplayName("鼠标悬于上方")]
 
        public bool Hovered { get; set; }
 
 
        [DisplayName("位置信息")]
 
        public PointF Position { get; set; } = new PointF(0, 0);
 
 
        public String RegionName { get; set; } = null;
 
 
        [Description("X坐标")]
        [DisplayName("X坐标")]
        [Browsable(true)]
        public float X
        {
            get
            {
                return Position.X;
            }
            set
            {
                Position = new PointF(value, Position.Y);
            }
        }
 
        [Description("Y坐标")]
        [DisplayName("Y坐标")]
        [Browsable(true)]
        public float Y
        {
            get
            {
                return Position.Y;
            }
            set
            {
                Position = new PointF(Position.X, value);
            }
        }
 
 
        [Description("标高")]
        [DisplayName("标高")]
        [Browsable(true)]
        public float Elev { get; set; }
 
 
        [Description("对象的等级")]
        [DisplayName("级别")]
 
 
        public int Level { get; set; } = 0;
 
        [Description("对象的等级")]
        [DisplayName("是否显示")]
        public bool Visible { get; set; } = true;
 
 
 
        public MapObjectType Type { get { return this.GetTypeString(); } }
 
 
        [Description("ID类型")]
        [DisplayName("ID类型")]
 
        public string IDType => Type.ToString() + "\t" + ID;
 
 
 
        [Description("标签")]
        [DisplayName("标签")]
        public TagList Tags { get; set; } = null;
 
 
 
        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;
        }
    }
}