public TileRegionFilter(SQuantizedExtentGrid <int> grid, SQuantizedExtent3D quantizedExtent, GridRange tileRange) { m_range = tileRange; m_grid = grid; m_quantizedExtent = quantizedExtent; }
public TileRegionFilter(SQuantizedExtentGrid<int> grid, SQuantizedExtent3D quantizedExtent, GridRange tileRange) { m_range = tileRange; m_grid = grid; m_quantizedExtent = quantizedExtent; }
public GridCounter(IPointCloudBinarySource source, SQuantizedExtentGrid<int> grid) { m_source = source; m_grid = grid; m_quantizedExtent = source.QuantizedExtent; m_chunkTiles = new List<int[]>(); }
public GridCounter(IPointCloudBinarySource source, SQuantizedExtentGrid <int> grid) { m_source = source; m_grid = grid; m_quantizedExtent = source.QuantizedExtent; m_chunkTiles = new List <int[]>(); }
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); }
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); }
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); }
public PointCloudTileSet(IPointCloudBinarySource source, PointCloudTileDensity density, SQuantizedExtentGrid <int> tileCounts, Grid <int> lowResCounts) { Extent = source.Extent; Quantization = source.Quantization; QuantizedExtent = source.QuantizedExtent; Density = density; Cols = tileCounts.SizeX; Rows = tileCounts.SizeY; TileSizeX = tileCounts.CellSizeX; TileSizeY = tileCounts.CellSizeY; //TileSize = tileCounts.CellSize; PointCount = density.PointCount; TileCount = density.TileCount; ValidTileCount = density.ValidTileCount; LowResCount = 0; m_tileIndex = CreateTileIndex(ValidTileCount); m_tiles = new PointCloudTile[density.ValidTileCount]; // create valid tiles (in order) long offset = 0; int validTileIndex = 0; foreach (var tile in GetTileOrdering(Rows, Cols)) { int pointCount = tileCounts.Data[tile.Row, tile.Col]; if (pointCount > 0) { var lowResCount = lowResCounts.Data[tile.Row, tile.Col]; m_tiles[validTileIndex] = new PointCloudTile(this, tile.Col, tile.Row, validTileIndex, offset, pointCount, LowResCount, lowResCount); m_tileIndex.Add(tile.Index, validTileIndex); ++validTileIndex; offset += (pointCount - lowResCount); LowResCount += lowResCount; } } }
public PointCloudTileSet(BinaryReader reader) { Rows = reader.ReadUInt16(); Cols = reader.ReadUInt16(); TileSizeY = reader.ReadInt32(); TileSizeX = reader.ReadInt32(); TileCount = Rows * Cols; Extent = reader.ReadExtent3D(); Quantization = reader.ReadSQuantization3D(); QuantizedExtent = Quantization.Convert(Extent); Density = reader.ReadTileDensity(); PointCount = Density.PointCount; ValidTileCount = Density.ValidTileCount; LowResCount = 0; m_tileIndex = CreateTileIndex(ValidTileCount); m_tiles = new PointCloudTile[ValidTileCount]; // fill in valid tiles (dense) long pointOffset = 0; var i = 0; foreach (var tile in GetTileOrdering(Rows, Cols)) { var pointCount = reader.ReadInt32(); var lowResCount = reader.ReadInt32(); if (pointCount > 0) { m_tiles[i] = new PointCloudTile(this, tile.Col, tile.Row, i, pointOffset, pointCount, LowResCount, lowResCount); m_tileIndex.Add(tile.Index, i); pointOffset += (pointCount - lowResCount); LowResCount += lowResCount; ++i; } } }
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); } }
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; }
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); } }