mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
Handle tiled mesh layers in more code paths
This commit is contained in:
parent
5cf8f2ceb5
commit
1e1535d63d
@ -21,5 +21,8 @@ QgsProcessingUtils.LayerHint.Annotation.__doc__ = "Annotation layer type, since
|
|||||||
QgsProcessingUtils.VectorTile = QgsProcessingUtils.LayerHint.VectorTile
|
QgsProcessingUtils.VectorTile = QgsProcessingUtils.LayerHint.VectorTile
|
||||||
QgsProcessingUtils.VectorTile.is_monkey_patched = True
|
QgsProcessingUtils.VectorTile.is_monkey_patched = True
|
||||||
QgsProcessingUtils.LayerHint.VectorTile.__doc__ = "Vector tile layer type, since QGIS 3.32"
|
QgsProcessingUtils.LayerHint.VectorTile.__doc__ = "Vector tile layer type, since QGIS 3.32"
|
||||||
QgsProcessingUtils.LayerHint.__doc__ = 'Layer type hints.\n\n.. versionadded:: 3.4\n\n' + '* ``UnknownType``: ' + QgsProcessingUtils.LayerHint.UnknownType.__doc__ + '\n' + '* ``Vector``: ' + QgsProcessingUtils.LayerHint.Vector.__doc__ + '\n' + '* ``Raster``: ' + QgsProcessingUtils.LayerHint.Raster.__doc__ + '\n' + '* ``Mesh``: ' + QgsProcessingUtils.LayerHint.Mesh.__doc__ + '\n' + '* ``PointCloud``: ' + QgsProcessingUtils.LayerHint.PointCloud.__doc__ + '\n' + '* ``Annotation``: ' + QgsProcessingUtils.LayerHint.Annotation.__doc__ + '\n' + '* ``VectorTile``: ' + QgsProcessingUtils.LayerHint.VectorTile.__doc__
|
QgsProcessingUtils.TiledMesh = QgsProcessingUtils.LayerHint.TiledMesh
|
||||||
|
QgsProcessingUtils.TiledMesh.is_monkey_patched = True
|
||||||
|
QgsProcessingUtils.LayerHint.TiledMesh.__doc__ = "Tiled mesh layer type, since QGIS 3.34"
|
||||||
|
QgsProcessingUtils.LayerHint.__doc__ = 'Layer type hints.\n\n.. versionadded:: 3.4\n\n' + '* ``UnknownType``: ' + QgsProcessingUtils.LayerHint.UnknownType.__doc__ + '\n' + '* ``Vector``: ' + QgsProcessingUtils.LayerHint.Vector.__doc__ + '\n' + '* ``Raster``: ' + QgsProcessingUtils.LayerHint.Raster.__doc__ + '\n' + '* ``Mesh``: ' + QgsProcessingUtils.LayerHint.Mesh.__doc__ + '\n' + '* ``PointCloud``: ' + QgsProcessingUtils.LayerHint.PointCloud.__doc__ + '\n' + '* ``Annotation``: ' + QgsProcessingUtils.LayerHint.Annotation.__doc__ + '\n' + '* ``VectorTile``: ' + QgsProcessingUtils.LayerHint.VectorTile.__doc__ + '\n' + '* ``TiledMesh``: ' + QgsProcessingUtils.LayerHint.TiledMesh.__doc__
|
||||||
# --
|
# --
|
||||||
|
@ -45,6 +45,8 @@ value.
|
|||||||
|
|
||||||
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleTiledMeshLayers`
|
||||||
|
|
||||||
.. seealso:: :py:func:`compatibleLayers`
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
@ -75,6 +77,8 @@ value.
|
|||||||
|
|
||||||
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleTiledMeshLayers`
|
||||||
|
|
||||||
.. seealso:: :py:func:`compatibleLayers`
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
@ -98,6 +102,8 @@ value.
|
|||||||
|
|
||||||
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleTiledMeshLayers`
|
||||||
|
|
||||||
.. seealso:: :py:func:`compatibleLayers`
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
|
|
||||||
.. versionadded:: 3.6
|
.. versionadded:: 3.6
|
||||||
@ -123,6 +129,8 @@ value.
|
|||||||
|
|
||||||
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleTiledMeshLayers`
|
||||||
|
|
||||||
.. seealso:: :py:func:`compatibleLayers`
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
|
|
||||||
.. versionadded:: 3.22
|
.. versionadded:: 3.22
|
||||||
@ -148,6 +156,8 @@ value.
|
|||||||
|
|
||||||
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleTiledMeshLayers`
|
||||||
|
|
||||||
.. seealso:: :py:func:`compatibleLayers`
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
|
|
||||||
.. versionadded:: 3.22
|
.. versionadded:: 3.22
|
||||||
@ -173,6 +183,8 @@ value.
|
|||||||
|
|
||||||
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleTiledMeshLayers`
|
||||||
|
|
||||||
.. seealso:: :py:func:`compatibleLayers`
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
|
|
||||||
.. versionadded:: 3.22
|
.. versionadded:: 3.22
|
||||||
@ -198,9 +210,38 @@ value.
|
|||||||
|
|
||||||
.. seealso:: :py:func:`compatibleAnnotationLayers`
|
.. seealso:: :py:func:`compatibleAnnotationLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleTiledMeshLayers`
|
||||||
|
|
||||||
.. seealso:: :py:func:`compatibleLayers`
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
|
|
||||||
.. versionadded:: 3.32
|
.. versionadded:: 3.32
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QList<QgsTiledMeshLayer *> compatibleTiledMeshLayers( QgsProject *project, bool sort = true );
|
||||||
|
%Docstring
|
||||||
|
Returns a list of tiled mesh layers from a ``project`` which are compatible with the processing
|
||||||
|
framework.
|
||||||
|
|
||||||
|
If the ``sort`` argument is ``True`` then the layers will be sorted by their :py:func:`QgsMapLayer.name()`
|
||||||
|
value.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleRasterLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleVectorLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleMeshLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatiblePluginLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatiblePointCloudLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleAnnotationLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleVectorTileLayers`
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`compatibleLayers`
|
||||||
|
|
||||||
|
.. versionadded:: 3.34
|
||||||
%End
|
%End
|
||||||
|
|
||||||
static QList< QgsMapLayer * > compatibleLayers( QgsProject *project, bool sort = true );
|
static QList< QgsMapLayer * > compatibleLayers( QgsProject *project, bool sort = true );
|
||||||
@ -247,6 +288,7 @@ Decodes a provider key and layer ``uri`` from an encoded string, for use with
|
|||||||
PointCloud,
|
PointCloud,
|
||||||
Annotation,
|
Annotation,
|
||||||
VectorTile,
|
VectorTile,
|
||||||
|
TiledMesh,
|
||||||
};
|
};
|
||||||
|
|
||||||
static QgsMapLayer *mapLayerFromString( const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers = true, QgsProcessingUtils::LayerHint typeHint = QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
|
static QgsMapLayer *mapLayerFromString( const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers = true, QgsProcessingUtils::LayerHint typeHint = QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags = QgsProcessing::LayerOptionsFlags() );
|
||||||
|
@ -2272,6 +2272,7 @@ target_include_directories(qgis_core PUBLIC
|
|||||||
sensor
|
sensor
|
||||||
symbology
|
symbology
|
||||||
textrenderer
|
textrenderer
|
||||||
|
tiledmesh
|
||||||
validity
|
validity
|
||||||
vector
|
vector
|
||||||
vectortile
|
vectortile
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "qgsvectortilelayer.h"
|
#include "qgsvectortilelayer.h"
|
||||||
#include "qgspointcloudlayer.h"
|
#include "qgspointcloudlayer.h"
|
||||||
#include "qgsannotationlayer.h"
|
#include "qgsannotationlayer.h"
|
||||||
|
#include "qgstiledmeshlayer.h"
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
@ -105,6 +106,11 @@ QList<QgsVectorTileLayer *> QgsProcessingUtils::compatibleVectorTileLayers( QgsP
|
|||||||
return compatibleMapLayers< QgsVectorTileLayer >( project, sort );
|
return compatibleMapLayers< QgsVectorTileLayer >( project, sort );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QgsTiledMeshLayer *> QgsProcessingUtils::compatibleTiledMeshLayers( QgsProject *project, bool sort )
|
||||||
|
{
|
||||||
|
return compatibleMapLayers< QgsTiledMeshLayer >( project, sort );
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T> QList<T *> QgsProcessingUtils::compatibleMapLayers( QgsProject *project, bool sort )
|
template<typename T> QList<T *> QgsProcessingUtils::compatibleMapLayers( QgsProject *project, bool sort )
|
||||||
{
|
{
|
||||||
if ( !project )
|
if ( !project )
|
||||||
@ -160,6 +166,10 @@ QList<QgsMapLayer *> QgsProcessingUtils::compatibleLayers( QgsProject *project,
|
|||||||
for ( QgsVectorTileLayer *vtl : vectorTileLayers )
|
for ( QgsVectorTileLayer *vtl : vectorTileLayers )
|
||||||
layers << vtl;
|
layers << vtl;
|
||||||
|
|
||||||
|
const auto tiledMeshLayers = compatibleMapLayers< QgsTiledMeshLayer >( project, false );
|
||||||
|
for ( QgsTiledMeshLayer *tml : tiledMeshLayers )
|
||||||
|
layers << tml;
|
||||||
|
|
||||||
const auto pluginLayers = compatibleMapLayers< QgsPluginLayer >( project, false );
|
const auto pluginLayers = compatibleMapLayers< QgsPluginLayer >( project, false );
|
||||||
for ( QgsPluginLayer *pl : pluginLayers )
|
for ( QgsPluginLayer *pl : pluginLayers )
|
||||||
layers << pl;
|
layers << pl;
|
||||||
@ -215,6 +225,8 @@ QgsMapLayer *QgsProcessingUtils::mapLayerFromStore( const QString &string, QgsMa
|
|||||||
return !canUseLayer( qobject_cast< QgsMeshLayer * >( layer ) );
|
return !canUseLayer( qobject_cast< QgsMeshLayer * >( layer ) );
|
||||||
case Qgis::LayerType::VectorTile:
|
case Qgis::LayerType::VectorTile:
|
||||||
return !canUseLayer( qobject_cast< QgsVectorTileLayer * >( layer ) );
|
return !canUseLayer( qobject_cast< QgsVectorTileLayer * >( layer ) );
|
||||||
|
case Qgis::LayerType::TiledMesh:
|
||||||
|
return !canUseLayer( qobject_cast< QgsTiledMeshLayer * >( layer ) );
|
||||||
case Qgis::LayerType::PointCloud:
|
case Qgis::LayerType::PointCloud:
|
||||||
return !canUseLayer( qobject_cast< QgsPointCloudLayer * >( layer ) );
|
return !canUseLayer( qobject_cast< QgsPointCloudLayer * >( layer ) );
|
||||||
case Qgis::LayerType::Annotation:
|
case Qgis::LayerType::Annotation:
|
||||||
@ -247,6 +259,9 @@ QgsMapLayer *QgsProcessingUtils::mapLayerFromStore( const QString &string, QgsMa
|
|||||||
|
|
||||||
case LayerHint::VectorTile:
|
case LayerHint::VectorTile:
|
||||||
return l->type() == Qgis::LayerType::VectorTile;
|
return l->type() == Qgis::LayerType::VectorTile;
|
||||||
|
|
||||||
|
case LayerHint::TiledMesh:
|
||||||
|
return l->type() == Qgis::LayerType::TiledMesh;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -404,6 +419,29 @@ QgsMapLayer *QgsProcessingUtils::loadMapLayerFromString( const QString &string,
|
|||||||
return tileLayer.release();
|
return tileLayer.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( typeHint == LayerHint::UnknownType || typeHint == LayerHint::TiledMesh )
|
||||||
|
{
|
||||||
|
QgsTiledMeshLayer::LayerOptions tiledMeshOptions;
|
||||||
|
tiledMeshOptions.skipCrsValidation = true;
|
||||||
|
|
||||||
|
std::unique_ptr< QgsTiledMeshLayer > tiledMeshLayer;
|
||||||
|
if ( useProvider )
|
||||||
|
{
|
||||||
|
tiledMeshLayer = std::make_unique< QgsTiledMeshLayer >( uri, name, provider, tiledMeshOptions );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const QList< QgsProviderRegistry::ProviderCandidateDetails > preferredProviders = QgsProviderRegistry::instance()->preferredProvidersForUri( uri );
|
||||||
|
if ( !preferredProviders.empty() )
|
||||||
|
{
|
||||||
|
tiledMeshLayer = std::make_unique< QgsTiledMeshLayer >( uri, name, preferredProviders.at( 0 ).metadata()->key(), tiledMeshOptions );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( tiledMeshLayer && tiledMeshLayer->isValid() )
|
||||||
|
{
|
||||||
|
return tiledMeshLayer.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,6 +651,11 @@ bool QgsProcessingUtils::canUseLayer( const QgsAnnotationLayer *layer )
|
|||||||
return layer && layer->isValid();
|
return layer && layer->isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QgsProcessingUtils::canUseLayer( const QgsTiledMeshLayer *layer )
|
||||||
|
{
|
||||||
|
return layer && layer->isValid();
|
||||||
|
}
|
||||||
|
|
||||||
bool QgsProcessingUtils::canUseLayer( const QgsVectorLayer *layer, const QList<int> &sourceTypes )
|
bool QgsProcessingUtils::canUseLayer( const QgsVectorLayer *layer, const QList<int> &sourceTypes )
|
||||||
{
|
{
|
||||||
return layer && layer->isValid() &&
|
return layer && layer->isValid() &&
|
||||||
|
@ -39,6 +39,7 @@ class QgsVectorTileLayer;
|
|||||||
class QgsPointCloudLayer;
|
class QgsPointCloudLayer;
|
||||||
class QgsAnnotationLayer;
|
class QgsAnnotationLayer;
|
||||||
class QgsVectorTileLayer;
|
class QgsVectorTileLayer;
|
||||||
|
class QgsTiledMeshLayer;
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@ -65,6 +66,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
* \see compatiblePointCloudLayers()
|
* \see compatiblePointCloudLayers()
|
||||||
* \see compatibleAnnotationLayers()
|
* \see compatibleAnnotationLayers()
|
||||||
* \see compatibleVectorTileLayers()
|
* \see compatibleVectorTileLayers()
|
||||||
|
* \see compatibleTiledMeshLayers()
|
||||||
* \see compatibleLayers()
|
* \see compatibleLayers()
|
||||||
*/
|
*/
|
||||||
static QList< QgsRasterLayer * > compatibleRasterLayers( QgsProject *project, bool sort = true );
|
static QList< QgsRasterLayer * > compatibleRasterLayers( QgsProject *project, bool sort = true );
|
||||||
@ -86,6 +88,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
* \see compatiblePointCloudLayers()
|
* \see compatiblePointCloudLayers()
|
||||||
* \see compatibleAnnotationLayers()
|
* \see compatibleAnnotationLayers()
|
||||||
* \see compatibleVectorTileLayers()
|
* \see compatibleVectorTileLayers()
|
||||||
|
* \see compatibleTiledMeshLayers()
|
||||||
* \see compatibleLayers()
|
* \see compatibleLayers()
|
||||||
*/
|
*/
|
||||||
static QList< QgsVectorLayer * > compatibleVectorLayers( QgsProject *project,
|
static QList< QgsVectorLayer * > compatibleVectorLayers( QgsProject *project,
|
||||||
@ -105,6 +108,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
* \see compatiblePointCloudLayers()
|
* \see compatiblePointCloudLayers()
|
||||||
* \see compatibleAnnotationLayers()
|
* \see compatibleAnnotationLayers()
|
||||||
* \see compatibleVectorTileLayers()
|
* \see compatibleVectorTileLayers()
|
||||||
|
* \see compatibleTiledMeshLayers()
|
||||||
* \see compatibleLayers()
|
* \see compatibleLayers()
|
||||||
*
|
*
|
||||||
* \since QGIS 3.6
|
* \since QGIS 3.6
|
||||||
@ -124,6 +128,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
* \see compatiblePointCloudLayers()
|
* \see compatiblePointCloudLayers()
|
||||||
* \see compatibleAnnotationLayers()
|
* \see compatibleAnnotationLayers()
|
||||||
* \see compatibleVectorTileLayers()
|
* \see compatibleVectorTileLayers()
|
||||||
|
* \see compatibleTiledMeshLayers()
|
||||||
* \see compatibleLayers()
|
* \see compatibleLayers()
|
||||||
*
|
*
|
||||||
* \since QGIS 3.22
|
* \since QGIS 3.22
|
||||||
@ -143,6 +148,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
* \see compatiblePluginLayers()
|
* \see compatiblePluginLayers()
|
||||||
* \see compatibleAnnotationLayers()
|
* \see compatibleAnnotationLayers()
|
||||||
* \see compatibleVectorTileLayers()
|
* \see compatibleVectorTileLayers()
|
||||||
|
* \see compatibleTiledMeshLayers()
|
||||||
* \see compatibleLayers()
|
* \see compatibleLayers()
|
||||||
*
|
*
|
||||||
* \since QGIS 3.22
|
* \since QGIS 3.22
|
||||||
@ -162,6 +168,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
* \see compatiblePluginLayers()
|
* \see compatiblePluginLayers()
|
||||||
* \see compatiblePointCloudLayers()
|
* \see compatiblePointCloudLayers()
|
||||||
* \see compatibleVectorTileLayers()
|
* \see compatibleVectorTileLayers()
|
||||||
|
* \see compatibleTiledMeshLayers()
|
||||||
* \see compatibleLayers()
|
* \see compatibleLayers()
|
||||||
*
|
*
|
||||||
* \since QGIS 3.22
|
* \since QGIS 3.22
|
||||||
@ -181,12 +188,33 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
* \see compatiblePluginLayers()
|
* \see compatiblePluginLayers()
|
||||||
* \see compatiblePointCloudLayers()
|
* \see compatiblePointCloudLayers()
|
||||||
* \see compatibleAnnotationLayers()
|
* \see compatibleAnnotationLayers()
|
||||||
|
* \see compatibleTiledMeshLayers()
|
||||||
* \see compatibleLayers()
|
* \see compatibleLayers()
|
||||||
*
|
*
|
||||||
* \since QGIS 3.32
|
* \since QGIS 3.32
|
||||||
*/
|
*/
|
||||||
static QList<QgsVectorTileLayer *> compatibleVectorTileLayers( QgsProject *project, bool sort = true );
|
static QList<QgsVectorTileLayer *> compatibleVectorTileLayers( QgsProject *project, bool sort = true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of tiled mesh layers from a \a project which are compatible with the processing
|
||||||
|
* framework.
|
||||||
|
*
|
||||||
|
* If the \a sort argument is TRUE then the layers will be sorted by their QgsMapLayer::name()
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* \see compatibleRasterLayers()
|
||||||
|
* \see compatibleVectorLayers()
|
||||||
|
* \see compatibleMeshLayers()
|
||||||
|
* \see compatiblePluginLayers()
|
||||||
|
* \see compatiblePointCloudLayers()
|
||||||
|
* \see compatibleAnnotationLayers()
|
||||||
|
* \see compatibleVectorTileLayers()
|
||||||
|
* \see compatibleLayers()
|
||||||
|
*
|
||||||
|
* \since QGIS 3.34
|
||||||
|
*/
|
||||||
|
static QList<QgsTiledMeshLayer *> compatibleTiledMeshLayers( QgsProject *project, bool sort = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of map layers from a \a project which are compatible with the processing
|
* Returns a list of map layers from a \a project which are compatible with the processing
|
||||||
* framework.
|
* framework.
|
||||||
@ -232,6 +260,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
PointCloud, //!< Point cloud layer type, since QGIS 3.22
|
PointCloud, //!< Point cloud layer type, since QGIS 3.22
|
||||||
Annotation, //!< Annotation layer type, since QGIS 3.22
|
Annotation, //!< Annotation layer type, since QGIS 3.22
|
||||||
VectorTile, //!< Vector tile layer type, since QGIS 3.32
|
VectorTile, //!< Vector tile layer type, since QGIS 3.32
|
||||||
|
TiledMesh, //!< Tiled mesh layer type, since QGIS 3.34
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -567,6 +596,7 @@ class CORE_EXPORT QgsProcessingUtils
|
|||||||
static bool canUseLayer( const QgsVectorTileLayer *layer );
|
static bool canUseLayer( const QgsVectorTileLayer *layer );
|
||||||
static bool canUseLayer( const QgsPointCloudLayer *layer );
|
static bool canUseLayer( const QgsPointCloudLayer *layer );
|
||||||
static bool canUseLayer( const QgsAnnotationLayer *layer );
|
static bool canUseLayer( const QgsAnnotationLayer *layer );
|
||||||
|
static bool canUseLayer( const QgsTiledMeshLayer *layer );
|
||||||
static bool canUseLayer( const QgsVectorLayer *layer,
|
static bool canUseLayer( const QgsVectorLayer *layer,
|
||||||
const QList< int > &sourceTypes = QList< int >() );
|
const QList< int > &sourceTypes = QList< int >() );
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "qgsprojectstylesettings.h"
|
#include "qgsprojectstylesettings.h"
|
||||||
#include "qgsprojecttimesettings.h"
|
#include "qgsprojecttimesettings.h"
|
||||||
#include "qgsvectortilelayer.h"
|
#include "qgsvectortilelayer.h"
|
||||||
|
#include "qgstiledmeshlayer.h"
|
||||||
#include "qgsruntimeprofiler.h"
|
#include "qgsruntimeprofiler.h"
|
||||||
#include "qgsannotationlayer.h"
|
#include "qgsannotationlayer.h"
|
||||||
#include "qgspointcloudlayer.h"
|
#include "qgspointcloudlayer.h"
|
||||||
@ -1606,6 +1607,10 @@ bool QgsProject::addLayer( const QDomElement &layerElem,
|
|||||||
mapLayer = std::make_unique<QgsPointCloudLayer>();
|
mapLayer = std::make_unique<QgsPointCloudLayer>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Qgis::LayerType::TiledMesh:
|
||||||
|
mapLayer = std::make_unique<QgsTiledMeshLayer>();
|
||||||
|
break;
|
||||||
|
|
||||||
case Qgis::LayerType::Plugin:
|
case Qgis::LayerType::Plugin:
|
||||||
{
|
{
|
||||||
const QString typeName = layerElem.attribute( QStringLiteral( "name" ) );
|
const QString typeName = layerElem.attribute( QStringLiteral( "name" ) );
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "qgsreadwritecontext.h"
|
#include "qgsreadwritecontext.h"
|
||||||
#include "qgsvectorlayer.h"
|
#include "qgsvectorlayer.h"
|
||||||
#include "qgsvectortilelayer.h"
|
#include "qgsvectortilelayer.h"
|
||||||
|
#include "qgstiledmeshlayer.h"
|
||||||
#include "qgsapplication.h"
|
#include "qgsapplication.h"
|
||||||
#include "qgsmaplayerfactory.h"
|
#include "qgsmaplayerfactory.h"
|
||||||
#include "qgsmeshlayer.h"
|
#include "qgsmeshlayer.h"
|
||||||
@ -339,6 +340,10 @@ QList<QgsMapLayer *> QgsLayerDefinition::loadLayerDefinitionLayersInternal( QDom
|
|||||||
layer = new QgsPointCloudLayer();
|
layer = new QgsPointCloudLayer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Qgis::LayerType::TiledMesh:
|
||||||
|
layer = new QgsTiledMeshLayer;
|
||||||
|
break;
|
||||||
|
|
||||||
case Qgis::LayerType::Group:
|
case Qgis::LayerType::Group:
|
||||||
layer = new QgsGroupLayer( QString(), QgsGroupLayer::LayerOptions( QgsCoordinateTransformContext() ) );
|
layer = new QgsGroupLayer( QString(), QgsGroupLayer::LayerOptions( QgsCoordinateTransformContext() ) );
|
||||||
break;
|
break;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "qgsvectortilelayer.h"
|
#include "qgsvectortilelayer.h"
|
||||||
#include "qgsannotationlayer.h"
|
#include "qgsannotationlayer.h"
|
||||||
#include "qgsgrouplayer.h"
|
#include "qgsgrouplayer.h"
|
||||||
|
#include "qgstiledmeshlayer.h"
|
||||||
|
|
||||||
Qgis::LayerType QgsMapLayerFactory::typeFromString( const QString &string, bool &ok )
|
Qgis::LayerType QgsMapLayerFactory::typeFromString( const QString &string, bool &ok )
|
||||||
{
|
{
|
||||||
@ -131,6 +132,14 @@ QgsMapLayer *QgsMapLayerFactory::createLayer( const QString &uri, const QString
|
|||||||
return new QgsPointCloudLayer( uri, name, provider, pointCloudOptions );
|
return new QgsPointCloudLayer( uri, name, provider, pointCloudOptions );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Qgis::LayerType::TiledMesh:
|
||||||
|
{
|
||||||
|
QgsTiledMeshLayer::LayerOptions tiledMeshOptions;
|
||||||
|
tiledMeshOptions.loadDefaultStyle = options.loadDefaultStyle;
|
||||||
|
tiledMeshOptions.transformContext = options.transformContext;
|
||||||
|
return new QgsTiledMeshLayer( uri, name, provider, tiledMeshOptions );
|
||||||
|
}
|
||||||
|
|
||||||
case Qgis::LayerType::Plugin:
|
case Qgis::LayerType::Plugin:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "qgstiledmeshlayer.h"
|
#include "qgstiledmeshlayer.h"
|
||||||
#include "qgsmaplayerlegend.h"
|
|
||||||
#include "qgsthreadingutils.h"
|
#include "qgsthreadingutils.h"
|
||||||
#include "qgsmaplayerfactory.h"
|
#include "qgsmaplayerfactory.h"
|
||||||
#include "qgspainting.h"
|
#include "qgspainting.h"
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "qgspointcloudlayer.h"
|
#include "qgspointcloudlayer.h"
|
||||||
#include "qgslayeritem.h"
|
#include "qgslayeritem.h"
|
||||||
#include "qgsdirectoryitem.h"
|
#include "qgsdirectoryitem.h"
|
||||||
|
#include "qgstiledmeshlayer.h"
|
||||||
|
|
||||||
/// @cond PRIVATE
|
/// @cond PRIVATE
|
||||||
|
|
||||||
@ -232,6 +233,15 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem *item )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Qgis::LayerType::TiledMesh:
|
||||||
|
{
|
||||||
|
QgsDebugMsgLevel( QStringLiteral( "creating tiled mesh layer" ), 2 );
|
||||||
|
QgsTiledMeshLayer::LayerOptions options { QgsProject::instance()->transformContext() };
|
||||||
|
options.skipCrsValidation = true;
|
||||||
|
mLayer = std::make_unique< QgsTiledMeshLayer >( layerItem->uri(), layerItem->name(), layerItem->providerKey(), options );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case Qgis::LayerType::Plugin:
|
case Qgis::LayerType::Plugin:
|
||||||
case Qgis::LayerType::Annotation:
|
case Qgis::LayerType::Annotation:
|
||||||
case Qgis::LayerType::Group:
|
case Qgis::LayerType::Group:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user