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

#include <ossimPdalReader.h>

Inheritance diagram for ossimPdalReader:
ossimPointCloudHandler ossimPointCloudSource ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced ossimPdalFileReader ossimRialtoReader

Public Member Functions

 ossimPdalReader ()
 default constructor More...
 
virtual ~ossimPdalReader ()
 virtual destructor More...
 
virtual void rewind () const
 
virtual ossim_uint32 getNumPoints () const
 Returns number of points in the data file. More...
 
virtual void close ()
 Closes the point cloud file(s). More...
 
virtual ossim_uint32 getFieldCode () const
 Fetches the data fields ids available from this source, OR'd together for testing against specific field (. More...
 
virtual void setFieldCode (ossim_uint32 fieldCode)
 Sets the data fields ID of interest for this source, and all input sources connected to this. More...
 
- Public Member Functions inherited from ossimPointCloudHandler
 ossimPointCloudHandler ()
 
 ossimPointCloudHandler (ossimObject *owner)
 
virtual ~ossimPointCloudHandler ()
 
virtual bool open (const ossimFilename &imageFile)=0
 Method to open input point cloud dataset. More...
 
virtual void getFileBlock (ossim_uint32 offset, ossimPointBlock &block, ossim_uint32 maxNumPoints=0xFFFFFFFF) const =0
 Fetches up to maxNumPoints points starting at the dataset's <offset> in the order they appear in the data file. More...
 
virtual void getNextFileBlock (ossimPointBlock &block, ossim_uint32 maxNumPoints=0xFFFFFFFF) const
 
virtual void getBlock (const ossimGrect &bounds, ossimPointBlock &block) const
 Fetches the block of points inside the block bounds. More...
 
virtual const ossimPointRecordgetMinPoint () const
 Assigns the two points with fields representing the extremes of the dataset. More...
 
virtual const ossimPointRecordgetMaxPoint () const
 
virtual void getBounds (ossimGrect &bounds) const
 
virtual bool canConnectMyInputTo (ossim_int32, const ossimConnectableObject *) const
 Handler is always on the start of the pipeline. More...
 
void normalizeBlock (ossimPointBlock &block)
 
- Public Member Functions inherited from ossimPointCloudSource
 ossimPointCloudSource (ossimObject *owner=0)
 
virtual ~ossimPointCloudSource ()
 
virtual bool hasFields (ossim_uint32 id) const
 Returns true if the data field is available from this source. More...
 
bool hasRGB () const
 Special for convenience. More...
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual void initialize ()
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) 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
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 

Protected Member Functions

void parsePointView (ossimPointBlock &block, ossim_uint32 maxNumPoints=0xFFFFFFFF) const
 The current point ID (pid) gets updated. More...
 
void parsePoint (ossimPointRecord *precord) const
 Need to pass allocated ossimPointRecord with field code set to desired fields. More...
 
virtual void establishMinMax ()
 Computes min and max records using points in the current PointViewSet. More...
 
virtual void establishAvailableFields ()
 
- Protected Member Functions inherited from ossimPointCloudSource
 ossimPointCloudSource (const ossimPointCloudSource &rhs)
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

pdal::PointViewSet m_pvs
 
pdal::PointViewPtr m_currentPV
 
ossim_uint32 m_currentPvOffset
 
PointTablePtr m_pointTable
 
pdal::Stage * m_pdalPipe
 
pdal::Options m_pdalOptions
 
ossim_uint32 m_availableFields
 
- Protected Attributes inherited from ossimPointCloudHandler
ossimFilename m_inputFilename
 
ossimRefPtr< ossimPointCloudGeometrym_geometry
 
ossimRefPtr< ossimPointRecordm_minRecord
 
ossimRefPtr< ossimPointRecordm_maxRecord
 
ossim_uint32 m_currentPID
 
- Protected Attributes inherited from ossimPointCloudSource
ossimPointRecord m_nullPCR
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Additional Inherited Members

- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 
- Static Public Attributes inherited from ossimPointCloudHandler
static ossim_uint32 DEFAULT_BLOCK_SIZE = 0x400000
 

Detailed Description

Definition at line 22 of file ossimPdalReader.h.

Constructor & Destructor Documentation

◆ ossimPdalReader()

ossimPdalReader::ossimPdalReader ( )

