OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimLasPointRecord3.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // File: ossimLasPointRecord3.cpp
4 //
5 // License: MIT
6 //
7 // See LICENSE.txt file in the top level directory for more details.
8 //
9 // Author: Garrett Potts
10 //
11 // Description: Container class LAS point record type 3.
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_red(0),
37  m_green(0),
38  m_blue(0)
39 {
40 }
41 
44  :
45  m_x(obj.m_x),
46  m_y(obj.m_y),
47  m_z(obj.m_z),
48  m_intensity(obj.m_intensity),
49  m_bitFlags(obj.m_bitFlags),
50  m_classification(obj.m_classification),
51  m_scanAngleRank(obj.m_scanAngleRank),
52  m_userData(obj.m_userData),
53  m_pointSourceId(obj.m_pointSourceId),
54  m_gpsTime(obj.m_gpsTime),
55  m_red(obj.m_red),
56  m_green(obj.m_green),
57  m_blue(obj.m_blue)
58 {
59 }
60 
64 {
65  if ( this != &obj )
66  {
67  m_x = obj.m_x;
68  m_y = obj.m_y;
69  m_z = obj.m_z;
70  m_intensity = obj.m_intensity;
71  m_bitFlags = obj.m_bitFlags;
72  m_classification = obj.m_classification;
73  m_scanAngleRank = obj.m_scanAngleRank;
74  m_userData = obj.m_userData;
75  m_pointSourceId = obj.m_pointSourceId;
76  m_gpsTime = obj.m_gpsTime;
77  m_red = obj.m_red;
78  m_green = obj.m_green;
79  m_blue = obj.m_blue;
80  }
81  return *this;
82 }
83 
85  :
86  m_record()
87 {
88 }
89 
91  :
92  m_record(obj.m_record)
93 {
94 }
95 
97 {
98  if (this != &copy_this)
99  {
100  m_record = copy_this.m_record;
101  }
102  return *this;
103 }
104 
106 {
107 }
108 
110 {
111  in.read((char*)&m_record, sizeof(ossimLasPointRecord3Data));
112 
114  {
115  swap();
116  }
117 }
118 
120 {
122  {
123  // Write little endian per spec:
124  swap();
125  }
126 
127  out.write((char*)&m_record, sizeof(ossimLasPointRecord3Data));
128 
130  {
131  // Swap back to native byte order if needed:
132  swap();
133  }
134 }
135 
137 {
138  return m_record.m_x;
139 }
140 
142 {
143  return m_record.m_y;
144 }
145 
147 {
148  return m_record.m_z;
149 }
150 
152 {
153  return 0;
154 }
155 
157 {
158  return 0;
159 }
160 
162 {
163  return 0;
164 }
165 
166 
168 {
169  return m_record.m_intensity;
170 }
171 
173 {
175 }
176 
178 {
180 }
181 
183 {
185 }
186 
188 {
189  // Capture the original flags.
190  std::ios_base::fmtflags f = out.flags();
191 
192  out << std::setiosflags(std::ios_base::fixed) << std::setprecision(8);
193 
194  out << "x: " << m_record.m_x
195  << "\ny: " << m_record.m_y
196  << "\nz: " << m_record.m_z
197  << "\nintensity: " << m_record.m_intensity
198  << "\nreturn: " << int(getReturnNumber())
199  << "\nnumber_of_returns: " << int(getNumberOfReturns())
200  << "\nedge: " << (getEdgeFlag()?"true":"false")
201  << "\nscan_direction: " << int(m_record.m_bitFlags.m_scanDirection)
202  << "\nclassification: " << m_record.m_classification
203  << "\nscan_angle_rank: " << int(m_record.m_scanAngleRank)
204  << "\nuser_data: " << m_record.m_userData
205  << "\npoint_source_id: " << m_record.m_pointSourceId
206  << "\ngrs_time: " << m_record.m_gpsTime
207  << "\nred: " << m_record.m_red
208  << "\ngreen: " << m_record.m_green
209  << "\nblue: " << m_record.m_blue
210  << std::endl;
211 
212  // Reset flags.
213  out.setf(f);
214  return out;
215 }
216 
218 {
219  ossimEndian endian;
220  endian.swap(m_record.m_x);
221  endian.swap(m_record.m_y);
222  endian.swap(m_record.m_z);
223  endian.swap(m_record.m_intensity);
224  endian.swap(m_record.m_pointSourceId);
225  endian.swap(m_record.m_gpsTime);
226  endian.swap(m_record.m_red);
227  endian.swap(m_record.m_green);
228  endian.swap(m_record.m_blue);
229 }
230 
const ossimLasPointRecord3 & operator=(const ossimLasPointRecord3 &copy_this)
virtual ossim_uint16 getBlue() const
virtual ossim_uint8 getEdgeFlag() const
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
unsigned short ossim_uint16
virtual ossim_uint16 getGreen() const
virtual ossim_int32 getY() const
ossimLasPointRecord3()
default constructor
virtual std::ostream & print(std::ostream &out) const
const ossimLasPointRecord3Data & operator=(const ossimLasPointRecord3Data &obj)
virtual ~ossimLasPointRecord3()
destructor
virtual ossim_uint16 getRed() const
Container class for LAS point record type 3.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
ossimLasPointRecord3Data m_record
virtual ossim_int32 getX() const
virtual ossim_uint8 getReturnNumber() const
virtual ossim_uint8 getNumberOfReturns() const
virtual void readStream(std::istream &in)
Initialize record from stream.
virtual ossim_int32 getZ() const
void swap()
Performs a swap if system byte order is not little endian.
virtual ossim_uint16 getIntensity() const
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
virtual void writeStream(std::ostream &out)
Writes record to stream.
unsigned char ossim_uint8
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32