示例#1
0
        //-----------------------------------------------------------------------------

        public LasPoint2[] GetPointsByTile(String prmInput, Int32 prmRow, Int32 prmCol)
        {
            String blockFile = String.Format(@"{0}\{1}.xml", Path.GetDirectoryName(prmInput), Path.GetFileNameWithoutExtension(prmInput));
            TcTileBlockInfoCollection tileInfoCollection = TcTileUtils.GetTileBlocks(blockFile);

            IEnumerable <TcTileBlockInfo> blocks = tileInfoCollection.TileBlocks.Where(iter => iter.Row == prmRow && iter.Col == prmCol);
            Int32 numberOfPoints = blocks.Aggregate(0, (result, iter) => result += iter.NoOfPoints);

            using (TcLasReader reader = new TcLasReader(prmInput))
            {
                LasHeader   header     = reader.GetHeaderOld();
                LasPoint2[] points     = new LasPoint2[numberOfPoints];
                Int32       arrayStart = 0;
                foreach (TcTileBlockInfo info in blocks)
                {
                    if (reader.GetLasBlock(ref points, arrayStart, info.StartPoint, info.NoOfPoints, header))
                    {
                        arrayStart += info.NoOfPoints;
                    }
                    else
                    {
                        throw new Exception(String.Format("Couldn't read the las tile ({0},{1})", prmRow, prmCol));
                    }
                }
                return(points);
            }
        }
示例#2
0
        //-----------------------------------------------------------------------------

        /// <summary>
        /// Open function to produce a list of grid files.
        /// </summary>
        /// <param name="prmInput">Input las file</param>
        /// <param name="prmGridTypes">List of grid types</param>
        /// <param name="prmGridSizes">List of grid sizes</param>
        public void Grid(String prmInput, IEnumerable <TeGriddingType> prmGridTypes, IEnumerable <Int32> prmGridSizes)
        {
            List <TcGridObject> gridObjects = new List <TcGridObject>(prmGridTypes.Count() + prmGridSizes.Count());
            String xmlFile = String.Format(@"{0}\{1}.xml", Path.GetDirectoryName(prmInput), Path.GetFileNameWithoutExtension(prmInput));

            m_Info = TcTileUtils.GetTileBlocks(xmlFile);

            // Type defined las tiling.
            foreach (TeGriddingType type in prmGridTypes)
            {
                String outputFile = String.Format(@"{0}\{1}_{2}.tor"
                                                  , m_OutputDirectory
                                                  , Path.GetFileNameWithoutExtension(prmInput)
                                                  , TcEnums.ShortName(type));
                gridObjects.Add(new TcGridObject(outputFile, type, m_Info));
            }

            // Type defined las tiling.
            foreach (Int32 size in prmGridSizes.Distinct())
            {
                String outputFile = String.Format(@"{0}\{1}_m{2}.tor"
                                                  , m_OutputDirectory
                                                  , Path.GetFileNameWithoutExtension(prmInput)
                                                  , size);

                gridObjects.Add(new TcGridObject(outputFile, size, m_Info));
            }

            Grid(prmInput, gridObjects);
        }
示例#3
0
        public TcIndexedLasInfo(String prmFile)
        {
            LasFile   = prmFile;
            IndexFile = String.Format(@"{0}\{1}.xml", Path.GetDirectoryName(LasFile), Path.GetFileNameWithoutExtension(LasFile));

            if (File.Exists(IndexFile))
            {
                TileInfoCollection = TcTileUtils.GetTileBlocks(IndexFile);
            }
        }
示例#4
0
        //-----------------------------------------------------------------------------

        /// <summary>
        /// Open function to produce a single grid file with a given type.
        /// </summary>
        /// <param name="prmInput">Input las file</param>
        /// <param name="prmOutputFileName">Output tor file name</param>
        /// <param name="prmGridSize">Size of the grid</param>
        public void Grid(String prmInput, String prmOutputFileName, Int32 prmGridSize)
        {
            // Start of the actual function.
            String blockFile = String.Format(@"{0}\{1}.xml", Path.GetDirectoryName(prmInput), Path.GetFileNameWithoutExtension(prmInput));

            m_Info = TcTileUtils.GetTileBlocks(blockFile);

            String outputFile = String.Format(@"{0}\{1}", m_OutputDirectory, prmOutputFileName);

            Grid(prmInput, new List <TcGridObject>(1)
            {
                new TcGridObject(outputFile, prmGridSize, m_Info)
            });
        }