QGIS API Documentation
3.41.0-Master (af5edcb665c)
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
42
// *INDENT-OFF*
43
50
enum class
CustomRole
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsPointCloudAttributeModel
, FieldRoles ) : int
51
{
52
AttributeName
SIP_MONKEYPATCH_COMPAT_NAME
(AttributeNameRole)= Qt::UserRole + 1,
53
AttributeIndex
SIP_MONKEYPATCH_COMPAT_NAME
(AttributeIndexRole),
54
AttributeSize
SIP_MONKEYPATCH_COMPAT_NAME
(AttributeSizeRole),
55
AttributeType
SIP_MONKEYPATCH_COMPAT_NAME
(AttributeTypeRole),
56
IsEmpty
SIP_MONKEYPATCH_COMPAT_NAME
(IsEmptyRole),
57
IsNumeric
SIP_MONKEYPATCH_COMPAT_NAME
(IsNumericRole),
58
};
59
Q_ENUM( CustomRole )
60
// *INDENT-ON*
61
62
65
explicit
QgsPointCloudAttributeModel
( QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
66
72
void
setLayer(
QgsPointCloudLayer
*layer );
73
79
QgsPointCloudLayer
*layer();
80
87
void
setAttributes(
const
QgsPointCloudAttributeCollection
&attributes );
88
94
QgsPointCloudAttributeCollection
attributes
()
const
{
return
mAttributes; }
95
100
void
setAllowEmptyAttributeName(
bool
allowEmpty );
101
105
QModelIndex indexFromName(
const
QString &name );
106
111
bool
allowEmptyAttributeName
()
const
{
return
mAllowEmpty; }
112
113
// QAbstractItemModel interface
114
QModelIndex index(
int
row,
int
column,
const
QModelIndex &parent = QModelIndex() )
const override
;
115
QModelIndex parent(
const
QModelIndex &child )
const override
;
116
int
rowCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
117
int
columnCount(
const
QModelIndex &parent )
const override
;
118
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
119
124
static
QString attributeToolTip(
const
QgsPointCloudAttribute
&attribute );
125
129
static
QIcon iconForAttributeType(
QgsPointCloudAttribute::DataType
type );
130
131
private
:
132
133
QgsPointCloudAttributeCollection
mAttributes;
134
bool
mAllowEmpty =
false
;
135
QPointer< QgsPointCloudLayer > mLayer;
136
};
137
138
146
class
CORE_EXPORT
QgsPointCloudAttributeProxyModel
:
public
QSortFilterProxyModel
147
{
148
Q_OBJECT
149
public
:
150
152
enum
Filter
SIP_ENUM_BASETYPE
( IntFlag )
153
{
154
Char = 1 << 0,
155
Short = 1 << 1,
156
Int32 = 1 << 2,
157
Float = 1 << 3,
158
Double = 1 << 4,
159
Numeric = Short | Int32 | Float | Double,
160
AllTypes = Numeric | Char,
161
};
162
Q_DECLARE_FLAGS(
Filters
,
Filter
)
163
Q_FLAG(
Filters
)
164
165
169
explicit
QgsPointCloudAttributeProxyModel
(
QgsPointCloudAttributeModel
*source, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
170
174
QgsPointCloudAttributeModel
*
sourceAttributeModel
() {
return
mModel; }
175
180
QgsPointCloudAttributeProxyModel
*setFilters(
QgsPointCloudAttributeProxyModel::Filters
filters );
181
186
Filters
filters
()
const
{
return
mFilters; }
187
188
private
:
189
190
QgsPointCloudAttributeModel
*mModel =
nullptr
;
191
Filters mFilters = AllTypes;
192
193
// QSortFilterProxyModel interface
194
public
:
195
bool
filterAcceptsRow(
int
source_row,
const
QModelIndex &source_parent )
const override
;
196
bool
lessThan(
const
QModelIndex &left,
const
QModelIndex &right )
const override
;
197
};
198
Q_DECLARE_OPERATORS_FOR_FLAGS
(
QgsPointCloudAttributeProxyModel::Filters
)
199
200
201
#endif
// QGSPOINTCLOUDATTRIBUTEMODEL_H
QgsPointCloudAttributeCollection
Collection of point cloud attributes.
Definition
qgspointcloudattribute.h:141
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:94
QgsPointCloudAttributeModel::CustomRole
CustomRole
Custom model roles.
Definition
qgspointcloudattributemodel.h:51
QgsPointCloudAttributeModel::allowEmptyAttributeName
bool allowEmptyAttributeName() const
Returns true if the model allows the empty attribute ("not set") choice.
Definition
qgspointcloudattributemodel.h:111
QgsPointCloudAttributeProxyModel
A proxy model for filtering available attributes from a point cloud attribute model.
Definition
qgspointcloudattributemodel.h:147
QgsPointCloudAttributeProxyModel::filters
Filters filters() const
Returns the filters controlling displayed attributes.
Definition
qgspointcloudattributemodel.h:186
QgsPointCloudAttributeProxyModel::sourceAttributeModel
QgsPointCloudAttributeModel * sourceAttributeModel()
Returns the QgsPointCloudAttributeModel used in this QSortFilterProxyModel.
Definition
qgspointcloudattributemodel.h:174
QgsPointCloudAttributeProxyModel::Filters
QFlags< Filter > Filters
Definition
qgspointcloudattributemodel.h:162
QgsPointCloudAttributeProxyModel::Filter
Filter
Attribute type filters.
Definition
qgspointcloudattributemodel.h:153
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
SIP_ENUM_BASETYPE
#define SIP_ENUM_BASETYPE(type)
Definition
qgis_sip.h:278
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition
qgis_sip.h:271
SIP_MONKEYPATCH_COMPAT_NAME
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition
qgis_sip.h:273
qgspointcloudattribute.h
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
Generated on Thu Dec 26 2024 02:19:01 for QGIS API Documentation by
1.9.8