Skip to content
Permalink
Browse files

add some basic skelet for point cloud data providers

  • Loading branch information
PeterPetrik authored and nyalldawson committed Oct 26, 2020
1 parent 9039aad commit b796dbb07b1028d08ff9f8b1a78292605e1440e0
Showing with 310 additions and 44 deletions.
  1. +63 −0 python/core/auto_generated/pointcloud/qgspointclouddataprovider.sip.in
  2. +3 −1 python/core/auto_generated/pointcloud/qgspointcloudlayer.sip.in
  3. +0 −4 python/core/auto_generated/pointcloud/qgspointcloudrenderer.sip.in
  4. +4 −0 python/core/auto_generated/qgsdataprovider.sip.in
  5. +1 −0 python/core/core_auto.sip
  6. +1 −1 python/gui/auto_generated/qgisinterface.sip.in
  7. +1 −1 python/gui/auto_generated/qgsabstractdatasourcewidget.sip.in
  8. +1 −1 src/3d/qgspointcloudlayerchunkloader_p.cpp
  9. +6 −0 src/analysis/processing/qgsalgorithmpackage.cpp
  10. +6 −6 src/app/qgisapp.cpp
  11. +5 −2 src/app/qgisapp.h
  12. +2 −2 src/app/qgisappinterface.cpp
  13. +1 −1 src/app/qgisappinterface.h
  14. +2 −0 src/core/CMakeLists.txt
  15. +2 −0 src/core/expression/qgsexpressionfunction.cpp
  16. +1 −0 src/core/labeling/qgspallabeling.cpp
  17. +62 −0 src/core/pointcloud/qgspointclouddataprovider.cpp
  18. +64 −0 src/core/pointcloud/qgspointclouddataprovider.h
  19. +24 −12 src/core/pointcloud/qgspointcloudlayer.cpp
  20. +40 −5 src/core/pointcloud/qgspointcloudlayer.h
  21. +3 −3 src/core/pointcloud/qgspointcloudrenderer.cpp
  22. +2 −0 src/core/processing/qgsprocessingutils.cpp
  23. +4 −0 src/core/qgsdataprovider.h
  24. +1 −0 src/core/qgsmapclippingutils.cpp
  25. +2 −0 src/core/qgsmaprendererjob.cpp
  26. +5 −1 src/core/qgsmimedatautils.cpp
  27. +1 −1 src/gui/pointcloud/qgspointcloudsourceselect.cpp
  28. +1 −1 src/gui/qgisinterface.h
  29. +1 −1 src/gui/qgsabstractdatasourcewidget.h
  30. +1 −1 src/gui/qgsdatasourcemanagerdialog.h
@@ -0,0 +1,63 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/pointcloud/qgspointclouddataprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsPointCloudDataProvider: QgsDataProvider
{
%Docstring
Base class for providing data for QgsPointCloudLayer

Responsible for reading native point cloud data and returning the indexed data?

.. note::

The API is considered EXPERIMENTAL and can be changed without a notice

.. versionadded:: 3.18
%End

%TypeHeaderCode
#include "qgspointclouddataprovider.h"
%End
public:
QgsPointCloudDataProvider( const QString &uri,
const QgsDataProvider::ProviderOptions &providerOptions,
QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() );
%Docstring
Ctor
%End

~QgsPointCloudDataProvider();
virtual QgsCoordinateReferenceSystem crs() const;


virtual QgsRectangle extent() const;


virtual bool isValid() const;


virtual QString name() const;


virtual QString description() const;



};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/pointcloud/qgspointclouddataprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -47,6 +47,9 @@ QgsPointCloudLayer cannot be copied.
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;


virtual QgsPointCloudDataProvider *dataProvider();


virtual bool readXml( const QDomNode &layerNode, QgsReadWriteContext &context );


@@ -64,7 +67,6 @@ QgsPointCloudLayer cannot be copied.
virtual QString loadDefaultStyle( bool &resultFlag /Out/ );



private: // Private methods
QgsPointCloudLayer( const QgsPointCloudLayer &rhs );
};
@@ -35,12 +35,8 @@ Represents a 2D renderer of point cloud data
explicit QgsPointCloudRenderer( QgsPointCloudLayer *layer, QgsRenderContext &context );
~QgsPointCloudRenderer();


virtual bool render();

%Docstring
QgsPointCloudRenderer cannot be copied.
%End