default constructor

Definition at line 23 of file ossimPdalReader.cpp.

References ossimPointCloudHandler::m_geometry.

24 : m_currentPV (0),
26  m_pdalPipe (0),
28 {
29  // create unity-transform, geographic geometry. derived classes may overwrite this later
31 }
pdal::Stage * m_pdalPipe
ossim_uint32 m_currentPvOffset
pdal::PointViewPtr m_currentPV
ossim_uint32 m_availableFields
ossimRefPtr< ossimPointCloudGeometry > m_geometry

◆ ~ossimPdalReader()

ossimPdalReader::~ossimPdalReader ( )
virtual

virtual destructor

Definition at line 34 of file ossimPdalReader.cpp.

References m_pdalPipe.

35 {
36  delete m_pdalPipe;
37 }
pdal::Stage * m_pdalPipe

Member Function Documentation

◆ close()

virtual void ossimPdalReader::close ( )
inlinevirtual

Closes the point cloud file(s).

Implements ossimPointCloudHandler.

Definition at line 38 of file ossimPdalReader.h.

38 { m_currentPV = 0; m_pointTable = 0; }
pdal::PointViewPtr m_currentPV
PointTablePtr m_pointTable

◆ establishAvailableFields()

void ossimPdalReader::establishAvailableFields ( )
protectedvirtual

Reimplemented in ossimRialtoReader.

Definition at line 311 of file ossimPdalReader.cpp.

References ossimPointRecord::Blue, ossimPointRecord::GpsTime, ossimPointRecord::Green, ossimPointRecord::Infrared, ossimPointRecord::Intensity, m_availableFields, m_currentPV, ossimPointRecord::NumberOfReturns, ossimPointRecord::Red, and ossimPointRecord::ReturnNumber.

312 {
313  m_availableFields = 0;
314  if (!m_currentPV)
315  return;
316 
317  if (m_currentPV->hasDim(Id::Enum::Intensity))
319  if (m_currentPV->hasDim(Id::Enum::ReturnNumber))
321  if (m_currentPV->hasDim(Id::Enum::NumberOfReturns))
323  if (m_currentPV->hasDim(Id::Enum::Red))
325  if (m_currentPV->hasDim(Id::Enum::Green))
327  if (m_currentPV->hasDim(Id::Enum::Blue))
329  if (m_currentPV->hasDim(Id::Enum::GpsTime))
331  if (m_currentPV->hasDim(Id::Enum::Infrared))
333 }
pdal::PointViewPtr m_currentPV
ossim_uint32 m_availableFields

◆ establishMinMax()

void ossimPdalReader::establishMinMax ( )
protectedvirtual

Computes min and max records using points in the current PointViewSet.

Reimplemented in ossimRialtoReader, and ossimPdalFileReader.

Definition at line 203 of file ossimPdalReader.cpp.

References ossimRefPtr< T >::get(), ossimPointRecord::getField(), getFieldCode(), ossimPointRecord::getFieldCode(), ossimPointRecord::getFieldMap(), ossimPointRecord::getPosition(), ossimPointRecord::Green, ossimGpt::hgt, ossimGpt::lat, ossimGpt::lon, m_currentPV, m_currentPvOffset, ossimPointCloudHandler::m_maxRecord, ossimPointCloudHandler::m_minRecord, m_pvs, parsePoint(), ossimPointRecord::Red, rewind(), ossimPointRecord::setField(), ossimPointRecord::setPosition(), and ossimRefPtr< T >::valid().

Referenced by ossimRialtoReader::establishAvailableFields(), and ossimPdalFileReader::establishMinMax().

