lixiaojun
2025-04-03 2e52f10a2cccb1471859b05e0d0e9dd9649859c8
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
namespace Yw.WinFrmUI.Hydro
{
    /// <summary>
    /// 
    /// </summary>
    public partial class OrthoViewer2d : UserControl
    {
        /// <summary>
        /// 
        /// </summary>
        public OrthoViewer2d()
        {
            InitializeComponent();
            InitializeGLEvents();
        }
 
        private NetworkL3d _nw = null;
        private OrthoViewer2dHelper _helper = null;
 
        /// <summary>
        /// 初始化管网
        /// </summary>
        public void InitialNetwork(NetworkL3d nw)
        {
            _nw = nw;
            _helper = new OrthoViewer2dHelper();
            _helper.Initial(this.glControl1, _nw);
        }
 
 
        #region 私有方法
 
        //初始化GL事件
        private void InitializeGLEvents()
        {
            this.glControl1.Load += glControl_Load;
            this.glControl1.Resize += glControl_Resize;
            this.glControl1.Paint += glControl_Paint;
            this.glControl1.MouseWheel += OnMouseWheel;
            this.glControl1.MouseDown += OnMouseDown;
            this.glControl1.MouseUp += OnMouseUp;
            this.glControl1.MouseMove += OnMouseMove;
            this.glControl1.MouseClick += OnMouseClick;
            this.glControl1.MouseDoubleClick += OnMouseDoubleClick;
        }
 
        #endregion
 
        #region 鼠标交互
 
        //加载事件
        private void glControl_Load(object sender, EventArgs e)
        {
            _helper?.Load();
        }
 
        // 尺寸改变
        private void glControl_Resize(object sender, EventArgs e)
        {
            _helper?.Resize();
        }
 
        // 绘制
        private void glControl_Paint(object sender, PaintEventArgs e)
        {
            _helper?.Render();
        }
 
        //鼠标滚轮
        private void OnMouseWheel(object sender, MouseEventArgs e)
        {
            _helper?.MouseWheel(e);
        }
 
        // 鼠标按下
        private void OnMouseDown(object sender, MouseEventArgs e)
        {
            _helper?.MouseDown(e);
        }
 
        //鼠标弹起
        private void OnMouseUp(object sender, MouseEventArgs e)
        {
            _helper?.MouseUp(e);
        }
 
        //鼠标移动
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            _helper?.MouseMove(e);
        }
 
        //鼠标点击
        private void OnMouseClick(object sender, MouseEventArgs e)
        {
            _helper?.MouseClick(e);
        }
 
        //鼠标双击
        private void OnMouseDoubleClick(object sender, MouseEventArgs e)
        {
            _helper?.MouseDoubleClick(e);
        }
 
        #endregion
 
 
    }
}