Ejemplo n.º 1
0
        public TileRegionFilter(SQuantizedExtentGrid<int> grid, SQuantizedExtent3D quantizedExtent, GridRange tileRange)
        {
            m_range = tileRange;
            m_grid = grid;

            m_quantizedExtent = quantizedExtent;
        }
Ejemplo n.º 2
0
        public GridCounter(IPointCloudBinarySource source, SQuantizedExtentGrid<int> grid)
        {
            m_source = source;
            m_grid = grid;
            m_quantizedExtent = source.QuantizedExtent;

            m_chunkTiles = new List<int[]>();
        }
Ejemplo n.º 3
0
 public PointCloudBinarySource(FileHandlerBase file, long count, Extent3D extent, SQuantization3D quantization, long dataOffset, short pointSizeBytes)
     : base(file)
 {
     m_count = count;
     m_extent = extent;
     m_quantization = quantization;
     m_pointDataOffset = dataOffset;
     m_pointSizeBytes = pointSizeBytes;
     m_quantizedExtent = quantization.Convert(m_extent);
 }
        public PointCloudBinarySourceComposite(FileHandlerBase file, Extent3D extent, IPointCloudBinarySource[] sources)
            : base(file)
        {
            m_sources = sources;

            // verify that they are compatible

            m_count = m_sources.Sum(s => s.Count);
            m_extent = extent;
            m_quantization = m_sources[0].Quantization;
            m_pointSizeBytes = m_sources[0].PointSizeBytes;
            m_quantizedExtent = m_quantization.Convert(m_extent);
        }
Ejemplo n.º 5
0
        public unsafe void ComputeExtent(ProgressManager progressManager)
        {
            using (var process = progressManager.StartProcess("CalculateLASExtent"))
            {
                short pointSizeBytes = PointSizeBytes;

                int minX = 0, minY = 0, minZ = 0;
                int maxX = 0, maxY = 0, maxZ = 0;

                foreach (var chunk in GetBlockEnumerator(process))
                {
                    if (minX == 0 && maxX == 0)
                    {
                        var p = (SQuantizedPoint3D*)chunk.PointDataPtr;

                        minX = maxX = (*p).X;
                        minY = maxY = (*p).Y;
                        minZ = maxZ = (*p).Z;
                    }

                    byte* pb = chunk.PointDataPtr;
                    while (pb < chunk.PointDataEndPtr)
                    {
                        var p = (SQuantizedPoint3D*)pb;

                        if ((*p).X < minX) minX = (*p).X; else if ((*p).X > maxX) maxX = (*p).X;
                        if ((*p).Y < minY) minY = (*p).Y; else if ((*p).Y > maxY) maxY = (*p).Y;
                        if ((*p).Z < minZ) minZ = (*p).Z; else if ((*p).Z > maxZ) maxZ = (*p).Z;

                        pb += pointSizeBytes;
                    }

                    if (!process.Update(chunk))
                        break;
                }

                var quantizedExtent = new SQuantizedExtent3D(minX, minY, minZ, maxX, maxY, maxZ);
                m_extent = m_header.Quantization.Convert(quantizedExtent);

                process.LogTime("Traversed {0:0,0} points", Count);
            }
        }
Ejemplo n.º 6
0
        private static unsafe BitmapSource CreateBitmapSource(Grid<int> grid, SQuantizedExtent3D extent, QuantizedStatistics statistics, bool useStdDevStretch, IColorHandler colorHandler, int quality)
        {
            var ramp = colorHandler as ColorRamp;
            var map = colorHandler as ColorMapDistinct;

            var bmp = new WriteableBitmap(grid.SizeX, grid.SizeY, 96, 96, System.Windows.Media.PixelFormats.Bgra32, null);
            bmp.Lock();
            var pBackBuffer = bmp.BackBuffer;
            var p = (int*)pBackBuffer;

            if (map != null)
            {
                //CreateColorBufferMap(grid, p, map);
            }
            else
            {
                if (ramp == null)
                    ramp = ColorRamp.PredefinedColorRamps.Grayscale;

                var qualityRatio = (float)quality / 100;
                var rampSize = (int)(qualityRatio * 300);

                StretchBase stretch = null;
                if(useStdDevStretch)
                    stretch = new StdDevStretch(extent.MinZ, extent.MaxZ, statistics, 2);
                else
                    stretch = new MinMaxStretch(extent.MinZ, extent.MaxZ);

                var cachedRamp = ramp.CreateCachedRamp(stretch, rampSize);

                //var sw = Stopwatch.StartNew();
                //int count = 300;
                //for (int i = 0; i < count; i++)
                {
                    CreateColorBufferMap(grid, p, cachedRamp);
                }
                //sw.Stop();
                //Context.WriteLine("fps: {0}", (double)1000 * count / sw.ElapsedMilliseconds);
            }

            bmp.AddDirtyRect(new System.Windows.Int32Rect(0, 0, bmp.PixelWidth, bmp.PixelHeight));
            bmp.Unlock();
            bmp.Freeze();

            return bmp;
        }