1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
using System;
using System.Collections.Generic;
using System.Text;
using LibLAS;
using System.IO;
namespace WriteLAS
{
public class WriteLAS
{
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();
}
}
}
|