MCPcopy Create free account
hub / github.com/LAStools/LAStools / open

Method open

LASlib/src/lasreaderstored.cpp:44–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42#include <string.h>
43
44BOOL LASreaderStored::open(LASreader* lasreader)
45{
46 if (lasreader == 0)
47 {
48 laserror("no lasreader");
49 return FALSE;
50 }
51
52 // store a reference to the actual lasreader
53
54 this->lasreader = lasreader;
55
56 // populate our header from the actual header
57 header = lasreader->header;
58
59 // zero the pointers of the other header so they don't get deallocated twice
60 lasreader->header.unlink();
61
62 // special check for attributes in extra bytes
63 if (header.number_attributes)
64 {
65 header.number_attributes = 0;
66 header.init_attributes(lasreader->header.number_attributes, lasreader->header.attributes);
67 }
68
69 // initialize the point with the header info
70
71 if (header.laszip)
72 {
73 if (!point.init(&header, header.laszip->num_items, header.laszip->items)) return FALSE;
74 }
75 else
76 {
77 if (!point.init(&header, header.point_data_format, header.point_data_record_length)) return FALSE;
78 }
79
80 // create the stream output array
81
82 if (streamoutarray) delete streamoutarray;
83 streamoutarray = 0;
84
85 if (Endian::IS_LITTLE_ENDIAN)
86 streamoutarray = new ByteStreamOutArrayLE((header.number_of_point_records ? (I64)header.number_of_point_records : header.extended_number_of_point_records)*2);
87 else
88 streamoutarray = new ByteStreamOutArrayBE((header.number_of_point_records ? (I64)header.number_of_point_records : header.extended_number_of_point_records)*2);
89
90 if (streamoutarray == 0)
91 {
92 laserror("allocating streamoutarray");
93 return FALSE;
94 }
95
96 // create the LASwriter
97
98 if (laswriter) delete laswriter;
99 laswriter = 0;
100
101 LASwriterLAS* laswriterlas = new LASwriterLAS();

Callers 1

reopenMethod · 0.45

Calls 2

laserrorFunction · 0.85
initMethod · 0.45

Tested by

no test coverage detected