lixiaojun
2025-03-18 90c8d96d1c7f02dd10a114811a668915921b8834
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
 
using OpenTK.Mathematics;
 
namespace Yw.WinFrmUI.Hydro
{
    /// <summary>
    /// 
    /// </summary>
    public partial class NetworkL3d
    {
 
        /// <summary>
        /// 判断是否存在
        /// </summary>
        public bool IsExist(string id)
        {
            return _parters.Exists(x => x.Id == id);
        }
 
        /// <summary>
        /// 获取包围盒
        /// </summary>
        public BoundingBoxL3d GetBoundingBox()
        {
            var minX = float.MaxValue;
            var minY = float.MaxValue;
            var minZ = float.MaxValue;
            var maxX = float.MinValue;
            var maxY = float.MinValue;
            var maxZ = float.MinValue;
 
            foreach (var node in this.Nodes)
            {
                minX = Math.Min(minX, node.Position.X);
                minY = Math.Min(minY, node.Position.Y);
                minZ = Math.Min(minZ, node.Position.Z);
                maxX = Math.Max(maxX, node.Position.X);
                maxY = Math.Max(maxY, node.Position.Y);
                maxZ = Math.Max(maxZ, node.Position.Z);
            }
 
            return new BoundingBoxL3d()
            {
                Min = new PointL3d(minX, minY, minZ),
                Max = new PointL3d(maxX, maxY, maxZ)
            };
        }
 
        /// <summary>
        /// 获取中心点
        /// </summary>
        public PointL3d GetCenter(BoundingBoxL3d boundingBox)
        {
            if (boundingBox == null)
            {
                boundingBox = GetBoundingBox();
            }
            return boundingBox.GetCenter();
        }
 
        /// <summary>
        /// 绘制2d
        /// </summary>
        public void Draw2d()
        {
            this.Links?.ForEach(x => x.Draw2d());
            this.Nodes?.ForEach(x => x.Draw2d());
        }
 
 
 
 
 
 
 
 
 
 
 
    }
}