Skip to content
Permalink
Browse files

Add QgsProviderRegistry::filePointCloudFilters() for retrieving filte…

…r string of all supported point cloud types
  • Loading branch information
nyalldawson committed Nov 4, 2020
1 parent 6885a16 commit e59bab7f2e181c16b10e35c1d1dbddde616e3cb0
@@ -339,6 +339,22 @@ fileMeshFilters to a string, which is then returned.
.. seealso:: :py:func:`fileMeshFilters`

.. versionadded:: 3.6
%End

QString filePointCloudFilters() const;
%Docstring
Returns a file filter string for supported point clouds.

Returns a string suitable for a QFileDialog of point cloud file formats
supported by all data providers.

.. seealso:: :py:func:`fileMeshFilters`

.. seealso:: :py:func:`fileRasterFilters`

.. seealso:: :py:func:`fileVectorFilters`

.. versionadded:: 3.18
%End

QString databaseDrivers() const;
@@ -292,6 +292,15 @@ void QgsProviderRegistry::init()
QgsDebugMsgLevel( QStringLiteral( "Checking %1: ...loaded OK (%2 file dataset filters)" ).arg( key ).arg( mMeshDatasetFileFilters.split( ";;" ).count() ), 2 );
}

// now get point cloud file filters, if any
const QString filePointCloudFilters = meta->filters( QgsProviderMetadata::FilterType::FilterPointCloud );
if ( !filePointCloudFilters.isEmpty() )
{
QgsDebugMsgLevel( "point cloud filters: " + filePointCloudFilters, 2 );
mPointCloudFileFilters += filePointCloudFilters;
QgsDebugMsgLevel( QStringLiteral( "Checking %1: ...loaded OK (%2 file filters)" ).arg( key ).arg( filePointCloudFilters.split( ";;" ).count() ), 2 );
}

// call initProvider() - allows provider to register its services to QGIS
meta->initProvider();
}
@@ -702,6 +711,11 @@ QString QgsProviderRegistry::fileMeshDatasetFilters() const
return mMeshDatasetFileFilters;
}

QString QgsProviderRegistry::filePointCloudFilters() const
{
return mPointCloudFileFilters;
}

QString QgsProviderRegistry::databaseDrivers() const
{
return mDatabaseDrivers;
@@ -340,6 +340,20 @@ class CORE_EXPORT QgsProviderRegistry
*/
QString fileMeshDatasetFilters() const;

/**
* Returns a file filter string for supported point clouds.
*
* Returns a string suitable for a QFileDialog of point cloud file formats
* supported by all data providers.
*
* \see fileMeshFilters()
* \see fileRasterFilters()
* \see fileVectorFilters()
*
* \since QGIS 3.18
*/
QString filePointCloudFilters() const;

//! Returns a string containing the available database drivers
QString databaseDrivers() const;
//! Returns a string containing the available directory drivers
@@ -406,6 +420,11 @@ class CORE_EXPORT QgsProviderRegistry
*/
QString mMeshDatasetFileFilters;

/**
* File filter string for point cloud files
*/
QString mPointCloudFileFilters;

/**
* Available database drivers string for vector databases
*
@@ -82,6 +82,9 @@ void TestQgsEptProvider::filters()

QCOMPARE( metadata->filters( QgsProviderMetadata::FilterType::FilterPointCloud ), QStringLiteral( "Entwine Point Clouds (ept.json EPT.JSON)" ) );
QCOMPARE( metadata->filters( QgsProviderMetadata::FilterType::FilterVector ), QString() );

const QString registryPointCloudFilters = QgsProviderRegistry::instance()->filePointCloudFilters();
QVERIFY( registryPointCloudFilters.contains( "(ept.json EPT.JSON)" ) );
}


0 comments on commit e59bab7

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