Ejemplo n.º 1
0
        public static void TestPileQuery()
        {
            HCHXCodeQuery clr1 = new HCHXCodeQuery();

            ColumnLayerInfoArray columnLayerInfo = new ColumnLayerInfoArray();
            Point3d startPoint = new Point3d();
            Point3d endPoint   = new Point3d();

            startPoint.X = -1342015;
            startPoint.Y = 681099;
            startPoint.Z = 789160;

            endPoint.X = -1342015;
            endPoint.Y = 681099;
            endPoint.Z = -1264281;
            HCHXCodeQueryErrorCode status = clr1.QueryByRay(ref columnLayerInfo, startPoint, endPoint);

            OutputResult("D:\\Longe.txt", columnLayerInfo);


            ColumnLayerInfoArray columnLayerInfo1 = new ColumnLayerInfoArray();
            Point3d startPoint1 = new Point3d();
            Point3d endPoint1   = new Point3d();

            startPoint1.X = -942187;
            startPoint1.Y = 681099;
            startPoint1.Z = 789160;

            endPoint1.X = -942187;
            endPoint1.Y = 681099;
            endPoint1.Z = -588254;
            status      = clr1.QueryByRay(ref columnLayerInfo1, startPoint1, endPoint1);

            OutputResult("D:\\Small.txt", columnLayerInfo1);
        }
Ejemplo n.º 2
0
        public static void TestHCHXQueryLib()
        {
            HCHXCodeQuery clr1 = new HCHXCodeQuery();

            AllLayerInfo           idInfo = new AllLayerInfo();
            HCHXCodeQueryErrorCode status = clr1.QueryById(ref idInfo, "6782");

            OutputResult("D:\\QueryAllResult6782.txt", idInfo);


            status = clr1.QueryById(ref idInfo, "4358");
            OutputResult("D:\\QueryAllResult4358.txt", idInfo);

            ColumnLayerInfoArray columnLayerInfo = new ColumnLayerInfoArray();
            Point3d startPoint = new Point3d();
            Point3d endPoint   = new Point3d();

            startPoint.X = 173928.573996;
            startPoint.Y = 46617.477392;
            startPoint.Z = 36875.226081;

            endPoint.X = 28714.044367;
            endPoint.Y = 130457.125163;
            endPoint.Z = -801521.251635;
            status     = clr1.QueryByRay(ref columnLayerInfo, startPoint, endPoint);

            OutputResult("D:\\QueryAllResultRay.txt", columnLayerInfo);

            System.Windows.MessageBox.Show("Finished");
        }
Ejemplo n.º 3
0
        public static List <ColumnLayerInfo> GetSortedColumnLayerList(this ColumnLayerInfoArray colarray)
        {
            var layerList = from layer in colarray.m_layers
                            orderby layer.BasePosition.Z descending
                            select layer;

            return(layerList.ToList());
        }
Ejemplo n.º 4
0
        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 = "查找完成";
        }
Ejemplo n.º 5
0
        private static void OutputResult(string fileName, ColumnLayerInfoArray columnInfos)
        {
            if (null == columnInfos.m_layers)
            {
                return;
            }

            FileStream   fs = new FileStream(fileName, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);

            foreach (ColumnLayerInfo columnInfo in columnInfos.m_layers)
            {
                sw.Write(columnInfo.ToString());
            }

            sw.Flush();
            sw.Close();
            fs.Close();
        }
Ejemplo n.º 6
0
 public static HCHXCodeQueryErrorCode QueryByRay(this HCHXCodeQuery pilequery, ref ColumnLayerInfoArray result, BG.DSegment3d linesegement)
 {
     return(pilequery.QueryByRay(ref result, linesegement.StartPoint.DPoint3dToPoint3d(), linesegement.EndPoint.DPoint3dToPoint3d()));
 }