From 5aba199b669c0fb63461dac715c7db02e516d79c Mon Sep 17 00:00:00 2001 From: Zhuangkh Date: Wed, 4 Sep 2024 18:25:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8B=9F=E5=90=88=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/Monitor/MonitorViewModel.cs | 80 +++++++++---------- uBIMEarthTools/Ribbon.cs | 3 + 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/uBIMEarthTools/Commands/Monitor/MonitorViewModel.cs b/uBIMEarthTools/Commands/Monitor/MonitorViewModel.cs index cd3dc61..99e873b 100644 --- a/uBIMEarthTools/Commands/Monitor/MonitorViewModel.cs +++ b/uBIMEarthTools/Commands/Monitor/MonitorViewModel.cs @@ -108,51 +108,51 @@ namespace uBIMEarthTools.Commands.Monitor var boreholeKriging = new IDW(boreholeList.SelectMany(b => b.ValueList.Select(p => new Point3D() { X = p.Point.X, Y = p.Point.Y, Z = p.Point.Z, Value = typeValue[p.Type] })).ToList(), 2); List boreholes1 = new List(); - //tris.AsParallel().ForAll(item => - //{ - // Func func = (p => - // { - // var topZ = topKriging.Interpolate(new Point2D() { X = p.X, Y = p.Y }); - // var bottomZ = bottomKriging.Interpolate(new Point2D() { X = p.X, Y = p.Y }); - // var plus = (topZ - bottomZ) / 10; - // var geologyLayers = new List(); - // for (int i = 0; i < 10; i++) - // { - // var p3d = new Point3D() { X = p.X, Y = p.Y, Z = topZ - i * plus }; - // var value = boreholeKriging.Interpolate2(p3d); - // geologyLayers.Add(new GeologyLayer(valueType[(int)Math.Round(value)], new Autodesk.Revit.DB.XYZ(p3d.X, p3d.Y, p3d.Z))); - // } - // return new Borehole("", geologyLayers); - // }); + tris.AsParallel().ForAll(item => + { + Func func = (p => + { + var topZ = topKriging.Interpolate(new Point2D() { X = p.X, Y = p.Y }); + var bottomZ = bottomKriging.Interpolate(new Point2D() { X = p.X, Y = p.Y }); + var plus = (topZ - bottomZ) / 10; + var geologyLayers = new List(); + for (int i = 0; i < 10; i++) + { + var p3d = new Point3D() { X = p.X, Y = p.Y, Z = topZ - i * plus }; + var value = boreholeKriging.Interpolate2(p3d); + geologyLayers.Add(new GeologyLayer(valueType[(int)Math.Round(value)], new Autodesk.Revit.DB.XYZ(p3d.X, p3d.Y, p3d.Z))); + } + return new Borehole("", geologyLayers); + }); - // var v1 = boreholeList.ElementAt(item[1]).ValueList[0].Point - boreholeList.ElementAt(item[0]).ValueList[0].Point; - // var v2 = boreholeList.ElementAt(item[2]).ValueList[0].Point - boreholeList.ElementAt(item[0]).ValueList[0].Point; - // var originP = boreholeList.ElementAt(item[0]).ValueList[0].Point; - // var triangle = new List() { boreholeList.ElementAt(item[0]).ValueList[0].Point, - // boreholeList.ElementAt(item[1]).ValueList[0].Point, - // boreholeList.ElementAt(item[2]).ValueList[0].Point }; - // var seg = 10; - // v1 = v1 / seg; - // v2 = v2 / seg; - // for (int i = 0; i < seg; i++) - // { - // for (int j = 0; j < seg; j++) - // { - // if (i == j && i == 0) { continue; } - // var xyz = originP + v1 * i + v2 * j; - // if (IsInPolygon(xyz, triangle)) - // { - // boreholes1.Add(func(xyz)); - // } - // } - // } - //}); + var v1 = boreholeList.ElementAt(item[1]).ValueList[0].Point - boreholeList.ElementAt(item[0]).ValueList[0].Point; + var v2 = boreholeList.ElementAt(item[2]).ValueList[0].Point - boreholeList.ElementAt(item[0]).ValueList[0].Point; + var originP = boreholeList.ElementAt(item[0]).ValueList[0].Point; + var triangle = new List() { boreholeList.ElementAt(item[0]).ValueList[0].Point, + boreholeList.ElementAt(item[1]).ValueList[0].Point, + boreholeList.ElementAt(item[2]).ValueList[0].Point }; + var seg = 20; + v1 = v1 / seg; + v2 = v2 / seg; + for (int i = 0; i < seg; i++) + { + for (int j = 0; j < seg; j++) + { + if (i == j && i == 0) { continue; } + var xyz = originP + v1 * i + v2 * j; + if (IsInPolygon(xyz, triangle)) + { + boreholes1.Add(func(xyz)); + } + } + } + }); //foreach (int[] item in tris) //{ - + //} #endregion - boreholeList.AddRange(boreholes1); + boreholeList.AddRange(boreholes1); #region 计算地质块 List triIndexList = Common.Delaunay(boreholeList, 10000000 / 304.8); diff --git a/uBIMEarthTools/Ribbon.cs b/uBIMEarthTools/Ribbon.cs index f75b9a8..bdcf7aa 100644 --- a/uBIMEarthTools/Ribbon.cs +++ b/uBIMEarthTools/Ribbon.cs @@ -53,6 +53,9 @@ namespace uBIMEarthTools ReLoadLink_ButtonData.LargeImage = Icon(uBIMEarthTools.Properties.Resources.pyramid); sPanel.AddItem(ReLoadLink_ButtonData); + + ReLoadLink_ButtonData = new PushButtonData("Test", "Test", AddInPath, "uBIMEarthTools.Commands.Monitor.MonitorCommand"); + sPanel.AddItem(ReLoadLink_ButtonData); } private BitmapSource Icon(System.Drawing.Bitmap bitmap)