204 {
205  rewind();
206 
207  PointViewSet::iterator pvs_iter = m_pvs.begin();
208  if ((pvs_iter == m_pvs.end()) || (*pvs_iter)->empty())
209  return;
210 
211  if (!m_minRecord.valid())
212  {
215  }
216 
217  // Latch first point:
218  m_currentPV = *pvs_iter;
221  ossimGpt minPos (m_minRecord->getPosition());
222  ossimGpt maxPos (minPos);
223 
224  // Set up loop over all point view sets:
226  while (pvs_iter != m_pvs.end())
227  {
228  // Set up loop over points in each PointView:
229  m_currentPV = *pvs_iter;
230  m_currentPvOffset = 0;
231 
232  // Now loop over all points in PV to latch min/max:
233  PointViewIter pv_iter = m_currentPV->begin();
234  while (pv_iter != m_currentPV->end())
235  {
236  parsePoint(opr.get());
237 
238  if (opr->getPosition().lat < minPos.lat)
239  minPos.lat = opr->getPosition().lat;
240  if (opr->getPosition().lon < minPos.lon)
241  minPos.lon = opr->getPosition().lon;
242  if (opr->getPosition().hgt < minPos.hgt)
243  minPos.hgt = opr->getPosition().hgt;
244 
245  if (opr->getPosition().lat > maxPos.lat)
246  maxPos.lat = opr->getPosition().lat;
247  if (opr->getPosition().lon > maxPos.lon)
248  maxPos.lon = opr->getPosition().lon;
249  if (opr->getPosition().hgt > maxPos.hgt)
250  maxPos.hgt = opr->getPosition().hgt;
251 
252  std::map<ossimPointRecord::FIELD_CODES, ossim_float32>::const_iterator field =
253  opr->getFieldMap().begin();
254  while (field != opr->getFieldMap().end())
255  {
256  if (field->second < m_minRecord->getField(field->first))
257  m_minRecord->setField(field->first, field->second);
258  else if (field->second > m_maxRecord->getField(field->first))
259  m_maxRecord->setField(field->first, field->second);
260  ++field;
261  }
262  ++pv_iter;
264  }
265  ++pvs_iter;
266  }
267 
268  m_minRecord->setPosition(minPos);
269  m_maxRecord->setPosition(maxPos);
270 
271  // Latch overall min and max color band to avoid color distortion when normalizing:
275  if (m_minRecord->hasFields(R|G|B))
276  {
280  float c = std::min(r, std::min(g, b));
281  m_minRecord->setField(R, c);
282  m_minRecord->setField(G, c);
283  m_minRecord->setField(B, c);
284 
285  r = m_maxRecord->getField(R);
286  g = m_maxRecord->getField(G);
287  b = m_maxRecord->getField(B);
288  c = std::max(r, std::max(g, b));
289  m_maxRecord->setField(R, c);
290  m_maxRecord->setField(G, c);
291  m_maxRecord->setField(B, c);
292  }
293 
294  rewind();
295 }
ossimRefPtr< ossimPointRecord > m_maxRecord
const std::map< FIELD_CODES, ossim_float32 > & getFieldMap() const
ossim_uint32 m_currentPvOffset
bool valid() const
Definition: ossimRefPtr.h:75
float ossim_float32
ossim_float32 getField(FIELD_CODES fc) const
Return the float value of the requested field.
pdal::PointViewPtr m_currentPV
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
virtual ossim_uint32 getFieldCode() const
Fetches the data fields ids available from this source, OR&#39;d together for testing against specific fi...
void parsePoint(ossimPointRecord *precord) const
Need to pass allocated ossimPointRecord with field code set to desired fields.
ossim_float64 lon
Definition: ossimGpt.h:266
virtual bool hasFields(ossim_uint32 code_mashup) const
Argument can be mash-up of OR&#39;d codes for check of multiple fields.
#define max(a, b)
Definition: auxiliary.h:76
virtual ossim_uint32 getFieldCode() const
Returns mash-up of OR&#39;d codes of multiple fields being stored.
virtual void rewind() const
const ossimGpt & getPosition() const
Returns the 3D position vector in the dataset&#39;s coodinate reference system (available from the ossimP...
ossim_float64 lat
Definition: ossimGpt.h:265
void setField(FIELD_CODES fc, ossim_float32 value)
void setPosition(const ossimGpt &p)
ossimRefPtr< ossimPointRecord > m_minRecord
pdal::PointViewSet m_pvs
#define min(a, b)
Definition: auxiliary.h:75

◆ getFieldCode()

virtual ossim_uint32 ossimPdalReader::getFieldCode ( ) const
inlinevirtual

Fetches the data fields ids available from this source, OR'd together for testing against specific field (.

See also
ossimPointRecord::FIELD_CODES). e.g. (though should use hasField()),

bool hasIntensity = getFields() & ossimPointRecord::Intensity;

Reimplemented from ossimPointCloudSource.

