QGIS API Documentation
3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
src
core
pointcloud
qgspointcloudattributemodel.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgspointcloudattributemodel.h
3
---------------------
4
begin : November 2020
5
copyright : (C) 2020 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSPOINTCLOUDATTRIBUTEMODEL_H
19
#define QGSPOINTCLOUDATTRIBUTEMODEL_H
20
21
#include "
qgspointcloudattribute.h
"
22
23
#include <QAbstractItemModel>
24
#include <QPointer>
25
#include <QSortFilterProxyModel>
26
27
class
QgsPointCloudLayer
;
28
36
class
CORE_EXPORT
QgsPointCloudAttributeModel
:
public
QAbstractItemModel
37
{
38
Q_OBJECT
39
40
public
:
41
43
enum
FieldRoles
44
{
45
AttributeNameRole = Qt::UserRole + 1,
46
AttributeIndexRole
,
47
AttributeSizeRole
,
48
AttributeTypeRole
,
49
IsEmptyRole
,
50
IsNumericRole
,
51
};
52
56
explicit
QgsPointCloudAttributeModel
( QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
57
63
void
setLayer(
QgsPointCloudLayer
*layer );
64
70
QgsPointCloudLayer
*layer();
71
78
void
setAttributes(
const
QgsPointCloudAttributeCollection
&attributes );
79
85
QgsPointCloudAttributeCollection
attributes
()
const
{
return
mAttributes; }
86
91
void
setAllowEmptyAttributeName(
bool
allowEmpty );
92
96
QModelIndex indexFromName(
const
QString &name );
97
102
bool
allowEmptyAttributeName
()
const
{
return
mAllowEmpty; }
103
104
// QAbstractItemModel interface
105
QModelIndex index(
int
row,
int
column,
const
QModelIndex &parent = QModelIndex() )
const override
;
106
QModelIndex parent(
const
QModelIndex &child )
const override
;
107
int
rowCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
108
int
columnCount(
const
QModelIndex &parent )
const override
;
109
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
110
115
static
QString attributeToolTip(
const
QgsPointCloudAttribute
&attribute );
116
120
static
QIcon iconForAttributeType(
QgsPointCloudAttribute::DataType
type );
121
122
private
:
123
124
QgsPointCloudAttributeCollection
mAttributes;
125
bool
mAllowEmpty =
false
;
126
QPointer< QgsPointCloudLayer > mLayer;
127
};
128
129
137
class
CORE_EXPORT
QgsPointCloudAttributeProxyModel
:
public
QSortFilterProxyModel
138
{
139
Q_OBJECT
140
public
:
141
143
enum
Filter
144
{
145
Char = 1 << 0,
146
Short = 1 << 1,
147
Int32 = 1 << 2,
148
Float = 1 << 3,
149
Double = 1 << 4,
150
Numeric = Short | Int32 | Float | Double,
151
AllTypes = Numeric | Char,
152
};
153
Q_DECLARE_FLAGS( Filters, Filter )
154
Q_FLAG( Filters )
155
156
160
explicit
QgsPointCloudAttributeProxyModel
(
QgsPointCloudAttributeModel
*source, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
161
165
QgsPointCloudAttributeModel
*
sourceAttributeModel
() {
return
mModel; }
166
171
QgsPointCloudAttributeProxyModel
*setFilters( QgsPointCloudAttributeProxyModel::Filters filters );
172
177
Filters
filters
()
const
{
return
mFilters; }
178
179
private
:
180
181
QgsPointCloudAttributeModel
*mModel =
nullptr
;
182
Filters mFilters = AllTypes;
183
184
// QSortFilterProxyModel interface
185
public
:
186
bool
filterAcceptsRow(
int
source_row,
const
QModelIndex &source_parent )
const override
;
187
bool
lessThan(
const
QModelIndex &left,
const
QModelIndex &right )
const override
;
188
};
189
Q_DECLARE_OPERATORS_FOR_FLAGS
( QgsPointCloudAttributeProxyModel::Filters )
190
191
192
#endif
// QGSPOINTCLOUDATTRIBUTEMODEL_H
QgsPointCloudAttributeCollection
Collection of point cloud attributes.
Definition
qgspointcloudattribute.h:142
QgsPointCloudAttributeModel
A model for display of available attributes from a point cloud.
Definition
qgspointcloudattributemodel.h:37
QgsPointCloudAttributeModel::attributes
QgsPointCloudAttributeCollection attributes() const
Returns the attributes associated with the model.
Definition
qgspointcloudattributemodel.h:85
QgsPointCloudAttributeModel::FieldRoles
FieldRoles
Roles utilized by the model.
Definition
qgspointcloudattributemodel.h:44
QgsPointCloudAttributeModel::AttributeTypeRole
@ AttributeTypeRole
Attribute type, see QgsPointCloudAttribute::DataType.
Definition
qgspointcloudattributemodel.h:48
QgsPointCloudAttributeModel::IsEmptyRole
@ IsEmptyRole
true if the index corresponds to the empty value
Definition
qgspointcloudattributemodel.h:49
QgsPointCloudAttributeModel::AttributeIndexRole
@ AttributeIndexRole
Attribute index if index corresponds to an attribute.
Definition
qgspointcloudattributemodel.h:46
QgsPointCloudAttributeModel::AttributeSizeRole
@ AttributeSizeRole
Attribute size.
Definition
qgspointcloudattributemodel.h:47
QgsPointCloudAttributeModel::IsNumericRole
@ IsNumericRole
true if the index corresponds to a numeric attributre
Definition
qgspointcloudattributemodel.h:50
QgsPointCloudAttributeModel::allowEmptyAttributeName
bool allowEmptyAttributeName() const
Returns true if the model allows the empty attribute ("not set") choice.
Definition
qgspointcloudattributemodel.h:102
QgsPointCloudAttributeProxyModel
A proxy model for filtering available attributes from a point cloud attribute model.
Definition
qgspointcloudattributemodel.h:138
QgsPointCloudAttributeProxyModel::filters
Filters filters() const
Returns the filters controlling displayed attributes.
Definition
qgspointcloudattributemodel.h:177
QgsPointCloudAttributeProxyModel::sourceAttributeModel
QgsPointCloudAttributeModel * sourceAttributeModel()
Returns the QgsPointCloudAttributeModel used in this QSortFilterProxyModel.
Definition
qgspointcloudattributemodel.h:165
QgsPointCloudAttributeProxyModel::Filter
Filter
Attribute type filters.
Definition
qgspointcloudattributemodel.h:144
QgsPointCloudAttribute
Attribute for point cloud data pair of name and size in bytes.
Definition
qgspointcloudattribute.h:41
QgsPointCloudAttribute::DataType
DataType
Systems of unit measurement.
Definition
qgspointcloudattribute.h:45
QgsPointCloudLayer
Represents a map layer supporting display of point clouds.
Definition
qgspointcloudlayer.h:46
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:53
qgspointcloudattribute.h
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
Generated on Mon Oct 30 2023 18:42:25 for QGIS API Documentation by
1.9.8