OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimLasPointRecord4.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // File: ossimLasPointRecord4.cpp
4 //
5 // License: MIT
6 //
7 // See LICENSE.txt file in the top level directory for more details.
8 //
9 // Author: David burken
10 //
11 // Description: Container class LAS point record type 4.
12 //
13 //----------------------------------------------------------------------------
14 // $Id$
15 
17 #include <ossim/base/ossimCommon.h>
18 #include <ossim/base/ossimEndian.h>
19 #include <iomanip>
20 #include <iostream>
21 #include <istream>
22 #include <ostream>
23 
25  :
26  m_x(0),
27  m_y(0),
28  m_z(0),
29  m_intensity(0),
30  m_bitFlags(0),
31  m_classification(0),
32  m_scanAngleRank(0),
33  m_userData(0),
34  m_pointSourceId(0),
35  m_gpsTime(0.0),
36  m_wavePacketDescriptorIndex(0),
37  m_byteOffsetToWaveformData(0),
38  m_waveformPacketSizeInBytes(0),
39  m_returnPointWaveformLocation(0.0),
40  m_red(0),
41  m_green(0),
42  m_blue(0)
43 {
44 }
45 
48  :
49  m_x(obj.m_x),
50  m_y(obj.m_y),
51  m_z(obj.m_z),
52  m_intensity(obj.m_intensity),
53  m_bitFlags(obj.m_bitFlags),
54  m_classification(obj.m_classification),
55  m_scanAngleRank(obj.m_scanAngleRank),
56  m_userData(obj.m_userData),
57  m_pointSourceId(obj.m_pointSourceId),
58  m_gpsTime(obj.m_gpsTime),
59  m_wavePacketDescriptorIndex(obj.m_wavePacketDescriptorIndex),
60  m_byteOffsetToWaveformData(obj.m_byteOffsetToWaveformData),
61  m_waveformPacketSizeInBytes(obj.m_waveformPacketSizeInBytes),
62  m_returnPointWaveformLocation(obj.m_returnPointWaveformLocation),
63  m_red(obj.m_red),
64  m_green(obj.m_green),
65  m_blue(obj.m_blue)
66 {
67 }
68 
72 {
73  if ( this != &obj )
74  {
75  m_x = obj.m_x;
76  m_y = obj.m_y;
77  m_z = obj.m_z;
78  m_intensity = obj.m_intensity;
79  m_bitFlags = obj.m_bitFlags;
80  m_classification = obj.m_classification;
81  m_scanAngleRank = obj.m_scanAngleRank;
82  m_userData = obj.m_userData;
83  m_pointSourceId = obj.m_pointSourceId;
84  m_gpsTime = obj.m_gpsTime;
85  m_wavePacketDescriptorIndex = obj.m_wavePacketDescriptorIndex;
86  m_byteOffsetToWaveformData = obj.m_byteOffsetToWaveformData;
87  m_waveformPacketSizeInBytes = obj.m_waveformPacketSizeInBytes;
88  m_returnPointWaveformLocation = obj.m_returnPointWaveformLocation;
89  m_red = obj.m_red;
90  m_green = obj.m_green;
91  m_blue = obj.m_blue;
92  }
93  return *this;
94 }
95 
97  :
98  m_record()
99 {
100 }
101 
103  :
104  m_record(obj.m_record)
105 {
106 }
107 
109 {
110  if (this != &copy_this)
111  {
112  m_record = copy_this.m_record;
113  }
114  return *this;
115 }
116 
118 {
119 }
120 
122 {
123  in.read((char*)&m_record, sizeof(ossimLasPointRecord4Data));
124 
126  {
127  swap();
128  }
129 }
130 
132 {
134  {
135  // Write little endian per spec:
136  swap();
137  }
138 
139  out.write((char*)&m_record, sizeof(ossimLasPointRecord4Data));
140 
142  {
143  // Swap back to native byte order if needed:
144  swap();
145  }
146 }
147 
149 {
150  return m_record.m_x;
151 }
152 
154 {
155  return m_record.m_y;
156 }
157 
159 {
160  return m_record.m_z;
161 }
162 
164 {
165  return 0;
166 }
167 
169 {
170  return 0;
171 }
172 
174 {
175  return 0;
176 }
177 
179 {
180  return m_record.m_intensity;
181 }
182 
184 {
186 }
187 
189 {
191 }
192 
194 {
196 }
197 
199 {
200  // Capture the original flags.
201  std::ios_base::fmtflags f = out.flags();
202 
203  out << std::setiosflags(std::ios_base::fixed) << std::setprecision(8);
204 
205  out << "x: " << m_record.m_x
206  << "\ny: " << m_record.m_y
207  << "\nz: " << m_record.m_z
208  << "\nintensity: " << m_record.m_intensity
209  << "\nreturn: " << int(getReturnNumber())
210  << "\nnumber_of_returns: " << int(getNumberOfReturns())
211  << "\nedge: " << (getEdgeFlag()?"true":"false")
212  << "\nscan_direction: " << int(m_record.m_bitFlags.m_scanDirection)
213  << "\nclassification: " << m_record.m_classification
214  << "\nscan_angle_rank: " << int(m_record.m_scanAngleRank)
215  << "\nuser_data: " << m_record.m_userData
216  << "\npoint_source_id: " << m_record.m_pointSourceId
217  << "\ngrs_time: " << m_record.m_gpsTime
218  << "\nwave_packet_descriptor_index: " << m_record.m_wavePacketDescriptorIndex
219  << "\nbyte_offset_to_waveform_data: " << m_record.m_byteOffsetToWaveformData
220  << "\nwaveform_packet_size_in_bytes: " << m_record.m_waveformPacketSizeInBytes
221  << "\nm_returnPointWaveformLocation: " << m_record.m_returnPointWaveformLocation
222  << "\nred: " << m_record.m_red
223  << "\ngreen: " << m_record.m_green
224  << "\nblue: " << m_record.m_blue
225  << std::endl;
226 
227  // Reset flags.
228  out.setf(f);
229  return out;
230 }
231 
233 {
234  ossimEndian endian;
235  endian.swap(m_record.m_x);
236  endian.swap(m_record.m_y);
237  endian.swap(m_record.m_z);
238  endian.swap(m_record.m_intensity);
239  endian.swap(m_record.m_pointSourceId);
240  endian.swap(m_record.m_gpsTime);
244  endian.swap(m_record.m_red);
245  endian.swap(m_record.m_green);
246  endian.swap(m_record.m_blue);
247 }
248 
virtual ossim_uint8 getReturnNumber() const
virtual ossim_uint16 getIntensity() const
virtual ossim_uint16 getRed() const
ossimLasPointRecord4Data m_record
void swap()
Performs a swap if system byte order is not little endian.
virtual std::ostream & print(std::ostream &out) const
virtual ossim_uint16 getBlue() const
virtual ossim_uint8 getEdgeFlag() const
virtual ~ossimLasPointRecord4()
destructor
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
unsigned short ossim_uint16
virtual ossim_uint8 getNumberOfReturns() const
virtual ossim_int32 getY() const
Container class for LAS point record type 4.
virtual ossim_int32 getX() const
const ossimLasPointRecord4 & operator=(const ossimLasPointRecord4 &copy_this)
virtual ossim_uint16 getGreen() const
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
const ossimLasPointRecord4Data & operator=(const ossimLasPointRecord4Data &obj)
virtual ossim_int32 getZ() const
ossimLasPointRecord4()
default constructor
virtual void writeStream(std::ostream &out)
Writes record to stream.
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
unsigned char ossim_uint8
virtual void readStream(std::istream &in)
Initialize record from stream.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32