Definition at line 46 of file ossimPdalReader.h.

Referenced by establishMinMax().

46 { return m_availableFields; }
ossim_uint32 m_availableFields

◆ getNumPoints()

ossim_uint32 ossimPdalReader::getNumPoints ( ) const
virtual

Returns number of points in the data file.

Implements ossimPointCloudSource.

Reimplemented in ossimPdalFileReader.

Definition at line 297 of file ossimPdalReader.cpp.

References m_pvs.

298 {
299  ossim_uint32 numPoints = 0;
300 
301  PointViewSet::iterator pvs_iter = m_pvs.begin();
302  while (pvs_iter != m_pvs.end())
303  {
304  numPoints += (*pvs_iter)->size();
305  ++pvs_iter;
306  }
307 
308  return numPoints;
309 }
unsigned int ossim_uint32
pdal::PointViewSet m_pvs

◆ parsePoint()

void ossimPdalReader::parsePoint ( ossimPointRecord precord) const
protected

Need to pass allocated ossimPointRecord with field code set to desired fields.

The pointNum is the point index into the point view

Definition at line 108 of file ossimPdalReader.cpp.

References ossimPointRecord::Blue, ossimPointCloudGeometry::convertPos(), ossimPointRecord::GpsTime, ossimPointRecord::Green, ossimPointRecord::hasFields(), ossimPointRecord::Infrared, ossimPointRecord::Intensity, m_currentPV, m_currentPvOffset, ossimPointCloudHandler::m_geometry, ossimPointRecord::NumberOfReturns, ossimPointRecord::Red, ossimPointRecord::ReturnNumber, ossimPointRecord::setField(), ossimPointRecord::setPosition(), ossimDpt3d::x, ossimDpt3d::y, and ossimDpt3d::z.

Referenced by establishMinMax(), and parsePointView().

109 {
110  if (!point)
111  return;
112 
113  ossimDpt3d dpt3d;
114  ossim_uint8 I8;
115  float F32;
116 
117  // The ossimPointRecord should already be initialized with the desired fields set to default
118  // values (i.e., their NULL values):
119  const IdList& idList = m_currentPV->dims();
120  IdList::const_iterator dim_iter = idList.begin();
121  while (dim_iter != idList.end())
122  {
123  Id::Enum id = *dim_iter;
124  switch (id)
125  {
126  case Id::Enum::X: // always do position
127  dpt3d.x = m_currentPV->getFieldAs<double>(Id::Enum::X, m_currentPvOffset);
128  break;
129  case Id::Enum::Y: // always do position
130  dpt3d.y = m_currentPV->getFieldAs<double>(Id::Enum::Y, m_currentPvOffset);
131  break;
132  case Id::Enum::Z: // always do position
133  dpt3d.z = m_currentPV->getFieldAs<double>(Id::Enum::Z, m_currentPvOffset);
134  break;
135  case Id::Enum::ReturnNumber:
136  if (point->hasFields(ossimPointRecord::ReturnNumber))
137  {
138  I8 = m_currentPV->getFieldAs<uint8_t>(Id::Enum::ReturnNumber, m_currentPvOffset);
139  point->setField(ossimPointRecord::ReturnNumber, (ossim_float32) I8);
140  }
141  break;
142  case Id::Enum::NumberOfReturns:
143  if (point->hasFields(ossimPointRecord::NumberOfReturns))
144  {
145  I8 = m_currentPV->getFieldAs<uint8_t>(Id::Enum::NumberOfReturns, m_currentPvOffset);
146  point->setField(ossimPointRecord::NumberOfReturns, (ossim_float32) I8);
147  }
148  break;
149  case Id::Enum::Intensity:
150  if (point->hasFields(ossimPointRecord::Intensity))
151  {
152  F32 = m_currentPV->getFieldAs<float>(Id::Enum::Intensity, m_currentPvOffset);
153  point->setField(ossimPointRecord::Intensity, (ossim_float32) F32);
154  }
155  break;
156  case Id::Enum::Red:
157  if (point->hasFields(ossimPointRecord::Red))
158  {
159  F32 = m_currentPV->getFieldAs<float>(Id::Enum::Red, m_currentPvOffset);
160  point->setField(ossimPointRecord::Red, (ossim_float32) F32);
161  }
162  break;
163  case Id::Enum::Green:
164  if (point->hasFields(ossimPointRecord::Green))
165  {
166  F32 = m_currentPV->getFieldAs<float>(Id::Enum::Green, m_currentPvOffset);
167  point->setField(ossimPointRecord::Green, (ossim_float32) F32);
168  }
169  break;
170  case Id::Enum::Blue:
171  if (point->hasFields(ossimPointRecord::Blue))
172  {
173  F32 = m_currentPV->getFieldAs<float>(Id::Enum::Blue, m_currentPvOffset);
174  point->setField(ossimPointRecord::Blue, (ossim_float32) F32);
175  }
176  break;
177  case Id::Enum::Infrared:
178  if (point->hasFields(ossimPointRecord::Infrared))
179  {
180  F32 = m_currentPV->getFieldAs<float>(Id::Enum::Infrared, m_currentPvOffset);
181  point->setField(ossimPointRecord::Infrared, (ossim_float32) F32);
182  }
183  break;
184  case Id::Enum::GpsTime:
185  if (point->hasFields(ossimPointRecord::GpsTime))
186  {
187  F32 = m_currentPV->getFieldAs<float>(Id::Enum::GpsTime, m_currentPvOffset);
188  point->setField(ossimPointRecord::GpsTime, (ossim_float32) F32);
189  }
190  break;
191  default:
192  break;
193  }
194  ++dim_iter;
195  }
196 
197  // Need to convert X, Y, Z to geographic point (if necessary).
198  ossimGpt pos;
199  m_geometry->convertPos(dpt3d, pos);
200  point->setPosition(pos);
201 }
ossim_uint32 m_currentPvOffset
float ossim_float32
pdal::PointViewPtr m_currentPV
double z
Definition: ossimDpt3d.h:145
void convertPos(const ossimDpt3d &stored_pos, ossimGpt &converted_gpos) const
Method converts a generic 3D point as stored in the argument ossim3Dpt object, and converts it to an ...
double x
Definition: ossimDpt3d.h:143
double y
Definition: ossimDpt3d.h:144
ossimRefPtr< ossimPointCloudGeometry > m_geometry
unsigned char ossim_uint8

