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 sucessful 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;
}