1
/******************************************************************************
4
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
5
* Purpose: Sample program demonstrating use of libLAS for .NET/Mono
6
* Author: Martin Vales, martin_gnu@mundo-r.com
8
******************************************************************************
9
* Copyright (c) 2008, Martin Vales
11
* All rights reserved.
13
* Redistribution and use in source and binary forms, with or without
14
* modification, are permitted provided that the following
17
* * Redistributions of source code must retain the above copyright
18
* notice, this list of conditions and the following disclaimer.
19
* * Redistributions in binary form must reproduce the above copyright
20
* notice, this list of conditions and the following disclaimer in
21
* the documentation and/or other materials provided
22
* with the distribution.
23
* * Neither the name of the Martin Isenburg or Iowa Department
24
* of Natural Resources nor the names of its contributors may be
25
* used to endorse or promote products derived from this software
26
* without specific prior written permission.
28
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
35
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
36
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
38
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
40
****************************************************************************/
49
static void Main(string[] args)
54
string filename = @"..\..\..\..\..\test\data\TO_core_last_zoom.las";
55
LASReader lasreader = new LASReader(filename);
56
LASHeader h = lasreader.GetHeader();
57
Console.WriteLine("Version : " + lasreader.GetVersion());
58
Console.WriteLine("Signature: : " + h.FileSignature);
59
Console.WriteLine("Format : " + h.DataFormatId);
60
Console.WriteLine("Project : " + h.ProjectId);
61
Console.WriteLine("Points count: " + h.PointRecordsCount);
62
Console.WriteLine("VLRecords count: " + h.VariableLengthRecordsCount);
64
while (lasreader.GetNextPoint())
66
LASPoint laspoint = lasreader.GetPoint();
70
if (lasreader.GetHeader().PointRecordsCount != counter)
71
throw new LASException("read incorrect number of point records");
75
catch (LASException e)
77
Console.WriteLine("\nLASException! Msg: {0}", e.Message);
79
catch (SystemException e)
81
Console.WriteLine("\nException! Msg: {0}", e.Message);
85
Console.WriteLine("Unknown exception caught");
88
Console.WriteLine("End of file");