◆ parsePointView()

void ossimPdalReader::parsePointView ( ossimPointBlock block,
ossim_uint32  maxNumPoints = 0xFFFFFFFF 
) const
protected

The current point ID (pid) gets updated.

The block is added to – pre-existing points remain or get overwritten if pid matches existing.

Definition at line 49 of file ossimPdalReader.cpp.

References ossimPointBlock::addPoint(), ossimPointRecord::Blue, ossimRefPtr< T >::get(), ossimPointRecord::getField(), ossimPointBlock::getFieldCode(), ossimPointRecord::Green, ossimPointCloudSource::hasRGB(), ossimPointRecord::Intensity, ossimPointCloudHandler::m_currentPID, m_currentPvOffset, ossimPointCloudHandler::m_maxRecord, ossimPointCloudHandler::m_minRecord, parsePoint(), ossimPointRecord::Red, ossimPointRecord::setField(), ossimPointRecord::setPointId(), ossimPointBlock::size(), and size.

50 {
51  ossim_uint32 field_code = block.getFieldCode();
52  while (m_currentPvOffset < m_currentPV->size())
53  {
54  if (block.size() == maxNumPoints)
55  break;
56 
57  // Convert point data to OSSIM-friendly format:
58 #ifdef NORMALIZE_FIELDS
59  ossim_float32 minI, delI, minC, delC;
60  bool hasIntensity = false;
61  bool hasRGB = false;
62  if (field_code & ossimPointRecord::Intensity)
63  {
64  hasIntensity = true;
67  }
69  if ((field_code & rgb_code) == rgb_code)
70  {
71  hasRGB = true;
74  }
75 #endif
76 
77  // cout << "ossimPdalReader::parsePointView() -- point_id = "<< point_id<<endl;
78 
79  // Reads directly from the PDAL point buffer:
80  ossimRefPtr<ossimPointRecord> opr = new ossimPointRecord(field_code);
81  parsePoint(opr.get());
82 
83  // Normalize intensity and color:
84 #ifdef NORMALIZE_FIELDS
85  if (hasIntensity)
86  {
87  float normI = (opr->getField(ossimPointRecord::Intensity) - minI) / delI;
89  }
90  if (hasRGB)
91  {
92  float normC = (opr->getField(ossimPointRecord::Red) - minC) / delC;
93  opr->setField(ossimPointRecord::Red, normC);
94  normC = (opr->getField(ossimPointRecord::Green) - minC) / delC;
95  opr->setField(ossimPointRecord::Green, normC);
96  normC = (opr->getField(ossimPointRecord::Blue) - minC) / delC;
97  opr->setField(ossimPointRecord::Blue, normC);
98  }
99 #endif
100 
101  // Add this point to the output block:
102  opr->setPointId(m_currentPID++);
103  block.addPoint(opr.get());
105  }
106 }
ossimRefPtr< ossimPointRecord > m_maxRecord
ossim_uint32 getFieldCode() const
Returns OR&#39;d mash-up of ossimPointRecord field codes being stored (or desired to be stored) ...
ossim_uint32 m_currentPvOffset
float ossim_float32
ossim_float32 getField(FIELD_CODES fc) const
Return the float value of the requested field.
virtual void addPoint(ossimPointRecord *point)
Adds single point to the tail of the list.
void parsePoint(ossimPointRecord *precord) const
Need to pass allocated ossimPointRecord with field code set to desired fields.
yy_size_t size
unsigned int ossim_uint32
virtual ossim_uint32 size() const
Returns allocated size.
bool hasRGB() const
Special for convenience.
void setField(FIELD_CODES fc, ossim_float32 value)
ossimRefPtr< ossimPointRecord > m_minRecord
void setPointId(ossim_uint32 id)

