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