Skip to content
Permalink
Browse files

Address reviews

  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 4, 2021
1 parent 7a4adf6 commit c6ad05d79c59fe3ac69b8066c22d320a3a4c0993
@@ -286,14 +286,14 @@ struct MapIndexedPointCloudNode
blockAttributes.find( QStringLiteral( "Z" ), zOffset );
std::unique_ptr< QgsGeometryEngine > extentEngine( QgsGeometry::createGeometryEngine( mExtentGeometry.constGet() ) );
extentEngine->prepareGeometry();
for ( int i = 0; i < block->pointCount(); ++i )
for ( int i = 0; i < block->pointCount() && pointsCount < mPointsLimit; ++i )
{
double x, y, z;
_pointXY( ptr, i, recordSize, xOffset, yOffset, mIndexScale, mIndexOffset, x, y );
z = _pointZ( ptr, i, recordSize, zOffset, mIndexScale, mIndexOffset );
QgsPoint pointXY( x, y );

if ( pointsCount < mPointsLimit && extentEngine->contains( &pointXY ) && mZRange.contains( z ) )
if ( mZRange.contains( z ) && extentEngine->contains( &pointXY ) )
{
QMap<QString, QVariant> pointAttr = _attributeMap( ptr, i * recordSize, blockAttributes );
pointAttr[ QStringLiteral( "X" ) ] = x;
@@ -327,15 +327,6 @@ QVector<QMap<QString, QVariant>> QgsPointCloudDataProvider::identify(
const IndexedPointCloudNode root = index->root();

QgsRectangle rootNodeExtentMapCoords = index->nodeMapExtent( root );
// TODO? reproject the root node extent
// try
// {
// rootNodeExtentMapCoords = renderContext.coordinateTransform().transformBoundingBox( index->nodeMapExtent( root ) );
// }
// catch ( QgsCsException & )
// {
// QgsDebugMsg( QStringLiteral( "Could not transform node extent to map CRS" ) );
// }
const float rootErrorInMapCoordinates = rootNodeExtentMapCoords.width() / index->span();

QVector<IndexedPointCloudNode> nodes = traverseTree( index, root, maxErrorInMapCoords, rootErrorInMapCoordinates, extentGeometry, extentZRange );
@@ -77,26 +77,6 @@ class CORE_EXPORT QgsPointCloudLayerRenderer: public QgsMapLayerRenderer
QgsPointCloudAttributeCollection mLayerAttributes;
QgsPointCloudAttributeCollection mAttributes;
QgsGeometry mCloudExtent;

/**
* Retrieves the x and y coordinate for the point at index \a i.
*/
static void pointXY( QgsPointCloudRenderContext &context, const char *ptr, int i, double &x, double &y )
{
const qint32 ix = *reinterpret_cast< const qint32 * >( ptr + i * context.pointRecordSize() + context.xOffset() );
const qint32 iy = *reinterpret_cast< const qint32 * >( ptr + i * context.pointRecordSize() + context.yOffset() );
x = context.offset().x() + context.scale().x() * ix;
y = context.offset().y() + context.scale().y() * iy;
}

/**
* Retrieves the z value for the point at index \a i.
*/
static double pointZ( QgsPointCloudRenderContext &context, const char *ptr, int i )
{
const qint32 iz = *reinterpret_cast<const qint32 * >( ptr + i * context.pointRecordSize() + context.zOffset() );
return context.offset().z() + context.scale().z() * iz;
}
};

#endif // QGSPOINTCLOUDLAYERRENDERER_H
@@ -249,8 +249,8 @@ QVector<QMap<QString, QVariant>> QgsPointCloudRenderer::identify( QgsPointCloudL
QgsPointXY point1MapCoords = renderContext.mapToPixel().toMapCoordinates( point1.x(), point1.y() );
QgsPointXY point2MapCoords = renderContext.mapToPixel().toMapCoordinates( point2.x(), point2.y() );
QgsCircle circle = QgsCircle::from2Points( QgsPoint( point1MapCoords ), QgsPoint( point2MapCoords ) );
QgsPolygon *polygon = circle.toPolygon( 6 );
QgsGeometry circleGeometry( polygon );
std::unique_ptr<QgsPolygon> polygon( circle.toPolygon( 6 ) );
QgsGeometry circleGeometry( std::move( polygon ) );
selectionGeometry = circleGeometry;
}
}
@@ -520,7 +520,7 @@ bool QgsMapToolIdentify::identifyPointCloudLayer( QList<QgsMapToolIdentify::Iden
{
transformedGeometry.transform( ct );
}
catch ( QgsCsException& )
catch ( QgsCsException & )
{
return false;
}

0 comments on commit c6ad05d

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