lixiaojun
6 天以前 d6f1a8535c0030e282f823f0e9b3d6e56e32e474
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
namespace Yw.WpfUI.Hydro
{
    /// <summary>
    /// 节点绘制3D
    /// </summary>
    internal abstract class NodeDraw3D : VisualDraw3D
    {
        /// <summary>
        /// 
        /// </summary>
        public NodeDraw3D(NodeL3d visual, NodeDrawer drawer) : base(visual, drawer)
        {
 
        }
 
        /// <summary>
        /// 可见元素
        /// </summary>
        public new NodeL3d Visual
        {
            get { return _visual as NodeL3d; }
            set { _visual = value; }
        }
 
        /// <summary>
        /// 绘制器
        /// </summary>
        public new NodeDrawer Drawer
        {
            get { return _drawer as NodeDrawer; }
            set { _drawer = value; }
        }
 
        #region 合法验证
 
        /// <summary>
        /// 验证
        /// </summary>
        public override bool Verify()
        {
            if (this.Visual == null)
            {
                return false;
            }
            if (this.Visual.Position == null)
            {
                return false;
            }
            if (this.Drawer == null)
            {
                return false;
            }
            if (!this.Drawer.Position.HasValue)
            {
                return false;
            }
            return true;
        }
 
        #endregion
 
        #region 位置处理
 
        /// <summary>
        /// 偏移
        /// </summary>
        public override void Offset(Vector3D offset)
        {
            if (this.Visual != null)
            {
                if (this.Visual.Position != null)
                {
                    this.Visual.Position = this.Visual.Position + offset.ToPointL3d();
                }
            }
            this.Drawer?.UpdatePositions();
        }
 
        /// <summary>
        /// 获取位置
        /// </summary>
        public override List<Point3D> GetPositions()
        {
            return this.Drawer?.GetPositions();
        }
 
        /// <summary>
        /// 获取位置
        /// </summary>
        public virtual Point3D? GetPosition()
        {
            return this.Drawer?.Position;
        }
 
        /// <summary>
        /// 更新位置
        /// </summary>
        public override void UpdatePositions()
        {
            this.Drawer?.UpdatePositions();
        }
 
        /// <summary>
        /// 更新位置
        /// </summary>
        public virtual void UpdatePosition(Point3D pt)
        {
            if (this.Visual != null)
            {
                this.Visual.Position = pt.ToPointL3d();
            }
            if (this.Drawer != null)
            {
                this.Drawer.Position = pt;
            }
        }
 
        #endregion
 
 
 
 
 
 
 
 
 
 
    }
}