lixiaojun
2025-03-21 aef3b2e0fc631437868e39924600c0991a7887e9
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
namespace Yw.WinFrmUI.Hydro
{
    /// <summary>
    /// 
    /// </summary>
    internal static class Network2dExtensions
    {
        /// <summary>
        /// 绘制2d
        /// </summary>
        public static void Draw2d(this NetworkL3d nw)
        {
            if (nw == null)
            {
                return;
            }
            nw.Links.ForEach(x =>
            {
                x.Draw2d();
            });
 
            nw.Nodes.ForEach(x =>
            {
                x.Draw2d();
            });
        }
 
        /// <summary>
        /// 悬停2d
        /// </summary>
        public static void Hover2d(this NetworkL3d nw, Ray3 ray, float zoom, Vector3CacheHelper vecache)
        {
            nw.Visuals.ForEach(x => x.IsHovered = false);
            var visual = ray.CastingClosest(zoom, nw, vecache);
            if (visual != null)
            {
                visual.IsHovered = true;
            }
        }
 
        /// <summary>
        /// 选择2d
        /// </summary>
        public static void Select2d(this NetworkL3d nw, Ray3 ray, float zoom, Vector3CacheHelper vecache)
        {
            nw.Visuals.ForEach(x => x.IsSelected = false);
            var visual = ray.CastingClosest(zoom, nw, vecache);
            if (visual != null)
            {
                visual.IsSelected = true;
                return;
            }
        }
 
 
    }
}