Skip to content
Permalink
Browse files

fix attributes type

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Jan 13, 2021
1 parent b5e6033 commit 3c7e78861e18ba4e7dcdaed8e1bd6c20440374ed
@@ -314,7 +314,7 @@ struct MapIndexedPointCloudNode
const char *ptr = block->data();
QgsPointCloudAttributeCollection blockAttributes = block->attributes();
const std::size_t recordSize = blockAttributes.pointRecordSize();
int xOffset, yOffset, zOffset;
int xOffset = 0, yOffset = 0, zOffset = 0;
const QgsPointCloudAttribute::DataType xType = blockAttributes.find( QStringLiteral( "X" ), xOffset )->type();
const QgsPointCloudAttribute::DataType yType = blockAttributes.find( QStringLiteral( "Y" ), yOffset )->type();
const QgsPointCloudAttribute::DataType zType = blockAttributes.find( QStringLiteral( "Z" ), zOffset )->type();
@@ -324,9 +324,9 @@ struct MapIndexedPointCloudNode
{
double x, y, z;
_pointXYZ( ptr, i, recordSize, xOffset, xType, yOffset, yType, zOffset, zType, mIndexScale, mIndexOffset, x, y, z );
QgsPoint pointXY( x, y );
QgsPoint point( x, y );

if ( mZRange.contains( z ) && extentEngine->contains( &pointXY ) )
if ( mZRange.contains( point.z() ) && extentEngine->contains( &point ) )
{
QVariantMap pointAttr = _attributeMap( ptr, i * recordSize, blockAttributes );
pointAttr[ QStringLiteral( "X" ) ] = x;
@@ -435,15 +435,14 @@ QVector<QVariantMap> QgsPointCloudDataProvider::getPointsOnRay( const QVector3D
const char *ptr = block->data();
QgsPointCloudAttributeCollection blockAttributes = block->attributes();
const std::size_t recordSize = blockAttributes.pointRecordSize();
int xOffset, yOffset, zOffset;
blockAttributes.find( QStringLiteral( "X" ), xOffset );
blockAttributes.find( QStringLiteral( "Y" ), yOffset );
blockAttributes.find( QStringLiteral( "Z" ), zOffset );
int xOffset = 0, yOffset = 0, zOffset = 0;
const QgsPointCloudAttribute::DataType xType = blockAttributes.find( QStringLiteral( "X" ), xOffset )->type();
const QgsPointCloudAttribute::DataType yType = blockAttributes.find( QStringLiteral( "Y" ), yOffset )->type();
const QgsPointCloudAttribute::DataType zType = blockAttributes.find( QStringLiteral( "Z" ), zOffset )->type();
for ( int i = 0; i < block->pointCount() && points.size() < pointsLimit; ++i )
{
double x, y, z;
_pointXY( ptr, i, recordSize, xOffset, yOffset, index->scale(), index->offset(), x, y );
z = _pointZ( ptr, i, recordSize, zOffset, index->scale(), index->offset() );
_pointXYZ( ptr, i, recordSize, xOffset, xType, yOffset, yType, zOffset, zType, index->scale(), index->offset(), x, y, z );
QVector3D point( x, y, z );
// project point on ray
QVector3D projectedPoint = rayOrigin + QgsVector3D::dotProduct( point - rayOrigin, rayDirection ) * rayDirection;
@@ -23,6 +23,7 @@
#include "qgspointcloudattribute.h"
#include "qgsstatisticalsummary.h"
#include "qgspointcloudindex.h"
#include "qgspoint.h"
#include <memory>

class IndexedPointCloudNode;

0 comments on commit 3c7e788

Please sign in to comment.
You can’t perform that action at this time.