void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
@@ -33,6 +33,10 @@ Abstract base class for spatial data provider implementations.
{
sipType = sipType_QgsMeshDataProvider;
}
else if ( qobject_cast<QgsPointCloudDataProvider *>( sipCpp ) )
{
sipType = sipType_QgsPointCloudDataProvider;
}
else
{
sipType = 0;
@@ -439,6 +439,7 @@
%Include auto_generated/mesh/qgsmeshcalculator.sip
%Include auto_generated/pointcloud/qgspointcloudlayer.sip
%Include auto_generated/pointcloud/qgspointcloudrenderer.sip
%Include auto_generated/pointcloud/qgspointclouddataprovider.sip
%Include auto_generated/metadata/qgsabstractmetadatabase.sip
%Include auto_generated/metadata/qgslayermetadata.sip
%Include auto_generated/metadata/qgslayermetadataformatter.sip
@@ -807,7 +807,7 @@ Adds a vector tile layer to the current project.
.. versionadded:: 3.14
%End

virtual QgsPointCloudLayer *addPointCloudLayer( const QString &url, const QString &baseName ) = 0;
virtual QgsPointCloudLayer *addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey ) = 0;
%Docstring
Adds a point cloud layer to the current project.

@@ -101,7 +101,7 @@ Emitted when a vector tile layer has been selected for addition.
.. versionadded:: 3.14
%End

void addPointCloudLayer( const QString &url, const QString &baseName );
void addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey );
%Docstring
Emitted when a point cloud layer has been selected for addition.

