DM_iterate_simple.cpp
// =================================================================
// iterating over all points of an existing ODM within C++
// =================================================================
#include <iostream>
#include "DM/Datamanager.hpp"
using namespace std;
void DM_iterate_simple(const char *filename)
{
//open the odm
DM::DatamanagerHandle dm = DM::IDatamanager::load(filename,true/*readOnly*/,false/*threadSafety*/);
//if the dm wasn't opened successful exit function
if (!dm)
{
cout << "Unable to open ODM '" << filename << "'" << endl;
return;
}
int idx = 0;
cout << "Output " << dm->sizePoint() << " points from the ODM" << endl;
//now iterate over all points
for(auto it = dm->beginPoint(); it != dm->endPoint(); ++it)
{
idx += 1;
//get point reference
const DM::IPoint &pt = *it;
//output point
cout << idx << ".point " << pt.x() << ", " << pt.y() << ", " << pt.z() << endl;
}
cout << "done" << endl;
}
static IDatamanager * load(const char *filename, bool readOnly=false, bool threadSafety=true)
Smart pointer class using reference counting with support for DM objects (see ObjectBase)
Definition: Handle.hpp:75
3d point object
Definition: IPoint.hpp:14