◆ rewind()

void ossimPdalReader::rewind ( ) const
virtual

Reimplemented from ossimPointCloudHandler.

Definition at line 39 of file ossimPdalReader.cpp.

References ossimPointCloudHandler::m_currentPID, m_currentPV, m_currentPvOffset, and m_pvs.

Referenced by establishMinMax().

40 {
42  if (m_pvs.size())
43  m_currentPV = *(m_pvs.begin());
44  else
45  m_currentPV = 0;
46  m_currentPID = 0;
47 }
ossim_uint32 m_currentPvOffset
pdal::PointViewPtr m_currentPV
pdal::PointViewSet m_pvs

◆ setFieldCode()

virtual void ossimPdalReader::setFieldCode ( ossim_uint32  fieldCode)
inlinevirtual

Sets the data fields ID of interest for this source, and all input sources connected to this.

This is an OR'd mash-up of

See also
ossimPointRecord::FIELD_CODES

Reimplemented from ossimPointCloudSource.

Definition at line 52 of file ossimPdalReader.h.

52 { m_availableFields = fieldCode; }
ossim_uint32 m_availableFields

Member Data Documentation

◆ m_availableFields

ossim_uint32 ossimPdalReader::m_availableFields
protected

Definition at line 74 of file ossimPdalReader.h.

Referenced by establishAvailableFields().

◆ m_currentPV

pdal::PointViewPtr ossimPdalReader::m_currentPV
mutableprotected

Definition at line 69 of file ossimPdalReader.h.

Referenced by establishAvailableFields(), establishMinMax(), parsePoint(), and rewind().

◆ m_currentPvOffset

ossim_uint32 ossimPdalReader::m_currentPvOffset
mutableprotected

Definition at line 70 of file ossimPdalReader.h.

Referenced by establishMinMax(), parsePoint(), parsePointView(), and rewind().

◆ m_pdalOptions

pdal::Options ossimPdalReader::m_pdalOptions
mutableprotected

Definition at line 73 of file ossimPdalReader.h.

◆ m_pdalPipe

pdal::Stage* ossimPdalReader::m_pdalPipe
protected

Definition at line 72 of file ossimPdalReader.h.

Referenced by ~ossimPdalReader().

◆ m_pointTable

PointTablePtr ossimPdalReader::m_pointTable
mutableprotected

Definition at line 71 of file ossimPdalReader.h.

◆ m_pvs

pdal::PointViewSet ossimPdalReader::m_pvs
mutableprotected

Definition at line 68 of file ossimPdalReader.h.

Referenced by establishMinMax(), getNumPoints(), and rewind().


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