//------------------------------------------------------------------ public TcTorObject GetTor() { TcTorObject returnObject = new TcTorObject(Info); returnObject.Blocks.AddRange(GetTorBlocks(Info)); return(returnObject); }
//------------------------------------------------------------------ public void Write(TcTorObject prmTor, String prmOutputFile) { m_TolObject = prmTor.Info; using (BinaryWriter writer = new BinaryWriter(new FileStream(prmOutputFile, FileMode.Create))) { WriteTol(prmOutputFile); foreach (TcTorBlock32 block in prmTor.Blocks) { Write(writer, block); } } }
//------------------------------------------------------------------ public void Write(TcTorObject prmTor) { Write(prmTor, prmTor.Info.TorFile); }
//----------------------------------------------------------------------------- /// <summary> /// This function reads the LAS file and arrange points into the specific grid. /// It also applies filtering for some given pre-defined gridding types. /// </summary> /// <typeparam name="T">Type of the LAS points</typeparam> /// <param name="prmReader">Tile LAS reader which reads LAS points by tile</param> /// <param name="prmObjects">A collection of grid data objects (1 per gridding type)</param> private void Grid <T>(TcTileLasReader prmReader, IEnumerable <TcGridObject> prmObjects) where T : TiLasPoint { TcLasPointBase[] points; TcTileBlockInfo info; for (int row = 0; row < m_Info.TileInfo.Row; row++) { for (int col = 0; col < m_Info.TileInfo.Col; col++) { if ((info = m_Info.TileBlocks.FirstOrDefault(iter => iter.Row == row && iter.Col == col)) != null) { points = prmReader.GetPointObjectsByTile <T>(row, col, m_LasHeader); foreach (TcGridObject gridObject in prmObjects) { // Report the message. ReportMessage(String.Format("Processing Tile({0},{1}) of {2} ({3}m)", row, col, TcEnums.ShortName(gridObject.Type), gridObject.GridSize)); // Filter points that are not required by 1M grid. if (gridObject.Type == TeGriddingType.M1FirstEcho || gridObject.Type == TeGriddingType.M1LastEcho) { FilterOutOfInterestPoints(points); } UpdateGrid(gridObject, info, points); } } } } foreach (TcGridObject gridObject in prmObjects) { // Write the tor file. TcTolObject objDiff = new TcTolObject(gridObject.OutputFile) { Rows = m_Info.TileInfo.Row * gridObject.GridCount, Columns = m_Info.TileInfo.Col * gridObject.GridCount, UpperLeftEast = m_LasHeader.MinX, UpperLeftNorth = m_LasHeader.MaxY, LowerRightEast = m_LasHeader.MaxX, LowerRightNorth = m_LasHeader.MinY, MinHeight = (Single)gridObject.MinZ, MaxHeight = (Single)gridObject.MaxZ, ScalingX = gridObject.GridSize, ScalingY = gridObject.GridSize, Model = m_CoordinateSystem, BitSize = 32 }; // Report the message. ReportMessage(String.Format("Writing {0}", Path.GetFileName(gridObject.OutputFile))); TcTorObject objTor = new TcTorObject(objDiff) { Blocks = gridObject.TorBlocks }; using (TcTorWriter writer = new TcTorWriter(objDiff)) { writer.WriteTol(); writer.Write(objTor); } } ReportFinished(); }