public void SearchByRay() { Info = ""; Point3d startPoint = ParseStringToPoint3d(StartPoint); Point3d endPoint = ParseStringToPoint3d(EndPoint); ColumnLayerInfoArray columnLayerInfo = new ColumnLayerInfoArray(); HCHXCodeQueryErrorCode status = PileQuery.QueryByRay(ref columnLayerInfo, startPoint, endPoint); if (status != HCHXCodeQueryErrorCode.Success) { System.Windows.MessageBox.Show($"查找出现错误!\n{status}", "查找出现错误", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); return; } var columnLayerList = columnLayerInfo.GetSortedColumnLayerList(); Pile = new PileInfoClass(); Pile.SoilInfo = new ObservableCollection <SoilInfoClass>(); Pile.PileId = -1; Pile.PileCode = $"此为虚拟桩\n顶部坐标为:{StartPoint}\r\n底部坐标为:{EndPoint}\n"; Pile.PileDiameter = 1000; Pile.PileLength = GetLengthByVertex(startPoint, endPoint); Pile.CalParameter = new CalculateParameter { GammaR = 1.2 }; var random = new Random(); //测试 for (int i = 0; i < columnLayerList.Count; i++) { double pileinsoilLenght; if (i == columnLayerList.Count - 1) { pileinsoilLenght = GetLengthByVertex(columnLayerList[i].TopPosition, ParseStringToPoint3d(EndPoint)); } else { pileinsoilLenght = GetLengthByVertex(columnLayerList[i].TopPosition, columnLayerList[i + 1].TopPosition); } Pile.SoilInfo.Add(new SoilInfoClass(columnLayerList[i].IntersectLayerInfo.Category, columnLayerList[i].IntersectLayerInfo.UserCode, pileinsoilLenght * 1e-4, random.NextDouble() * 10 + 100, random.NextDouble() * 10 * +100)); } //foreach (var columnInfo in columnLayerInfo.m_layers) //{ // Pile.SoilInfo.Add(new SoilInfoClass(columnInfo.IntersectLayerInfo.Category, columnInfo.IntersectLayerInfo.UserCode, columnInfo.TopPosition, columnInfo.BasePosition)); //} Info = "查找完成"; }
protected override void OnInitializeInRuntime() { base.OnInitializeInRuntime(); Pile = new PileInfoClass { PileId = 924, PileCode = "Test", PileDiameter = 10, //PileTypeInfo = Models.PileType.Filling, SoilInfo = new ObservableCollection <SoilInfoClass>() { new SoilInfoClass() { SoilLayerName = "layer1", SoilLayerNum = "0-0" }, new SoilInfoClass() { SoilLayerName = "layer2", SoilLayerNum = "0-1" } }, CalParameter = new CalculateParameter { GammaR = 1.2 } }; SPanel = new List <SearchPanel>() { new SearchPanel() { Name = "根据桩ID获取", Type = SearchType.ById }, new SearchPanel() { Name = "根据虚拟射线获取", Type = SearchType.ByRay } }; SearchId = "924"; StartPoint = "(173928.573996,46617.477392,36875.226081)"; EndPoint = "(28714.044367,130457.125163,-801521.251635)"; }