~ubuntu-branches/ubuntu/trusty/liblas/trusty-proposed

« back to all changes in this revision

Viewing changes to csharp/dotnetLibLAS/LASHeader.cs

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2014-01-05 17:00:29 UTC
  • mfrom: (7.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140105170029-ddtp0j63x5jvck2u
Tags: 1.7.0+dfsg-2
Fixed missing linking of system boost component.
(closes: #733282)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 * $Id$ 
 
3
 *
 
4
 * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
 
5
 * Purpose:  
 
6
 * Author:   Martin Vales, martin_gnu@mundo-r.com
 
7
 *
 
8
 ******************************************************************************
 
9
 * Copyright (c) 2008, Martin Vales
 
10
 *
 
11
 * All rights reserved.
 
12
 * 
 
13
 * Redistribution and use in source and binary forms, with or without 
 
14
 * modification, are permitted provided that the following 
 
15
 * conditions are met:
 
16
 * 
 
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.
 
27
 * 
 
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 
 
39
 * OF SUCH DAMAGE.
 
40
 ****************************************************************************/
 
41
 
 
42
using System;
 
43
using System.Collections.Generic;
 
44
using System.Text;
 
45
using LASError = System.Int32;
 
46
using LASWriterH = System.IntPtr;
 
47
using LASReaderH = System.IntPtr;
 
48
using LASPointH = System.IntPtr;
 
49
using LASGuidH = System.IntPtr;
 
50
using LASVLRH = System.IntPtr;
 
51
using LASHeaderH = System.IntPtr;
 
52
 
 
53
namespace LibLAS
 
54
{
 
55
    /// <summary>
 
56
    /// LASHeader class
 
57
    /// </summary>
 
58
    public class LASHeader : IDisposable
 
59
    {
 
60
 
 
61
        /// <summary>
 
62
        /// The object user should call this method when they finished with the object.
 
63
        /// In .NET is magaged by the GC.
 
64
        /// </summary>
 
65
        public void Dispose()
 
66
        {
 
67
 
 
68
            CAPI.LASHeader_Destroy(hHeader);
 
69
            // Clean up unmanaged resources here.
 
70
            // Dispose other contained disposable objects.
 
71
        }
 
72
 
 
73
        enum FormatVersion
 
74
        {
 
75
            /// Minimum of major component
 
76
            eVersionMajorMin = 1,
 
77
            ///Maximum of major component        
 
78
            eVersionMajorMax = 1,
 
79
            /// Minimum of minor component
 
80
            eVersionMinorMin = 0,
 
81
            /// Maximum of minor component
 
82
            eVersionMinorMax = 1
 
83
        };
 
84
 
 
85
        /// Versions of point record format.
 
86
        public enum PointFormat
 
87
        {
 
88
            ///Point Data Format \e 0
 
89
            ePointFormat0 = 0,
 
90
            /// Point Data Format \e 1
 
91
            ePointFormat1 = 1
 
92
        };
 
93
 
 
94
        /// Number of bytes of point record storage in particular format.
 
95
        public enum PointSize
 
96
        {
 
97
            ///Size of point record in data format \e 0
 
98
            ePointSize0 = 20,
 
99
            /// Size of point record in data format \e 1
 
100
            ePointSize1 = 28
 
101
        };
 
102
 
 
103
        //// Official signature of ASPRS LAS file format, always \b "LASF".
 
104
        //public static readonly string FileSignature_;
 
105
 
 
106
        //// Default system identifier used by libLAS, always \b "libLAS".
 
107
        //public static readonly string SystemIdentifier;
 
108
 
 
109
        ////Default software identifier used by libLAS, always \b "libLAS X.Y".
 
110
        //public static readonly string SoftwareIdentifier;
 
111
 
 
112
        private LASHeaderH hHeader;
 
113
 
 
114
        /// <summary>
 
115
        /// gets the opaque pointer to the LASHeaderH instance.
 
116
        /// </summary>
 
117
        /// <returns>opaque pointer to the LASHeaderH instance.</returns>
 
118
        internal LASHeaderH GetPointer()
 
119
        {
 
120
            return hHeader;
 
121
        }
 
122
 
 
123
        /// <summary>
 
124
        /// LASHeader constructor using the LASHeaderH opaque pointer.
 
125
        /// </summary>
 
126
        /// <param name="hLASHeader"></param>
 
127
        public LASHeader(LASHeaderH hLASHeader)
 
128
        {
 
129
            hHeader = hLASHeader;
 
130
        }
 
131
 
 
132
        /// <summary>
 
133
        /// Default constructor.
 
134
        /// </summary>
 
135
        /// <remarks>The default constructed header is configured according
 
136
        /// to the ASPRS LAS 1.1 Specification, point data format set to 0.
 
137
        /// Other fields filled with 0.</remarks>
 
138
        public LASHeader()
 
139
        {
 
140
            hHeader = CAPI.LASHeader_Create();
 
141
        }
 
142
 
 
143
        /// <summary>
 
144
        /// Copy the LASHeader in a new instance
 
145
        /// </summary>
 
146
        /// <returns>new LASHeader instance.</returns>
 
147
        public LASHeader Copy()
 
148
        {
 
149
            return new LASHeader(CAPI.LASHeader_Copy(hHeader));
 
150
        }
 
151
 
 
152
        /// <summary>
 
153
        /// Destroy the unmanaged resources to the instance.
 
154
        /// </summary>
 
155
        /// <remarks>The user could call this method when they finished with the object.</remarks>
 
156
        public void Destroy()
 
157
        {
 
158
            CAPI.LASHeader_Destroy(hHeader);
 
159
        }
 
160
 
 
161
        /// <summary>
 
162
        /// Comparison overload to the LASHeader
 
163
        /// </summary>
 
164
        /// <param name="lasHeader1">LASHeader instance to be compared</param>
 
165
        /// <param name="lasHeader2">LASHeader instance to be compared</param>
 
166
        /// <returns>true if lasHeader1==lasHeader2</returns>
 
167
        public static bool operator ==(LASHeader lasHeader1, LASHeader lasHeader2)
 
168
        {
 
169
            return lasHeader1.Equals(lasHeader2);
 
170
        }
 
171
 
 
172
        /// <summary>
 
173
        /// Comparison overload to the LASHeader
 
174
        /// </summary>
 
175
        /// <param name="lasHeader1">LASHeader instance to be compared</param>
 
176
        /// <param name="lasHeader2">LASHeader instance to be compared</param>
 
177
        /// <returns></returns>
 
178
        public static bool operator !=(LASHeader lasHeader1, LASHeader lasHeader2)
 
179
        {
 
180
            return !(lasHeader1 == lasHeader2);
 
181
        }
 
182
 
 
183
        /// <summary>
 
184
        /// Get ASPRS LAS file signature.
 
185
        /// </summary>
 
186
        /// <remarks>The only value allowed as file signature is "LASF",</remarks>
 
187
        public string FileSignature
 
188
        {
 
189
            get
 
190
            {
 
191
                return CAPI.LASHeader_GetFileSignature(hHeader);
 
192
            }
 
193
        }
 
194
 
 
195
        /// <summary>
 
196
        /// file source identifier.
 
197
        /// </summary>
 
198
        /// <remarks> should be set to a value between 1 and 65535.</remarks>
 
199
        public UInt16 FileSourceId
 
200
        {
 
201
            get
 
202
            {
 
203
                return CAPI.LASHeader_GetFileSourceId(hHeader);
 
204
            }
 
205
            set
 
206
            {
 
207
                LASError error = CAPI.LASHeader_SetFileSourceId(hHeader, value);
 
208
                if ((Int32)error != 0)
 
209
                {
 
210
                    LASException e = new LASException("Exception in Set Header SetFileSourceId.");
 
211
                    throw e;
 
212
                }
 
213
            }
 
214
        }
 
215
 
 
216
        /// <summary>
 
217
        /// Get value field reserved by the ASPRS LAS Specification.
 
218
        /// </summary>
 
219
        /// <remarks>This field is always filled with 0.</remarks>
 
220
        public Int16 Reserved
 
221
        {
 
222
            get
 
223
            {
 
224
                return CAPI.LASHeader_GetReserved(hHeader);
 
225
            }
 
226
        }
 
227
 
 
228
        /// <summary>
 
229
        /// Get project identifier.
 
230
        /// </summary>
 
231
        /// <remarks>return Global Unique Identifier.</remarks>
 
232
        public String ProjectId
 
233
        {
 
234
            get
 
235
            {
 
236
                return CAPI.LASHeader_GetProjectId(hHeader);
 
237
            }
 
238
        }
 
239
 
 
240
        /// <summary>
 
241
        /// major component of version of LAS format.
 
242
        /// </summary>
 
243
        /// <remarks>Always 1 as the only valid value. value between
 
244
        /// eVersionMajorMin and eVersionMajorMax (always 1).</remarks>
 
245
        public byte VersionMajor
 
246
        {
 
247
            get
 
248
            {
 
249
                return CAPI.LASHeader_GetVersionMajor(hHeader);
 
250
            }
 
251
            set
 
252
            {
 
253
                LASError error = CAPI.LASHeader_SetVersionMajor(hHeader, value);
 
254
                if ((Int32)error != 0)
 
255
                {
 
256
                    LASException e = new LASException("Exception in Set Header VersionMajor.");
 
257
                    throw e;
 
258
                }
 
259
            }
 
260
        }
 
261
 
 
262
        /// <summary>
 
263
        /// minor component of version of LAS format.
 
264
        /// </summary>
 
265
        /// <remarks>Valid values are 1 or 0. value between
 
266
        /// eVersionMinorMin and eVersionMinorMax.</remarks>
 
267
        public byte VersionMinor
 
268
        {
 
269
            get
 
270
            {
 
271
 
 
272
                return CAPI.LASHeader_GetVersionMinor(hHeader);
 
273
            }
 
274
            set
 
275
            {
 
276
                LASError error = CAPI.LASHeader_SetVersionMinor(hHeader, value);
 
277
                if ((Int32)error != 0)
 
278
                {
 
279
                    LASException e = new LASException("Exception in Set Header VersionMinor.");
 
280
                    throw e;
 
281
                }
 
282
            }
 
283
        }
 
284
 
 
285
        /// <summary>
 
286
        /// system identifier
 
287
        /// </summary>
 
288
        /// <remarks>Default value is "libLAS" specified as the SystemIdentifier constant.
 
289
        /// string is padded right with spaces and its length is 32 bytes.</remarks>
 
290
        public String SystemId
 
291
        {
 
292
            get
 
293
            {
 
294
                return CAPI.LASHeader_GetSystemId(hHeader);
 
295
            }
 
296
            set
 
297
            {
 
298
                LASError error = CAPI.LASHeader_SetSystemId(hHeader, value);
 
299
                if ((Int32)error != 0)
 
300
                {
 
301
                    LASException e = new LASException("Exception in Set Header SystemId.");
 
302
                    throw e;
 
303
                }
 
304
            }
 
305
        }
 
306
 
 
307
        /// <summary>
 
308
        /// software identifier
 
309
        /// </summary>
 
310
        /// <remarks>Default value is "libLAS 1.0", specified as the SoftwareIdentifier constant.
 
311
        /// String is padded right with spaces and its length is 32 bytes.</remarks>
 
312
        public String SoftwareId
 
313
        {
 
314
            get
 
315
            {
 
316
 
 
317
                return CAPI.LASHeader_GetSoftwareId(hHeader);
 
318
            }
 
319
            set
 
320
            {
 
321
                LASError error = CAPI.LASHeader_SetSoftwareId(hHeader, value);
 
322
                if ((Int32)error != 0)
 
323
                {
 
324
                    LASException e = new LASException("Exception in Set Header SoftwareId.");
 
325
                    throw e;
 
326
                }
 
327
            }
 
328
        }
 
329
 
 
330
        /// <summary>
 
331
        /// day of year of file creation date.
 
332
        /// </summary>
 
333
        /// <remarks>Use full date structure instead of Julian date number.
 
334
        /// value is lower than number 366.</remarks>
 
335
        public UInt16 CreationDOY
 
336
        {
 
337
            get
 
338
            {
 
339
                return CAPI.LASHeader_GetCreationDOY(hHeader);
 
340
            }
 
341
            set
 
342
            {
 
343
                LASError error = CAPI.LASHeader_SetCreationDOY(hHeader, value);
 
344
                if ((Int32)error != 0)
 
345
                {
 
346
                    LASException e = new LASException("Exception in Set Header CreationDOY.");
 
347
                    throw e;
 
348
                }
 
349
            }
 
350
        }
 
351
 
 
352
        /// <summary>
 
353
        /// year of file creation date.
 
354
        /// </summary>
 
355
        /// <remarks>value is lower than number 9999.</remarks>
 
356
        public UInt16 CreationYear
 
357
        {
 
358
            get
 
359
            {
 
360
                return CAPI.LASHeader_GetCreationYear(hHeader);
 
361
            }
 
362
            set
 
363
            {
 
364
                LASError error = CAPI.LASHeader_SetCreationYear(hHeader, value);
 
365
                if ((Int32)error != 0)
 
366
                {
 
367
                    LASException e = new LASException("Exception in Set Header CreationYear.");
 
368
                    throw e;
 
369
                }
 
370
            }
 
371
        }
 
372
 
 
373
        /// <summary>
 
374
        /// number of bytes of generic verion of public header block storage.
 
375
        /// </summary>
 
376
        /// <remarks>Standard version of the public header block is 227 bytes long.</remarks>
 
377
        public UInt16 HeaderSize
 
378
        {
 
379
            get
 
380
            {
 
381
                return CAPI.LASHeader_GetHeaderSize(hHeader);
 
382
            }
 
383
        }
 
384
 
 
385
        /// <summary>
 
386
        /// number of bytes from the beginning to the first point record.
 
387
        /// </summary>
 
388
        public UInt32 DataOffset
 
389
        {
 
390
            get
 
391
            {
 
392
                return CAPI.LASHeader_GetDataOffset(hHeader);
 
393
            }
 
394
        }
 
395
 
 
396
        /// <summary>
 
397
        /// Returns the number of variable length records in the header
 
398
        /// </summary>
 
399
        public UInt32 VariableLengthRecordsCount
 
400
        {
 
401
            get
 
402
            {
 
403
                return CAPI.LASHeader_GetRecordsCount(hHeader);
 
404
            }
 
405
        }
 
406
 
 
407
        /// <summary>
 
408
        /// the data format id for the file.  
 
409
        /// </summary>
 
410
        /// <remarks>The value should be 1 or 0, with 1 being points that contain
 
411
        /// time values and 0 being points that do not.</remarks>
 
412
        public byte DataFormatId
 
413
        {
 
414
            get
 
415
            {
 
416
                return CAPI.LASHeader_GetDataFormatId(hHeader);
 
417
            }
 
418
            set
 
419
            {
 
420
                LASError error = CAPI.LASHeader_SetDataFormatId(hHeader, value);
 
421
                if ((Int32)error != 0)
 
422
                {
 
423
                    LASException e = new LASException("Exception in Set Header DataFormatId.");
 
424
                    throw e;
 
425
                }
 
426
            }
 
427
        }
 
428
 
 
429
        /// <summary>
 
430
        /// return the record length for the points based on their data format id in bytes.
 
431
        /// </summary>
 
432
        public UInt16 DataRecordLength
 
433
        {
 
434
            get
 
435
            {
 
436
                return CAPI.LASHeader_GetDataRecordLength(hHeader);
 
437
            }
 
438
        }
 
439
 
 
440
        /// <summary>
 
441
        /// number of point records in the file.  
 
442
        /// </summary>
 
443
        /// <remarks>This value may not reflect the actual number of point
 
444
        /// records in the file.</remarks>
 
445
        public UInt32 PointRecordsCount
 
446
        {
 
447
            get
 
448
            {
 
449
                //Get total number of point records stored in the LAS file.
 
450
                return CAPI.LASHeader_GetPointRecordsCount(hHeader);
 
451
            }
 
452
            set
 
453
            {
 
454
                //Set number of point records that will be stored in a new LAS file.
 
455
                LASError error = CAPI.LASHeader_SetPointRecordsCount(hHeader, value);
 
456
                if ((Int32)error != 0)
 
457
                {
 
458
                    LASException e = new LASException("Exception in Set Header PointRecordsCount.");
 
459
                    throw e;
 
460
                }
 
461
            }
 
462
        }
 
463
 
 
464
        /// <summary>
 
465
        /// Returns the number of point records by return.
 
466
        /// </summary>
 
467
        /// <param name="index">the return number to fetch the count for</param>
 
468
        /// <returns>the number of point records for a given return</returns>
 
469
        public UInt32 GetPointRecordsByReturnCount(int index)
 
470
        {
 
471
            // Get array of the total point records per return.
 
472
            return CAPI.LASHeader_GetPointRecordsByReturnCount(hHeader, index);
 
473
        }
 
474
 
 
475
        //    /// Set values of 5-elements array of total point records per return.
 
476
        //    /// \exception std::out_of_range - if index is bigger than 4.
 
477
        //    /// \param index - subscript (0-4) of array element being updated.
 
478
        //    /// \param v - new value to assign to array element identified by index.
 
479
        /// <summary>
 
480
        /// Sets the number of point records for a given return
 
481
        /// </summary>
 
482
        /// <param name="index">the return number to set the count for</param>
 
483
        /// <param name="value">the number of point records for the return </param>
 
484
        public void SetPointRecordsByReturnCount(int index, UInt32 value)
 
485
        {
 
486
            LASError error = CAPI.LASHeader_SetPointRecordsByReturnCount(hHeader, index, value);
 
487
            if ((Int32)error != 0)
 
488
            {
 
489
                LASException e = new LASException("Exception in Set Header SetPointRecordsByReturnCount.");
 
490
                throw e;
 
491
            }
 
492
        }
 
493
 
 
494
        /// <summary>
 
495
        /// Get scale factor for X coordinate.
 
496
        /// </summary>
 
497
        /// <returns>scale factor for X coordinate.</returns>
 
498
        public double GetScaleX()
 
499
        {
 
500
            return CAPI.LASHeader_GetScaleX(hHeader);
 
501
        }
 
502
 
 
503
        /// <summary>
 
504
        /// Get scale factor for Y coordinate.
 
505
        /// </summary>
 
506
        /// <returns>scale factor for Y coordinate.</returns>
 
507
        public double GetScaleY()
 
508
        {
 
509
            return CAPI.LASHeader_GetScaleY(hHeader);
 
510
        }
 
511
 
 
512
        /// <summary>
 
513
        /// Get scale factor for Z coordinate.
 
514
        /// </summary>
 
515
        /// <returns>scale factor for Z coordinate.</returns>
 
516
        public double GetScaleZ()
 
517
        {
 
518
            return CAPI.LASHeader_GetScaleZ(hHeader);
 
519
        }
 
520
 
 
521
        /// <summary>
 
522
        /// Set values of scale factor for X, Y and Z coordinates.
 
523
        /// </summary>
 
524
        /// <param name="x">X scale factor of the coordinate</param>
 
525
        /// <param name="y">Y scale factor of the coordinate</param>
 
526
        /// <param name="z">Z scale factor of the coordinate</param>
 
527
        public void SetScale(double x, double y, double z)
 
528
        {
 
529
            LASError error = CAPI.LASHeader_SetScale(hHeader, x, y, z);
 
530
            if ((Int32)error != 0)
 
531
            {
 
532
                LASException e = new LASException("Exception in Set Header SetScale.");
 
533
                throw e;
 
534
            }
 
535
        }
 
536
 
 
537
        /// <summary>
 
538
        /// Get X coordinate offset.
 
539
        /// </summary>
 
540
        /// <returns>X coordinate offset.</returns>
 
541
        public double GetOffsetX()
 
542
        {
 
543
            return CAPI.LASHeader_GetOffsetX(hHeader);
 
544
        }
 
545
 
 
546
        /// <summary>
 
547
        /// Get Y coordinate offset.
 
548
        /// </summary>
 
549
        /// <returns>Y coordinate offset.</returns>
 
550
        public double GetOffsetY()
 
551
        {
 
552
            return CAPI.LASHeader_GetOffsetY(hHeader);
 
553
        }
 
554
 
 
555
        /// <summary>
 
556
        /// Get Z coordinate offset.
 
557
        /// </summary>
 
558
        /// <returns>Z coordinate offset.</returns>
 
559
        public double GetOffsetZ()
 
560
        {
 
561
            return CAPI.LASHeader_GetOffsetZ(hHeader);
 
562
        }
 
563
 
 
564
        //Set values of X, Y and Z coordinates offset.
 
565
        /// <summary>
 
566
        /// Set values of X, Y and Z coordinates offset.
 
567
        /// </summary>
 
568
        /// <param name="x">X coordinate offset.</param>
 
569
        /// <param name="y">Y coordinate offset.</param>
 
570
        /// <param name="z">Z coordinate offset.</param>
 
571
        public void SetOffset(double x, double y, double z)
 
572
        {
 
573
            LASError error = CAPI.LASHeader_SetOffset(hHeader, x, y, z);
 
574
            if ((Int32)error != 0)
 
575
            {
 
576
                LASException e = new LASException("Exception in Set Header SetOffset.");
 
577
                throw e;
 
578
            }
 
579
        }
 
580
 
 
581
        /// <summary>
 
582
        /// Get maximum value of extent of X coordinate.
 
583
        /// </summary>
 
584
        /// <returns>maximum value of extent of X coordinate.</returns>
 
585
        public double MaxX()
 
586
        {
 
587
            return CAPI.LASHeader_GetMaxX(hHeader);
 
588
        }
 
589
 
 
590
        /// <summary>
 
591
        /// Get maximum value of extent of Y coordinate.
 
592
        /// </summary>
 
593
        /// <returns>maximum value of extent of Y coordinate.</returns>
 
594
        public double GetMaxY()
 
595
        {
 
596
            return CAPI.LASHeader_GetMaxY(hHeader);
 
597
        }
 
598
 
 
599
        /// <summary>
 
600
        /// Get maximum value of extent of Z coordinate.
 
601
        /// </summary>
 
602
        /// <returns>maximum value of extent of Z coordinate.</returns>
 
603
        public double GetMaxZ()
 
604
        {
 
605
            return CAPI.LASHeader_GetMaxZ(hHeader);
 
606
        }
 
607
 
 
608
        /// <summary>
 
609
        /// Get minimum value of extent of X coordinate.
 
610
        /// </summary>
 
611
        /// <returns>minimum value of extent of X coordinate.</returns>
 
612
        public double GetMinX()
 
613
        {
 
614
            return CAPI.LASHeader_GetMinX(hHeader);
 
615
        }
 
616
 
 
617
        /// <summary>
 
618
        /// Get minimum value of extent of Y coordinate.
 
619
        /// </summary>
 
620
        /// <returns>minimum value of extent of Y coordinate.</returns>
 
621
        public double GetMinY()
 
622
        {
 
623
            return CAPI.LASHeader_GetMinY(hHeader);
 
624
        }
 
625
 
 
626
        /// <summary>
 
627
        /// Get minimum value of extent of Z coordinate.
 
628
        /// </summary>
 
629
        /// <returns>minimum value of extent of Z coordinate.</returns>
 
630
        public double GetMinZ()
 
631
        {
 
632
            return CAPI.LASHeader_GetMinZ(hHeader);
 
633
        }
 
634
 
 
635
        /// <summary>
 
636
        /// Set maximum values of extent of X, Y and Z coordinates.
 
637
        /// </summary>
 
638
        /// <param name="x">maximum value of extent of X coordinate.</param>
 
639
        /// <param name="y">maximum value of extent of Y coordinate.</param>
 
640
        /// <param name="z">maximum value of extent of Z coordinate.</param>
 
641
        public void SetMax(double x, double y, double z)
 
642
        {
 
643
            LASError error = CAPI.LASHeader_SetMax(hHeader, x, y, z);
 
644
            if ((Int32)error != 0)
 
645
            {
 
646
                LASException e = new LASException("Exception in Set Header SetMax.");
 
647
                throw e;
 
648
            }
 
649
        }
 
650
 
 
651
        /// <summary>
 
652
        /// Set minimum values of extent of X, Y and Z coordinates.
 
653
        /// </summary>
 
654
        /// <param name="x">Set minimum value of extent of X coordinate.</param>
 
655
        /// <param name="y">Set minimum value of extent of Y coordinate.</param>
 
656
        /// <param name="z">Set minimum value of extent of Z coordinate.</param>
 
657
        public void SetMin(double x, double y, double z)
 
658
        {
 
659
            LASError error = CAPI.LASHeader_SetMin(hHeader, x, y, z);
 
660
            if ((Int32)error != 0)
 
661
            {
 
662
                LASException e = new LASException("Exception in Set Header SetMin.");
 
663
                throw e;
 
664
            }
 
665
        }
 
666
 
 
667
        /// <summary>
 
668
        /// Adds a variable length record instance to the header. 
 
669
        /// </summary>
 
670
        /// <param name="variableLengthRecord">variable Length record instance to add</param>
 
671
        public void AddVariableLengthRecord(LASVariableLengthRecord variableLengthRecord)
 
672
        {
 
673
            LASError error = CAPI.LASHeader_AddVLR(hHeader, variableLengthRecord.GetPointer());
 
674
            if ((Int32)error != 0)
 
675
            {
 
676
                LASException e = new LASException("Exception in Header AddVariableLengthRecord.");
 
677
                throw e;
 
678
            }
 
679
        }
 
680
 
 
681
        /// <summary>
 
682
        /// Returns the variable length record for the given index.  
 
683
        /// </summary>
 
684
        /// <param name="i">the index starting from 0 of the variable length record to fetch</param>
 
685
        /// <returns>a new variable length record instance</returns>
 
686
        /// <remarks>Use VariableLengthRecordsCount property to determine the number of
 
687
        /// variable length records available on the header.</remarks>
 
688
        public LASVariableLengthRecord GetVariableLengthRecord(UInt32 i)
 
689
        {
 
690
            LASVLRH vlrh = CAPI.LASHeader_GetVLR(hHeader, i);
 
691
            return new LASVariableLengthRecord(vlrh);
 
692
        }
 
693
 
 
694
        /// <summary>
 
695
        /// Deletes a variable length record from the header for the given index.
 
696
        /// </summary>
 
697
        /// <param name="index">the index starting from 0 of the variable length record to delete</param>
 
698
        public void DeleteVariableLengthRecord(UInt32 index)
 
699
        {
 
700
            LASError error = CAPI.LASHeader_DeleteVLR(hHeader, index);
 
701
            if ((Int32)error != 0)
 
702
            {
 
703
                LASException e = new LASException("Exception in Header DeleteVariableLengthRecord.");
 
704
                throw e;
 
705
            }
 
706
        }
 
707
 
 
708
        /// <summary>
 
709
        /// GUID value for the header.
 
710
        /// </summary>
 
711
        /// <remarks>sets and gets the LASGuid instance of the header.</remarks>
 
712
        public LASGuid GUID
 
713
        {
 
714
            get
 
715
            {
 
716
                LASGuidH guidh = CAPI.LASHeader_GetGUID(hHeader);
 
717
                return new LASGuid(guidh);
 
718
            }
 
719
            set
 
720
            {
 
721
 
 
722
                LASError error = CAPI.LASHeader_SetGUID(hHeader, value.GetPointer());
 
723
                if ((Int32)error != 0)
 
724
                {
 
725
                    LASException e = new LASException("Exception in Set Header GUID.");
 
726
                    throw e;
 
727
                }
 
728
            }
 
729
        }
 
730
 
 
731
        /// <summary>
 
732
        /// sets and gets the Proj4 in the header.
 
733
        /// </summary>
 
734
        public string Proj4
 
735
        {
 
736
            get
 
737
            {
 
738
                return CAPI.LASHeader_GetProj4(hHeader);
 
739
            }
 
740
            set
 
741
            {
 
742
                LASError error = CAPI.LASHeader_SetProj4(hHeader, value);
 
743
                if ((Int32)error != 0)
 
744
                {
 
745
                    LASException e = new LASException("Exception in Set Header Proj4.");
 
746
                    throw e;
 
747
                }
 
748
            }
 
749
        }
 
750
    }
 
751
}