@@ -222,7 +222,7 @@ QgsPointCloudLayerChunkLoader::QgsPointCloudLayerChunkLoader( const QgsPointClou
QgsPointCloud3DSymbolHandler *handler = new QgsPointCloud3DSymbolHandler;
mHandler.reset( handler );

QgsPointCloudIndex *pc = layer->pointCloudIndex();
QgsPointCloudIndex *pc = layer->dataProvider()->index();

//QgsExpressionContext exprContext( Qgs3DUtils::globalProjectLayerExpressionContext( layer ) );
//exprContext.setFields( layer->fields() );
@@ -178,6 +178,12 @@ QVariantMap QgsPackageAlgorithm::processAlgorithm( const QVariantMap &parameters
errored = true;
break;

case QgsMapLayerType::PointCloudLayer:
//not supported
feedback->pushDebugInfo( QObject::tr( "Packaging point cloud layers is not supported." ) );
errored = true;
break;

case QgsMapLayerType::VectorTileLayer:
//not supported
feedback->pushDebugInfo( QObject::tr( "Packaging vector tile layers is not supported." ) );
@@ -2096,7 +2096,7 @@ void QgisApp::handleDropUriList( const QgsMimeDataUtils::UriList &lst )
}
else if ( u.layerType == QLatin1String( "pointcloud" ) )
{
addPointCloudLayer( uri, u.name );
addPointCloudLayer( uri, u.name, u.providerKey );
}
else if ( u.layerType == QLatin1String( "vector-tile" ) )
{
@@ -5709,9 +5709,9 @@ QgsVectorTileLayer *QgisApp::addVectorTileLayer( const QString &url, const QStri
return addVectorTileLayerPrivate( url, baseName );
}

QgsPointCloudLayer *QgisApp::addPointCloudLayer( const QString &url, const QString &baseName )
QgsPointCloudLayer *QgisApp::addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey )
{
return addPointCloudLayerPrivate( url, baseName );
return addPointCloudLayerPrivate( url, baseName, providerKey );
}

QgsVectorTileLayer *QgisApp::addVectorTileLayerPrivate( const QString &url, const QString &baseName, const bool guiWarning )
@@ -5756,7 +5756,7 @@ QgsVectorTileLayer *QgisApp::addVectorTileLayerPrivate( const QString &url, cons
return layer.release();
}

QgsPointCloudLayer *QgisApp::addPointCloudLayerPrivate( const QString &uri, const QString &baseName, bool guiWarning )
QgsPointCloudLayer *QgisApp::addPointCloudLayerPrivate( const QString &uri, const QString &baseName, const QString &providerKey, bool guiWarning )
{
QgsCanvasRefreshBlocker refreshBlocker;
QgsSettings settings;
@@ -5771,7 +5771,7 @@ QgsPointCloudLayer *QgisApp::addPointCloudLayerPrivate( const QString &uri, cons
QgsDebugMsgLevel( "completeBaseName: " + base, 2 );

// create the layer
std::unique_ptr<QgsPointCloudLayer> layer( new QgsPointCloudLayer( uri, base ) );
std::unique_ptr<QgsPointCloudLayer> layer( new QgsPointCloudLayer( uri, base, providerKey ) );

if ( !layer || !layer->isValid() )
{
@@ -7623,7 +7623,7 @@ bool QgisApp::openLayer( const QString &fileName, bool allowInteractive )
// Try to load as point cloud layer after raster & vector & mesh
if ( !ok )
{
ok = static_cast< bool >( addPointCloudLayerPrivate( fileName, fileInfo.completeBaseName(), false ) );
ok = static_cast< bool >( addPointCloudLayerPrivate( fileName, fileInfo.completeBaseName(), QStringLiteral( "pointcloud" ), false ) );
}

if ( !ok )
@@ -1165,7 +1165,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* in the Map Legend so it should be formed in a meaningful way.
* \since QGIS 3.18
*/
QgsPointCloudLayer *addPointCloudLayer( const QString &url, const QString &baseName );
QgsPointCloudLayer *addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey );

/**
* \brief overloaded version of the private addLayer method that takes a list of
@@ -2095,7 +2095,10 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsVectorTileLayer *addVectorTileLayerPrivate( const QString &uri, const QString &baseName, bool guiWarning = true );

//! Open a point cloyd layer - this is the generic function which takes all parameters
QgsPointCloudLayer *addPointCloudLayerPrivate( const QString &uri, const QString &baseName, bool guiWarning = true );
QgsPointCloudLayer *addPointCloudLayerPrivate( const QString &uri,
const QString &baseName,
const QString &providerKey,
bool guiWarning = true );

bool addVectorLayersPrivate( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType, bool guiWarning = true );
QgsVectorLayer *addVectorLayerPrivate( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey, bool guiWarning = true );
@@ -167,9 +167,9 @@ QgsVectorTileLayer *QgisAppInterface::addVectorTileLayer( const QString &url, co
return qgis->addVectorTileLayer( url, baseName );
}

QgsPointCloudLayer *QgisAppInterface::addPointCloudLayer( const QString &url, const QString &baseName )
QgsPointCloudLayer *QgisAppInterface::addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey )
{
return qgis->addPointCloudLayer( url, baseName );
return qgis->addPointCloudLayer( url, baseName, providerKey );
}

bool QgisAppInterface::addProject( const QString &projectName )
@@ -71,7 +71,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
QgsRasterLayer *addRasterLayer( const QString &url, const QString &baseName, const QString &providerKey ) override;
QgsMeshLayer *addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey ) override;
QgsVectorTileLayer *addVectorTileLayer( const QString &url, const QString &baseName ) override;
QgsPointCloudLayer *addPointCloudLayer( const QString &url, const QString &baseName ) override;
QgsPointCloudLayer *addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey ) override;
bool addProject( const QString &projectName ) override;
bool newProject( bool promptToSaveFlag = false ) override;
void reloadConnections( ) override;
@@ -627,6 +627,7 @@ SET(QGIS_CORE_SRCS
pointcloud/qgspointclouddataitems.cpp
pointcloud/qgspointcloudprovidermetadata.cpp
pointcloud/qgspointclouddecoder.cpp
pointcloud/qgspointclouddataprovider.cpp

labeling/qgslabelfeature.cpp
labeling/qgslabelingengine.cpp
@@ -1303,6 +1304,7 @@ SET(QGIS_CORE_HDRS
pointcloud/qgspointclouddataitems.h
pointcloud/qgspointcloudprovidermetadata.h
pointcloud/qgspointclouddecoder.h
pointcloud/qgspointclouddataprovider.h

metadata/qgsabstractmetadatabase.h
metadata/qgslayermetadata.h
@@ -5150,6 +5150,8 @@ static QVariant fcnGetLayerProperty( const QVariantList &values, const QgsExpres
return QCoreApplication::translate( "expressions", "Plugin" );
case QgsMapLayerType::AnnotationLayer:
return QCoreApplication::translate( "expressions", "Annotation" );
case QgsMapLayerType::PointCloudLayer:
return QCoreApplication::translate( "expressions", "Point Cloud" );
}
}
else
@@ -3580,6 +3580,7 @@ bool QgsPalLabeling::staticWillUseLayer( const QgsMapLayer *layer )
case QgsMapLayerType::RasterLayer:
case QgsMapLayerType::PluginLayer:
case QgsMapLayerType::MeshLayer:
case QgsMapLayerType::PointCloudLayer:
case QgsMapLayerType::AnnotationLayer:
return false;
}
@@ -0,0 +1,62 @@
/***************************************************************************
qgspointclouddataprovider.cpp
-----------------------
begin : October 2020
copyright : (C) 2020 by Peter Petrik
email : zilolv at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgis.h"
#include "qgspointclouddataprovider.h"
#include "qgspointcloudindex.h"

QgsPointCloudDataProvider::QgsPointCloudDataProvider(
const QString &uri,
const QgsDataProvider::ProviderOptions &options,
QgsDataProvider::ReadFlags flags )
: QgsDataProvider( uri, options, flags )
, mIndex( new QgsPointCloudIndex )
{
mIsValid = mIndex->load( uri );
}

QgsPointCloudDataProvider::~QgsPointCloudDataProvider() = default;

QgsCoordinateReferenceSystem QgsPointCloudDataProvider::crs() const
{
return QgsCoordinateReferenceSystem::fromWkt( mIndex->wkt() );
}

QgsRectangle QgsPointCloudDataProvider::extent() const
{
return mIndex->extent();
}

bool QgsPointCloudDataProvider::isValid() const
{
return mIsValid;
}

QString QgsPointCloudDataProvider::name() const
{
return QStringLiteral( "pointclouds" );
}

QString QgsPointCloudDataProvider::description() const
{
return QStringLiteral( "Point Clouds" );
}

QgsPointCloudIndex *QgsPointCloudDataProvider::index()
{
return mIndex.get();
}

0 comments on commit b796dbb

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