forked from ngageoint/csm
-
Notifications
You must be signed in to change notification settings - Fork 13
/
PointCloudIsd.h
214 lines (175 loc) · 5.34 KB
/
PointCloudIsd.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
//#############################################################################
//
// FILENAME: PointCloudIsd.h
//
// CLASSIFICATION: Unclassified
//
// DESCRIPTION:
//
// Header for LAS and BPF ISD classes derived from the csm::Isd
// base class. This class provides portions of the LAS file that are
// useful for initializing a model.
//
// LIMITATIONS: None
//
// SOFTWARE HISTORY:
// Date Author Comment
// ----------- ------ -------
// 01-DEC-2014 ISK Initial version.
// 22-FEB-2018 JPK Changed macro for inclusion into csm library.
//
// NOTES:
//
//#############################################################################
#ifndef __CSM_POINT_CLOUD_ISD_H
#define __CSM_POINT_CLOUD_ISD_H
#include "Isd.h"
#include "csmPointCloud.h"
#include <vector>
#include <cstdlib>
namespace csm
{
//***
// CLASS: Vlr
//> Variable Length Record (VLR) class. VLRs contain most of the support
// data needed to instantiate a model.
//<
//***
class CSM_EXPORT_API Vlr
{
public:
Vlr() : theUserId(),
theRecordId(0),
theRecordLength(0),
theDescription(),
theData() {}
Vlr(
const std::string& aUserId,
unsigned short aRecordId,
unsigned long long aLength,
const std::string& aDescription,
const std::string& aData )
: theUserId(aUserId),
theRecordId(aRecordId),
theRecordLength(aLength),
theDescription(aDescription),
theData(aData) {}
~Vlr();
const std::string& userId() const { return theUserId; }
const unsigned short& recordId() const { return theRecordId; }
const unsigned long long& length() const { return theRecordLength; }
const std::string& description() const { return theDescription; }
const std::string& data() const { return theData; }
void setUserId(const std::string& aUserId)
{ theUserId = aUserId; }
void setRecordId(unsigned int aRecordId)
{ theRecordId = aRecordId; }
void setLength(unsigned int aLength)
{ theRecordLength = aLength; }
void setDescription(const std::string& aDescription )
{ theDescription = aDescription; }
void setData(
const std::string& aData )
{ theData = aData; }
void set(
const std::string& aUserId,
unsigned short aRecordId,
unsigned long long aLength,
const std::string& aDescription,
const std::string& aData )
{
theUserId = aUserId;
theRecordId = aRecordId;
theRecordLength = aLength;
theDescription = aDescription;
theData = aData;
}
void clear()
{
theUserId = "";
theRecordId = 0;
theRecordLength = 0;
theDescription = "";
theData = "";
}
// For BPF nomenclature
void setFilename( const std::string& aFilename )
{ theDescription = aFilename; }
const std::string& filename() const { return theDescription; }
void setMagicNumber( const std::string& aMagicNumber )
{ theUserId = aMagicNumber; }
const std::string& magicNumber() const { return theUserId; }
protected:
std::string theUserId;
//> This string contains the user id of the VLR.
//<
unsigned short theRecordId;
//> This integer contains the record identifier.
//<
unsigned long long theRecordLength;
//> This integer contains the record length.
// It is of type long long to allow for extended VLRs.
//<
std::string theDescription;
//> This string contains the VLR description.
//<
std::string theData;
//> This string contains the VLR data.
//<
};
//***
// CLASS: PointCloudIsd
//> LAS ISD class. This is an intermediary class that the LAS and
// BPF ISD classes are derived from. Do not construct this class
// directly. Construct the appropriate derived class to set the format
// that the calling application needs to parse the data. Then this class
// can be used to retrieve the format and access the data.
//<
//***
class CSM_EXPORT_API PointCloudIsd : public Isd
{
public:
virtual ~PointCloudIsd();
const std::string& fileHeader() const { return theFileHeader; }
//> This method returns the entire file subheader.
//<
const std::vector<Vlr>& vlrList() const { return theVlrs; }
//> This method returns the file header VLR objects.
//<
void addVlr( const Vlr &aVrl )
{ theVlrs.push_back( aVrl ); }
//> This method adds a VLR to the VLR list.
//<
void setFileHeader(const std::string& head) { theFileHeader = head; }
//> This method sets the file header. The interprtation of the header
// depends upon the format setting.
//<
protected:
PointCloudIsd(
const std::string& format,
const std::string& filename = "")
: Isd(format,filename), theFileHeader(), theVlrs() {}
private:
std::string theFileHeader;
//> This string contains the full file header text.
//<
std::vector<Vlr> theVlrs;
};
class CSM_EXPORT_API LasIsd : public PointCloudIsd
{
public:
LasIsd(
const std::string& filename = "")
: PointCloudIsd("PointCloudLAS", filename) {}
virtual ~LasIsd();
};
class CSM_EXPORT_API BpfIsd : public PointCloudIsd
{
public:
BpfIsd(
const std::string& filename = "")
: PointCloudIsd("PointCloudBPF", filename) {}
virtual ~BpfIsd();
};
} // namespace csm
#endif