コード例 #1
1
ファイル: Program.cs プロジェクト: GeospatialDaryl/libLAS
    static void Main(string[] args)
    {
        try
        {
            LASReader lasreader = new LASReader(@"c:\las\sample_our2.las");

            LASPoint laspoint;

            LASHeader lasheader = lasreader.GetHeader();
            Console.WriteLine(lasheader.SoftwareId);// 
            lasheader.VersionMinor = 0;
            LASWriter laswriter = new LASWriter(@"c:\las\sample_our.las", lasheader, LASReadWriteMode.LASModeWrite);

            Console.WriteLine("Number of points in file= {0}", lasheader.PointRecordsCount);

            while (lasreader.GetNextPoint())
            {
                laspoint = lasreader.GetPoint();
                laspoint.X = laspoint.X + 3;

                //Console.WriteLine(laspoint.X + "," + laspoint.Y + "," + laspoint.Z);

                laswriter.WritePoint(laspoint);
            }
        }
        catch (LASException e)
        {
            Console.WriteLine("\nLASException! Msg: {0}", e.Message);
        }
        catch (SystemException e)
        {
            Console.WriteLine("\nException! Msg: {0}", e.Message);
        }
        catch
        {
            Console.WriteLine("Unknown exception caught");
        }
        finally
        {
            Console.WriteLine("Do i need something to do?");
        }
        Console.WriteLine("End of file");
        Console.Read();
    }
コード例 #2
0
ファイル: ReadLAS.cs プロジェクト: GEO-IASS/libLAS
    static void Main(string[] args)
    {
        try
        {

            string filename = @"..\..\..\..\..\test\data\TO_core_last_zoom.las";
            LASReader lasreader = new LASReader(filename);
            LASHeader h = lasreader.GetHeader();
            Console.WriteLine("Version  : " + lasreader.GetVersion());
            Console.WriteLine("Signature: : " + h.FileSignature);
            Console.WriteLine("Format   : " + h.DataFormatId);
            Console.WriteLine("Project  : " + h.ProjectId);
            Console.WriteLine("Points count: " + h.PointRecordsCount);
            Console.WriteLine("VLRecords count: " + h.VariableLengthRecordsCount);
            int counter = 0;
            while (lasreader.GetNextPoint())
            {
                LASPoint laspoint = lasreader.GetPoint();
                counter += 1;
            }

            if (lasreader.GetHeader().PointRecordsCount != counter)
                throw new LASException("read incorrect number of point records");


        }
        catch (LASException e)
        {
            Console.WriteLine("\nLASException! Msg: {0}", e.Message);
        }
        catch (SystemException e)
        {
            Console.WriteLine("\nException! Msg: {0}", e.Message);
        }
        catch
        {
            Console.WriteLine("Unknown exception caught");
        }

        Console.WriteLine("End of file");
        Console.Read();
    }