QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
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
// *INDENT-OFF*
42
49
enum class
CustomRole
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsPointCloudAttributeModel
, FieldRoles ) : int
50
{
51
AttributeName
SIP_MONKEYPATCH_COMPAT_NAME
( AttributeNameRole ) = Qt::UserRole + 1,
52
AttributeIndex
SIP_MONKEYPATCH_COMPAT_NAME
( AttributeIndexRole ),
53
AttributeSize
SIP_MONKEYPATCH_COMPAT_NAME
( AttributeSizeRole ),
54
AttributeType
SIP_MONKEYPATCH_COMPAT_NAME
( AttributeTypeRole ),
55
IsEmpty
SIP_MONKEYPATCH_COMPAT_NAME
( IsEmptyRole ),
56
IsNumeric
SIP_MONKEYPATCH_COMPAT_NAME
( IsNumericRole ),
57
};
58
Q_ENUM( CustomRole )
59
// *INDENT-ON*
60
61
64
explicit
QgsPointCloudAttributeModel
( QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
65
71
void
setLayer(
QgsPointCloudLayer
*layer );
72
78
QgsPointCloudLayer
*layer();
79
86
void
setAttributes(
const
QgsPointCloudAttributeCollection
&attributes );
87
93
QgsPointCloudAttributeCollection
attributes
()
const
{
return
mAttributes; }
94
99
void
setAllowEmptyAttributeName(
bool
allowEmpty );
100
104
QModelIndex indexFromName(
const
QString &name );
105
110
bool
allowEmptyAttributeName
()
const
{
return
mAllowEmpty; }
111
112
// QAbstractItemModel interface
113
QModelIndex index(
int
row,
int
column,
const
QModelIndex &parent = QModelIndex() )
const override
;
114
QModelIndex parent(
const
QModelIndex &child )
const override
;
115
int
rowCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
116
int
columnCount(
const
QModelIndex &parent )
const override
;
117
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
118
123
static
QString attributeToolTip(
const
QgsPointCloudAttribute
&attribute );
124
128
static
QIcon iconForAttributeType(
QgsPointCloudAttribute::DataType
type );
129
130
private
:
131
QgsPointCloudAttributeCollection
mAttributes;
132
bool
mAllowEmpty =
false
;
133
QPointer< QgsPointCloudLayer > mLayer;
134
};
135
136
144
class
CORE_EXPORT
QgsPointCloudAttributeProxyModel
:
public
QSortFilterProxyModel
145
{
146
Q_OBJECT
147
public
:
149
enum
Filter
SIP_ENUM_BASETYPE
( IntFlag )
150
{
151
Char
= 1 << 0,
152
Short
= 1 << 1,
153
Int32
= 1 << 2,
154
Float
= 1 << 3,
155
Double
= 1 << 4,
156
Numeric
=
Short
|
Int32
|
Float
|
Double
,
157
AllTypes
=
Numeric
|
Char
,
158
};
159
Q_DECLARE_FLAGS(
Filters
,
Filter
)
160
Q_FLAG(
Filters
)
161
162
166
explicit
QgsPointCloudAttributeProxyModel
(
QgsPointCloudAttributeModel
*source, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
167
171
QgsPointCloudAttributeModel
*
sourceAttributeModel
() {
return
mModel; }
172
177
QgsPointCloudAttributeProxyModel
*setFilters(
QgsPointCloudAttributeProxyModel::Filters
filters );
178
183
Filters
filters
()
const
{
return
mFilters; }
184
185
private
:
186
QgsPointCloudAttributeModel
*mModel =
nullptr
;
187
Filters mFilters = AllTypes;
188
189
// QSortFilterProxyModel interface
190
public
:
191
bool
filterAcceptsRow(
int
source_row,
const
QModelIndex &source_parent )
const override
;
192
bool
lessThan(
const
QModelIndex &left,
const
QModelIndex &right )
const override
;
193
};
194
Q_DECLARE_OPERATORS_FOR_FLAGS
(
QgsPointCloudAttributeProxyModel::Filters
)
195
196
197
#endif
// QGSPOINTCLOUDATTRIBUTEMODEL_H
QgsPointCloudAttributeCollection
A collection of point cloud attributes.
Definition
qgspointcloudattribute.h:157
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:93
QgsPointCloudAttributeModel::CustomRole
CustomRole
Custom model roles.
Definition
qgspointcloudattributemodel.h:50
QgsPointCloudAttributeModel::QgsPointCloudAttributeModel
QgsPointCloudAttributeModel(QObject *parent=nullptr)
Constructor for QgsPointCloudAttributeModel, with the specified parent object.
Definition
qgspointcloudattributemodel.cpp:31
QgsPointCloudAttributeModel::allowEmptyAttributeName
bool allowEmptyAttributeName() const
Returns true if the model allows the empty attribute ("not set") choice.
Definition
qgspointcloudattributemodel.h:110
QgsPointCloudAttributeProxyModel
A proxy model for filtering available attributes from a point cloud attribute model.
Definition
qgspointcloudattributemodel.h:145
QgsPointCloudAttributeProxyModel::filters
Filters filters() const
Returns the filters controlling displayed attributes.
Definition
qgspointcloudattributemodel.h:183
QgsPointCloudAttributeProxyModel::sourceAttributeModel
QgsPointCloudAttributeModel * sourceAttributeModel()
Returns the QgsPointCloudAttributeModel used in this QSortFilterProxyModel.
Definition
qgspointcloudattributemodel.h:171
QgsPointCloudAttributeProxyModel::Filters
QFlags< Filter > Filters
Definition
qgspointcloudattributemodel.h:159
QgsPointCloudAttributeProxyModel::Filter
Filter
Attribute type filters.
Definition
qgspointcloudattributemodel.h:150
QgsPointCloudAttributeProxyModel::Double
@ Double
Double attributes.
Definition
qgspointcloudattributemodel.h:155
QgsPointCloudAttributeProxyModel::Float
@ Float
Float attributes.
Definition
qgspointcloudattributemodel.h:154
QgsPointCloudAttributeProxyModel::AllTypes
@ AllTypes
All attribute types.
Definition
qgspointcloudattributemodel.h:157
QgsPointCloudAttributeProxyModel::Short
@ Short
Short attributes.
Definition
qgspointcloudattributemodel.h:152
QgsPointCloudAttributeProxyModel::Char
@ Char
Character attributes.
Definition
qgspointcloudattributemodel.h:151
QgsPointCloudAttributeProxyModel::Numeric
@ Numeric
All numeric attributes.
Definition
qgspointcloudattributemodel.h:156
QgsPointCloudAttributeProxyModel::Int32
@ Int32
Int32 attributes.
Definition
qgspointcloudattributemodel.h:153
QgsPointCloudAttributeProxyModel::QgsPointCloudAttributeProxyModel
QgsPointCloudAttributeProxyModel(QgsPointCloudAttributeModel *source, QObject *parent=nullptr)
Constructor for QgsPointCloudAttributeProxyModel, with the specified source model and parent object.
Definition
qgspointcloudattributemodel.cpp:262
QgsPointCloudAttribute
Attribute for point cloud data pair of name and size in bytes.
Definition
qgspointcloudattribute.h:43
QgsPointCloudAttribute::DataType
DataType
Systems of unit measurement.
Definition
qgspointcloudattribute.h:47
QgsPointCloudLayer
Represents a map layer supporting display of point clouds.
Definition
qgspointcloudlayer.h:49
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_ENUM_BASETYPE
#define SIP_ENUM_BASETYPE(type)
Definition
qgis_sip.h:277
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition
qgis_sip.h:270
SIP_MONKEYPATCH_COMPAT_NAME
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition
qgis_sip.h:272
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTimeZoneComboBox::StandardItems)
qgspointcloudattribute.h
Generated on
for QGIS API Documentation by
1.17.0