41 return QMetaType::Type::Int;
45 return QMetaType::Type::LongLong;
48 return QMetaType::Type::Double;
50 return QMetaType::Type::UnknownType;
58 return QObject::tr(
"Unsigned Character" );
60 return QObject::tr(
"Character" );
62 return QObject::tr(
"Short" );
64 return QObject::tr(
"Unsigned Short" );
66 return QObject::tr(
"Float" );
68 return QObject::tr(
"Integer" );
70 return QObject::tr(
"Unsigned Integer" );
72 return QObject::tr(
"Long Integer" );
74 return QObject::tr(
"Unsigned Long Integer" );
76 return QObject::tr(
"Double" );
101void QgsPointCloudAttribute::updateSize()
145 mCachedAttributes.insert( attribute.
name().toUpper(), CachedAttributeData( mAttributes.size(), mSize ) );
146 mAttributes.push_back( attribute );
147 mSize += attribute.
size();
152 for (
const auto &attributeName : matchingNames )
154 if (
indexOf( attributeName ) == -1 )
157 const auto attr = otherCollection.
find( attributeName, offset );
171 const auto it = mCachedAttributes.constFind( attributeName.toUpper() );
172 if ( it != mCachedAttributes.constEnd() )
175 return &mAttributes.at( it->index );
184 const auto it = mCachedAttributes.constFind( name.toUpper() );
185 if ( it != mCachedAttributes.constEnd() )
199 fields.
append(
QgsField( attribute.name(), attribute.variantType(), attribute.displayType() ) );
210 value = *
reinterpret_cast< const unsigned char *
>( data + offset );
214 value = *( data + offset );
218 value = *
reinterpret_cast< const quint32 *
>( data + offset );
222 value = *
reinterpret_cast< const qint32 *
>( data + offset );
226 value = *
reinterpret_cast< const quint64 *
>( data + offset );
230 value = *
reinterpret_cast< const qint64 *
>( data + offset );
234 value = *
reinterpret_cast< const short *
>( data + offset );
238 value = *
reinterpret_cast< const unsigned short *
>( data + offset );
242 value =
static_cast< T
>( *
reinterpret_cast< const float *
>( data + offset ) );
246 value = *
reinterpret_cast< const double *
>( data + offset );
264 _attribute( ptr, i * pointRecordSize + xOffset, xType, x );
265 x = indexOffset.
x() + indexScale.
x() * x;
267 _attribute( ptr, i * pointRecordSize + yOffset, yType, y );
268 y = indexOffset.
y() + indexScale.
y() * y;
270 _attribute( ptr, i * pointRecordSize + zOffset, zType, z );
271 z = indexOffset.
z() + indexScale.
z() * z;
277 const QVector<QgsPointCloudAttribute> attributes = attributeCollection.
attributes();
280 const QString attributeName = attr.name();
282 attributeCollection.
find( attributeName, attributeOffset );
283 switch ( attr.type() )
287 const unsigned char value = *
reinterpret_cast< const unsigned char *
>( data + recordOffset + attributeOffset );
288 map[ attributeName ] = value;
294 const char value = *( data + recordOffset + attributeOffset );
295 map[ attributeName ] = value;
301 const quint32 value = *
reinterpret_cast< const quint32 *
>( data + recordOffset + attributeOffset );
302 map[ attributeName ] = value;
307 const qint32 value = *
reinterpret_cast< const qint32 *
>( data + recordOffset + attributeOffset );
308 map[ attributeName ] = value;
314 const quint64 value = *
reinterpret_cast< const quint64 *
>( data + recordOffset + attributeOffset );
315 map[ attributeName ] = value;
320 const qint64 value = *
reinterpret_cast< const qint64 *
>( data + recordOffset + attributeOffset );
321 map[ attributeName ] = value;
327 const short value = *
reinterpret_cast< const short *
>( data + recordOffset + attributeOffset );
328 map[ attributeName ] = value;
334 const unsigned short value = *
reinterpret_cast< const unsigned short *
>( data + recordOffset + attributeOffset );
335 map[ attributeName ] = value;
341 const float value = *
reinterpret_cast< const float *
>( data + recordOffset + attributeOffset );
342 map[ attributeName ] = value;
348 const double value = *
reinterpret_cast< const double *
>( data + recordOffset + attributeOffset );
349 map[ attributeName ] = value;
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
bool append(const QgsField &field, Qgis::FieldOrigin origin=Qgis::FieldOrigin::Provider, int originIndex=-1)
Appends a field.
A collection of point cloud attributes.
void push_back(const QgsPointCloudAttribute &attribute)
Adds extra attribute.
QgsPointCloudAttributeCollection()
const QgsPointCloudAttribute * find(const QString &attributeName, int &offset) const
Finds the attribute with the name.
QgsFields toFields() const
Converts the attribute collection to an equivalent QgsFields collection.
void extend(const QgsPointCloudAttributeCollection &otherCollection, const QSet< QString > &matchingNames)
Adds specific missing attributes from another QgsPointCloudAttributeCollection.
QVector< QgsPointCloudAttribute > attributes() const
Returns all attributes.
int indexOf(const QString &name) const
Returns the index of the attribute with the specified name.
Attribute for point cloud data pair of name and size in bytes.
QMetaType::Type variantType() const
Returns the most suitable equivalent QVariant data type to this attribute type.
DataType
Systems of unit measurement.
@ UShort
Unsigned short int 2 bytes.
@ Short
Short int 2 bytes.
@ UChar
Unsigned char 1 byte.
@ UInt32
Unsigned int32 4 bytes.
@ UInt64
Unsigned int64 8 bytes.
static void getPointXYZ(const char *ptr, int i, std::size_t pointRecordSize, int xOffset, QgsPointCloudAttribute::DataType xType, int yOffset, QgsPointCloudAttribute::DataType yType, int zOffset, QgsPointCloudAttribute::DataType zType, const QgsVector3D &indexScale, const QgsVector3D &indexOffset, double &x, double &y, double &z)
Retrieves the x, y, z values for the point at index i.
static bool isNumeric(DataType type)
Returns true if the specified data type is numeric.
static QVariantMap getAttributeMap(const char *data, std::size_t recordOffset, const QgsPointCloudAttributeCollection &attributeCollection)
Retrieves all the attributes of a point.
QString displayType() const
Returns the type to use when displaying this field.
int size() const
Returns size of the attribute in bytes.
QString name() const
Returns name of the attribute.
DataType type() const
Returns the data type.
double convertValueToDouble(const char *ptr) const
Returns the attribute's value as a double for data pointed to by ptr.
A 3D vector (similar to QVector3D) with the difference that it uses double precision instead of singl...
double y() const
Returns Y coordinate.
double z() const
Returns Z coordinate.
double x() const
Returns X coordinate.
#define BUILTIN_UNREACHABLE
void _attribute(const char *data, std::size_t offset, QgsPointCloudAttribute::DataType type, T &value)