lixiaojun
9 天以前 1f9175051e468da4007fcdf6e882d24002166be7
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
namespace Yw.WpfUI.Hydro
{
    /// <summary>
    /// 绘制编辑管理器
    /// </summary>
    internal class DrawEditManager : DrawManager
    {
        /// <summary>
        /// 
        /// </summary>
        public DrawEditManager(HelixViewport3D viewport) : base(viewport)
        {
            _addHelper = new DrawAddHelper(viewport, _initialHelper);
            _editHelper = new DrawEditHelper(viewport, _initialHelper, _selectionHelper);
            _editHelper.EditChangedEvent += OnEditChanged;
        }
 
 
        #region 事件集合
 
        /// <summary>
        /// 编辑改变事件
        /// </summary>
        public event Action<List<VisualL3d>> EditChangedEvent;
 
        #endregion
 
        protected readonly DrawAddHelper _addHelper = null;//添加辅助类
        protected readonly DrawEditHelper _editHelper = null;//编辑辅助类
 
        #region 添加方法
 
        /// <summary>
        /// 设置添加方式
        /// </summary>
        public void SetAddWay(eDrawAddWay addWay)
        {
            if (!Initialized)
            {
                return;
            }
            _addHelper.AddWay = addWay;
        }
 
        /// <summary>
        /// 设置添加类型
        /// </summary>
        public void SetAddType(eDrawAddType addType)
        {
            if (!Initialized)
            {
                return;
            }
            _addHelper.AddType = addType;
        }
 
 
        #endregion
 
        #region 编辑方法
 
        /// <summary>
        /// 开始编辑
        /// </summary>
        public void StartEdit()
        {
            _editHelper.Start();
        }
 
        /// <summary>
        /// 结束编辑
        /// </summary>
        public void EndEdit()
        {
            _editHelper.End();
        }
 
        //处理编辑改变
        protected virtual void OnEditChanged(List<VisualDraw3D> visual3ds)
        {
            if (visual3ds == null || visual3ds.Count < 1)
            {
                return;
            }
            var visuals = visual3ds.Select(x => x.Visual).ToList();
            this.EditChangedEvent?.Invoke(visuals);
        }
 
        #endregion
 
        /// <summary>
        /// 关闭
        /// </summary>
        public override void Close()
        {
            _editHelper.EditChangedEvent -= OnEditChanged;
            _editHelper.Dispose();
            base.Close();
        }
 
 
 
    }
}