Skip to content

Commit

Permalink
[ui] Make the qt list view display ordering indifferent to the view m…
Browse files Browse the repository at this point in the history
…ap ordering.
  • Loading branch information
pmoulon committed Apr 22, 2016
1 parent 077ea51 commit 722e4ef
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/software/ui/SfM/control_points_registration/mainLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "openMVG/sfm/sfm_data_BA_ceres.hpp"
#include "openMVG/sfm/sfm_data_transform.hpp"

#include "openMVG/stl/stl.hpp"

void MainWindow::removeAllControlPoints()
{
m_doc._sfm_data.control_points = Landmarks();
Expand Down Expand Up @@ -118,10 +120,17 @@ void MainWindow::openProject()
model->setHeaderData(0, Qt::Horizontal, QObject::tr("Views"));
m_treeView_Images->setModel(model);

for (Views::const_reverse_iterator iterV = m_doc._sfm_data.GetViews().rbegin();
iterV != m_doc._sfm_data.GetViews().rend();
++iterV)
std::vector<IndexT> view_ids;
view_ids.reserve(m_doc._sfm_data.GetViews().size());
std::transform(m_doc._sfm_data.GetViews().begin(), m_doc._sfm_data.GetViews().end(),
std::back_inserter(view_ids), stl::RetrieveKey());
std::sort(view_ids.begin(), view_ids.end());

// Add view in reverse order to have them ordered by ID
for (std::vector<IndexT>::const_reverse_iterator iter = view_ids.rbegin();
iter != view_ids.rend(); ++iter)
{
Views::const_iterator iterV = m_doc._sfm_data.GetViews().find(*iter);
const View * view = iterV->second.get();
if (m_doc._sfm_data.IsPoseAndIntrinsicDefined(view))
{
Expand Down

0 comments on commit 722e4ef

Please sign in to comment.