Skip to content
Permalink
Browse files

use std::unique_ptr for symbol in qgspointcloudlayerchunkloader_p

  • Loading branch information
NEDJIMAbelgacem committed Nov 17, 2020
1 parent 7f5656b commit 62351552e187fae493b1169a995ab20aa7a0905b
Showing with 12 additions and 9 deletions.
  1. +3 −5 src/3d/qgspointcloudlayerchunkloader_p.cpp
  2. +9 −4 src/3d/qgspointcloudlayerchunkloader_p.h
@@ -96,9 +96,8 @@ void QgsPointCloud3DGeometry::makeVertexBuffer( const QgsPointCloud3DSymbolHandl


QgsPointCloud3DSymbolHandler::QgsPointCloud3DSymbolHandler( QgsPointCloud3DSymbol *symbol )
: mSymbol( symbol )
{

mSymbol.reset( symbol );
}

bool QgsPointCloud3DSymbolHandler::prepare( const Qgs3DRenderContext &context )
@@ -226,8 +225,7 @@ QgsPointCloudLayerChunkLoader::QgsPointCloudLayerChunkLoader( const QgsPointClou

QgsDebugMsgLevel( QStringLiteral( "loading entity %1" ).arg( node->tileId().text() ), 2 );

QgsPointCloud3DSymbolHandler *handler = new QgsPointCloud3DSymbolHandler( symbol );
mHandler.reset( handler );
mHandler.reset( new QgsPointCloud3DSymbolHandler( symbol ) );

//
// this will be run in a background thread
@@ -284,8 +282,8 @@ Qt3DCore::QEntity *QgsPointCloudLayerChunkLoader::createEntity( Qt3DCore::QEntit
QgsPointCloudLayerChunkLoaderFactory::QgsPointCloudLayerChunkLoaderFactory( const Qgs3DMapSettings &map, QgsPointCloudIndex *pc, QgsPointCloud3DSymbol *symbol )
: mMap( map )
, mPointCloudIndex( pc )
, mSymbol( symbol )
{
mSymbol.reset( symbol );
}

QgsChunkLoader *QgsPointCloudLayerChunkLoaderFactory::createChunkLoader( QgsChunkNode *node ) const
@@ -30,14 +30,16 @@
#include "qgschunkloader_p.h"
#include "qgsfeature3dhandler_p.h"
#include "qgschunkedentity_p.h"
#include "qgspointcloud3dsymbol.h"

#define SIP_NO_FILE

class Qgs3DMapSettings;
class QgsPointCloudLayer;
class IndexedPointCloudNode;
class QgsPointCloudIndex;
class QgsPointCloud3DSymbol;

#include <memory>

#include <QFutureWatcher>
#include <Qt3DRender/QGeometry>
@@ -87,7 +89,7 @@ class QgsPointCloud3DSymbolHandler // : public QgsFeature3DHandler
PointData outNormal; //!< Features that are not selected
// PointData outSelected; //!< Features that are selected

QgsPointCloud3DSymbol *mSymbol = nullptr;
std::unique_ptr<QgsPointCloud3DSymbol> mSymbol;
};

class QgsPointCloud3DGeometry: public Qt3DRender::QGeometry
@@ -114,7 +116,10 @@ class QgsPointCloud3DGeometry: public Qt3DRender::QGeometry
class QgsPointCloudLayerChunkLoaderFactory : public QgsChunkLoaderFactory
{
public:
//! Constructs the factory
/*
* Constructs the factory
* The factory takes ownership over the passed \a symbol
*/
QgsPointCloudLayerChunkLoaderFactory( const Qgs3DMapSettings &map, QgsPointCloudIndex *pc, QgsPointCloud3DSymbol *symbol );

//! Creates loader for the given chunk node. Ownership of the returned is passed to the caller.
@@ -124,7 +129,7 @@ class QgsPointCloudLayerChunkLoaderFactory : public QgsChunkLoaderFactory

const Qgs3DMapSettings &mMap;
QgsPointCloudIndex *mPointCloudIndex;
QgsPointCloud3DSymbol *mSymbol = nullptr;
std::unique_ptr< QgsPointCloud3DSymbol > mSymbol;
};


0 comments on commit 6235155

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