OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimLasPointRecord0.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // File: ossimLasPointRecord0.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 1.
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_returnByte(0),
31  m_classification(0),
32  m_scanAngleRank(0),
33  m_userData(0),
34  m_pointSourceID(0)
35 {
36 }
37 
40  :
41  m_x(obj.m_x),
42  m_y(obj.m_y),
43  m_z(obj.m_z),
44  m_intensity(obj.m_intensity),
45  m_returnByte(obj.m_returnByte),
46  m_classification(obj.m_classification),
47  m_scanAngleRank(obj.m_scanAngleRank),
48  m_userData(obj.m_userData),
49  m_pointSourceID(obj.m_pointSourceID)
50 {
51 }
52 
56 {
57  if ( this != &obj )
58  {
59  m_x = obj.m_x;
60  m_y = obj.m_y;
61  m_z = obj.m_z;
62  m_intensity = obj.m_intensity;
63  m_returnByte = obj.m_returnByte;
64  m_classification = obj.m_classification;
65  m_scanAngleRank = obj.m_scanAngleRank;
66  m_userData = obj.m_userData;
67  m_pointSourceID = obj.m_pointSourceID;
68  }
69  return *this;
70 }
71 
73  :
74  m_record()
75 {
76 }
77 
79  :
80  m_record(obj.m_record)
81 {
82 }
83 
85 {
86  if (this != &copy_this)
87  {
88  m_record = copy_this.m_record;
89  }
90  return *this;
91 }
92 
94 {
95 }
96 
98 {
99  in.read((char*)&m_record, 28);
100 
102  {
103  swap();
104  }
105 }
106 
108 {
110  {
111  // Write little endian per spec:
112  swap();
113  }
114 
115  out.write((char*)&m_record, 28);
116 
118  {
119  // Swap back to native byte order if needed:
120  swap();
121  }
122 }
123 
125 {
126  return m_record.m_x;
127 }
128 
130 {
131  return m_record.m_y;
132 }
133 
135 {
136  return m_record.m_z;
137 }
138 
140 {
141  return 0;
142 }
143 
145 {
146  return 0;
147 }
148 
150 {
151  return 0;
152 }
153 
155 {
156  return m_record.m_intensity;
157 }
158 
160 {
161  return (0x07 & m_record.m_returnByte);
162 }
163 
165 {
166  return (0x34 & m_record.m_returnByte);
167 }
168 
170 {
171  return (0x40 & m_record.m_returnByte);
172 }
173 
175 {
176  // Capture the original flags.
177  std::ios_base::fmtflags f = out.flags();
178 
179  out << std::setiosflags(std::ios_base::fixed) << std::setprecision(8);
180 
181  out << "x: " << m_record.m_x
182  << "\ny: " << m_record.m_y
183  << "\nz: " << m_record.m_z
184  << "\nintensity: " << m_record.m_intensity
185  << "\nreturn: " << int(getReturnNumber())
186  << "\nnumber_of_returns: " << int(getNumberOfReturns())
187  << "\nedge: " << (getEdgeFlag()?"true":"false")
188  << "\nclassification: " << m_record.m_classification
189  << "\nscan_angle_rank: " << int(m_record.m_scanAngleRank)
190  << "\nuser_data: " << m_record.m_userData
191  << "\npoint_source_id: " << m_record.m_pointSourceID
192  << std::endl;
193 
194  // Reset flags.
195  out.setf(f);
196  return out;
197 }
198 
200 {
201  ossimEndian endian;
202  endian.swap(m_record.m_x);
203  endian.swap(m_record.m_y);
204  endian.swap(m_record.m_z);
205  endian.swap(m_record.m_intensity);
206  endian.swap(m_record.m_pointSourceID);
207 }
208 
virtual ossim_uint16 getGreen() const
virtual ossim_uint16 getIntensity() const
virtual ossim_int32 getX() const
void swap()
Performs a swap if system byte order is not little endian.
virtual std::ostream & print(std::ostream &out) const
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
const ossimLasPointRecord0Data & operator=(const ossimLasPointRecord0Data &obj)
unsigned short ossim_uint16
Container class for LAS point record type 1.
virtual ossim_int32 getY() const
virtual ossim_uint16 getBlue() const
virtual ossim_uint16 getRed() const
virtual ossim_uint8 getEdgeFlag() const
const ossimLasPointRecord0 & operator=(const ossimLasPointRecord0 &copy_this)
ossimLasPointRecord0()
default constructor
virtual void writeStream(std::ostream &out)
Writes record to stream.
ossimLasPointRecord0Data m_record
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
virtual ossim_uint8 getNumberOfReturns() const
virtual void readStream(std::istream &in)
Initialize record from stream.
virtual ossim_uint8 getReturnNumber() const
virtual ossim_int32 getZ() const
virtual ~ossimLasPointRecord0()
destructor
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
unsigned char ossim_uint8
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32