ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
pointstomodelconverter.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <QDebug>
11 
12 #include "tablemodel.h"
13 
14 namespace VtkUtils {
15 
17  TableModel* model)
18  : m_points(points), m_model(model) {}
19 
21  if (!m_model) {
22  qDebug() << "PointsToModelConverter::run : null model.";
23  emit finished();
24  return;
25  }
26 
27  m_model->resize(3, m_points.size());
28  m_model->blockSignals(true);
29 
30  for (int i = 0; i < m_points.size(); ++i) {
31  m_model->setData(i, 0, m_points.at(i).x);
32  m_model->setData(i, 1, m_points.at(i).y);
33  m_model->setData(i, 2, m_points.at(i).z);
34  }
35 
36  m_model->blockSignals(false);
37 
38  emit finished();
39 }
40 
41 } // namespace VtkUtils
int points
PointsToModelConverter(const QList< Point3F > &points, TableModel *model)
void resize(int column, int row)
Definition: tablemodel.cpp:123
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: tablemodel.cpp:227