OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
ossimPointRecord Class Reference

#include <ossimPointRecord.h>

Inheritance diagram for ossimPointRecord:
ossimReferenced

Public Types

enum  FIELD_CODES {
  Intensity = 0x0008, ReturnNumber = 0x0010, NumberOfReturns = 0x0020, Red = 0x0040,
  Green = 0x0080, Blue = 0x0100, GpsTime = 0x0200, Infrared = 0x0400,
  All = 0x0777
}
 

Public Member Functions

 ossimPointRecord (ossim_uint32 fields_code=0)
 
 ossimPointRecord (const ossimPointRecord &pcr)
 
 ossimPointRecord (const ossimGpt &pos)
 
 ~ossimPointRecord ()
 Creates a point record with fields set to null values. More...
 
ossimPointRecordoperator= (const ossimPointRecord &pcr)
 
ossim_uint32 getPointId () const
 
void setPointId (ossim_uint32 id)
 
const ossimGptgetPosition () const
 Returns the 3D position vector in the dataset's coodinate reference system (available from the ossimPointCloudSource object. More...
 
void setPosition (const ossimGpt &p)
 
virtual bool hasFields (ossim_uint32 code_mashup) const
 Argument can be mash-up of OR'd codes for check of multiple fields. More...
 
virtual ossim_uint32 getFieldCode () const
 Returns mash-up of OR'd codes of multiple fields being stored. More...
 
ossim_float32 getField (FIELD_CODES fc) const
 Return the float value of the requested field. More...
 
const std::map< FIELD_CODES, ossim_float32 > & getFieldMap () const
 
void setField (FIELD_CODES fc, ossim_float32 value)
 
void clear ()
 Initializes point to undefined state: More...
 
bool isValid () const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 

Protected Attributes

ossim_uint32 m_pointId
 
ossimGpt m_position
 
std::map< FIELD_CODES, ossim_float32m_fieldMap
 

Friends

std::ostream & operator<< (std::ostream &ostr, const ossimPointRecord &p)
 

Additional Inherited Members

- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Detailed Description

Definition at line 23 of file ossimPointRecord.h.

Member Enumeration Documentation

◆ FIELD_CODES

Enumerator
Intensity 
ReturnNumber 
NumberOfReturns 
Red 
Green 
Blue 
GpsTime 
Infrared 
All 

Definition at line 28 of file ossimPointRecord.h.

29  {
30  Intensity = 0x0008, // float 32
31  ReturnNumber = 0x0010, // unsigned int 32
32  NumberOfReturns = 0x0020, // unsigned int 32
33  Red = 0x0040, // float 32
34  Green = 0x0080, // float 32
35  Blue = 0x0100, // float 32
36  GpsTime = 0x0200, // unsigned long Unix epoch (microsec from 01/01/1970)
37  Infrared = 0x0400, // float 32
38  All = 0x0777
39  };

Constructor & Destructor Documentation

◆ ossimPointRecord() [1/3]

ossimPointRecord::ossimPointRecord ( ossim_uint32  fields_code = 0)

Definition at line 12 of file ossimPointRecord.cpp.

References Blue, GpsTime, Green, Infrared, Intensity, m_fieldMap, ossim::nan(), NumberOfReturns, Red, and ReturnNumber.

