コード例 #1
0
        private static void UpdateFlatPoints(string[] allFiles)
        {
            long flatpointsloaded = 0;
            long totalpointsflat  = 0;
            var  start            = Stopwatch.StartNew();
            var  lastprogress     = 0;

            foreach (var path in allFiles)
            {
                using (var readerobj = new TcLasReader(path))
                {
                    totalpointsflat += readerobj.TotalPoints;
                }
            }

            Console.WriteLine(" Reading Flat Points {0}", totalpointsflat);
            Console.WriteLine("");

            foreach (var path in allFiles)
            {
                using (var readerobj = new TcLasReader(path))
                {
                    var pts    = readerobj.ReadPoints(readerobj.TotalPoints, readerobj.Header);
                    var length = (object)(FlatPoints.Length);

                    Array.Resize(ref FlatPoints, (FlatPoints.Length + pts.Length));

                    for (int i = 0; i < pts.Length; i++)
                    {
                        var pos = ((int)length + i);
                        var p   = pts[i];

                        FlatPoints[pos] = new TcReportPoint3D(p.X, p.Y, p.Z);
                    }

                    flatpointsloaded += readerobj.TotalPoints;
                }

                var percent = Clamp(
                    (int)Math.Ceiling((double)flatpointsloaded * 100
                                      / totalpointsflat), 0, 100);


                lastprogress = UpdateProgressBar(percent);
            }

            lastprogress = UpdateProgressBar(lastprogress);

            Console.WriteLine("");
            Console.WriteLine("");
            start.Stop();
            Console.WriteLine(" {0} Flat Points Loaded. - Finished {1} secs", flatpointsloaded, Math.Ceiling((double)start.ElapsedMilliseconds / 1000));
        }
コード例 #2
0
        public void CalculateReportPoints(Single prmZAdj)
        {
            Samples      = 0;
            ReportPoints = new TcReportPoint3D[HeightPointCount];

            var j = 0;

            foreach (var gcp in HeightPoints)
            {
                //no xy adjustments
                var subject   = new TcReportPoint3D(gcp.X - m_XAdjustment, gcp.Y - m_YAjustment, gcp.Z);
                var lidarNear = Tree.NearestNeighbours(subject, Program.options.Radius);

                //nearby lidar
                if (lidarNear.Count > 0)
                {
                    subject.LidarHeight = (float)Math.Round((float)lidarNear.Average(i => i.Z), 2);

                    Samples++;

                    //filter out bad quality points.
                    if (subject.Difference > c_QATolerance)
                    {
                        subject.Status = TePointStatus.BadQuality;
                    }
                    else
                    {
                        subject.Status = TePointStatus.Accepted;
                    }
                }
                else
                {
                    subject.Status = TePointStatus.NotCovered;
                }

                ReportPoints[j] = new TcReportPoint3D(m_Heights[j], subject.LidarHeight, prmZAdj, subject.Status)
                {
                    Id = j
                };
                j++;
            }

            // Update the average.
            List <Double> acceptedPoints = ReportPoints.Where(iter => iter.Status == TePointStatus.Accepted).Select(iter => iter.Difference).ToList();

            if (acceptedPoints.Count > 0)
            {
                m_AvgDifference = Math.Round(acceptedPoints.Average(), 2);
                m_Sigma         = (Single)Math.Round(TcMathUtil.StDev(acceptedPoints, m_AvgDifference), 2);
            }

            FilterBySigma(3);
        }
コード例 #3
0
        public TcReportPoint3D GetPoint(Double prmX, Double prmY)
        {
            Double rx = Math.Round(prmX, 2);
            Double ry = Math.Round(prmY, 2);

            if (Accepted.Count > 0)
            {
                TcReportPoint3D foundPoint = Accepted.FirstOrDefault(iter => iter.X == rx && iter.Y == ry);
                if (foundPoint != null)
                {
                    return(foundPoint);
                }
            }

            if (NotCovered.Count > 0)
            {
                TcReportPoint3D foundPoint = NotCovered.FirstOrDefault(iter => iter.X == rx && iter.Y == ry);
                if (foundPoint != null)
                {
                    return(foundPoint);
                }
            }

            if (NotFlat.Count > 0)
            {
                TcReportPoint3D foundPoint = NotFlat.FirstOrDefault(iter => iter.X == rx && iter.Y == ry);
                if (foundPoint != null)
                {
                    return(foundPoint);
                }
            }

            if (OutOfSigma.Count > 0)
            {
                TcReportPoint3D foundPoint = OutOfSigma.FirstOrDefault(iter => iter.X == rx && iter.Y == ry);
                if (foundPoint != null)
                {
                    return(foundPoint);
                }
            }

            return(null);
        }