ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
tablemodel.h
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 
8 #pragma once
9 
10 #include <QAbstractTableModel>
11 #include <QVector>
12 
13 #include "../qPCL.h"
14 #include "point3f.h"
15 
16 // CV_CORE_LIB
17 #include <CVGeom.h>
18 
19 class ccHObject;
20 namespace VtkUtils {
21 class QPCL_ENGINE_LIB_API TableModel : public QAbstractTableModel {
22  Q_OBJECT
23 public:
24  explicit TableModel(int column, int row, QObject *parent = nullptr);
25  explicit TableModel(const ccHObject *objContainer,
26  QObject *parent = nullptr);
27  void updateData(const ccHObject *objContainer);
28  virtual ~TableModel();
29 
30  void random(int min = -5, int max = 5);
31  void resize(int column, int row);
32 
33  void clear();
34 
35  int randomMin();
36  int randomMax();
37 
38  void setHorizontalHeaderData(const QVariantList &data);
39  QVariantList horizontalHeaderData() const;
40 
41  void setVerticalHeaderData(const QVariantList &data);
42  QVariantList verticalHeaderData() const;
43 
44  int rowCount(const QModelIndex &parent = QModelIndex()) const;
45  int columnCount(const QModelIndex &parent = QModelIndex()) const;
46  QVariant headerData(int section,
47  Qt::Orientation orientation,
48  int role = Qt::DisplayRole) const;
49  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
50  qreal data(int row, int col) const;
51  QVector<Tuple3ui> verticesData() const;
52  bool setData(const QModelIndex &index,
53  const QVariant &value,
54  int role = Qt::EditRole);
55  bool setData(int row, int column, const QVariant &value);
56  Qt::ItemFlags flags(const QModelIndex &index) const;
57 
58 signals:
59  void rowsChanged(int oldRows, int newRows);
60  void columnsChanged(int oldCols, int newCols);
61 
62 private:
63  QVector<QVector<qreal> *> m_data;
64  QVector<Tuple3ui> m_vertices;
65 
66  QVariantList m_horHeaderData;
67  QVariantList m_verHeaderData;
68  int m_cols = 3;
69  int m_rows = 30;
70  int m_randomMin = -1;
71  int m_randomMax = 1;
72 };
73 
74 } // namespace VtkUtils
VtkUtils::TableModel::randomMin
int randomMin()
Definition: tablemodel.cpp:158
VtkUtils::TableModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: tablemodel.cpp:182
utils.h
ccObject::isKindOf
bool isKindOf(CV_CLASS_ENUM type) const
Definition: ecvObject.h:128
VtkUtils::TableModel::data
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: tablemodel.cpp:213
VtkUtils::TableModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: tablemodel.cpp:187
cloudViewer::GenericMesh::size
virtual unsigned size() const =0
Returns the number of triangles.
cloudViewer::VerticesIndexes::i2
unsigned i2
Definition: GenericIndexedMesh.h:19
cloudViewer::GenericCloud::size
virtual unsigned size() const =0
Returns the number of points.
VtkUtils::TableModel::~TableModel
virtual ~TableModel()
Definition: tablemodel.cpp:108
cloudViewer::VerticesIndexes
Triangle described by the indexes of its 3 vertices.
Definition: GenericIndexedMesh.h:16
Tuple3ui
Tuple3Tpl< unsigned int > Tuple3ui
Tuple of 3 unsigned int values.
Definition: CVGeom.h:219
data
GraphType data
Definition: graph_cut.cc:138
VtkUtils::TableModel::verticalHeaderData
QVariantList verticalHeaderData() const
Definition: tablemodel.cpp:180
CV_TYPES::MESH
@ MESH
Definition: CVTypes.h:105
VtkUtils::TableModel::random
void random(int min=-5, int max=5)
Definition: tablemodel.cpp:110
tablemodel.h
signals
#define signals
Definition: PythonPlugin.cpp:26
CV_TYPES::POINT_CLOUD
@ POINT_CLOUD
Definition: CVTypes.h:104
CVLog.h
VtkUtils::TableModel::setHorizontalHeaderData
void setHorizontalHeaderData(const QVariantList &data)
Definition: tablemodel.cpp:162
VtkUtils::TableModel::randomMax
int randomMax()
Definition: tablemodel.cpp:160
VtkUtils::TableModel::rowsChanged
void rowsChanged(int oldRows, int newRows)
VtkUtils::TableModel::verticesData
QVector< Tuple3ui > verticesData() const
Definition: tablemodel.cpp:225
ecvGenericMesh.h
VtkUtils::TableModel::columnsChanged
void columnsChanged(int oldCols, int newCols)
ccGenericPointCloud::getTheVisibilityArray
virtual VisibilityTableType & getTheVisibilityArray()
Returns associated visibility array.
Definition: ecvGenericPointCloud.h:168
ccGenericPointCloud
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
Vector3Tpl< PointCoordinateType >
ecvGenericPointCloud.h
cloudViewer::VerticesIndexes::i3
unsigned i3
Definition: GenericIndexedMesh.h:19
cloudViewer::VerticesIndexes::i
unsigned i[3]
Definition: GenericIndexedMesh.h:21
CVGeom.h
VtkUtils::TableModel::resize
void resize(int column, int row)
Definition: tablemodel.cpp:123
Utils::random
double random(int low, int high)
Definition: utils.cpp:55
VtkUtils::TableModel::setVerticalHeaderData
void setVerticalHeaderData(const QVariantList &data)
Definition: tablemodel.cpp:173
ccGenericMesh
Generic mesh interface.
Definition: ecvGenericMesh.h:28
ccDrawableObject::colorsShown
virtual bool colorsShown() const
Returns whether colors are shown or not.
Definition: ecvDrawableObject.h:82
VtkUtils::TableModel::clear
void clear()
Definition: tablemodel.cpp:147
VtkUtils::TableModel
Definition: tablemodel.h:21
VtkUtils::TableModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: tablemodel.cpp:227
POINT_VISIBLE
constexpr unsigned char POINT_VISIBLE
Definition: CVConst.h:92
cloudViewer::GenericIndexedMesh::getTriangleVertIndexes
virtual VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex)=0
Returns the indexes of the vertices of a given triangle.
VtkUtils::TableModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: tablemodel.cpp:192
ecvHObjectCaster.h
VtkUtils::TableModel::horizontalHeaderData
QVariantList horizontalHeaderData() const
Definition: tablemodel.cpp:169
ccHObject::getChildrenNumber
unsigned getChildrenNumber() const
Returns the number of children.
Definition: ecvHObject.h:312
VtkUtils::TableModel::TableModel
TableModel(int column, int row, QObject *parent=nullptr)
Definition: tablemodel.cpp:28
cloudViewer::GenericIndexedCloud::getPoint
virtual const CCVector3 * getPoint(unsigned index) const =0
Returns the ith point.
count
int count
Definition: FileIOFactory.cpp:132
QPCL_ENGINE_LIB_API
#define QPCL_ENGINE_LIB_API
Definition: qPCL.h:15
VtkUtils
Definition: VtkMultiTextureRenderer.cpp:46
ccHObject::getChild
ccHObject * getChild(unsigned childPos) const
Returns the ith child.
Definition: ecvHObject.h:325
VtkUtils::columnCount
static int columnCount(int count)
Definition: vtkwidget.cpp:72
ccHObject
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
VtkUtils::TableModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: tablemodel.cpp:243
VtkUtils::TableModel::updateData
void updateData(const ccHObject *objContainer)
Definition: tablemodel.cpp:51
Tuple3Tpl::u
Type u[3]
Definition: CVGeom.h:139
point3f.h
ecvHObject.h
ccHObjectCaster::ToGenericPointCloud
static ccGenericPointCloud * ToGenericPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccGenericPointCloud.
Definition: ecvHObjectCaster.cpp:81
cloudViewer::VerticesIndexes::i1
unsigned i1
Definition: GenericIndexedMesh.h:19
ccGenericPointCloud::VisibilityTableType
std::vector< unsigned char > VisibilityTableType
Array of "visibility" information for each point.
Definition: ecvGenericPointCloud.h:165