Skip to content
Permalink
Browse files

Fix entity's bbox and always show the bboxes for point clouds (for now)

  • Loading branch information
wonder-sk authored and nyalldawson committed Oct 26, 2020
1 parent 8c059eb commit a3da3b3c8483481ff67e0411407d9dcf1616e842
@@ -19,6 +19,7 @@
#include "qgschunkedentity_p.h"
#include "qgspointcloudlayerchunkloader_p.h"

#include "qgspointcloudindex.h"
#include "qgspointcloudlayer.h"
#include "qgsxmlutils.h"
#include "qgsapplication.h"
@@ -63,14 +64,13 @@ QgsPointCloudLayer3DRenderer *QgsPointCloudLayer3DRenderer::clone() const

Qt3DCore::QEntity *QgsPointCloudLayer3DRenderer::createEntity( const Qgs3DMapSettings &map ) const
{
QgsPointCloudLayer *vl = layer();
if ( !vl )
QgsPointCloudLayer *pcl = layer();
if ( !pcl || !pcl->dataProvider() )
return nullptr;

double zMin, zMax;
//Qgs3DUtils::estimateVectorLayerZRange( vl, zMin, zMax );
QgsPointCloudIndex *index = pcl->dataProvider()->index();

return new QgsPointCloudLayerChunkedEntity( vl, zMin, zMax, map );
return new QgsPointCloudLayerChunkedEntity( pcl, index->zMin(), index->zMax(), map );
}

void QgsPointCloudLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const
@@ -123,7 +123,7 @@ void QgsPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc, const In
double z = offset.z() + scale.z() * iz;
QVector3D point( x, y, z );
QgsVector3D p = context.map().mapToWorldCoordinates( point );
outNormal.positions.push_back( QVector3D( p.x(), p.y() - 400, p.z() ) );
outNormal.positions.push_back( QVector3D( p.x(), p.y(), p.z() ) );

// }
}
@@ -325,7 +325,7 @@ QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( QgsPointCloudL
0, //QgsVectorLayer3DTilingSettings().zoomLevelsCount() - 1,
new QgsPointCloudLayerChunkLoaderFactory( map, vl, 0 /*QgsVectorLayer3DTilingSettings().zoomLevelsCount() - 1*/ ), true )
{
setShowBoundingBoxes( QgsVectorLayer3DTilingSettings().showBoundingBoxes() );
setShowBoundingBoxes( true ); //QgsVectorLayer3DTilingSettings().showBoundingBoxes() );
}

QgsPointCloudLayerChunkedEntity::~QgsPointCloudLayerChunkedEntity()
@@ -72,7 +72,7 @@ void initCanvas3D( Qgs3DMapCanvas *canvas )
canvas->setMap( map );

float dist = static_cast< float >( std::max( extent.width(), extent.height() ) );
canvas->setViewFromTop( extent.center(), dist, 0 );
canvas->setViewFromTop( extent.center(), dist * 2, 0 );

QObject::connect( canvas->scene(), &Qgs3DMapScene::totalPendingJobsCountChanged, [canvas]
{

0 comments on commit a3da3b3

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