QGIS API Documentation
4.3.0-Master (0ad0cdb9438)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
pointcloud
qgspointcloudattribute.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgspointcloudattribute.h
3
---------------------
4
begin : October 2020
5
copyright : (C) 2020 by Peter Petrik
6
email : zilolv 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 QGSPOINTCLOUDATTRIBUTE_H
19
#define QGSPOINTCLOUDATTRIBUTE_H
20
21
#include "
qgis.h
"
22
#include "qgis_core.h"
23
#include "
qgsfields.h
"
24
#include "
qgsvector3d.h
"
25
26
#include <QSet>
27
#include <QString>
28
#include <QVector>
29
30
using namespace
Qt::StringLiterals;
31
32
class
QgsPointCloudAttributeCollection
;
33
42
class
CORE_EXPORT
QgsPointCloudAttribute
43
{
44
public
:
46
enum
DataType
47
{
48
Char
,
49
UChar
,
50
Short
,
51
UShort
,
52
Int32
,
53
UInt32
,
54
Int64
,
55
UInt64
,
56
Float
,
57
Double
,
58
};
59
60
QgsPointCloudAttribute
();
62
QgsPointCloudAttribute
(
const
QString &
name
,
DataType
type
);
63
65
QString
name
()
const
{
return
mName; }
66
68
int
size
()
const
{
return
mSize; }
69
75
DataType
type
()
const
{
return
mType; }
76
82
QMetaType::Type variantType()
const
;
83
91
QString displayType()
const
;
92
99
double
convertValueToDouble(
const
char
*ptr )
const
SIP_SKIP
;
100
104
static
bool
isNumeric( DataType type );
105
106
#ifdef SIP_RUN
107
// clang-format off
108
SIP_PYOBJECT __repr__();
109
% MethodCode
110
QString str = u
"<QgsPointCloudAttribute: %1 (%2)>"
_s.arg( sipCpp->name() ).arg( sipCpp->displayType() );
111
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
112
% End
113
// clang-format on
114
#endif
115
119
static
void
getPointXYZ(
120
const
char
*ptr,
121
int
i,
122
std::size_t pointRecordSize,
123
int
xOffset,
124
QgsPointCloudAttribute::DataType
xType,
125
int
yOffset,
126
QgsPointCloudAttribute::DataType
yType,
127
int
zOffset,
128
QgsPointCloudAttribute::DataType
zType,
129
const
QgsVector3D
&indexScale,
130
const
QgsVector3D
&indexOffset,
131
double
&x,
132
double
&y,
133
double
&z
134
)
SIP_SKIP
;
135
139
static
QVariantMap getAttributeMap(
const
char
*data, std::size_t recordOffset,
const
QgsPointCloudAttributeCollection
&attributeCollection )
SIP_SKIP
;
140
141
private
:
142
void
updateSize();
143
144
QString mName;
145
int
mSize = 0;
146
DataType mType = DataType::Char;
147
};
148
156
class
CORE_EXPORT
QgsPointCloudAttributeCollection
157
{
158
public
:
159
QgsPointCloudAttributeCollection
();
161
QgsPointCloudAttributeCollection
(
const
QVector<QgsPointCloudAttribute> &
attributes
);
163
void
push_back
(
const
QgsPointCloudAttribute
&attribute );
164
171
void
extend
(
const
QgsPointCloudAttributeCollection
&otherCollection,
const
QSet<QString> &matchingNames );
172
174
QVector<QgsPointCloudAttribute>
attributes
()
const
;
175
179
int
count
()
const
{
return
mAttributes.size(); }
180
184
const
QgsPointCloudAttribute
&
at
(
int
index )
const
{
return
mAttributes.at( index ); }
185
191
const
QgsPointCloudAttribute
*find(
const
QString &attributeName,
int
&offset )
const
;
192
198
int
indexOf(
const
QString &name )
const
;
199
201
int
pointRecordSize
()
const
{
return
mSize; }
202
206
QgsFields
toFields()
const
;
207
208
private
:
209
int
mSize = 0;
210
QVector<QgsPointCloudAttribute> mAttributes;
211
212
struct
CachedAttributeData
213
{
214
int
index;
215
int
offset;
216
CachedAttributeData(
int
index,
int
offset )
217
: index( index )
218
, offset( offset )
219
{}
220
};
221
222
QMap< QString, CachedAttributeData > mCachedAttributes;
223
};
224
225
#endif
// QGSPOINTCLOUDATTRIBUTE_H
QgsFields
Container of fields for a vector layer.
Definition
qgsfields.h:45
QgsPointCloudAttributeCollection
A collection of point cloud attributes.
Definition
qgspointcloudattribute.h:157
QgsPointCloudAttributeCollection::push_back
void push_back(const QgsPointCloudAttribute &attribute)
Adds extra attribute.
Definition
qgspointcloudattribute.cpp:143
QgsPointCloudAttributeCollection::pointRecordSize
int pointRecordSize() const
Returns total size of record.
Definition
qgspointcloudattribute.h:201
QgsPointCloudAttributeCollection::QgsPointCloudAttributeCollection
QgsPointCloudAttributeCollection()
QgsPointCloudAttributeCollection::at
const QgsPointCloudAttribute & at(int index) const
Returns the attribute at the specified index.
Definition
qgspointcloudattribute.h:184
QgsPointCloudAttributeCollection::count
int count() const
Returns the number of attributes present in the collection.
Definition
qgspointcloudattribute.h:179
QgsPointCloudAttributeCollection::extend
void extend(const QgsPointCloudAttributeCollection &otherCollection, const QSet< QString > &matchingNames)
Adds specific missing attributes from another QgsPointCloudAttributeCollection.
Definition
qgspointcloudattribute.cpp:150
QgsPointCloudAttributeCollection::attributes
QVector< QgsPointCloudAttribute > attributes() const
Returns all attributes.
Definition
qgspointcloudattribute.cpp:164
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
QgsPointCloudAttribute::UShort
@ UShort
Unsigned short int 2 bytes.
Definition
qgspointcloudattribute.h:51
QgsPointCloudAttribute::Double
@ Double
Double 8 bytes.
Definition
qgspointcloudattribute.h:57
QgsPointCloudAttribute::Int32
@ Int32
Int32 4 bytes.
Definition
qgspointcloudattribute.h:52
QgsPointCloudAttribute::Short
@ Short
Short int 2 bytes.
Definition
qgspointcloudattribute.h:50
QgsPointCloudAttribute::Char
@ Char
Char 1 byte.
Definition
qgspointcloudattribute.h:48
QgsPointCloudAttribute::Int64
@ Int64
Int64 8 bytes.
Definition
qgspointcloudattribute.h:54
QgsPointCloudAttribute::UChar
@ UChar
Unsigned char 1 byte.
Definition
qgspointcloudattribute.h:49
QgsPointCloudAttribute::UInt32
@ UInt32
Unsigned int32 4 bytes.
Definition
qgspointcloudattribute.h:53
QgsPointCloudAttribute::Float
@ Float
Float 4 bytes.
Definition
qgspointcloudattribute.h:56
QgsPointCloudAttribute::UInt64
@ UInt64
Unsigned int64 8 bytes.
Definition
qgspointcloudattribute.h:55
QgsPointCloudAttribute::QgsPointCloudAttribute
QgsPointCloudAttribute()
QgsPointCloudAttribute::size
int size() const
Returns size of the attribute in bytes.
Definition
qgspointcloudattribute.h:68
QgsPointCloudAttribute::name
QString name() const
Returns name of the attribute.
Definition
qgspointcloudattribute.h:65
QgsPointCloudAttribute::type
DataType type() const
Returns the data type.
Definition
qgspointcloudattribute.h:75
QgsVector3D
A 3D vector (similar to QVector3D) with the difference that it uses double precision instead of singl...
Definition
qgsvector3d.h:33
qgis.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
qgsfields.h
qgsvector3d.h
Generated on
for QGIS API Documentation by
1.17.0