13  : m_pointId(0)
14 {
15  if (field_code & Intensity)
17  if (field_code & ReturnNumber)
19  if (field_code & NumberOfReturns)
21  if (field_code & Red)
23  if (field_code & Green)
25  if (field_code & Blue)
27  if (field_code & GpsTime)
29  if (field_code & Infrared)
31 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossim_uint32 m_pointId
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ ossimPointRecord() [2/3]

ossimPointRecord::ossimPointRecord ( const ossimPointRecord pcr)

Definition at line 33 of file ossimPointRecord.cpp.

34  : m_pointId(pcr.m_pointId),
37 {
38 }
ossim_uint32 m_pointId
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ ossimPointRecord() [3/3]

ossimPointRecord::ossimPointRecord ( const ossimGpt pos)

Definition at line 40 of file ossimPointRecord.cpp.

41  : m_pointId(0),
42  m_position(pos)
43 {
44 }
ossim_uint32 m_pointId

◆ ~ossimPointRecord()

ossimPointRecord::~ossimPointRecord ( )

Creates a point record with fields set to null values.

Definition at line 46 of file ossimPointRecord.cpp.

47 {
48 }

Member Function Documentation

◆ clear()

void ossimPointRecord::clear ( )

Initializes point to undefined state:

Definition at line 167 of file ossimPointRecord.cpp.

References m_pointId.

168 {
169  m_pointId = 0;
170 }
ossim_uint32 m_pointId

◆ getField()

ossim_float32 ossimPointRecord::getField ( FIELD_CODES  fc) const

Return the float value of the requested field.

Definition at line 98 of file ossimPointRecord.cpp.

References m_fieldMap, and ossim::nan().

Referenced by ossimPointCloudImageHandler::addSample(), ossimPdalReader::establishMinMax(), ossimPointBlock::getFieldMax(), ossimPointBlock::getFieldMin(), ossimPointCloudHandler::normalizeBlock(), ossimPdalReader::parsePointView(), and ossimPointCloudImageHandler::setCurrentEntry().

99 {
100  std::map<FIELD_CODES, ossim_float32>::const_iterator v = m_fieldMap.find(fc);
101  if (v == m_fieldMap.end())
102  return ossim::nan();
103  return v->second;
104 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ getFieldCode()

ossim_uint32 ossimPointRecord::getFieldCode ( ) const
inlinevirtual

Returns mash-up of OR'd codes of multiple fields being stored.

Definition at line 74 of file ossimPointRecord.cpp.

References Blue, GpsTime, Green, Infrared, Intensity, m_fieldMap, NumberOfReturns, Red, and ReturnNumber.

Referenced by ossimPointBlock::addPoint(), and ossimPdalReader::establishMinMax().

75 {
76  ossim_uint32 field_code = 0;
77 
78  if (m_fieldMap.find(Intensity) != m_fieldMap.end())
79  field_code |= Intensity;
80  if (m_fieldMap.find(ReturnNumber) != m_fieldMap.end())
81  field_code |= ReturnNumber;
82  if (m_fieldMap.find(NumberOfReturns) != m_fieldMap.end())
83  field_code |= NumberOfReturns;
84  if (m_fieldMap.find(Red) != m_fieldMap.end())
85  field_code |= Red;
86  if (m_fieldMap.find(Green) != m_fieldMap.end())
87  field_code |= Green;
88  if (m_fieldMap.find(Blue) != m_fieldMap.end())
89  field_code |= Blue;
90  if (m_fieldMap.find(GpsTime) != m_fieldMap.end())
91  field_code |= GpsTime;
92  if (m_fieldMap.find(Infrared) != m_fieldMap.end())
93  field_code |= Infrared;
94 
95  return field_code;
96 }
unsigned int ossim_uint32
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ getFieldMap()

const std::map<FIELD_CODES, ossim_float32>& ossimPointRecord::getFieldMap ( ) const
inline

Definition at line 72 of file ossimPointRecord.h.

Referenced by ossimPdalReader::establishMinMax().

72 { return m_fieldMap; }
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ getPointId()

ossim_uint32 ossimPointRecord::getPointId ( ) const
inline

Definition at line 50 of file ossimPointRecord.h.

50 { return m_pointId; }
ossim_uint32 m_pointId

◆ getPosition()

const ossimGpt& ossimPointRecord::getPosition ( ) const
inline

Returns the 3D position vector in the dataset's coodinate reference system (available from the ossimPointCloudSource object.

This is either map/meters (x, y, z) or geog (lat, lon, hgt). Refer to the ossimPointCloudGeometry::getStoredPosFormat() available from the associated ossimPointCloudSource->getGeometry()

Definition at line 59 of file ossimPointRecord.h.

Referenced by ossimPointCloudImageHandler::addSample(), ossimPdalReader::establishMinMax(), ossimPointBlock::getBounds(), ossimPointCloudHandler::getBounds(), ossimPointBlock::scanForMinMax(), and ossimPointCloudImageHandler::setCurrentEntry().

59 { return m_position; }

◆ hasFields()

bool ossimPointRecord::hasFields ( ossim_uint32  code_mashup) const
inlinevirtual

Argument can be mash-up of OR'd codes for check of multiple fields.

Returns TRUE if ALL fields are present.

Definition at line 50 of file ossimPointRecord.cpp.

References Blue, GpsTime, Green, Infrared, Intensity, m_fieldMap, NumberOfReturns, Red, and ReturnNumber.

Referenced by ossimPdalReader::parsePoint().

51 {
52  bool found = true;
53 
54  if (field_code & Intensity)
55  found &= m_fieldMap.find(Intensity) != m_fieldMap.end();
56  if (found && (field_code & ReturnNumber))
57  found = m_fieldMap.find(ReturnNumber) != m_fieldMap.end();
58  if (found && (field_code & NumberOfReturns))
59  found = m_fieldMap.find(NumberOfReturns) != m_fieldMap.end();
60  if (found && (field_code & Red))
61  found = m_fieldMap.find(Red) != m_fieldMap.end();
62  if (found && (field_code & Green))
63  found = m_fieldMap.find(Green) != m_fieldMap.end();
64  if (found && (field_code & Blue))
65  found = m_fieldMap.find(Blue) != m_fieldMap.end();
66  if (found && (field_code & GpsTime))
67  found = m_fieldMap.find(GpsTime) != m_fieldMap.end();
68  if (found && (field_code & Infrared))
69  found = m_fieldMap.find(Infrared) != m_fieldMap.end();
70 
71  return found;
72 }
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ isValid()

bool ossimPointRecord::isValid ( void  ) const

Definition at line 172 of file ossimPointRecord.cpp.

References ossimGpt::hasNans(), m_fieldMap, m_pointId, and m_position.

173 {
174  if ((m_pointId == 0) || m_fieldMap.empty() || m_position.hasNans())
175  return false;
176  return true;
177 }
ossim_uint32 m_pointId
bool hasNans() const
Definition: ossimGpt.h:135
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ operator=()

ossimPointRecord & ossimPointRecord::operator= ( const ossimPointRecord pcr)

Definition at line 112 of file ossimPointRecord.cpp.

References m_fieldMap, m_pointId, and m_position.

113 {
114  if (this == &pcr)
115  return *this;
116 
117  m_pointId = pcr.m_pointId;
118  m_position = pcr.m_position;
119  m_fieldMap = pcr.m_fieldMap;
120 
121  return *this;
122 }
ossim_uint32 m_pointId
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ setField()

void ossimPointRecord::setField ( FIELD_CODES  fc,
ossim_float32  value 
)

Definition at line 106 of file ossimPointRecord.cpp.

References m_fieldMap.

Referenced by ossimPdalReader::establishMinMax(), ossimPointCloudHandler::normalizeBlock(), ossimPdalReader::parsePoint(), and ossimPdalReader::parsePointView().

107 {
108  m_fieldMap[fc] = value;
109 }
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

◆ setPointId()

void ossimPointRecord::setPointId ( ossim_uint32  id)
inline

Definition at line 51 of file ossimPointRecord.h.

Referenced by ossimPdalReader::parsePointView().

51 {m_pointId = id; }
ossim_uint32 m_pointId

◆ setPosition()

void ossimPointRecord::setPosition ( const ossimGpt p)
inline

Definition at line 60 of file ossimPointRecord.h.

Referenced by ossimPdalReader::establishMinMax(), and ossimPdalReader::parsePoint().

60 { m_position = p; }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ostr,
const ossimPointRecord p 
)
friend

Definition at line 124 of file ossimPointRecord.cpp.

125 {
126  out << "ossimPointCloudRecord for pointId: " << p.m_pointId
127  << "\n Position: " << p.m_position << ends;
128 
129  std::map<ossimPointRecord::FIELD_CODES, ossim_float32>::const_iterator iter = p.m_fieldMap.begin();
130  while (iter != p.m_fieldMap.end())
131  {
132  switch (iter->first)
133  {
135  out << "\n Intensity: ";
136  break;
138  out << "\n ReturnNumber: ";
139  break;
141  out << "\n NumberOfReturns: ";
142  break;
144  out << "\n Red: ";
145  break;
147  out << "\n Green: ";
148  break;
150  out << "\n Blue: ";
151  break;
153  out << "\n GpsTime: ";
154  break;
156  out << "\n Infrared: ";
157  break;
158  default:
159  out << "\n Unidentified: ";
160  }
161  out << iter->second;
162  ++iter;
163  }
164  return out;
165 }
ossim_uint32 m_pointId
std::map< FIELD_CODES, ossim_float32 > m_fieldMap

Member Data Documentation

◆ m_fieldMap

std::map<FIELD_CODES, ossim_float32> ossimPointRecord::m_fieldMap
protected

◆ m_pointId

ossim_uint32 ossimPointRecord::m_pointId
protected

Definition at line 85 of file ossimPointRecord.h.

Referenced by clear(), isValid(), operator<<(), and operator=().

◆ m_position

ossimGpt ossimPointRecord::m_position
protected

Definition at line 86 of file ossimPointRecord.h.

Referenced by isValid(), operator<<(), and operator=().


The documentation for this class was generated from the following files: