Exemplo n.º 1
1
    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();
    }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            try
            {

                string filename = @".\test.las";
                LASHeader hdr = new LASHeader();
                hdr.VersionMajor = 1;
                hdr.VersionMinor = 1;
                hdr.DataFormatId = (byte)LASHeader.PointFormat.ePointFormat1;
                hdr.PointRecordsCount = 1000; // should be corrected automatically by writer
                LASWriter laswriter = new LASWriter(filename, hdr, LASReadWriteMode.LASModeWrite);
                LASPoint p=new LASPoint();
                p.X = 10;
                p.Y = 20;
                p.Z = 30;
                laswriter.WritePoint(p);
                //File.Delete(filename);

            }
            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();
        }