QgsEllipsoidUtils::definitions()
name.replace( '_', ' ' );
def.description = QStringLiteral( "%1 (%2:%3)" ).arg( name, authority, code );
-#if PROJ_VERSION_MAJOR>8 || (PROJ_VERSION_MAJOR==8 && PROJ_VERSION_MINOR>=1)
def.celestialBodyName = proj_get_celestial_body_name( context, ellipsoid.get() );
-#endif
double semiMajor, semiMinor, invFlattening;
int semiMinorComputed = 0;
diff --git a/src/core/proj/qgsprojutils.cpp b/src/core/proj/qgsprojutils.cpp
index 453086b506226..f381644d301b2 100644
--- a/src/core/proj/qgsprojutils.cpp
+++ b/src/core/proj/qgsprojutils.cpp
@@ -340,7 +340,6 @@ QgsProjUtils::proj_pj_unique_ptr QgsProjUtils::crsToDatumEnsemble( const PJ *crs
if ( !crs )
return nullptr;
-#if PROJ_VERSION_MAJOR>=8
PJ_CONTEXT *context = QgsProjContext::get();
QgsProjUtils::proj_pj_unique_ptr candidate = crsToHorizontalCrs( crs );
if ( !candidate ) // purely vertical CRS
@@ -350,9 +349,6 @@ QgsProjUtils::proj_pj_unique_ptr QgsProjUtils::crsToDatumEnsemble( const PJ *crs
return nullptr;
return QgsProjUtils::proj_pj_unique_ptr( proj_crs_get_datum_ensemble( context, candidate.get() ) );
-#else
- throw QgsNotSupportedException( QObject::tr( "Calculating datum ensembles requires a QGIS build based on PROJ 8.0 or later" ) );
-#endif
}
void QgsProjUtils::proj_collecting_logger( void *user_data, int /*level*/, const char *message )
diff --git a/src/core/proj/qgsprojutils.h b/src/core/proj/qgsprojutils.h
index 862e52a76b87e..a343df0d62041 100644
--- a/src/core/proj/qgsprojutils.h
+++ b/src/core/proj/qgsprojutils.h
@@ -206,10 +206,6 @@ class CORE_EXPORT QgsProjUtils
*
* \note In the case of a compound \a crs, this method will always return the datum ensemble for the horizontal component.
*
- * \warning This method requires PROJ 8.0 or later
- *
- * \throws QgsNotSupportedException on QGIS builds based on PROJ 7 or earlier.
- *
* \since QGIS 3.20
*/
static proj_pj_unique_ptr crsToDatumEnsemble( const PJ *crs );
@@ -270,13 +266,8 @@ class CORE_EXPORT QgsProjUtils
#ifndef SIP_RUN
-#if PROJ_VERSION_MAJOR>=8
struct pj_ctx;
typedef struct pj_ctx PJ_CONTEXT;
-#else
-struct projCtx_t;
-typedef struct projCtx_t PJ_CONTEXT;
-#endif
/**
* \class QgsProjContext
diff --git a/src/core/providers/qgsprovidersublayerdetails.cpp b/src/core/providers/qgsprovidersublayerdetails.cpp
index 02c621ddc54c9..fabab7a1aca8c 100644
--- a/src/core/providers/qgsprovidersublayerdetails.cpp
+++ b/src/core/providers/qgsprovidersublayerdetails.cpp
@@ -30,35 +30,20 @@ QgsMapLayer *QgsProviderSublayerDetails::toLayer( const LayerOptions &options )
QgsMimeDataUtils::Uri QgsProviderSublayerDetails::toMimeUri() const
{
QgsMimeDataUtils::Uri u;
+ u.layerType = QgsMapLayerFactory::typeToString( mType );
switch ( mType )
{
case Qgis::LayerType::Vector:
- u.layerType = QStringLiteral( "vector" );
u.wkbType = mWkbType;
break;
case Qgis::LayerType::Raster:
- u.layerType = QStringLiteral( "raster" );
- break;
case Qgis::LayerType::Mesh:
- u.layerType = QStringLiteral( "mesh" );
- break;
case Qgis::LayerType::VectorTile:
- u.layerType = QStringLiteral( "vector-tile" );
- break;
case Qgis::LayerType::PointCloud:
- u.layerType = QStringLiteral( "pointcloud" );
- break;
case Qgis::LayerType::Plugin:
- u.layerType = QStringLiteral( "plugin" );
- break;
case Qgis::LayerType::Group:
- u.layerType = QStringLiteral( "group" );
- break;
case Qgis::LayerType::Annotation:
- u.layerType = QStringLiteral( "annotation" );
- break;
case Qgis::LayerType::TiledScene:
- u.layerType = QStringLiteral( "tiled-scene" );
break;
}
diff --git a/src/core/providers/sensorthings/qgssensorthingsutils.cpp b/src/core/providers/sensorthings/qgssensorthingsutils.cpp
index fa92c1a2041dc..21358ba76c9ed 100644
--- a/src/core/providers/sensorthings/qgssensorthingsutils.cpp
+++ b/src/core/providers/sensorthings/qgssensorthingsutils.cpp
@@ -661,10 +661,8 @@ Qgis::GeometryType QgsSensorThingsUtils::geometryTypeForEntity( Qgis::SensorThin
case Qgis::SensorThingsEntity::Location:
case Qgis::SensorThingsEntity::FeatureOfInterest:
- return Qgis::GeometryType::Unknown;
-
case Qgis::SensorThingsEntity::MultiDatastream:
- return Qgis::GeometryType::Polygon;
+ return Qgis::GeometryType::Unknown;
}
BUILTIN_UNREACHABLE
}
diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp
index 4da4369fac02a..be80991c95095 100644
--- a/src/core/qgsmaplayer.cpp
+++ b/src/core/qgsmaplayer.cpp
@@ -473,13 +473,37 @@ QString QgsMapLayer::metadataUrlFormat() const
}
}
-QString QgsMapLayer::publicSource( bool hidePassword ) const
+QString QgsMapLayer::publicSource( bool redactCredentials ) const
{
QGIS_PROTECT_QOBJECT_THREAD_ACCESS
+ QString safeName = mDataSource;
+
+ if ( providerType() == QLatin1String( "gdal" ) )
+ {
+ QVariantMap components = QgsProviderRegistry::instance()->decodeUri( providerType(), safeName );
+ QVariantMap credentialOptions = components.value( QStringLiteral( "credentialOptions" ) ).toMap();
+ if ( !credentialOptions.empty() )
+ {
+ if ( redactCredentials )
+ {
+ for ( auto it = credentialOptions.begin(); it != credentialOptions.end(); ++it )
+ {
+ it.value() = QStringLiteral( "XXXXXXXX" );
+ }
+ components.insert( QStringLiteral( "credentialOptions" ), credentialOptions );
+ }
+ else
+ {
+ components.remove( QStringLiteral( "credentialOptions" ) );
+ }
+ }
+ safeName = QgsProviderRegistry::instance()->encodeUri( providerType(), components );
+ }
+
// Redo this every time we're asked for it, as we don't know if
// dataSource has changed.
- QString safeName = QgsDataSourceUri::removePassword( mDataSource, hidePassword );
+ safeName = QgsDataSourceUri::removePassword( safeName, redactCredentials );
return safeName;
}
@@ -3228,12 +3252,14 @@ QString QgsMapLayer::generalHtmlMetadata() const
// name
metadata += QStringLiteral( "" ) + tr( "Name" ) + QStringLiteral( " | " ) + name() + QStringLiteral( " |
\n" );
+ const QString lPublicSource = publicSource();
+
QString path;
bool isLocalPath = false;
if ( dataProvider() )
{
// local path
- QVariantMap uriComponents = QgsProviderRegistry::instance()->decodeUri( dataProvider()->name(), publicSource() );
+ QVariantMap uriComponents = QgsProviderRegistry::instance()->decodeUri( dataProvider()->name(), lPublicSource );
if ( uriComponents.contains( QStringLiteral( "path" ) ) )
{
path = uriComponents[QStringLiteral( "path" )].toString();
@@ -3279,8 +3305,8 @@ QString QgsMapLayer::generalHtmlMetadata() const
}
// data source
- if ( publicSource() != path || !isLocalPath )
- metadata += QStringLiteral( "" ) + tr( "Source" ) + QStringLiteral( " | %1" ).arg( publicSource() != path ? publicSource() : path ) + QStringLiteral( " |
\n" );
+ if ( lPublicSource != path || !isLocalPath )
+ metadata += QStringLiteral( "" ) + tr( "Source" ) + QStringLiteral( " | %1" ).arg( lPublicSource != path ? lPublicSource : path ) + QStringLiteral( " |
\n" );
// provider
if ( dataProvider() )
diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h
index 19303cb6e2127..861b2ffc5c0b7 100644
--- a/src/core/qgsmaplayer.h
+++ b/src/core/qgsmaplayer.h
@@ -573,12 +573,15 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
bool isValid() const;
+ // TODO QGIS 4.0: consider changing bool hidePassword to an enumeration: HIDE_CREDENTIALS / REDACT_CREDENTIALS
+ // to avoid the ambiguity of the double negation (hide = false)
+
/**
* Gets a version of the internal layer definition that has sensitive
- * bits removed (for example, the password). This function should
- * be used when displaying the source name for general viewing.
- * \param hidePassword False, if the password should be removed or replaced by an arbitrary string, since QGIS 3.34
- * \see source()
+ * bits removed (for example, the password). This function should
+ * be used when displaying the source name for general viewing.
+ * \param hidePassword TRUE to replace the value of credentials with 'xxxxxxxx', FALSE to completely remove credentials (key and value). Since QGIS 3.34
+ * \see source()
*/
QString publicSource( bool hidePassword = false ) const;
diff --git a/src/core/qgsmaplayerfactory.cpp b/src/core/qgsmaplayerfactory.cpp
index ddf42af3aeb93..b5a260226857d 100644
--- a/src/core/qgsmaplayerfactory.cpp
+++ b/src/core/qgsmaplayerfactory.cpp
@@ -36,7 +36,11 @@ Qgis::LayerType QgsMapLayerFactory::typeFromString( const QString &string, bool
return Qgis::LayerType::Mesh;
else if ( string.compare( QLatin1String( "vector-tile" ), Qt::CaseInsensitive ) == 0 )
return Qgis::LayerType::VectorTile;
- else if ( string.compare( QLatin1String( "point-cloud" ), Qt::CaseInsensitive ) == 0 )
+ else if ( string.compare( QLatin1String( "point-cloud" ), Qt::CaseInsensitive ) == 0 ||
+ // We accept "pointcloud" for backward compatibility with the
+ // MIME related code, which spelled it that way before 3.42.0 where
+ // we have delegated to QgsMapLayerFactory::typeToString()
+ string.compare( QLatin1String( "pointcloud" ), Qt::CaseInsensitive ) == 0 )
return Qgis::LayerType::PointCloud;
else if ( string.compare( QLatin1String( "plugin" ), Qt::CaseInsensitive ) == 0 )
return Qgis::LayerType::Plugin;
diff --git a/src/core/qgsmimedatautils.cpp b/src/core/qgsmimedatautils.cpp
index 6ad3b74581848..528fe7c210fe5 100644
--- a/src/core/qgsmimedatautils.cpp
+++ b/src/core/qgsmimedatautils.cpp
@@ -20,6 +20,7 @@
#include "qgslogger.h"
#include "qgsrasterlayer.h"
#include "qgsvectorlayer.h"
+#include "qgsmaplayerfactory.h"
#include "qgsmeshlayer.h"
#include
@@ -71,38 +72,20 @@ QgsMimeDataUtils::Uri::Uri( QgsMapLayer *layer )
, layerId( layer->id() )
, pId( QString::number( QCoreApplication::applicationPid() ) )
{
+ layerType = QgsMapLayerFactory::typeToString( layer->type() );
switch ( layer->type() )
{
case Qgis::LayerType::Vector:
{
- layerType = QStringLiteral( "vector" );
wkbType = qobject_cast< QgsVectorLayer *>( layer )->wkbType();
break;
}
case Qgis::LayerType::Raster:
- {
- layerType = QStringLiteral( "raster" );
- break;
- }
-
case Qgis::LayerType::Mesh:
- {
- layerType = QStringLiteral( "mesh" );
- break;
- }
case Qgis::LayerType::PointCloud:
- {
- layerType = QStringLiteral( "pointcloud" );
- break;
- }
case Qgis::LayerType::VectorTile:
- {
- layerType = QStringLiteral( "vector-tile" );
- break;
- }
case Qgis::LayerType::TiledScene:
{
- layerType = QStringLiteral( "tiled-scene" );
break;
}
diff --git a/src/core/qgsmimedatautils.h b/src/core/qgsmimedatautils.h
index 2289a7a8cd628..e14fba5313928 100644
--- a/src/core/qgsmimedatautils.h
+++ b/src/core/qgsmimedatautils.h
@@ -100,14 +100,20 @@ class CORE_EXPORT QgsMimeDataUtils
* - "vector": vector layers
* - "raster": raster layers
* - "mesh": mesh layers
- * - "pointcloud": point cloud layers
+ * - "point-cloud": point cloud layers (spelled with a dash since QGIS 3.42.0. In prior versions, there was no dash)
* - "vector-tile": vector tile layers
* - "tiled-scene": tiled scene layers
+ * - "annotation": annotation layers
+ * - "group": group layers
* - "plugin": plugin layers
* - "custom": custom types
* - "project": QGS/QGZ project file
* - "directory": directory path
*
+ * Note: use QgsMapLayerFactory::typeToString() to convert from a
+ * Qgis::LayerType to a string (except for "custom", "project" and
+ * "directory")
+ *
* Mime data from plugins may use additional custom layer types.
*/
QString layerType;
diff --git a/src/core/vector/qgsvectorlayerrenderer.cpp b/src/core/vector/qgsvectorlayerrenderer.cpp
index 2e682ead38b12..34afa9f29a0d7 100644
--- a/src/core/vector/qgsvectorlayerrenderer.cpp
+++ b/src/core/vector/qgsvectorlayerrenderer.cpp
@@ -171,8 +171,6 @@ QgsVectorLayerRenderer::QgsVectorLayerRenderer( QgsVectorLayer *layer, QgsRender
// set editing vertex markers style (main renderer only)
mRenderer->setVertexMarkerAppearance( mVertexMarkerStyle, mVertexMarkerSize );
}
- if ( !mNoSetLayerExpressionContext )
- renderContext()->expressionContext() << QgsExpressionContextUtils::layerScope( layer );
for ( const std::unique_ptr< QgsFeatureRenderer > &renderer : mRenderers )
{
diff --git a/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp b/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp
index 0dff182ce931e..f037da8876dbb 100644
--- a/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp
+++ b/src/core/vectortile/qgsmbtilesvectortiledataprovider.cpp
@@ -59,15 +59,26 @@ QgsMbTilesVectorTileDataProvider::QgsMbTilesVectorTileDataProvider( const QStrin
QgsDebugMsgLevel( QStringLiteral( "name: " ) + reader.metadataValue( QStringLiteral( "name" ) ), 2 );
- mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator();
-
bool minZoomOk, maxZoomOk;
const int minZoom = reader.metadataValue( QStringLiteral( "minzoom" ) ).toInt( &minZoomOk );
const int maxZoom = reader.metadataValue( QStringLiteral( "maxzoom" ) ).toInt( &maxZoomOk );
- if ( minZoomOk )
- mMatrixSet.dropMatricesOutsideZoomRange( minZoom, 99 );
- if ( maxZoomOk )
- mMatrixSet.dropMatricesOutsideZoomRange( 0, maxZoom );
+ if ( minZoomOk && maxZoomOk )
+ {
+ mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator( minZoom, maxZoom );
+ }
+ else if ( minZoomOk )
+ {
+ mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator( minZoom, 99 );
+ }
+ else if ( maxZoomOk )
+ {
+ mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator( 0, maxZoom );
+ }
+ else
+ {
+ mMatrixSet = QgsVectorTileMatrixSet::fromWebMercator();
+ }
+
QgsDebugMsgLevel( QStringLiteral( "zoom range: %1 - %2" ).arg( mMatrixSet.minimumZoom() ).arg( mMatrixSet.maximumZoom() ), 2 );
QgsRectangle r = reader.extent();
diff --git a/src/core/vectortile/qgsvectortilelayerrenderer.cpp b/src/core/vectortile/qgsvectortilelayerrenderer.cpp
index 3e854dd931e5a..797e960615b42 100644
--- a/src/core/vectortile/qgsvectortilelayerrenderer.cpp
+++ b/src/core/vectortile/qgsvectortilelayerrenderer.cpp
@@ -224,6 +224,15 @@ bool QgsVectorTileLayerRenderer::render()
mErrors.append( asyncLoader->error() );
}
+ // Register labels features when all tiles are fetched to ensure consistent labeling
+ if ( mLabelProvider )
+ {
+ for ( const auto &tile : mTileDataMap )
+ {
+ mLabelProvider->registerTileFeatures( tile, ctx );
+ }
+ }
+
if ( ctx.flags() & Qgis::RenderContextFlag::DrawSelection )
mRenderer->renderSelectedFeatures( mSelectedFeatures, ctx );
@@ -309,8 +318,9 @@ void QgsVectorTileLayerRenderer::decodeAndDrawTile( const QgsVectorTileRawData &
mTotalDrawTime += tDraw.elapsed();
}
+ // Store tile for later use
if ( mLabelProvider )
- mLabelProvider->registerTileFeatures( tile, ctx );
+ mTileDataMap.insert( tile.id().toString(), tile );
if ( mDrawTileBoundaries )
{
diff --git a/src/core/vectortile/qgsvectortilelayerrenderer.h b/src/core/vectortile/qgsvectortilelayerrenderer.h
index 127f55d860a76..e024d636b418f 100644
--- a/src/core/vectortile/qgsvectortilelayerrenderer.h
+++ b/src/core/vectortile/qgsvectortilelayerrenderer.h
@@ -71,6 +71,9 @@ class QgsVectorTileLayerRenderer : public QgsMapLayerRenderer
*/
QgsVectorTileLabelProvider *mLabelProvider = nullptr;
+ // Decoded tile data
+ QMap mTileDataMap;
+
//! Whether to draw boundaries of tiles (useful for debugging)
bool mDrawTileBoundaries = false;
diff --git a/src/gui/annotations/qgsannotationitemwidget_impl.cpp b/src/gui/annotations/qgsannotationitemwidget_impl.cpp
index e05dd7f90657d..0c73c750f309b 100644
--- a/src/gui/annotations/qgsannotationitemwidget_impl.cpp
+++ b/src/gui/annotations/qgsannotationitemwidget_impl.cpp
@@ -314,14 +314,9 @@ QgsAnnotationPointTextItemWidget::QgsAnnotationPointTextItemWidget( QWidget *par
{
setupUi( this );
- mTextFormatWidget = new QgsTextFormatWidget();
- QVBoxLayout *vLayout = new QVBoxLayout();
- vLayout->setContentsMargins( 0, 0, 0, 0 );
- vLayout->addWidget( mTextFormatWidget );
- mTextFormatWidgetContainer->setLayout( vLayout );
-
mTextEdit->setMode( QgsRichTextEditor::Mode::QgsTextRenderer );
- mTextEdit->setMaximumHeight( mTextEdit->fontMetrics().height() * 10 );
+
+ mTextFormatButton->setMode( QgsFontButton::ModeTextRenderer );
mSpinTextAngle->setClearValue( 0 );
@@ -330,10 +325,9 @@ QgsAnnotationPointTextItemWidget::QgsAnnotationPointTextItemWidget( QWidget *par
mAlignmentComboBox->setAvailableAlignments( Qt::AlignLeft | Qt::AlignHCenter | Qt::AlignRight );
- mTextFormatWidget->setDockMode( dockMode() );
- connect( mTextFormatWidget, &QgsTextFormatWidget::widgetChanged, this, [=] {
+ connect( mTextFormatButton, &QgsFontButton::changed, this, [=] {
mTextEdit->setMode(
- mTextFormatWidget->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText
+ mTextFormatButton->textFormat().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText
);
if ( !mBlockChangedSignal )
@@ -377,8 +371,8 @@ void QgsAnnotationPointTextItemWidget::updateItem( QgsAnnotationItem *item )
if ( QgsAnnotationPointTextItem *pointTextItem = dynamic_cast( item ) )
{
mBlockChangedSignal = true;
- pointTextItem->setFormat( mTextFormatWidget->format() );
- pointTextItem->setText( mTextFormatWidget->format().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() );
+ pointTextItem->setFormat( mTextFormatButton->textFormat() );
+ pointTextItem->setText( mTextFormatButton->textFormat().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() );
pointTextItem->setAngle( mSpinTextAngle->value() );
pointTextItem->setRotationMode( mRotationModeCombo->currentData().value() );
pointTextItem->setAlignment( mAlignmentComboBox->currentAlignment() );
@@ -387,18 +381,14 @@ void QgsAnnotationPointTextItemWidget::updateItem( QgsAnnotationItem *item )
}
}
-void QgsAnnotationPointTextItemWidget::setDockMode( bool dockMode )
-{
- QgsAnnotationItemBaseWidget::setDockMode( dockMode );
- if ( mTextFormatWidget )
- mTextFormatWidget->setDockMode( dockMode );
-}
-
void QgsAnnotationPointTextItemWidget::setContext( const QgsSymbolWidgetContext &context )
{
QgsAnnotationItemBaseWidget::setContext( context );
- if ( mTextFormatWidget )
- mTextFormatWidget->setContext( context );
+ if ( mTextFormatButton )
+ {
+ mTextFormatButton->setMapCanvas( context.mapCanvas() );
+ mTextFormatButton->setMessageBar( context.messageBar() );
+ }
mPropertiesWidget->setContext( context );
}
@@ -419,7 +409,7 @@ bool QgsAnnotationPointTextItemWidget::setNewItem( QgsAnnotationItem *item )
mItem.reset( textItem->clone() );
mBlockChangedSignal = true;
- mTextFormatWidget->setFormat( mItem->format() );
+ mTextFormatButton->setTextFormat( mItem->format() );
mTextEdit->setMode( mItem->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText );
mTextEdit->setText( mItem->text() );
mSpinTextAngle->setValue( mItem->angle() );
@@ -464,19 +454,13 @@ QgsAnnotationLineTextItemWidget::QgsAnnotationLineTextItemWidget( QWidget *paren
{
setupUi( this );
- mTextFormatWidget = new QgsTextFormatWidget();
- QVBoxLayout *vLayout = new QVBoxLayout();
- vLayout->setContentsMargins( 0, 0, 0, 0 );
- vLayout->addWidget( mTextFormatWidget );
- mTextFormatWidgetContainer->setLayout( vLayout );
+ mTextFormatButton->setMode( QgsFontButton::ModeTextRenderer );
mTextEdit->setMode( QgsRichTextEditor::Mode::QgsTextRenderer );
- mTextEdit->setMaximumHeight( mTextEdit->fontMetrics().height() * 10 );
- mTextFormatWidget->setDockMode( dockMode() );
- connect( mTextFormatWidget, &QgsTextFormatWidget::widgetChanged, this, [=] {
+ connect( mTextFormatButton, &QgsFontButton::changed, this, [=] {
mTextEdit->setMode(
- mTextFormatWidget->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText
+ mTextFormatButton->textFormat().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText
);
if ( !mBlockChangedSignal )
@@ -519,8 +503,8 @@ void QgsAnnotationLineTextItemWidget::updateItem( QgsAnnotationItem *item )
if ( QgsAnnotationLineTextItem *lineTextItem = dynamic_cast( item ) )
{
mBlockChangedSignal = true;
- lineTextItem->setFormat( mTextFormatWidget->format() );
- lineTextItem->setText( mTextFormatWidget->format().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() );
+ lineTextItem->setFormat( mTextFormatButton->textFormat() );
+ lineTextItem->setText( mTextFormatButton->textFormat().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() );
lineTextItem->setOffsetFromLine( mSpinOffset->value() );
lineTextItem->setOffsetFromLineUnit( mOffsetUnitWidget->unit() );
@@ -531,18 +515,14 @@ void QgsAnnotationLineTextItemWidget::updateItem( QgsAnnotationItem *item )
}
}
-void QgsAnnotationLineTextItemWidget::setDockMode( bool dockMode )
-{
- QgsAnnotationItemBaseWidget::setDockMode( dockMode );
- if ( mTextFormatWidget )
- mTextFormatWidget->setDockMode( dockMode );
-}
-
void QgsAnnotationLineTextItemWidget::setContext( const QgsSymbolWidgetContext &context )
{
QgsAnnotationItemBaseWidget::setContext( context );
- if ( mTextFormatWidget )
- mTextFormatWidget->setContext( context );
+ if ( mTextFormatButton )
+ {
+ mTextFormatButton->setMapCanvas( context.mapCanvas() );
+ mTextFormatButton->setMessageBar( context.messageBar() );
+ }
mPropertiesWidget->setContext( context );
}
@@ -561,7 +541,7 @@ bool QgsAnnotationLineTextItemWidget::setNewItem( QgsAnnotationItem *item )
mItem.reset( textItem->clone() );
mBlockChangedSignal = true;
- mTextFormatWidget->setFormat( mItem->format() );
+ mTextFormatButton->setTextFormat( mItem->format() );
mTextEdit->setMode( mItem->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText );
mTextEdit->setText( mItem->text() );
mPropertiesWidget->setItem( mItem.get() );
@@ -614,7 +594,6 @@ QgsAnnotationRectangleTextItemWidget::QgsAnnotationRectangleTextItemWidget( QWid
mSizeUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << Qgis::RenderUnit::Pixels << Qgis::RenderUnit::Millimeters << Qgis::RenderUnit::Points << Qgis::RenderUnit::Inches << Qgis::RenderUnit::Percentage );
-
mBackgroundSymbolButton->setSymbolType( Qgis::SymbolType::Fill );
mBackgroundSymbolButton->setDialogTitle( tr( "Background" ) );
mBackgroundSymbolButton->registerExpressionContextGenerator( this );
@@ -628,22 +607,16 @@ QgsAnnotationRectangleTextItemWidget::QgsAnnotationRectangleTextItemWidget( QWid
mSpinLeftMargin->setClearValue( 0 );
mMarginUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << Qgis::RenderUnit::Millimeters << Qgis::RenderUnit::MetersInMapUnits << Qgis::RenderUnit::MapUnits << Qgis::RenderUnit::Pixels << Qgis::RenderUnit::Points << Qgis::RenderUnit::Inches );
- mTextFormatWidget = new QgsTextFormatWidget();
- QVBoxLayout *vLayout = new QVBoxLayout();
- vLayout->setContentsMargins( 0, 0, 0, 0 );
- vLayout->addWidget( mTextFormatWidget );
- mTextFormatWidgetContainer->setLayout( vLayout );
+ mTextFormatButton->setMode( QgsFontButton::ModeTextRenderer );
mTextEdit->setMode( QgsRichTextEditor::Mode::QgsTextRenderer );
- mTextEdit->setMaximumHeight( mTextEdit->fontMetrics().height() * 10 );
mAlignmentComboBox->setAvailableAlignments( Qt::AlignLeft | Qt::AlignHCenter | Qt::AlignRight | Qt::AlignJustify );
mVerticalAlignmentComboBox->setAvailableAlignments( Qt::AlignTop | Qt::AlignVCenter | Qt::AlignBottom );
- mTextFormatWidget->setDockMode( dockMode() );
- connect( mTextFormatWidget, &QgsTextFormatWidget::widgetChanged, this, [this] {
+ connect( mTextFormatButton, &QgsFontButton::changed, this, [this] {
mTextEdit->setMode(
- mTextFormatWidget->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText
+ mTextFormatButton->textFormat().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText
);
onWidgetChanged();
@@ -685,8 +658,8 @@ void QgsAnnotationRectangleTextItemWidget::updateItem( QgsAnnotationItem *item )
if ( QgsAnnotationRectangleTextItem *rectTextItem = dynamic_cast( item ) )
{
mBlockChangedSignal = true;
- rectTextItem->setFormat( mTextFormatWidget->format() );
- rectTextItem->setText( mTextFormatWidget->format().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() );
+ rectTextItem->setFormat( mTextFormatButton->textFormat() );
+ rectTextItem->setText( mTextFormatButton->textFormat().allowHtmlFormatting() ? mTextEdit->toHtml() : mTextEdit->toPlainText() );
rectTextItem->setAlignment( mAlignmentComboBox->currentAlignment() | mVerticalAlignmentComboBox->currentAlignment() );
rectTextItem->setPlacementMode( mSizeModeCombo->currentData().value() );
@@ -714,18 +687,14 @@ void QgsAnnotationRectangleTextItemWidget::updateItem( QgsAnnotationItem *item )
}
}
-void QgsAnnotationRectangleTextItemWidget::setDockMode( bool dockMode )
-{
- QgsAnnotationItemBaseWidget::setDockMode( dockMode );
- if ( mTextFormatWidget )
- mTextFormatWidget->setDockMode( dockMode );
-}
-
void QgsAnnotationRectangleTextItemWidget::setContext( const QgsSymbolWidgetContext &context )
{
QgsAnnotationItemBaseWidget::setContext( context );
- if ( mTextFormatWidget )
- mTextFormatWidget->setContext( context );
+ if ( mTextFormatButton )
+ {
+ mTextFormatButton->setMapCanvas( context.mapCanvas() );
+ mTextFormatButton->setMessageBar( context.messageBar() );
+ }
mBackgroundSymbolButton->setMapCanvas( context.mapCanvas() );
mBackgroundSymbolButton->setMessageBar( context.messageBar() );
mFrameSymbolButton->setMapCanvas( context.mapCanvas() );
@@ -760,7 +729,7 @@ bool QgsAnnotationRectangleTextItemWidget::setNewItem( QgsAnnotationItem *item )
mItem.reset( textItem->clone() );
mBlockChangedSignal = true;
- mTextFormatWidget->setFormat( mItem->format() );
+ mTextFormatButton->setTextFormat( mItem->format() );
mTextEdit->setMode( mItem->format().allowHtmlFormatting() ? QgsRichTextEditor::Mode::QgsTextRenderer : QgsRichTextEditor::Mode::PlainText );
mTextEdit->setText( mItem->text() );
mAlignmentComboBox->setCurrentAlignment( mItem->alignment() & Qt::AlignHorizontal_Mask );
@@ -783,6 +752,7 @@ bool QgsAnnotationRectangleTextItemWidget::setNewItem( QgsAnnotationItem *item )
mWidthSpinBox->setValue( textItem->fixedSize().width() );
mHeightSpinBox->setValue( textItem->fixedSize().height() );
+ mSizeUnitWidget->setUnit( textItem->fixedSizeUnit() );
mSizeModeCombo->setCurrentIndex( mSizeModeCombo->findData( QVariant::fromValue( textItem->placementMode() ) ) );
mBlockChangedSignal = false;
diff --git a/src/gui/annotations/qgsannotationitemwidget_impl.h b/src/gui/annotations/qgsannotationitemwidget_impl.h
index 4fa3a6bdfe6b8..175602f731059 100644
--- a/src/gui/annotations/qgsannotationitemwidget_impl.h
+++ b/src/gui/annotations/qgsannotationitemwidget_impl.h
@@ -121,7 +121,6 @@ class QgsAnnotationPointTextItemWidget : public QgsAnnotationItemBaseWidget, pri
~QgsAnnotationPointTextItemWidget() override;
QgsAnnotationItem *createItem() override;
void updateItem( QgsAnnotationItem *item ) override;
- void setDockMode( bool dockMode ) override;
void setContext( const QgsSymbolWidgetContext &context ) override;
public slots:
@@ -134,7 +133,6 @@ class QgsAnnotationPointTextItemWidget : public QgsAnnotationItemBaseWidget, pri
private:
void mInsertExpressionButton_clicked();
- QgsTextFormatWidget *mTextFormatWidget = nullptr;
bool mBlockChangedSignal = false;
std::unique_ptr mItem;
};
@@ -149,7 +147,6 @@ class QgsAnnotationRectangleTextItemWidget : public QgsAnnotationItemBaseWidget,
~QgsAnnotationRectangleTextItemWidget() override;
QgsAnnotationItem *createItem() override;
void updateItem( QgsAnnotationItem *item ) override;
- void setDockMode( bool dockMode ) override;
void setContext( const QgsSymbolWidgetContext &context ) override;
QgsExpressionContext createExpressionContext() const override;
@@ -170,7 +167,6 @@ class QgsAnnotationRectangleTextItemWidget : public QgsAnnotationItemBaseWidget,
private:
void mInsertExpressionButton_clicked();
- QgsTextFormatWidget *mTextFormatWidget = nullptr;
bool mBlockChangedSignal = false;
bool mUpdateItemPosition = false;
@@ -186,7 +182,6 @@ class QgsAnnotationLineTextItemWidget : public QgsAnnotationItemBaseWidget, priv
~QgsAnnotationLineTextItemWidget() override;
QgsAnnotationItem *createItem() override;
void updateItem( QgsAnnotationItem *item ) override;
- void setDockMode( bool dockMode ) override;
void setContext( const QgsSymbolWidgetContext &context ) override;
public slots:
@@ -199,7 +194,6 @@ class QgsAnnotationLineTextItemWidget : public QgsAnnotationItemBaseWidget, priv
private:
void mInsertExpressionButton_clicked();
- QgsTextFormatWidget *mTextFormatWidget = nullptr;
bool mBlockChangedSignal = false;
std::unique_ptr mItem;
};
diff --git a/src/gui/auth/qgsauthsettingswidget.cpp b/src/gui/auth/qgsauthsettingswidget.cpp
index c49f11cd2c310..02bfe356e6cde 100644
--- a/src/gui/auth/qgsauthsettingswidget.cpp
+++ b/src/gui/auth/qgsauthsettingswidget.cpp
@@ -50,6 +50,12 @@ QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent, const QString &co
updateConvertBtnState();
}
+void QgsAuthSettingsWidget::removeBasicSettings()
+{
+ tabAuth->removeTab( tabAuth->indexOf( tabBasic ) );
+ tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
+}
+
void QgsAuthSettingsWidget::setWarningText( const QString &warningText )
{
lblWarning->setText( warningText );
diff --git a/src/gui/auth/qgsauthsettingswidget.h b/src/gui/auth/qgsauthsettingswidget.h
index e3a422b3fc157..eadfdeccba9e0 100644
--- a/src/gui/auth/qgsauthsettingswidget.h
+++ b/src/gui/auth/qgsauthsettingswidget.h
@@ -62,6 +62,13 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
*/
explicit QgsAuthSettingsWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &configId = QString(), const QString &username = QString(), const QString &password = QString(), const QString &dataprovider = QString() );
+ /**
+ * Removes the basic authentication tab from the widget.
+ *
+ * \since QGIS 3.42
+ */
+ void removeBasicSettings();
+
/**
* \brief setWarningText set the text of the warning label
* \param warningText the text of the warning label
diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp
index 62128b6dd7be6..7a1df16d54506 100644
--- a/src/gui/codeeditors/qgscodeeditor.cpp
+++ b/src/gui/codeeditors/qgscodeeditor.cpp
@@ -318,7 +318,7 @@ void QgsCodeEditor::contextMenuEvent( QContextMenuEvent *event )
{
QAction *toggleCommentAction = new QAction( tr( "Toggle Comment" ), menu );
toggleCommentAction->setShortcut( QStringLiteral( "Ctrl+:" ) );
- toggleCommentAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconCommentEditorConsole.svg" ) ) );
+ toggleCommentAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconCommentEditorConsole.svg" ), palette().color( QPalette::ColorRole::WindowText ) ) );
toggleCommentAction->setEnabled( !isReadOnly() );
connect( toggleCommentAction, &QAction::triggered, this, &QgsCodeEditor::toggleComment );
menu->addAction( toggleCommentAction );
diff --git a/src/gui/layertree/qgslayertreemapcanvasbridge.cpp b/src/gui/layertree/qgslayertreemapcanvasbridge.cpp
index 4daf5814f43a7..2608c7e45e053 100644
--- a/src/gui/layertree/qgslayertreemapcanvasbridge.cpp
+++ b/src/gui/layertree/qgslayertreemapcanvasbridge.cpp
@@ -203,6 +203,7 @@ void QgsLayerTreeMapCanvasBridge::layersAdded( const QList &layer
// if we are moving from zero valid layers to non-zero VALID layers, let's zoom to those data
mCanvas->zoomToProjectExtent();
}
+ deferredSetCanvasLayers();
} );
}
}
diff --git a/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp b/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp
index f37b255cf0e2f..ab51eb3f6553c 100644
--- a/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp
+++ b/src/gui/processing/qgsprocessingmultipleselectiondialog.cpp
@@ -19,6 +19,7 @@
#include "qgssettings.h"
#include "qgsfileutils.h"
#include "qgsvectorlayer.h"
+#include "qgsmaplayerfactory.h"
#include "qgsmeshlayer.h"
#include "qgsrasterlayer.h"
#include "qgspluginlayer.h"
@@ -460,7 +461,7 @@ QStringList QgsProcessingMultipleInputPanelWidget::compatibleUrisFromMimeData( c
|| parameter->layerType() == Qgis::ProcessingSourceType::VectorLine
|| parameter->layerType() == Qgis::ProcessingSourceType::VectorPoint
|| parameter->layerType() == Qgis::ProcessingSourceType::VectorPolygon )
- && u.layerType == QLatin1String( "vector" ) )
+ && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::Vector ) )
{
bool acceptable = false;
switch ( QgsWkbTypes::geometryType( u.wkbType ) )
@@ -493,16 +494,16 @@ QStringList QgsProcessingMultipleInputPanelWidget::compatibleUrisFromMimeData( c
res.append( u.providerKey != QLatin1String( "ogr" ) ? QgsProcessingUtils::encodeProviderKeyAndUri( u.providerKey, u.uri ) : u.uri );
}
else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::Raster )
- && u.layerType == QLatin1String( "raster" ) && u.providerKey == QLatin1String( "gdal" ) )
+ && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::Raster ) && u.providerKey == QLatin1String( "gdal" ) )
res.append( u.uri );
else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::Mesh )
- && u.layerType == QLatin1String( "mesh" ) && u.providerKey == QLatin1String( "mdal" ) )
+ && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::Mesh ) && u.providerKey == QLatin1String( "mdal" ) )
res.append( u.uri );
else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::PointCloud )
- && u.layerType == QLatin1String( "pointcloud" ) )
+ && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::PointCloud ) )
res.append( u.uri );
else if ( ( parameter->layerType() == Qgis::ProcessingSourceType::MapLayer || parameter->layerType() == Qgis::ProcessingSourceType::VectorTile )
- && u.layerType == QLatin1String( "vector-tile" ) )
+ && u.layerType == QgsMapLayerFactory::typeToString( Qgis::LayerType::VectorTile ) )
res.append( u.uri );
// NOLINTEND(bugprone-branch-clone)
}
diff --git a/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp b/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp
index e16b5409e2c97..c15dcf2d3a859 100644
--- a/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp
+++ b/src/gui/providers/sensorthings/qgssensorthingsconnectionwidget.cpp
@@ -29,6 +29,9 @@ QgsSensorThingsConnectionWidget::QgsSensorThingsConnectionWidget( QWidget *paren
connect( mEditUrl, &QLineEdit::textChanged, this, &QgsSensorThingsConnectionWidget::validate );
connect( mEditUrl, &QLineEdit::textChanged, this, &QgsSensorThingsConnectionWidget::changed );
+ // only auth config supported, not basic auth
+ mAuthSettings->removeBasicSettings();
+
connect( mAuthSettings, &QgsAuthSettingsWidget::configIdChanged, this, &QgsSensorThingsConnectionWidget::changed );
connect( mAuthSettings, &QgsAuthSettingsWidget::usernameChanged, this, &QgsSensorThingsConnectionWidget::changed );
connect( mAuthSettings, &QgsAuthSettingsWidget::passwordChanged, this, &QgsSensorThingsConnectionWidget::changed );
diff --git a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp
index 0438dde67ebfb..0df2da7c05604 100644
--- a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp
+++ b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.cpp
@@ -71,7 +71,11 @@ QgsSensorThingsSourceWidget::QgsSensorThingsSourceWidget( QWidget *parent )
connect( mExpansionsTable, &QTableView::clicked, this, [this]( const QModelIndex &index ) {
if ( index.column() == QgsSensorThingsExpansionsModel::Column::Actions )
{
- mExpansionsModel->removeRows( index.row(), 1 );
+ // only the bottom expansion (or empty rows) can be removed - otherwise we end up with inconsistent expansions!
+ if ( mExpansionsModel->canRemoveRow( index.row() ) )
+ {
+ mExpansionsModel->removeRows( index.row(), 1 );
+ }
}
} );
@@ -722,6 +726,25 @@ bool QgsSensorThingsExpansionsModel::insertRows( int position, int rows, const Q
return true;
}
+bool QgsSensorThingsExpansionsModel::canRemoveRow( int row ) const
+{
+ if ( row >= mExpansions.size() )
+ return true;
+
+ for ( int i = mExpansions.size() - 1; i >= 0; --i )
+ {
+ if ( row == i && mExpansions.at( i ).isValid() )
+ return true;
+
+ // when we hit the first valid expansion from the end of the list, then
+ // any earlier rows CANNOT be removed
+ if ( mExpansions.at( i ).isValid() )
+ return false;
+ }
+
+ return false;
+}
+
bool QgsSensorThingsExpansionsModel::removeRows( int position, int rows, const QModelIndex &parent )
{
Q_UNUSED( parent )
@@ -774,6 +797,7 @@ QWidget *QgsSensorThingsExpansionsDelegate::createEditor( QWidget *parent, const
: index.model()->data( index.model()->index( index.row() - 1, 0 ), Qt::EditRole ).value();
QList compatibleEntities = QgsSensorThingsUtils::expandableTargets( entityType );
+ compatibleEntities.removeAll( mBaseEntityType );
// remove all entities which are already part of the expansion in previous rows -- we don't support "circular" expansion
for ( int row = index.row() - 1; row >= 0; row-- )
{
@@ -956,19 +980,25 @@ void QgsSensorThingsRemoveExpansionDelegate::paint( QPainter *painter, const QSt
{
QStyledItemDelegate::paint( painter, option, index );
- if ( index == mHoveredIndex )
+ if ( const QgsSensorThingsExpansionsModel *model = qobject_cast< const QgsSensorThingsExpansionsModel * >( index.model() ) )
{
- QStyleOptionButton buttonOption;
- buttonOption.initFrom( option.widget );
- buttonOption.rect = option.rect;
+ if ( model->canRemoveRow( index.row() ) )
+ {
+ if ( index == mHoveredIndex )
+ {
+ QStyleOptionButton buttonOption;
+ buttonOption.initFrom( option.widget );
+ buttonOption.rect = option.rect;
- option.widget->style()->drawControl( QStyle::CE_PushButton, &buttonOption, painter );
- }
+ option.widget->style()->drawControl( QStyle::CE_PushButton, &buttonOption, painter );
+ }
- const QIcon icon = QgsApplication::getThemeIcon( "/mIconClearItem.svg" );
- const QRect iconRect( option.rect.left() + ( option.rect.width() - 16 ) / 2, option.rect.top() + ( option.rect.height() - 16 ) / 2, 16, 16 );
+ const QIcon icon = QgsApplication::getThemeIcon( "/mIconClearItem.svg" );
+ const QRect iconRect( option.rect.left() + ( option.rect.width() - 16 ) / 2, option.rect.top() + ( option.rect.height() - 16 ) / 2, 16, 16 );
- icon.paint( painter, iconRect );
+ icon.paint( painter, iconRect );
+ }
+ }
}
void QgsSensorThingsRemoveExpansionDelegate::setHoveredIndex( const QModelIndex &index )
diff --git a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h
index 9ff8febac80fb..9386b2a4e1184 100644
--- a/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h
+++ b/src/gui/providers/sensorthings/qgssensorthingssourcewidget.h
@@ -59,6 +59,7 @@ class QgsSensorThingsExpansionsModel : public QAbstractItemModel
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
bool setData( const QModelIndex &index, const QVariant &value, int role ) override;
bool insertRows( int position, int rows, const QModelIndex &parent = QModelIndex() ) override;
+ bool canRemoveRow( int row ) const;
bool removeRows( int position, int rows, const QModelIndex &parent = QModelIndex() ) override;
void setExpansions( const QList &expansions );
diff --git a/src/gui/qgsmanageconnectionsdialog.cpp b/src/gui/qgsmanageconnectionsdialog.cpp
index dd0460ae00014..59bed6444fd7e 100644
--- a/src/gui/qgsmanageconnectionsdialog.cpp
+++ b/src/gui/qgsmanageconnectionsdialog.cpp
@@ -461,6 +461,14 @@ bool QgsManageConnectionsDialog::populateConnections()
return true;
}
+static void addNamespaceDeclarations( QDomElement &root, const QMap &namespaceDeclarations )
+{
+ for ( auto it = namespaceDeclarations.begin(); it != namespaceDeclarations.end(); ++it )
+ {
+ root.setAttribute( QStringLiteral( "xmlns:" ) + it.key(), it.value() );
+ }
+}
+
QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &connections, const QString &service )
{
QDomDocument doc( QStringLiteral( "connections" ) );
@@ -468,6 +476,7 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
doc.appendChild( root );
+ QMap namespaceDeclarations;
for ( int i = 0; i < connections.count(); ++i )
{
QDomElement el = doc.createElement( service.toLower() );
@@ -484,7 +493,7 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &
el.setAttribute( QStringLiteral( "dpiMode" ), static_cast( QgsOwsConnection::settingsDpiMode->value( { service.toLower(), connections[i] } ) ) );
QgsHttpHeaders httpHeader( QgsOwsConnection::settingsHeaders->value( { service.toLower(), connections[i] } ) );
- httpHeader.updateDomElement( el );
+ httpHeader.updateDomElement( el, namespaceDeclarations );
}
el.setAttribute( QStringLiteral( "username" ), QgsOwsConnection::settingsUsername->value( { service.toLower(), connections[i] } ) );
@@ -492,6 +501,8 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &
root.appendChild( el );
}
+ addNamespaceDeclarations( root, namespaceDeclarations );
+
return doc;
}
@@ -710,6 +721,7 @@ QDomDocument QgsManageConnectionsDialog::saveXyzTilesConnections( const QStringL
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
doc.appendChild( root );
+ QMap namespaceDeclarations;
for ( int i = 0; i < connections.count(); ++i )
{
QDomElement el = doc.createElement( QStringLiteral( "xyztiles" ) );
@@ -724,11 +736,13 @@ QDomDocument QgsManageConnectionsDialog::saveXyzTilesConnections( const QStringL
el.setAttribute( QStringLiteral( "tilePixelRatio" ), QgsXyzConnectionSettings::settingsTilePixelRatio->value( connections[i] ) );
QgsHttpHeaders httpHeader( QgsXyzConnectionSettings::settingsHeaders->value( connections[i] ) );
- httpHeader.updateDomElement( el );
+ httpHeader.updateDomElement( el, namespaceDeclarations );
root.appendChild( el );
}
+ addNamespaceDeclarations( root, namespaceDeclarations );
+
return doc;
}
@@ -739,6 +753,7 @@ QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( const QStringLis
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
doc.appendChild( root );
+ QMap namespaceDeclarations;
for ( const QString &connection : connections )
{
QDomElement el = doc.createElement( QStringLiteral( "arcgisfeatureserver" ) );
@@ -746,7 +761,7 @@ QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( const QStringLis
el.setAttribute( QStringLiteral( "url" ), QgsArcGisConnectionSettings::settingsUrl->value( connection ) );
QgsHttpHeaders httpHeader( QgsArcGisConnectionSettings::settingsHeaders->value( connection ) );
- httpHeader.updateDomElement( el );
+ httpHeader.updateDomElement( el, namespaceDeclarations );
el.setAttribute( QStringLiteral( "username" ), QgsArcGisConnectionSettings::settingsUsername->value( connection ) );
el.setAttribute( QStringLiteral( "password" ), QgsArcGisConnectionSettings::settingsPassword->value( connection ) );
@@ -755,6 +770,8 @@ QDomDocument QgsManageConnectionsDialog::saveArcgisConnections( const QStringLis
root.appendChild( el );
}
+ addNamespaceDeclarations( root, namespaceDeclarations );
+
return doc;
}
@@ -765,6 +782,7 @@ QDomDocument QgsManageConnectionsDialog::saveVectorTileConnections( const QStrin
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
doc.appendChild( root );
+ QMap namespaceDeclarations;
for ( int i = 0; i < connections.count(); ++i )
{
QDomElement el = doc.createElement( QStringLiteral( "vectortile" ) );
@@ -780,11 +798,13 @@ QDomDocument QgsManageConnectionsDialog::saveVectorTileConnections( const QStrin
el.setAttribute( QStringLiteral( "styleUrl" ), QgsVectorTileProviderConnection::settingsStyleUrl->value( connections[i] ) );
QgsHttpHeaders httpHeader( QgsVectorTileProviderConnection::settingsHeaders->value( connections[i] ) );
- httpHeader.updateDomElement( el );
+ httpHeader.updateDomElement( el, namespaceDeclarations );
root.appendChild( el );
}
+ addNamespaceDeclarations( root, namespaceDeclarations );
+
return doc;
}
@@ -795,6 +815,7 @@ QDomDocument QgsManageConnectionsDialog::saveTiledSceneConnections( const QStrin
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
doc.appendChild( root );
+ QMap namespaceDeclarations;
for ( int i = 0; i < connections.count(); ++i )
{
QDomElement el = doc.createElement( QStringLiteral( "tiledscene" ) );
@@ -807,11 +828,13 @@ QDomDocument QgsManageConnectionsDialog::saveTiledSceneConnections( const QStrin
el.setAttribute( QStringLiteral( "password" ), QgsTiledSceneProviderConnection::settingsPassword->value( connections[i] ) );
QgsHttpHeaders httpHeader( QgsTiledSceneProviderConnection::settingsHeaders->value( connections[i] ) );
- httpHeader.updateDomElement( el );
+ httpHeader.updateDomElement( el, namespaceDeclarations );
root.appendChild( el );
}
+ addNamespaceDeclarations( root, namespaceDeclarations );
+
return doc;
}
@@ -822,6 +845,7 @@ QDomDocument QgsManageConnectionsDialog::saveSensorThingsConnections( const QStr
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
doc.appendChild( root );
+ QMap namespaceDeclarations;
for ( int i = 0; i < connections.count(); ++i )
{
QDomElement el = doc.createElement( QStringLiteral( "sensorthings" ) );
@@ -833,11 +857,13 @@ QDomDocument QgsManageConnectionsDialog::saveSensorThingsConnections( const QStr
el.setAttribute( QStringLiteral( "password" ), QgsSensorThingsProviderConnection::settingsPassword->value( connections[i] ) );
QgsHttpHeaders httpHeader( QgsTiledSceneProviderConnection::settingsHeaders->value( connections[i] ) );
- httpHeader.updateDomElement( el );
+ httpHeader.updateDomElement( el, namespaceDeclarations );
root.appendChild( el );
}
+ addNamespaceDeclarations( root, namespaceDeclarations );
+
return doc;
}
@@ -882,6 +908,7 @@ QDomDocument QgsManageConnectionsDialog::saveStacConnections( const QStringList
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
doc.appendChild( root );
+ QMap namespaceDeclarations;
for ( int i = 0; i < connections.count(); ++i )
{
QDomElement el = doc.createElement( QStringLiteral( "stac" ) );
@@ -893,11 +920,13 @@ QDomDocument QgsManageConnectionsDialog::saveStacConnections( const QStringList
el.setAttribute( QStringLiteral( "password" ), QgsStacConnection::settingsPassword->value( connections[i] ) );
QgsHttpHeaders httpHeader( QgsStacConnection::settingsHeaders->value( connections[i] ) );
- httpHeader.updateDomElement( el );
+ httpHeader.updateDomElement( el, namespaceDeclarations );
root.appendChild( el );
}
+ addNamespaceDeclarations( root, namespaceDeclarations );
+
return doc;
}
diff --git a/src/gui/qgsrichtexteditor.cpp b/src/gui/qgsrichtexteditor.cpp
index fb7aed3d0f2b3..6bb022e976765 100644
--- a/src/gui/qgsrichtexteditor.cpp
+++ b/src/gui/qgsrichtexteditor.cpp
@@ -752,16 +752,21 @@ void QgsRichTextEditor::setText( const QString &text )
{
if ( text.isEmpty() )
{
- setPlainText( text );
+ mTextEdit->setPlainText( text );
+ mSourceEdit->clear();
return;
}
- if ( text[0] == '<' )
+
+ const thread_local QRegularExpression sIsHtmlRx( QStringLiteral( "^\\s*<" ) );
+ if ( sIsHtmlRx.match( text ).hasMatch() )
{
- setHtml( text );
+ mTextEdit->setHtml( text );
+ mSourceEdit->setText( text );
}
else
{
- setPlainText( text );
+ mTextEdit->setPlainText( text );
+ mSourceEdit->setText( text );
}
}
diff --git a/src/gui/qgsrichtexteditor.h b/src/gui/qgsrichtexteditor.h
index c83551ddeda16..37968593d7378 100644
--- a/src/gui/qgsrichtexteditor.h
+++ b/src/gui/qgsrichtexteditor.h
@@ -162,8 +162,6 @@ class GUI_EXPORT QgsRichTextEditor : public QWidget, protected Ui::QgsRichTextEd
void focusInEvent( QFocusEvent *event ) override;
private slots:
- void setPlainText( const QString &text ) { mTextEdit->setPlainText( text ); }
- void setHtml( const QString &text ) { mTextEdit->setHtml( text ); }
void textRemoveFormat();
void textRemoveAllFormat();
void textBold();
diff --git a/src/gui/raster/qgsrasterlayerproperties.cpp b/src/gui/raster/qgsrasterlayerproperties.cpp
index a8db645d107b5..0c7496dcae783 100644
--- a/src/gui/raster/qgsrasterlayerproperties.cpp
+++ b/src/gui/raster/qgsrasterlayerproperties.cpp
@@ -816,6 +816,9 @@ void QgsRasterLayerProperties::sync()
mInvertColorsCheck->setChecked( hueSaturationFilter->invertColors() );
}
+ // Resampling
+ mResamplingUtils.refreshWidgetsFromLayer();
+
mRefreshSettingsWidget->syncToLayer();
QgsDebugMsgLevel( QStringLiteral( "populate general tab" ), 3 );
diff --git a/src/gui/symbology/qgspointclusterrendererwidget.cpp b/src/gui/symbology/qgspointclusterrendererwidget.cpp
index eec2d94340b7d..a8ffb60bdc52c 100644
--- a/src/gui/symbology/qgspointclusterrendererwidget.cpp
+++ b/src/gui/symbology/qgspointclusterrendererwidget.cpp
@@ -212,6 +212,7 @@ QgsExpressionContext QgsPointClusterRendererWidget::createExpressionContext() co
{
context << new QgsExpressionContextScope( s );
}
+ context.setHighlightedVariables( QStringList() << QgsExpressionContext::EXPR_CLUSTER_COLOR << QgsExpressionContext::EXPR_CLUSTER_SIZE );
return context;
}
diff --git a/src/gui/vector/qgsvectorlayerproperties.cpp b/src/gui/vector/qgsvectorlayerproperties.cpp
index 7c90256e2898f..87deb70593369 100644
--- a/src/gui/vector/qgsvectorlayerproperties.cpp
+++ b/src/gui/vector/qgsvectorlayerproperties.cpp
@@ -1305,8 +1305,16 @@ void QgsVectorLayerProperties::mJoinTreeWidget_itemDoubleClicked( QTreeWidgetIte
return;
}
+ // if current item is a child item, we should use its parent to be able to edit join
+ QTreeWidgetItem *currentJoinItem = item;
+ if ( item->parent() )
+ {
+ currentJoinItem = item->parent();
+ }
+
+
QList joinedLayers;
- QString joinLayerId = item->data( 0, Qt::UserRole ).toString();
+ QString joinLayerId = currentJoinItem->data( 0, Qt::UserRole ).toString();
const QList &joins = mLayer->vectorJoins();
int j = -1;
for ( int i = 0; i < joins.size(); ++i )
@@ -1478,6 +1486,12 @@ void QgsVectorLayerProperties::openPanel( QgsPanelWidget *panel )
void QgsVectorLayerProperties::mButtonRemoveJoin_clicked()
{
QTreeWidgetItem *currentJoinItem = mJoinTreeWidget->currentItem();
+ // if current item is a child item, we should use its parent to be able to remove join
+ if ( currentJoinItem && currentJoinItem->parent() )
+ {
+ currentJoinItem = currentJoinItem->parent();
+ }
+
if ( !mLayer || !currentJoinItem )
{
return;
diff --git a/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp b/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
index 144ae0edfaf53..ad4254b285c6a 100644
--- a/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
+++ b/src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
@@ -67,7 +67,6 @@ QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget *parent, Qt:
mBooleanFalse->setEnabled( !mBooleanTrue->text().isEmpty() );
updateFieldsAndEnable();
- connect( txtLayerName, &QLineEdit::textChanged, this, &QgsDelimitedTextSourceSelect::enableAccept );
connect( cmbEncoding, static_cast( &QComboBox::currentIndexChanged ), this, &QgsDelimitedTextSourceSelect::updateFieldsAndEnable );
connect( delimiterCSV, &QAbstractButton::toggled, this, &QgsDelimitedTextSourceSelect::updateFieldsAndEnable );
@@ -119,12 +118,6 @@ QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget *parent, Qt:
void QgsDelimitedTextSourceSelect::addButtonClicked()
{
// The following conditions should not be hit! OK will not be enabled...
- if ( txtLayerName->text().isEmpty() )
- {
- QMessageBox::warning( this, tr( "No layer name" ), tr( "Please enter a layer name before adding the layer to the map" ) );
- txtLayerName->setFocus();
- return;
- }
if ( delimiterChars->isChecked() )
{
if ( selectedChars().isEmpty() )
@@ -159,17 +152,17 @@ void QgsDelimitedTextSourceSelect::addButtonClicked()
saveSettings();
saveSettingsForFile( mFileWidget->filePath() );
+ const QString layerName = QFileInfo( mFileWidget->filePath() ).completeBaseName();
// add the layer to the map
Q_NOWARN_DEPRECATED_PUSH
- emit addVectorLayer( datasourceUrl, txtLayerName->text() );
+ emit addVectorLayer( datasourceUrl, layerName );
Q_NOWARN_DEPRECATED_POP
- emit addLayer( Qgis::LayerType::Vector, datasourceUrl, txtLayerName->text(), QStringLiteral( "delimitedtext" ) );
+ emit addLayer( Qgis::LayerType::Vector, datasourceUrl, layerName, QStringLiteral( "delimitedtext" ) );
// clear the file and layer name show something has happened, ready for another file
mFileWidget->setFilePath( QString() );
- txtLayerName->setText( QString() );
if ( widgetMode() == QgsProviderRegistry::WidgetMode::Standalone )
{
@@ -722,7 +715,6 @@ void QgsDelimitedTextSourceSelect::updateFileName()
settings.setValue( mSettingsKey + "/text_path", finfo.path() );
}
- txtLayerName->setText( finfo.completeBaseName() );
loadSettingsForFile( filename );
updateFieldsAndEnable();
}
@@ -748,10 +740,6 @@ bool QgsDelimitedTextSourceSelect::validate()
{
message = tr( "File %1 does not exist" ).arg( mFileWidget->filePath() );
}
- else if ( txtLayerName->text().isEmpty() )
- {
- message = tr( "Please enter a layer name" );
- }
else if ( delimiterChars->isChecked() && selectedChars().isEmpty() )
{
message = tr( "At least one delimiter character must be specified" );
diff --git a/src/providers/postgres/raster/qgspostgresrasterprovider.cpp b/src/providers/postgres/raster/qgspostgresrasterprovider.cpp
index a7db889b95ea2..f4670e4f1233d 100644
--- a/src/providers/postgres/raster/qgspostgresrasterprovider.cpp
+++ b/src/providers/postgres/raster/qgspostgresrasterprovider.cpp
@@ -2491,13 +2491,13 @@ bool QgsPostgresRasterProviderMetadata::styleExists( const QString &uri, const Q
" AND f_geometry_column IS NULL"
" AND (type=%4 OR type IS NULL)"
" AND styleName=%5"
- " AND r_raster_column=%6" )
+ " AND r_raster_column %6" )
.arg( QgsPostgresConn::quotedValue( dsUri.database() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.schema() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.table() ) )
.arg( QgsPostgresConn::quotedValue( mType ) )
.arg( QgsPostgresConn::quotedValue( styleId.isEmpty() ? dsUri.table() : styleId ) )
- .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) );
+ .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) );
QgsPostgresResult res( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), checkQuery ) );
if ( res.PQresultStatus() == PGRES_TUPLES_OK )
@@ -2609,13 +2609,13 @@ bool QgsPostgresRasterProviderMetadata::saveStyle( const QString &uri, const QSt
" AND f_geometry_column IS NULL"
" AND (type=%4 OR type IS NULL)"
" AND styleName=%5"
- " AND r_raster_column=%6" )
+ " AND r_raster_column %6" )
.arg( QgsPostgresConn::quotedValue( dsUri.database() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.schema() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.table() ) )
.arg( QgsPostgresConn::quotedValue( mType ) )
.arg( QgsPostgresConn::quotedValue( styleName.isEmpty() ? dsUri.table() : styleName ) )
- .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) );
+ .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) );
QgsPostgresResult res( conn->LoggedPQexec( "QgsPostgresRasterProviderMetadata", checkQuery ) );
if ( res.PQntuples() > 0 )
@@ -2633,7 +2633,7 @@ bool QgsPostgresRasterProviderMetadata::saveStyle( const QString &uri, const QSt
" AND f_geometry_column IS NULL"
" AND styleName=%9"
" AND (type=%2 OR type IS NULL)"
- " AND r_raster_column=%14" )
+ " AND r_raster_column %14" )
.arg( useAsDefault ? "true" : "false" )
.arg( QgsPostgresConn::quotedValue( mType ) )
.arg( QgsPostgresConn::quotedValue( styleDescription.isEmpty() ? QDateTime::currentDateTime().toString() : styleDescription ) )
@@ -2644,7 +2644,7 @@ bool QgsPostgresRasterProviderMetadata::saveStyle( const QString &uri, const QSt
.arg( QgsPostgresConn::quotedValue( styleName.isEmpty() ? dsUri.table() : styleName ) )
// Must be the final .arg replacement - see above
.arg( QgsPostgresConn::quotedValue( qmlStyle ), QgsPostgresConn::quotedValue( sldStyle ) )
- .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) );
+ .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) );
}
if ( useAsDefault )
@@ -2656,12 +2656,12 @@ bool QgsPostgresRasterProviderMetadata::saveStyle( const QString &uri, const QSt
" AND f_table_name=%3"
" AND f_geometry_column IS NULL"
" AND (type=%4 OR type IS NULL)"
- " AND r_raster_column=%5" )
+ " AND r_raster_column %5" )
.arg( QgsPostgresConn::quotedValue( dsUri.database() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.schema() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.table() ) )
.arg( QgsPostgresConn::quotedValue( mType ) )
- .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) );
+ .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) );
sql = QStringLiteral( "BEGIN; %1; %2; COMMIT;" ).arg( removeDefaultSql, sql );
}
@@ -2720,13 +2720,13 @@ QString QgsPostgresRasterProviderMetadata::loadStoredStyle( const QString &uri,
" AND f_table_schema=%2"
" AND f_table_name=%3"
" AND f_geometry_column IS NULL"
- " AND r_raster_column=%4"
+ " AND r_raster_column %4"
" ORDER BY CASE WHEN useAsDefault THEN 1 ELSE 2 END"
",update_time DESC LIMIT 1" )
.arg( QgsPostgresConn::quotedValue( dsUri.database() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.schema() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.table() ) )
- .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) );
+ .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) );
}
else
{
@@ -2737,14 +2737,14 @@ QString QgsPostgresRasterProviderMetadata::loadStoredStyle( const QString &uri,
" AND f_table_name=%3"
" AND f_geometry_column IS NULL"
" AND (type=%4 OR type IS NULL)"
- " AND r_raster_column=%5"
+ " AND r_raster_column %5"
" ORDER BY CASE WHEN useAsDefault THEN 1 ELSE 2 END"
",update_time DESC LIMIT 1" )
.arg( QgsPostgresConn::quotedValue( dsUri.database() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.schema() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.table() ) )
.arg( QgsPostgresConn::quotedValue( mType ) )
- .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) );
+ .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) );
}
QgsPostgresResult result( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), selectQmlQuery ) );
@@ -2792,13 +2792,13 @@ int QgsPostgresRasterProviderMetadata::listStyles( const QString &uri, QStringLi
" AND f_table_name=%3"
" AND f_geometry_column is NULL"
" AND (type=%4 OR type IS NULL)"
- " AND r_raster_column=%5"
+ " AND r_raster_column %5"
" ORDER BY useasdefault DESC, update_time DESC" )
.arg( QgsPostgresConn::quotedValue( dsUri.database() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.schema() ) )
.arg( QgsPostgresConn::quotedValue( dsUri.table() ) )
.arg( QgsPostgresConn::quotedValue( mType ) )
- .arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) );
+ .arg( dsUri.geometryColumn().isEmpty() ? QStringLiteral( "IS NULL" ) : QStringLiteral( "= %1" ).arg( QgsPostgresConn::quotedValue( dsUri.geometryColumn() ) ) );
QgsPostgresResult result( conn->LoggedPQexec( QStringLiteral( "QgsPostgresRasterProviderMetadata" ), selectRelatedQuery ) );
if ( result.PQresultStatus() != PGRES_TUPLES_OK )
diff --git a/src/providers/wfs/qgswfssourceselect.cpp b/src/providers/wfs/qgswfssourceselect.cpp
index d5b899c4a4e65..06a3706f87a39 100644
--- a/src/providers/wfs/qgswfssourceselect.cpp
+++ b/src/providers/wfs/qgswfssourceselect.cpp
@@ -95,7 +95,6 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
QgsSettings settings;
QgsDebugMsgLevel( QStringLiteral( "restoring settings" ), 3 );
- cbxUseTitleLayerName->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/UseTitleLayerName" ), false ).toBool() );
cbxFeatureCurrentViewExtent->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/FeatureCurrentViewExtent" ), true ).toBool() );
mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/HoldDialogOpen" ), false ).toBool() );
@@ -122,7 +121,6 @@ QgsWFSSourceSelect::~QgsWFSSourceSelect()
QgsSettings settings;
QgsDebugMsgLevel( QStringLiteral( "saving settings" ), 3 );
- settings.setValue( QStringLiteral( "Windows/WFSSourceSelect/UseTitleLayerName" ), cbxUseTitleLayerName->isChecked() );
settings.setValue( QStringLiteral( "Windows/WFSSourceSelect/FeatureCurrentViewExtent" ), cbxFeatureCurrentViewExtent->isChecked() );
settings.setValue( QStringLiteral( "Windows/WFSSourceSelect/HoldDialogOpen" ), mHoldDialogOpen->isChecked() );
@@ -529,14 +527,9 @@ void QgsWFSSourceSelect::addButtonClicked()
continue;
}
int row = idx.row();
- QString typeName = mModel->item( row, MODEL_IDX_NAME )->text(); //WFS repository's name for layer
- QString titleName = mModel->item( row, MODEL_IDX_TITLE )->text(); //WFS type name title for layer name (if option is set)
- QString sql = mModel->item( row, MODEL_IDX_SQL )->text(); //optional SqL specified by user
+ QString typeName = mModel->item( row, MODEL_IDX_NAME )->text(); //WFS repository's name for layer
+ QString sql = mModel->item( row, MODEL_IDX_SQL )->text(); //optional SqL specified by user
QString layerName = typeName;
- if ( cbxUseTitleLayerName->isChecked() && !titleName.isEmpty() )
- {
- layerName = titleName;
- }
QgsDebugMsgLevel( "Layer " + typeName + " SQL is " + sql, 3 );
mUri = QgsWFSDataSourceURI::build( connection.uri().uri( false ), typeName, pCrsString, isOapif() ? QString() : sql, isOapif() ? sql : QString(), cbxFeatureCurrentViewExtent->isChecked() );
diff --git a/src/providers/wms/qgswmssourceselect.cpp b/src/providers/wms/qgswmssourceselect.cpp
index 81bed8c9588fa..ecf12e42a4938 100644
--- a/src/providers/wms/qgswmssourceselect.cpp
+++ b/src/providers/wms/qgswmssourceselect.cpp
@@ -78,9 +78,6 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget *parent, Qt::WindowFlags fl, Qgs
connect( mLayersFilterLineEdit, &QgsFilterLineEdit::textChanged, this, &QgsWMSSourceSelect::filterLayers );
connect( mTilesetsFilterLineEdit, &QgsFilterLineEdit::textChanged, this, &QgsWMSSourceSelect::filterTiles );
- connect( mLoadLayersIndividuallyCheckBox, &QCheckBox::toggled, leLayerName, &QLineEdit::setDisabled );
-
- leLayerName->setDisabled( mLoadLayersIndividuallyCheckBox->isChecked() );
// Creates and connects standard ok/apply buttons
setupButtons( buttonBox );
@@ -651,9 +648,9 @@ void QgsWMSSourceSelect::addButtonClicked()
uri.setParam( QStringLiteral( "styles" ), styles );
Q_NOWARN_DEPRECATED_PUSH
- emit addRasterLayer( uri.encodedUri(), leLayerName->text().isEmpty() ? titles.join( QLatin1Char( '/' ) ) : leLayerName->text(), QStringLiteral( "wms" ) );
+ emit addRasterLayer( uri.encodedUri(), titles.join( QLatin1Char( '/' ) ), QStringLiteral( "wms" ) );
Q_NOWARN_DEPRECATED_POP
- emit addLayer( Qgis::LayerType::Raster, uri.encodedUri(), leLayerName->text().isEmpty() ? titles.join( QLatin1Char( '/' ) ) : leLayerName->text(), QStringLiteral( "wms" ) );
+ emit addLayer( Qgis::LayerType::Raster, uri.encodedUri(), titles.join( QLatin1Char( '/' ) ), QStringLiteral( "wms" ) );
}
}
@@ -1043,19 +1040,13 @@ void QgsWMSSourceSelect::updateButtons()
QString tileLayerName = item->data( Qt::UserRole + 5 ).toString();
if ( tileLayerName.isEmpty() )
tileLayerName = item->data( Qt::UserRole + 0 ).toString();
- leLayerName->setText( tileLayerName );
}
else
{
QStringList layers, styles, titles;
collectSelectedLayers( layers, styles, titles );
- leLayerName->setText( titles.join( QLatin1Char( '/' ) ) );
}
}
- else
- {
- leLayerName->setText( "" );
- }
}
diff --git a/src/server/services/wms/qgswmsrenderer.cpp b/src/server/services/wms/qgswmsrenderer.cpp
index d3749453ed660..185df933ad5b6 100644
--- a/src/server/services/wms/qgswmsrenderer.cpp
+++ b/src/server/services/wms/qgswmsrenderer.cpp
@@ -2810,6 +2810,7 @@ namespace QgsWms
{ "features", json::array() },
};
const bool withGeometry = ( QgsServerProjectUtils::wmsFeatureInfoAddWktGeometry( *mProject ) && mWmsParameters.withGeometry() );
+ const bool withDisplayName = mWmsParameters.withDisplayName();
const QDomNodeList layerList = doc.elementsByTagName( QStringLiteral( "Layer" ) );
for ( int i = 0; i < layerList.size(); ++i )
@@ -2841,6 +2842,7 @@ namespace QgsWms
continue;
QMap fidMap;
+ QMap fidDisplayNameMap;
for ( int j = 0; j < featuresNode.size(); ++j )
{
@@ -2881,6 +2883,24 @@ namespace QgsWms
feature.setGeometry( QgsGeometry::fromWkt( wkt ) );
}
}
+
+ // Note: this is the feature expression display name, not the field alias
+ if ( withDisplayName )
+ {
+ QString displayName;
+ const QDomNodeList attrs = featureNode.elementsByTagName( "Attribute" );
+ for ( int k = 0; k < attrs.count(); k++ )
+ {
+ const QDomElement elm = attrs.at( k ).toElement();
+ if ( elm.attribute( QStringLiteral( "name" ) ).compare( "displayName" ) == 0 )
+ {
+ displayName = elm.attribute( "value" );
+ break;
+ }
+ }
+ fidDisplayNameMap.insert( feature.id(), displayName );
+ }
+
features << feature;
// search attributes to export (one time only)
@@ -2892,7 +2912,6 @@ namespace QgsWms
{
const QDomElement attributeElement = attributesNode.at( k ).toElement();
const QString fieldName = attributeElement.attribute( QStringLiteral( "name" ) );
-
attributes << feature.fieldNameIndex( fieldName );
}
}
@@ -2909,7 +2928,12 @@ namespace QgsWms
for ( const auto &feature : std::as_const( features ) )
{
const QString id = QStringLiteral( "%1.%2" ).arg( layerName ).arg( fidMap.value( feature.id() ) );
- json["features"].push_back( exporter.exportFeatureToJsonObject( feature, QVariantMap(), id ) );
+ QVariantMap extraProperties;
+ if ( withDisplayName )
+ {
+ extraProperties.insert( QStringLiteral( "display_name" ), fidDisplayNameMap.value( feature.id() ) );
+ }
+ json["features"].push_back( exporter.exportFeatureToJsonObject( feature, extraProperties, id ) );
}
}
else // raster layer
diff --git a/src/ui/annotations/qgsannotationlinetextwidgetbase.ui b/src/ui/annotations/qgsannotationlinetextwidgetbase.ui
index 49bc5e5b39149..7b085b40774dc 100644
--- a/src/ui/annotations/qgsannotationlinetextwidgetbase.ui
+++ b/src/ui/annotations/qgsannotationlinetextwidgetbase.ui
@@ -13,7 +13,7 @@
Point Text Annotation
-
+
0
@@ -26,7 +26,27 @@
0
- -
+
-
+
+
+ Text format
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Text format
+
+
+
+ -
@@ -38,17 +58,17 @@
Insert/Edit Expression…
- QToolButton::ToolButtonPopupMode::MenuButtonPopup
+ QToolButton::MenuButtonPopup
- Qt::ToolButtonStyle::ToolButtonTextOnly
+ Qt::ToolButtonTextOnly
- Qt::ArrowType::DownArrow
+ Qt::DownArrow
- -
+
-
@@ -58,7 +78,7 @@
- -
+
-
Properties
@@ -100,7 +120,7 @@
- Qt::FocusPolicy::StrongFocus
+ Qt::StrongFocus
@@ -116,26 +136,28 @@
- -
+
-
- -
-
-
+
+ QgsDoubleSpinBox
+ QDoubleSpinBox
+
+
+
+ QgsFontButton
+ QToolButton
+
+
QgsAnnotationItemCommonPropertiesWidget
QWidget
qgsannotationitemcommonpropertieswidget.h
1
-
- QgsDoubleSpinBox
- QDoubleSpinBox
-
-
QgsRichTextEditor
QWidget
diff --git a/src/ui/annotations/qgsannotationpointtextwidgetbase.ui b/src/ui/annotations/qgsannotationpointtextwidgetbase.ui
index 2bd54142f3649..b3285951679ab 100644
--- a/src/ui/annotations/qgsannotationpointtextwidgetbase.ui
+++ b/src/ui/annotations/qgsannotationpointtextwidgetbase.ui
@@ -13,7 +13,7 @@
Point Text Annotation
-
+
0
@@ -26,11 +26,14 @@
0
- -
-
-
-
+
+
+ 0
+ 0
+
+
Rotation
@@ -70,16 +73,13 @@
- -
-
-
- -
-
-
-
- 0
- 150
-
+
-
+
+
+
+ 0
+ 0
+
@@ -95,45 +95,80 @@
Insert/Edit Expression…
- QToolButton::ToolButtonPopupMode::MenuButtonPopup
+ QToolButton::MenuButtonPopup
- Qt::ToolButtonStyle::ToolButtonTextOnly
+ Qt::ToolButtonTextOnly
- Qt::ArrowType::DownArrow
+ Qt::DownArrow
- -
+
-
+
+
+ Alignment
+
+
+
+ -
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Text format
+
+
+
+ -
+
+
+
+ 0
+ 2
+
+
+
+
-
-
+
- Alignment
+ Text format
-
- QgsAnnotationItemCommonPropertiesWidget
- QWidget
- qgsannotationitemcommonpropertieswidget.h
- 1
-
QgsDoubleSpinBox
QDoubleSpinBox
+
+ QgsFontButton
+ QToolButton
+
+
QgsAlignmentComboBox
QComboBox
+
+ QgsAnnotationItemCommonPropertiesWidget
+ QWidget
+ qgsannotationitemcommonpropertieswidget.h
+ 1
+
QgsRichTextEditor
QWidget
diff --git a/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui b/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui
index aafa452027e22..338856556832f 100644
--- a/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui
+++ b/src/ui/annotations/qgsannotationrectangulartextwidgetbase.ui
@@ -7,7 +7,7 @@
0
0
321
- 716
+ 779
@@ -23,13 +23,67 @@
0
- -
-
-
-
- 0
- 150
-
+
-
+
+
+ Frame
+
+
+ true
+
+
+
-
+
+
+ Symbol
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Change…
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ Vertical alignment
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Insert/Edit Expression…
+
+
+ QToolButton::MenuButtonPopup
+
+
+ Qt::ToolButtonTextOnly
+
+
+ Qt::DownArrow
@@ -65,19 +119,119 @@
- -
-
+
-
+
+
+ -
+
+
+ -
+
+
+ Horizontal alignment
+
+
+
+ -
+
+
+
-
+
+
+ Width
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 6
+
+
+ 100000.000000000000000
+
+
+ 0.200000000000000
+
+
+ 1.000000000000000
+
+
+ false
+
+
+
+ -
+
+
+ Height
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 6
+
+
+ 100000.000000000000000
+
+
+ 0.200000000000000
+
+
+ 1.000000000000000
+
+
+ false
+
+
+
+ -
+
+
+ Unit
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::StrongFocus
+
+
+
+
+
+
+ -
+
0
- 0
+ 150
- -
-
-
-
@@ -247,209 +401,77 @@
- -
-
-
- Vertical alignment
-
-
-
-
-
+
- Horizontal alignment
+ Text format
- -
-
-
- -
-
-
- -
-
-
- Frame
-
-
- true
-
-
-
-
-
-
- Symbol
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Change…
-
-
-
-
-
-
- -
-
-
-
-
-
-
- Width
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 6
-
-
- 100000.000000000000000
-
-
- 0.200000000000000
-
-
- 1.000000000000000
-
-
- false
-
-
-
- -
-
-
- Height
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 6
-
-
- 100000.000000000000000
-
-
- 0.200000000000000
-
-
- 1.000000000000000
-
-
- false
-
-
-
- -
-
-
- Unit
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::StrongFocus
-
-
-
-
-
-
-
-
-
- -
-
+
-
+
0
0
- Insert/Edit Expression…
-
-
- QToolButton::MenuButtonPopup
-
-
- Qt::ToolButtonTextOnly
+ Text format
-
- Qt::DownArrow
+
+
+ -
+
+
+
+ 0
+ 0
+
-
- QgsAnnotationItemCommonPropertiesWidget
- QWidget
- qgsannotationitemcommonpropertieswidget.h
- 1
-
-
- QgsSymbolButton
- QToolButton
-
-
QgsDoubleSpinBox
QDoubleSpinBox
- QgsUnitSelectionWidget
- QWidget
-
- 1
+ QgsFontButton
+ QToolButton
+
QgsAlignmentComboBox
QComboBox
+
+ QgsAnnotationItemCommonPropertiesWidget
+ QWidget
+ qgsannotationitemcommonpropertieswidget.h
+ 1
+
QgsRichTextEditor
QWidget
1
+
+ QgsSymbolButton
+ QToolButton
+
+
+
+ QgsUnitSelectionWidget
+ QWidget
+
+ 1
+
QgsCollapsibleGroupBox
QGroupBox
diff --git a/src/ui/georeferencer/qgstransformsettingsdialogbase.ui b/src/ui/georeferencer/qgstransformsettingsdialogbase.ui
index 73021c397dc52..941522fc74b2c 100644
--- a/src/ui/georeferencer/qgstransformsettingsdialogbase.ui
+++ b/src/ui/georeferencer/qgstransformsettingsdialogbase.ui
@@ -7,7 +7,7 @@
0
0
438
- 702
+ 646
@@ -17,10 +17,10 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+ QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Help|QDialogButtonBox::StandardButton::Ok
@@ -49,8 +49,8 @@
0
- -
-
+
-
+
0
@@ -58,35 +58,19 @@
- Compression
-
-
- cmbCompressionComboBox
+ Output file
- -
-
+
-
+
- Use 0 for transparency when needed
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
+ Create world file only (linear transforms)
- -
-
+
-
+
0
@@ -94,17 +78,10 @@
- Output file
+ Resampling method
-
-
- -
-
-
- -
-
-
- Create world file only (linear transforms)
+
+ cmbResampling
@@ -175,20 +152,32 @@
- -
-
-
-
- 0
- 0
-
-
+
-
+
- Resampling method
+ Use 0 for transparency when needed
-
- cmbResampling
+
+ false
+
+
+
+ -
+
+
+ -
+
+
+ Raster creation options
+
+
+ true
+
+
-
+
+
+
-
@@ -250,12 +239,6 @@
Reports
- -
-
-
- -
-
-
-
@@ -270,6 +253,12 @@
+ -
+
+
+ -
+
+
@@ -318,7 +307,7 @@
-
- Qt::StrongFocus
+ Qt::FocusPolicy::StrongFocus
@@ -328,7 +317,7 @@
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -365,12 +354,23 @@
QDoubleSpinBox
georeferencer/qgsvalidateddoublespinbox.h
+
+ QgsRasterFormatSaveOptionsWidget
+ QWidget
+ qgsrasterformatsaveoptionswidget.h
+ 1
+
+
+ QgsCollapsibleGroupBox
+ QGroupBox
+
+ 1
+
cmbTransformType
mCrsSelector
cmbResampling
- cmbCompressionComboBox
mWorldFileCheckBox
cbxZeroAsTrans
cbxUserResolution
diff --git a/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui b/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui
index af99612eb5feb..f61e4ec2205d5 100644
--- a/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui
+++ b/src/ui/mesh/qgsmeshdatasetgrouptreewidgetbase.ui
@@ -68,6 +68,9 @@
-
+
+ Remove Extra Dataset from Mesh
+
false
diff --git a/src/ui/qgsdelimitedtextsourceselectbase.ui b/src/ui/qgsdelimitedtextsourceselectbase.ui
index 5e134aeb5e0ac..44c43ace64151 100644
--- a/src/ui/qgsdelimitedtextsourceselectbase.ui
+++ b/src/ui/qgsdelimitedtextsourceselectbase.ui
@@ -79,32 +79,6 @@
0
-
-
-
-
-
- 0
- 0
-
-
-
- Layer name
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Name to display in the map legend
-
-
-
-
@@ -121,7 +95,7 @@
Select the file encoding
- QComboBox::InsertAtTop
+ QComboBox::InsertPolicy::InsertAtTop
@@ -145,7 +119,7 @@
- QFrame::NoFrame
+ QFrame::Shape::NoFrame
true
@@ -155,8 +129,8 @@
0
0
- 703
- 647
+ 698
+ 655
@@ -179,14 +153,14 @@
0
-
-
+
0
0
-
+
File Format
@@ -297,10 +271,10 @@
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
@@ -332,7 +306,7 @@
Escape
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
txtEscapeChars
@@ -348,10 +322,10 @@
- Quote
+ &Quote
- Qt::AlignJustify|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignJustify|Qt::AlignmentFlag::AlignVCenter
txtQuoteChars
@@ -497,7 +471,7 @@
Others
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
txtDelimiterOther
@@ -544,10 +518,10 @@
-
- QFrame::StyledPanel
+ QFrame::Shape::StyledPanel
- QFrame::Raised
+ QFrame::Shadow::Raised
-
@@ -603,14 +577,14 @@
-
-
+
0
0
-
+
Record and Fields Options
@@ -791,14 +765,14 @@
-
-
+
0
0
-
+
Geometry Definition
@@ -942,7 +916,7 @@
X field
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter
cmbXField
@@ -1246,7 +1220,7 @@
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -1262,14 +1236,14 @@
-
-
+
0
0
-
+
Layer Settings
@@ -1370,7 +1344,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -1411,7 +1385,7 @@
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -1441,10 +1415,10 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QDialogButtonBox::Help
+ QDialogButtonBox::StandardButton::Help
@@ -1452,9 +1426,21 @@
+
+ QgsScrollArea
+ QScrollArea
+
+ 1
+
+
+ QgsProjectionSelectionWidget
+ QWidget
+ qgsprojectionselectionwidget.h
+ 1
+
QgsCollapsibleGroupBox
- QGroupBox
+ QWidget
1
@@ -1468,20 +1454,8 @@
QWidget
-
- QgsProjectionSelectionWidget
- QWidget
- qgsprojectionselectionwidget.h
-
-
- QgsScrollArea
- QScrollArea
-
- 1
-
- txtLayerName
cmbEncoding
scrollArea
delimiterCSV
diff --git a/src/ui/qgsrichtexteditorbase.ui b/src/ui/qgsrichtexteditorbase.ui
index 06573732ad7c9..b0e9f7dc58a1a 100644
--- a/src/ui/qgsrichtexteditorbase.ui
+++ b/src/ui/qgsrichtexteditorbase.ui
@@ -7,7 +7,7 @@
0
0
846
- 312
+ 705
@@ -51,7 +51,7 @@
-
- QTextEdit::AutoFormattingFlag::AutoNone
+ QTextEdit::AutoNone
true
diff --git a/src/ui/qgswfssourceselectbase.ui b/src/ui/qgswfssourceselectbase.ui
index 6f16d2cc2b42e..c64e31601015f 100644
--- a/src/ui/qgswfssourceselectbase.ui
+++ b/src/ui/qgswfssourceselectbase.ui
@@ -14,105 +14,50 @@
Add WFS Layer from a Server
-
-
-
-
- Coordinate Reference System
+
-
+
+
+ Keep dialog open
-
-
- 6
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 9
-
-
-
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Expanding
-
-
-
- 441
- 23
-
-
-
-
- -
-
-
- false
-
-
- Change…
-
-
-
-
- -
-
-
-
-
-
- Use title for layer name
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Keep dialog open
-
-
-
-
+ -
+
+
+ true
+
+
+
+
+
- -
-
-
- Qt::Horizontal
+
-
+
+
+ QAbstractItemView::EditTrigger::NoEditTriggers
-
- QDialogButtonBox::Help
+
+ true
+
+
+ QAbstractItemView::SelectionMode::ExtendedSelection
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Only request features overlapping the view extent
- -
+
-
Server Connections
@@ -175,10 +120,10 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSizePolicy::Expanding
+ QSizePolicy::Policy::Expanding
@@ -213,45 +158,76 @@
- -
-
-
- QAbstractItemView::NoEditTriggers
-
-
- true
-
-
- QAbstractItemView::ExtendedSelection
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Only request features overlapping the view extent
-
-
-
-
- -
-
-
- true
+
-
+
+
+ Qt::Orientation::Horizontal
-
-
+
+ QDialogButtonBox::StandardButton::Help
+ -
+
+
+ Coordinate Reference System
+
+
+
+ 6
+
+
+ 9
+
+
+ 9
+
+
+ 9
+
+
+ 9
+
+
-
+
+
+
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+ QSizePolicy::Policy::Expanding
+
+
+
+ 441
+ 23
+
+
+
+
+ -
+
+
+ false
+
+
+ Change…
+
+
+
+
+
+
@@ -270,8 +246,6 @@
btnLoad
btnSave
treeView
- cbxUseTitleLayerName
- mHoldDialogOpen
cbxFeatureCurrentViewExtent
btnChangeSpatialRefSys
diff --git a/src/ui/qgswmssourceselectbase.ui b/src/ui/qgswmssourceselectbase.ui
index 4591e4ebe542d..f1c4a180c01c3 100644
--- a/src/ui/qgswmssourceselectbase.ui
+++ b/src/ui/qgswmssourceselectbase.ui
@@ -39,14 +39,14 @@
-
- QDialogButtonBox::Help
+ QDialogButtonBox::StandardButton::Help
-
- QFrame::NoFrame
+ QFrame::Shape::NoFrame
true
@@ -57,7 +57,7 @@
0
0
744
- 639
+ 647
@@ -142,7 +142,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -256,7 +256,7 @@
-
- Request step size
+ Re&quest step size
mTileWidth
@@ -280,7 +280,7 @@
-
- Qt::StrongFocus
+ Qt::FocusPolicy::StrongFocus
@@ -303,7 +303,7 @@
- QAbstractItemView::ExtendedSelection
+ QAbstractItemView::SelectionMode::ExtendedSelection
true
@@ -380,7 +380,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -462,10 +462,10 @@
true
- QAbstractItemView::SingleSelection
+ QAbstractItemView::SelectionMode::SingleSelection
- QAbstractItemView::SelectRows
+ QAbstractItemView::SelectionBehavior::SelectRows
false
@@ -514,7 +514,7 @@
-
- Layer name
+ QGIS layer name
leLayerName
diff --git a/tests/src/3d/testqgs3dutils.cpp b/tests/src/3d/testqgs3dutils.cpp
index 6cc4f3e2401c0..30e1afe4f96e4 100644
--- a/tests/src/3d/testqgs3dutils.cpp
+++ b/tests/src/3d/testqgs3dutils.cpp
@@ -175,13 +175,13 @@ void TestQgs3DUtils::testQgsBox3DDistanceTo()
{
{
const QgsBox3D box( -1, -1, -1, 1, 1, 1 );
- QCOMPARE( box.distanceTo( QVector3D( 0, 0, 0 ) ), 0.0 );
- QCOMPARE( box.distanceTo( QVector3D( 2, 2, 2 ) ), qSqrt( 3.0 ) );
+ QCOMPARE( box.distanceTo( QgsVector3D( 0, 0, 0 ) ), 0.0 );
+ QCOMPARE( box.distanceTo( QgsVector3D( 2, 2, 2 ) ), qSqrt( 3.0 ) );
}
{
const QgsBox3D box( 1, 2, 1, 4, 3, 3 );
- QCOMPARE( box.distanceTo( QVector3D( 1, 2, 1 ) ), 0.0 );
- QCOMPARE( box.distanceTo( QVector3D( 0, 0, 0 ) ), qSqrt( 6.0 ) );
+ QCOMPARE( box.distanceTo( QgsVector3D( 1, 2, 1 ) ), 0.0 );
+ QCOMPARE( box.distanceTo( QgsVector3D( 0, 0, 0 ) ), qSqrt( 6.0 ) );
}
}
diff --git a/tests/src/analysis/testqgsrastercalculator.cpp b/tests/src/analysis/testqgsrastercalculator.cpp
index 1dee37ea09223..7545c85e751cf 100644
--- a/tests/src/analysis/testqgsrastercalculator.cpp
+++ b/tests/src/analysis/testqgsrastercalculator.cpp
@@ -25,6 +25,7 @@ Email : nyall dot dawson at gmail dot com
#include "qgsrastermatrix.h"
#include "qgsapplication.h"
#include "qgsproject.h"
+#include "qgsgdalutils.h"
#include
@@ -61,6 +62,8 @@ class TestQgsRasterCalculator : public QgsTest
void calcWithLayers();
void calcWithReprojectedLayers();
+ void calcWithDataType();
+ void calcWithDataType_data();
void errors();
void toString();
@@ -537,6 +540,148 @@ void TestQgsRasterCalculator::calcWithReprojectedLayers()
delete block;
}
+
+void TestQgsRasterCalculator::calcWithDataType_data()
+{
+ QTest::addColumn( "dataType" );
+ QTest::addColumn( "useOpenCL" );
+
+ QTest::newRow( "UInt16 without OpenCL" ) << static_cast( GDT_UInt16 ) << false;
+ QTest::newRow( "Byte without OpenCL" ) << static_cast( GDT_Byte ) << false;
+#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 7, 0 )
+ QTest::newRow( "Int8 without OpenCL" ) << static_cast( GDT_Int8 ) << false;
+#endif
+ QTest::newRow( "Int16 without OpenCL" ) << static_cast( GDT_Int16 ) << false;
+ QTest::newRow( "Int32 without OpenCL" ) << static_cast( GDT_Int32 ) << false;
+ QTest::newRow( "UInt32 without OpenCL" ) << static_cast( GDT_UInt32 ) << false;
+ QTest::newRow( "Float32 without OpenCL" ) << static_cast( GDT_Float32 ) << false;
+ QTest::newRow( "Float64 without OpenCL" ) << static_cast( GDT_Float64 ) << false;
+
+#ifdef HAVE_OPENCL
+ QTest::newRow( "UInt16 with OpenCL" ) << static_cast( GDT_UInt16 ) << true;
+ QTest::newRow( "Byte with OpenCL" ) << static_cast( GDT_Byte ) << true;
+#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 7, 0 )
+ QTest::newRow( "Int8 with OpenCL" ) << static_cast( GDT_Int8 ) << true;
+#endif
+ QTest::newRow( "Int16 with OpenCL" ) << static_cast( GDT_Int16 ) << true;
+ QTest::newRow( "Int32 with OpenCL" ) << static_cast( GDT_Int32 ) << true;
+ QTest::newRow( "UInt32 with OpenCL" ) << static_cast( GDT_UInt32 ) << true;
+ QTest::newRow( "Float32 with OpenCL" ) << static_cast( GDT_Float32 ) << true;
+ QTest::newRow( "Float64 with OpenCL" ) << static_cast( GDT_Float64 ) << true;
+#endif
+}
+void TestQgsRasterCalculator::calcWithDataType()
+{
+ QFETCH( int, dataType );
+ QFETCH( bool, useOpenCL );
+
+#ifdef HAVE_OPENCL
+ if ( QgsOpenClUtils::available() && useOpenCL )
+ QgsOpenClUtils::setEnabled( useOpenCL );
+ else
+ QgsOpenClUtils::setEnabled( false );
+
+#endif
+
+ QTemporaryDir tempDir;
+ const QString dirPath = tempDir.path();
+ const QString tempInputFilePath = dirPath + "/temp_input.tif";
+ const QString tempResultFilePath = dirPath + "/result.tif";
+
+ QgsRectangle extent = QgsRectangle::fromCenterAndSize( { 0, 0 }, 2, 2 );
+
+ QgsCoordinateReferenceSystem crs( QStringLiteral( "EPSG:32633" ) );
+
+ const GDALDataType gdalDataType { static_cast( dataType ) };
+
+ {
+ const gdal::dataset_unique_ptr hSrcDS( QgsGdalUtils::createSingleBandTiffDataset( tempInputFilePath, gdalDataType, extent, 2, 2, crs ) );
+ // Get first band
+ auto hBand = GDALGetRasterBand( hSrcDS.get(), 1 );
+ switch ( gdalDataType )
+ {
+ case GDT_Byte:
+ {
+ unsigned char data[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION( 3, 7, 0 )
+ case GDT_Int8:
+ {
+ char data8[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data8, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+#endif
+ case GDT_UInt16:
+ {
+ unsigned short data16[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data16, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+ case GDT_Int16:
+ {
+ short data16s[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data16s, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+ case GDT_Int32:
+ {
+ int data32[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data32, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+ case GDT_UInt32:
+ {
+ unsigned int data32u[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data32u, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+ case GDT_Float32:
+ {
+ float data32f[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data32f, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+ case GDT_Float64:
+ {
+ double data64[4] = { 1, 2, 3, 4 };
+ QCOMPARE( GDALRasterIO( hBand, GF_Write, 0, 0, 2, 2, data64, 2, 2, gdalDataType, 0, 0 ), CE_None );
+ break;
+ }
+ default:
+ QVERIFY( false );
+ break;
+ }
+ GDALFlushCache( hSrcDS.get() );
+ }
+
+ // Load 16 bit usigned raster
+ std::unique_ptr demRasterLayer = std::make_unique( tempInputFilePath, QStringLiteral( "dem" ) );
+
+ QgsRasterCalculatorEntry entry1;
+ entry1.bandNumber = 1;
+ entry1.raster = demRasterLayer.get();
+ entry1.ref = QStringLiteral( "dem@1" );
+ QVector entries;
+ entries << entry1;
+
+ QgsRasterCalculator rc( QStringLiteral( "\"dem@1\" * 2" ), tempResultFilePath, QStringLiteral( "GTiff" ), extent, crs, 2, 2, entries, QgsProject::instance()->transformContext() );
+ QCOMPARE( static_cast( rc.processCalculation() ), 0 );
+
+ std::unique_ptr result = std::make_unique( tempResultFilePath, QStringLiteral( "result" ) );
+ QCOMPARE( result->width(), 2 );
+ QCOMPARE( result->height(), 2 );
+ std::unique_ptr block;
+ block.reset( result->dataProvider()->block( 1, extent, 2, 2 ) );
+ QCOMPARE( block->value( 0, 0 ), 2 );
+ QCOMPARE( block->value( 0, 1 ), 4 );
+ QCOMPARE( block->value( 1, 0 ), 6 );
+ QCOMPARE( block->value( 1, 1 ), 8 );
+}
+
+
void TestQgsRasterCalculator::findNodes()
{
std::unique_ptr calcNode;
diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp
index 912577d5eeb57..2c5370d2ee902 100644
--- a/tests/src/core/testqgscoordinatereferencesystem.cpp
+++ b/tests/src/core/testqgscoordinatereferencesystem.cpp
@@ -1672,7 +1672,6 @@ void TestQgsCoordinateReferenceSystem::isDynamic()
void TestQgsCoordinateReferenceSystem::celestialBody()
{
-#if ( PROJ_VERSION_MAJOR > 8 || ( PROJ_VERSION_MAJOR == 8 && PROJ_VERSION_MINOR >= 1 ) )
QgsCoordinateReferenceSystem crs;
QCOMPARE( crs.celestialBodyName(), QString() );
@@ -1681,7 +1680,6 @@ void TestQgsCoordinateReferenceSystem::celestialBody()
crs = QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:104903" ) );
QCOMPARE( crs.celestialBodyName(), QStringLiteral( "Moon" ) );
-#endif
}
void TestQgsCoordinateReferenceSystem::operation()
diff --git a/tests/src/core/testqgscoordinatetransform.cpp b/tests/src/core/testqgscoordinatetransform.cpp
index d73357d96fcea..96aa62f3558f6 100644
--- a/tests/src/core/testqgscoordinatetransform.cpp
+++ b/tests/src/core/testqgscoordinatetransform.cpp
@@ -312,13 +312,11 @@ void TestQgsCoordinateTransform::constructorFlags()
QVERIFY( !tr4.isShortCircuited() );
QVERIFY( tr4.mIgnoreImpossible );
-#if ( PROJ_VERSION_MAJOR > 8 || ( PROJ_VERSION_MAJOR == 8 && PROJ_VERSION_MINOR >= 1 ) )
QgsCoordinateTransform tr5( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ), QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:104903" ) ), QgsProject::instance(), Qgis::CoordinateTransformationFlag::IgnoreImpossibleTransformations );
QVERIFY( !tr5.mBallparkTransformsAreAppropriate );
// crses are from two different celestial bodies, the transform is impossible and should be short-circuited
QVERIFY( tr5.isShortCircuited() );
QVERIFY( tr5.mIgnoreImpossible );
-#endif
}
void TestQgsCoordinateTransform::scaleFactor_data()
@@ -848,10 +846,8 @@ void TestQgsCoordinateTransform::testTransformationIsPossible()
QVERIFY( !QgsCoordinateTransform::isTransformationPossible( QgsCoordinateReferenceSystem(), QgsCoordinateReferenceSystem() ) );
QVERIFY( QgsCoordinateTransform::isTransformationPossible( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3857" ) ), QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) ) );
-#if ( PROJ_VERSION_MAJOR > 8 || ( PROJ_VERSION_MAJOR == 8 && PROJ_VERSION_MINOR >= 1 ) )
// crses from two different celestial bodies => transformation is not possible
QVERIFY( !QgsCoordinateTransform::isTransformationPossible( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ), QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:104903" ) ) ) );
-#endif
}
diff --git a/tests/src/core/testqgshttpheaders.cpp b/tests/src/core/testqgshttpheaders.cpp
index 9c2df3cc20ecb..a47fc9654e850 100644
--- a/tests/src/core/testqgshttpheaders.cpp
+++ b/tests/src/core/testqgshttpheaders.cpp
@@ -272,7 +272,8 @@ void TestQgsHttpheaders::updateSetDomElement()
QDomElement element = doc.createElement( "qgs" );
// === update
QgsHttpHeaders h( QVariantMap( { { QStringLiteral( "key1" ), "value1" }, { QgsHttpHeaders::KEY_REFERER, "my_ref" } } ) );
- h.updateDomElement( element );
+ QMap namespaceDeclarations;
+ h.updateDomElement( element, namespaceDeclarations );
QVERIFY( element.hasAttribute( QgsHttpHeaders::PARAM_PREFIX + "key1" ) );
QCOMPARE( element.attribute( QgsHttpHeaders::PARAM_PREFIX + "key1" ), "value1" );
@@ -284,6 +285,8 @@ void TestQgsHttpheaders::updateSetDomElement()
QVERIFY( element.hasAttribute( QgsHttpHeaders::KEY_REFERER ) );
QCOMPARE( element.attribute( QgsHttpHeaders::KEY_REFERER ), "my_ref" );
+ QCOMPARE( namespaceDeclarations["http-header"], "https://qgis.org/http-header" );
+
// === setFrom
QgsHttpHeaders h2;
element.setAttribute( QgsHttpHeaders::KEY_REFERER, "my_ref_root" ); // overwrite root ref to ckeck backward compatibility
diff --git a/tests/src/core/testqgsmaplayer.cpp b/tests/src/core/testqgsmaplayer.cpp
index 47e6f2d5a6e96..cad52331d7525 100644
--- a/tests/src/core/testqgsmaplayer.cpp
+++ b/tests/src/core/testqgsmaplayer.cpp
@@ -23,6 +23,7 @@
//qgis includes...
#include
+#include
#include
#include
#include
@@ -73,6 +74,8 @@ class TestQgsMapLayer : public QObject
void readCustomProperties();
+ void publicSourceOnGdalWithCredentials();
+
private:
QgsVectorLayer *mpLayer = nullptr;
};
@@ -510,5 +513,15 @@ void TestQgsMapLayer::readCustomProperties()
QCOMPARE( spy.at( 1 ).at( 0 ), "my_property_two" );
}
+void TestQgsMapLayer::publicSourceOnGdalWithCredentials()
+{
+ QgsRasterLayer rl(
+ QStringLiteral( "test.tif|option:AN=OPTION|credential:SOMEKEY=AAAAA|credential:ANOTHER=BBB" ), QString(), QStringLiteral( "gdal" )
+ );
+ QCOMPARE( rl.publicSource( true ), QStringLiteral( "test.tif|option:AN=OPTION|credential:ANOTHER=XXXXXXXX|credential:SOMEKEY=XXXXXXXX" ) );
+ QCOMPARE( rl.publicSource( false ), QStringLiteral( "test.tif|option:AN=OPTION" ) );
+ QCOMPARE( rl.publicSource(), QStringLiteral( "test.tif|option:AN=OPTION" ) );
+}
+
QGSTEST_MAIN( TestQgsMapLayer )
#include "testqgsmaplayer.moc"
diff --git a/tests/src/core/testqgsvectortilelayer.cpp b/tests/src/core/testqgsvectortilelayer.cpp
index 4a5f82f0b0dbe..2a55d79f849b7 100644
--- a/tests/src/core/testqgsvectortilelayer.cpp
+++ b/tests/src/core/testqgsvectortilelayer.cpp
@@ -67,6 +67,7 @@ class TestQgsVectorTileLayer : public QgsTest
void testMbtilesProviderMetadata();
void test_relativePathsMbTiles();
void test_absoluteRelativeUriMbTiles();
+ void test_mbtilesZoom16();
void test_relativePathsXyz();
void test_absoluteRelativeUriXyz();
@@ -371,6 +372,17 @@ void TestQgsVectorTileLayer::test_absoluteRelativeUriMbTiles()
QCOMPARE( vectorTileMetadata->relativeToAbsoluteUri( relativeUri, context ), absoluteUri );
}
+void TestQgsVectorTileLayer::test_mbtilesZoom16()
+{
+ const QString srcMbtiles = QStringLiteral( "type=mbtiles&url=%1/vector_tile/z16.mbtiles" ).arg( TEST_DATA_DIR );
+
+ std::unique_ptr layer = std::make_unique( srcMbtiles );
+ QVERIFY( layer->isValid() );
+ QCOMPARE( layer->providerType(), QStringLiteral( "mbtilesvectortiles" ) );
+ QCOMPARE( layer->sourceMinZoom(), 16 );
+ QCOMPARE( layer->sourceMaxZoom(), 16 );
+}
+
void TestQgsVectorTileLayer::test_relativePathsXyz()
{
QgsReadWriteContext contextRel;
diff --git a/tests/src/python/CMakeLists.txt b/tests/src/python/CMakeLists.txt
index eb1a995bb715b..be46cfd16125f 100644
--- a/tests/src/python/CMakeLists.txt
+++ b/tests/src/python/CMakeLists.txt
@@ -404,6 +404,7 @@ ADD_PYTHON_TEST(PyQgsAttributeEditorAction test_qgsattributeeditoraction.py)
ADD_PYTHON_TEST(PyQgsVectorTile test_qgsvectortile.py)
ADD_PYTHON_TEST(PyQgsVtpk test_qgsvtpk.py)
ADD_PYTHON_TEST(PyQgsProcessingAlgsGdalGdalUtils test_processing_algs_gdal_gdalutils.py)
+ADD_PYTHON_TEST(PyQgsInterpolation test_analysis_interpolation.py)
if (NOT WIN32)
ADD_PYTHON_TEST(PyQgsLogger test_qgslogger.py)
diff --git a/tests/src/python/test_analysis_interpolation.py b/tests/src/python/test_analysis_interpolation.py
new file mode 100644
index 0000000000000..bf0bcfbd54074
--- /dev/null
+++ b/tests/src/python/test_analysis_interpolation.py
@@ -0,0 +1,143 @@
+"""
+***************************************************************************
+ test_analysis_interpolation.py
+ ---------------------
+ Date : January 2025
+ Copyright : (C) 2025 by Alexander Bruy
+ Email : alexander dot bruy at gmail.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. *
+* *
+***************************************************************************
+"""
+
+__author__ = "Alexander Bruy"
+__date__ = "January 2025"
+__copyright__ = "(C) 2025, Alexander Bruy"
+
+import os
+import math
+import tempfile
+
+from qgis.core import (
+ Qgis,
+ QgsCoordinateTransformContext,
+ QgsVectorLayer,
+ QgsRasterChecker,
+)
+from qgis.analysis import (
+ QgsInterpolator,
+ QgsIDWInterpolator,
+ QgsTinInterpolator,
+ QgsGridFileWriter,
+)
+
+import unittest
+from qgis.testing import QgisTestCase
+
+from utilities import unitTestDataPath, start_app
+
+TEST_DATA_DIR = unitTestDataPath()
+start_app()
+
+
+class TestInterpolation(QgisTestCase):
+
+ def __init__(self, methodName):
+ QgisTestCase.__init__(self, methodName)
+ self.report = "
Python Raster Analysis Interpolation Tests
\n"
+
+ def test_idw_interpolator(self):
+ layer = QgsVectorLayer(
+ os.path.join(TEST_DATA_DIR, "points.shp"), "points", "ogr"
+ )
+ self.assertTrue(layer.isValid())
+
+ pixel_size = 5
+ extent = layer.extent()
+ context = QgsCoordinateTransformContext()
+
+ cols = max(math.ceil(extent.width() / pixel_size), 1)
+ rows = max(math.ceil(extent.height() / pixel_size), 1)
+
+ data = QgsInterpolator.LayerData()
+ data.source = layer
+ data.sourceType = QgsInterpolator.SourceType.SourcePoints
+ data.transformContext = context
+ data.valueSource = QgsInterpolator.ValueSource.ValueAttribute
+ data.interpolationAttribute = 3
+
+ interpolator = QgsIDWInterpolator([data])
+ interpolator.setDistanceCoefficient(2.0)
+
+ output_file = os.path.join(tempfile.gettempdir(), "idw_interpolation.tif")
+
+ writer = QgsGridFileWriter(interpolator, output_file, extent, cols, rows)
+ writer.writeFile()
+
+ checker = QgsRasterChecker()
+ ok = checker.runTest(
+ "gdal",
+ output_file,
+ "gdal",
+ os.path.join(TEST_DATA_DIR, "analysis", "idw_interpolation.tif"),
+ )
+ self.report += checker.report()
+
+ report_file = os.path.join(tempfile.gettempdir(), "idw_interpolation_test.html")
+ with open(report_file, "w", encoding="utf-8") as f:
+ f.write(self.report)
+
+ self.assertTrue(ok)
+
+ def test_tin_interpolator(self):
+ layer = QgsVectorLayer(
+ os.path.join(TEST_DATA_DIR, "points.shp"), "points", "ogr"
+ )
+ self.assertTrue(layer.isValid())
+
+ pixel_size = 5
+ extent = layer.extent()
+ context = QgsCoordinateTransformContext()
+
+ cols = max(math.ceil(extent.width() / pixel_size), 1)
+ rows = max(math.ceil(extent.height() / pixel_size), 1)
+
+ data = QgsInterpolator.LayerData()
+ data.source = layer
+ data.sourceType = QgsInterpolator.SourceType.SourcePoints
+ data.transformContext = context
+ data.valueSource = QgsInterpolator.ValueSource.ValueAttribute
+ data.interpolationAttribute = 3
+
+ interpolator = QgsTinInterpolator(
+ [data], QgsTinInterpolator.TinInterpolation.Linear
+ )
+
+ output_file = os.path.join(tempfile.gettempdir(), "tin_interpolation.tif")
+
+ writer = QgsGridFileWriter(interpolator, output_file, extent, cols, rows)
+ writer.writeFile()
+
+ checker = QgsRasterChecker()
+ ok = checker.runTest(
+ "gdal",
+ output_file,
+ "gdal",
+ os.path.join(TEST_DATA_DIR, "analysis", "tin_interpolation.tif"),
+ )
+ self.report += checker.report()
+
+ report_file = os.path.join(tempfile.gettempdir(), "tin_interpolation_test.html")
+ with open(report_file, "w", encoding="utf-8") as f:
+ f.write(self.report)
+
+ self.assertTrue(ok)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/src/python/test_provider_oracle.py b/tests/src/python/test_provider_oracle.py
index b9d6a9590162d..c7e8dce1ec09d 100644
--- a/tests/src/python/test_provider_oracle.py
+++ b/tests/src/python/test_provider_oracle.py
@@ -214,15 +214,6 @@ def testAddFeatureWrongGeomType(self):
"""
pass
- def testCrs(self):
- """
- We override this test for Oracle provider, because without PROJ >= 7
- Oracle is not able to understand correctly some EPSG code (4326 for instance)
- """
- # TODO remove this when PROJ will be >= 7
- if QgsProjUtils.projVersionMajor() >= 7:
- super().testCrs()
-
# HERE GO THE PROVIDER SPECIFIC TESTS
def testDateTimeTypes(self):
vl = QgsVectorLayer(
@@ -1710,10 +1701,7 @@ def testCreateEmptyLayer(self):
)
self.assertTrue(query.next())
self.assertEqual(query.value(0), "GEOM")
- # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326
- # TODO remove this when PROJ will be >= 7
- if QgsProjUtils.projVersionMajor() >= 7:
- self.assertEqual(query.value(1), 4326)
+ self.assertEqual(query.value(1), 4326)
query.finish()
# no feature, so we cannot guess the geometry type, so the layer is not valid
@@ -1746,10 +1734,7 @@ def testCreateEmptyLayer(self):
query.exec('SELECT "l"."GEOM"."SDO_SRID" from "QGIS"."EMPTY_LAYER" "l"')
)
self.assertTrue(query.next())
- # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326
- # TODO remove this when PROJ will be >= 7
- if QgsProjUtils.projVersionMajor() >= 7:
- self.assertEqual(query.value(0), 4326)
+ self.assertEqual(query.value(0), 4326)
query.finish()
# now we can autodetect geom type and srid
@@ -1759,10 +1744,7 @@ def testCreateEmptyLayer(self):
"oracle",
)
self.assertTrue(vl.isValid())
- # Cannot work with proj version < 7 because it cannot identify properly EPSG:4326
- # TODO remove this when PROJ will be >= 7
- if QgsProjUtils.projVersionMajor() >= 7:
- self.assertEqual(vl.sourceCrs().authid(), "EPSG:4326")
+ self.assertEqual(vl.sourceCrs().authid(), "EPSG:4326")
def testCreateAspatialLayer(self):
"""
diff --git a/tests/src/python/test_provider_postgresraster.py b/tests/src/python/test_provider_postgresraster.py
index 940429c60a180..5ecd291fd0ace 100644
--- a/tests/src/python/test_provider_postgresraster.py
+++ b/tests/src/python/test_provider_postgresraster.py
@@ -1012,6 +1012,168 @@ def testBlockSize(self):
self.assertEqual(dp.xBlockSize(), 2)
self.assertEqual(dp.yBlockSize(), 2)
+ def testStyle(self):
+ rl = QgsRasterLayer(
+ self.dbconn
+ + ' sslmode=disable srid=3035 table="public"."raster_tiled_3035" sql=',
+ "test",
+ "postgresraster",
+ )
+
+ self.assertTrue(rl.isValid())
+
+ self.assertEqual(
+ int(rl.dataProvider().styleStorageCapabilities())
+ & Qgis.ProviderStyleStorageCapability.LoadFromDatabase,
+ Qgis.ProviderStyleStorageCapability.LoadFromDatabase,
+ )
+ self.assertEqual(
+ int(rl.dataProvider().styleStorageCapabilities())
+ & Qgis.ProviderStyleStorageCapability.SaveToDatabase,
+ Qgis.ProviderStyleStorageCapability.SaveToDatabase,
+ )
+ self.assertEqual(
+ int(rl.dataProvider().styleStorageCapabilities())
+ & Qgis.ProviderStyleStorageCapability.DeleteFromDatabase,
+ Qgis.ProviderStyleStorageCapability.DeleteFromDatabase,
+ )
+
+ # not style yet for layer
+ res, err = QgsProviderRegistry.instance().styleExists(
+ "postgresraster", rl.source(), ""
+ )
+ self.assertFalse(res)
+ self.assertFalse(err)
+
+ related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase()
+ self.assertEqual(related_count, -1)
+ self.assertEqual(idlist, [])
+ self.assertEqual(namelist, [])
+ self.assertEqual(desclist, [])
+ self.assertFalse(errmsg)
+
+ # Save style twice, one as as default
+ errmsg = rl.saveStyleToDatabase("related raster style", "test style", False, "")
+ self.assertEqual(errmsg, "")
+
+ related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase()
+ self.assertEqual(related_count, 1)
+ self.assertEqual(idlist, ["1"])
+ self.assertEqual(namelist, ["related raster style"])
+ self.assertEqual(desclist, ["test style"])
+ self.assertFalse(errmsg)
+
+ errmsg = rl.saveStyleToDatabase(
+ "related raster style default", "default test style", True, ""
+ )
+ self.assertEqual(errmsg, "")
+
+ # check style exist
+ res, err = QgsProviderRegistry.instance().styleExists(
+ "postgresraster", rl.source(), "related raster style default"
+ )
+ self.assertTrue(res)
+ self.assertFalse(err)
+
+ qml, errmsg = rl.getStyleFromDatabase("2")
+ self.assertTrue(qml)
+ self.assertEqual(errmsg, "")
+
+ related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase()
+ self.assertEqual(related_count, 2)
+ self.assertEqual(idlist, ["2", "1"])
+ self.assertEqual(
+ namelist, ["related raster style default", "related raster style"]
+ )
+ self.assertEqual(desclist, ["default test style", "test style"])
+ self.assertFalse(errmsg)
+
+ # Remove these style
+ res, errmsg = rl.deleteStyleFromDatabase("1")
+ self.assertTrue(res)
+ self.assertFalse(errmsg)
+
+ related_count, idlist, namelist, desclist, errmsg = rl.listStylesInDatabase()
+ self.assertEqual(related_count, 1)
+ self.assertEqual(idlist, ["2"])
+ self.assertEqual(namelist, ["related raster style default"])
+ self.assertEqual(desclist, ["default test style"])
+ self.assertFalse(errmsg)
+
+ # Raster layer with defined column
+ rl_1 = QgsRasterLayer(
+ self.dbconn
+ + ' sslmode=disable srid=3035 table="public"."raster_tiled_3035" (rast) sql=',
+ "test",
+ "postgresraster",
+ )
+
+ self.assertTrue(rl_1.isValid())
+
+ # not style yet for layer
+ res, err = QgsProviderRegistry.instance().styleExists(
+ "postgresraster", rl_1.source(), ""
+ )
+ self.assertFalse(res)
+ self.assertFalse(err)
+
+ related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase()
+ self.assertEqual(related_count, 0)
+ self.assertEqual(idlist, [])
+ self.assertEqual(namelist, [])
+ self.assertEqual(desclist, [])
+ self.assertFalse(errmsg)
+
+ # Save style twice, one as as default
+ errmsg = rl_1.saveStyleToDatabase(
+ "related raster style", "test style", False, ""
+ )
+ self.assertEqual(errmsg, "")
+
+ related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase()
+ self.assertEqual(related_count, 1)
+ self.assertEqual(idlist, ["3"])
+ self.assertEqual(namelist, ["related raster style"])
+ self.assertEqual(desclist, ["test style"])
+ self.assertFalse(errmsg)
+
+ errmsg = rl_1.saveStyleToDatabase(
+ "related raster style default", "default test style", True, ""
+ )
+ self.assertEqual(errmsg, "")
+
+ # check style exist
+ res, err = QgsProviderRegistry.instance().styleExists(
+ "postgresraster", rl_1.source(), "related raster style default"
+ )
+ self.assertTrue(res)
+ self.assertFalse(err)
+
+ qml, errmsg = rl_1.getStyleFromDatabase("3")
+ self.assertTrue(qml)
+ self.assertEqual(errmsg, "")
+
+ related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase()
+ self.assertEqual(related_count, 2)
+ self.assertEqual(idlist, ["4", "3"])
+ self.assertEqual(
+ namelist, ["related raster style default", "related raster style"]
+ )
+ self.assertEqual(desclist, ["default test style", "test style"])
+ self.assertFalse(errmsg)
+
+ # Remove these style
+ res, errmsg = rl_1.deleteStyleFromDatabase("3")
+ self.assertTrue(res)
+ self.assertFalse(errmsg)
+
+ related_count, idlist, namelist, desclist, errmsg = rl_1.listStylesInDatabase()
+ self.assertEqual(related_count, 1)
+ self.assertEqual(idlist, ["4"])
+ self.assertEqual(namelist, ["related raster style default"])
+ self.assertEqual(desclist, ["default test style"])
+ self.assertFalse(errmsg)
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/src/python/test_qgsdatumtransforms.py b/tests/src/python/test_qgsdatumtransforms.py
index 877d8b9192906..0b3e92aaf6879 100644
--- a/tests/src/python/test_qgsdatumtransforms.py
+++ b/tests/src/python/test_qgsdatumtransforms.py
@@ -98,170 +98,83 @@ def testOperations(self):
self.assertEqual(ops[op1_index].accuracy, 0.01)
self.assertEqual(len(ops[op1_index].grids), 0)
- if QgsProjUtils.projVersionMajor() == 6:
- op2_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
- else:
- op2_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
+ op2_index = [
+ i
+ for i in range(len(ops))
+ if ops[i].proj
+ == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
+ ][0]
self.assertTrue(ops[op2_index].name)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op2_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
- else:
- self.assertEqual(
- ops[op2_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
+ self.assertEqual(
+ ops[op2_index].proj,
+ "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
+ )
self.assertEqual(ops[op2_index].accuracy, 0.05)
self.assertEqual(len(ops[op2_index].grids), 1)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op2_index].grids[0].shortName,
- "GDA94_GDA2020_conformal_and_distortion.gsb",
- )
- else:
- self.assertEqual(
- ops[op2_index].grids[0].shortName,
- "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif",
- )
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertTrue(ops[op2_index].grids[0].packageName)
+ self.assertEqual(
+ ops[op2_index].grids[0].shortName,
+ "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif",
+ )
self.assertIn("http", ops[op2_index].grids[0].url)
self.assertTrue(ops[op2_index].grids[0].directDownload)
self.assertTrue(ops[op2_index].grids[0].openLicense)
- if QgsProjUtils.projVersionMajor() == 6:
- op3_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
- else:
- op3_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
+ op3_index = [
+ i
+ for i in range(len(ops))
+ if ops[i].proj
+ == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
+ ][0]
self.assertTrue(ops[op3_index].name)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op3_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
- else:
- self.assertEqual(
- ops[op3_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
+ self.assertEqual(
+ ops[op3_index].proj,
+ "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
+ )
self.assertEqual(ops[op3_index].accuracy, 0.05)
self.assertEqual(len(ops[op3_index].grids), 1)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op3_index].grids[0].shortName, "GDA94_GDA2020_conformal.gsb"
- )
- else:
- self.assertEqual(
- ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif"
- )
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertTrue(ops[op3_index].grids[0].packageName)
+ self.assertEqual(
+ ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif"
+ )
self.assertIn("http", ops[op3_index].grids[0].url)
self.assertTrue(ops[op3_index].grids[0].directDownload)
self.assertTrue(ops[op3_index].grids[0].openLicense)
- if QgsProjUtils.projVersionMajor() == 6:
- op4_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_cocos_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
- else:
- op4_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
+ op4_index = [
+ i
+ for i in range(len(ops))
+ if ops[i].proj
+ == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
+ ][0]
self.assertTrue(ops[op4_index].name)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op4_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_cocos_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
- else:
- self.assertEqual(
- ops[op4_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
+ self.assertEqual(
+ ops[op4_index].proj,
+ "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_cocos_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
+ )
self.assertEqual(ops[op4_index].accuracy, 0.05)
self.assertEqual(len(ops[op4_index].grids), 1)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op4_index].grids[0].shortName,
- "GDA94_GDA2020_conformal_cocos_island.gsb",
- )
- else:
- self.assertEqual(
- ops[op4_index].grids[0].shortName,
- "au_icsm_GDA94_GDA2020_conformal_cocos_island.tif",
- )
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertTrue(ops[op4_index].grids[0].packageName)
+ self.assertEqual(
+ ops[op4_index].grids[0].shortName,
+ "au_icsm_GDA94_GDA2020_conformal_cocos_island.tif",
+ )
self.assertIn("http", ops[op4_index].grids[0].url)
- if QgsProjUtils.projVersionMajor() == 6:
- op5_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_christmas_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
- else:
- op5_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
- ][0]
+ op5_index = [
+ i
+ for i in range(len(ops))
+ if ops[i].proj
+ == "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg"
+ ][0]
self.assertTrue(ops[op5_index].name)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op5_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_christmas_island.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
- else:
- self.assertEqual(
- ops[op5_index].proj,
- "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
- )
+ self.assertEqual(
+ ops[op5_index].proj,
+ "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_christmas_island.tif +step +proj=unitconvert +xy_in=rad +xy_out=deg",
+ )
self.assertEqual(ops[op5_index].accuracy, 0.05)
self.assertEqual(len(ops[op5_index].grids), 1)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op5_index].grids[0].shortName,
- "GDA94_GDA2020_conformal_christmas_island.gsb",
- )
- else:
- self.assertEqual(
- ops[op5_index].grids[0].shortName,
- "au_icsm_GDA94_GDA2020_conformal_christmas_island.tif",
- )
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertTrue(ops[op5_index].grids[0].packageName)
+ self.assertEqual(
+ ops[op5_index].grids[0].shortName,
+ "au_icsm_GDA94_GDA2020_conformal_christmas_island.tif",
+ )
self.assertIn("http", ops[op5_index].grids[0].url)
# uses a pivot datum (technically a proj test, but this will help me sleep at night ;)
@@ -287,86 +200,43 @@ def testOperations(self):
self.assertEqual(ops[op1_index].accuracy, 0.01)
self.assertEqual(len(ops[op1_index].grids), 0)
- if QgsProjUtils.projVersionMajor() == 6:
- op2_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80"
- ][0]
- else:
- op2_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80"
- ][0]
+ op2_index = [
+ i
+ for i in range(len(ops))
+ if ops[i].proj
+ == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80"
+ ][0]
self.assertTrue(ops[op2_index].name)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op2_index].proj,
- "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80",
- )
- else:
- self.assertEqual(
- ops[op2_index].proj,
- "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80",
- )
+ self.assertEqual(
+ ops[op2_index].proj,
+ "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal_and_distortion.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80",
+ )
self.assertEqual(ops[op2_index].accuracy, 0.05)
self.assertEqual(len(ops[op2_index].grids), 1)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op2_index].grids[0].shortName,
- "GDA94_GDA2020_conformal_and_distortion.gsb",
- )
- else:
- self.assertEqual(
- ops[op2_index].grids[0].shortName,
- "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif",
- )
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertTrue(ops[op2_index].grids[0].packageName)
+ self.assertEqual(
+ ops[op2_index].grids[0].shortName,
+ "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif",
+ )
self.assertIn("http", ops[op2_index].grids[0].url)
self.assertTrue(ops[op2_index].grids[0].directDownload)
self.assertTrue(ops[op2_index].grids[0].openLicense)
- if QgsProjUtils.projVersionMajor() == 6:
- op3_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80"
- ][0]
- else:
- op3_index = [
- i
- for i in range(len(ops))
- if ops[i].proj
- == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80"
- ][0]
+ op3_index = [
+ i
+ for i in range(len(ops))
+ if ops[i].proj
+ == "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80"
+ ][0]
self.assertTrue(ops[op3_index].name)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op3_index].proj,
- "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=GDA94_GDA2020_conformal.gsb +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80",
- )
- else:
- self.assertEqual(
- ops[op3_index].proj,
- "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80",
- )
+ self.assertEqual(
+ ops[op3_index].proj,
+ "+proj=pipeline +step +inv +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80 +step +proj=hgridshift +grids=au_icsm_GDA94_GDA2020_conformal.tif +step +proj=lcc +lat_0=-37 +lon_0=145 +lat_1=-36 +lat_2=-38 +x_0=2500000 +y_0=2500000 +ellps=GRS80",
+ )
self.assertEqual(ops[op3_index].accuracy, 0.05)
self.assertEqual(len(ops[op3_index].grids), 1)
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertEqual(
- ops[op3_index].grids[0].shortName, "GDA94_GDA2020_conformal.gsb"
- )
- else:
- self.assertEqual(
- ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif"
- )
- if QgsProjUtils.projVersionMajor() == 6:
- self.assertTrue(ops[op3_index].grids[0].packageName)
+ self.assertEqual(
+ ops[op3_index].grids[0].shortName, "au_icsm_GDA94_GDA2020_conformal.tif"
+ )
self.assertIn("http", ops[op3_index].grids[0].url)
self.assertTrue(ops[op3_index].grids[0].directDownload)
self.assertTrue(ops[op3_index].grids[0].openLicense)
@@ -393,7 +263,6 @@ def testNoLasLos(self):
self.assertTrue(ops[1].name)
self.assertTrue(ops[1].proj)
- @unittest.skipIf(QgsProjUtils.projVersionMajor() < 8, "Not a proj >= 8 build")
def testDatumEnsembles(self):
"""
Test datum ensemble details
diff --git a/tests/src/python/test_qgsellipsoidutils.py b/tests/src/python/test_qgsellipsoidutils.py
index 250318fb1939a..d07b64beac41e 100644
--- a/tests/src/python/test_qgsellipsoidutils.py
+++ b/tests/src/python/test_qgsellipsoidutils.py
@@ -11,7 +11,7 @@
__copyright__ = "Copyright 2017, The QGIS Project"
-from qgis.core import QgsEllipsoidUtils, QgsProjUtils
+from qgis.core import QgsEllipsoidUtils
import unittest
from qgis.testing import start_app, QgisTestCase
@@ -105,11 +105,7 @@ def testDefinitions(self):
self.assertEqual(gany_defs.acronym, gany_id)
self.assertEqual(gany_defs.description, "Ganymede 2000 IAU IAG (ESRI:107916)")
- if QgsProjUtils.projVersionMajor() > 8 or (
- QgsProjUtils.projVersionMajor() == 8
- and QgsProjUtils.projVersionMinor() >= 1
- ):
- self.assertEqual(gany_defs.celestialBodyName, "Ganymede")
+ self.assertEqual(gany_defs.celestialBodyName, "Ganymede")
self.assertTrue(gany_defs.parameters.valid)
self.assertEqual(gany_defs.parameters.semiMajor, 2632345.0)
@@ -118,13 +114,6 @@ def testDefinitions(self):
self.assertFalse(gany_defs.parameters.useCustomParameters)
self.assertEqual(gany_defs.parameters.crs.authid(), "")
- @unittest.skipIf(
- QgsProjUtils.projVersionMajor() < 8
- or (
- QgsProjUtils.projVersionMajor() == 8 and QgsProjUtils.projVersionMinor() < 1
- ),
- "Not a proj >= 8.1 build",
- )
def testCelestialBodies(self):
bodies = QgsEllipsoidUtils.celestialBodies()
diff --git a/tests/src/python/test_qgsprovidersublayerdetails.py b/tests/src/python/test_qgsprovidersublayerdetails.py
index 0812b281a37f2..c9577fc28f17a 100644
--- a/tests/src/python/test_qgsprovidersublayerdetails.py
+++ b/tests/src/python/test_qgsprovidersublayerdetails.py
@@ -201,7 +201,7 @@ def test_to_mime(self):
details.setType(QgsMapLayerType.PointCloudLayer)
uri = details.toMimeUri()
- self.assertEqual(uri.layerType, "pointcloud")
+ self.assertEqual(uri.layerType, "point-cloud")
details.setType(QgsMapLayerType.PluginLayer)
uri = details.toMimeUri()
diff --git a/tests/src/python/test_qgsserver_wms_getfeatureinfo.py b/tests/src/python/test_qgsserver_wms_getfeatureinfo.py
index 4b05eb0a6459f..d0f7813d11cb4 100644
--- a/tests/src/python/test_qgsserver_wms_getfeatureinfo.py
+++ b/tests/src/python/test_qgsserver_wms_getfeatureinfo.py
@@ -1496,6 +1496,66 @@ def test_getfeatureinfo_form_config(self):
self.assertNotIn("name_xyz", body)
self.assertIn("id_xyz", body)
+ def test_getfeatureinfo_display_name(self):
+ """Test issue GH #59353"""
+
+ # create a memory layer with points
+ fields = QgsFields()
+ fields.append(QgsField("id_xyz", QVariant.Int))
+ fields.append(QgsField("name_xyz", QVariant.String))
+ layer = QgsMemoryProviderUtils.createMemoryLayer(
+ "points",
+ fields,
+ QgsWkbTypes.Point,
+ QgsCoordinateReferenceSystem("EPSG:4326"),
+ )
+ layer.setDisplayExpression("name_xyz || ' (' || id_xyz || ')'")
+
+ provider = layer.dataProvider()
+ self.assertTrue(layer.isValid())
+
+ # add some features
+ f = QgsFeature(fields)
+ f.setAttribute("id_xyz", 1)
+ f.setAttribute("name_xyz", "point1")
+ f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0, 0)))
+ provider.addFeature(f)
+
+ f = QgsFeature(fields)
+ f.setAttribute("id_xyz", 2)
+ f.setAttribute("name_xyz", "point2")
+ f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(1, 1)))
+ provider.addFeature(f)
+
+ f = QgsFeature(fields)
+ f.setAttribute("id_xyz", 3)
+ f.setAttribute("name_xyz", "point3")
+ f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(-1, -1)))
+ provider.addFeature(f)
+
+ project = QgsProject()
+ project.addMapLayer(layer)
+
+ # set up the WMS server
+ server = QgsServer()
+ request = QgsServerRequest()
+ w = 10
+ w2 = int(w / 2)
+
+ # Note: not implemented for , 'application/vnd.ogc.gml'
+ for info_format in ["text/plain", "application/json", "text/xml"]:
+
+ request.setUrl(
+ QUrl(
+ f"?SERVICE=WMS&REQUEST=GetFeatureInfo&LAYERS=points&QUERY_LAYERS=points&INFO_FORMAT={info_format}&FEATURE_COUNT=1&WIDTH={w}&HEIGHT={w}&CRS=EPSG:4326&STYLES=&WITH_DISPLAY_NAME=true&BBOX=-1,-1,1,1&X={w2}&Y={w2}&VERSION=1.3.0"
+ )
+ )
+ response = QgsBufferServerResponse()
+
+ server.handleRequest(request, response, project)
+ body = response.body().data().decode("utf8").replace("\n", " ")
+ self.assertIn("point1 (1)", body)
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/src/python/test_qgsvectorlayerprofilegenerator.py b/tests/src/python/test_qgsvectorlayerprofilegenerator.py
index e1fac53c446b1..d6c59e08a9fef 100644
--- a/tests/src/python/test_qgsvectorlayerprofilegenerator.py
+++ b/tests/src/python/test_qgsvectorlayerprofilegenerator.py
@@ -225,20 +225,12 @@ def testPointGenerationTerrain(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {175.6: 69.5, 31.2: 69.5, 1242.5: 55.2},
- )
- self.assertAlmostEqual(results.zRange().lower(), 55.249, 2)
- self.assertAlmostEqual(results.zRange().upper(), 69.5, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {31.2: 67.2, 175.6: 65.8, 1242.5: 52.2},
- )
- self.assertAlmostEqual(results.zRange().lower(), 52.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 67.25, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {175.6: 69.5, 31.2: 69.5, 1242.5: 55.2},
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 55.249, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 69.5, 2)
# 70 meters tolerance
req.setTolerance(70)
@@ -246,20 +238,12 @@ def testPointGenerationTerrain(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {175.6: 69.5, 31.2: 69.5, 1223.2: 56.8, 1242.5: 55.2},
- )
- self.assertAlmostEqual(results.zRange().lower(), 55.249, 2)
- self.assertAlmostEqual(results.zRange().upper(), 69.5, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {31.2: 67.2, 175.6: 65.8, 1242.5: 52.2},
- )
- self.assertAlmostEqual(results.zRange().lower(), 52.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 67.25, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {175.6: 69.5, 31.2: 69.5, 1223.2: 56.8, 1242.5: 55.2},
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 55.249, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 69.5, 2)
def testPointGenerationRelative(self):
"""
@@ -301,20 +285,12 @@ def testPointGenerationRelative(self):
generator = vl.createProfileGenerator(req)
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0},
- )
- self.assertAlmostEqual(results.zRange().lower(), 267.0, 2)
- self.assertAlmostEqual(results.zRange().upper(), 333.5, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {31.2: 331.2, 175.6: 329.8, 1242.5: 264.0},
- )
- self.assertAlmostEqual(results.zRange().lower(), 264.0, 2)
- self.assertAlmostEqual(results.zRange().upper(), 331.25, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0},
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 267.0, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 333.5, 2)
def testPointGenerationRelativeExtrusion(self):
"""
@@ -355,39 +331,21 @@ def testPointGenerationRelativeExtrusion(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0},
- )
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {31.2: 331.2, 175.6: 329.8, 1242.5: 264.0},
- )
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {31.2: 333.5, 175.6: 333.5, 1242.5: 267.0},
+ )
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "LineString Z (-347395 6632649.6 333.5, -347395 6632649.6 340.5)",
- "LineString Z (-347533.4 6632692.2 333.5, -347533.4 6632692.2 340.5)",
- "LineString Z (-346399.2 6632265.6 267, -346399.2 6632265.6 274)",
- ],
- )
- self.assertAlmostEqual(results.zRange().lower(), 267.0, 2)
- self.assertAlmostEqual(results.zRange().upper(), 340.5, 2)
- else:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "LineString Z (-347395 6632649.6 329.8, -347395 6632649.6 336.8)",
- "LineString Z (-347533.4 6632692.2 331.3, -347533.4 6632692.2 338.3)",
- "LineString Z (-346399.2 6632265.6 264, -346399.2 6632265.6 271)",
- ],
- )
- self.assertAlmostEqual(results.zRange().lower(), 264.0, 2)
- self.assertAlmostEqual(results.zRange().upper(), 338.25, 2)
+ self.assertCountEqual(
+ [g.asWkt(1) for g in results.asGeometries()],
+ [
+ "LineString Z (-347395 6632649.6 333.5, -347395 6632649.6 340.5)",
+ "LineString Z (-347533.4 6632692.2 333.5, -347533.4 6632692.2 340.5)",
+ "LineString Z (-346399.2 6632265.6 267, -346399.2 6632265.6 274)",
+ ],
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 267.0, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 340.5, 2)
def testPointGenerationMultiPoint(self):
vl = QgsVectorLayer("MultipointZ?crs=EPSG:27700", "trees", "memory")
@@ -624,34 +582,19 @@ def testLineGenerationTerrain(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 675.2: 66.5,
- 1195.7: 49.2,
- 1223.1: 50.0,
- 1272.0: 53.8,
- 1339.4: 58.2,
- 1444.4: 58.2,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 66.5, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 675.2: 62.7,
- 1195.7: 53.0,
- 1223.1: 56.0,
- 1272.0: 58.2,
- 1339.4: 57.5,
- 1444.4: 52.2,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 52.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {
+ 675.2: 66.5,
+ 1195.7: 49.2,
+ 1223.1: 50.0,
+ 1272.0: 53.8,
+ 1339.4: 58.2,
+ 1444.4: 58.2,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 66.5, 2)
def testLineGenerationTerrainTolerance(self):
vl = QgsVectorLayer("LineStringZ?crs=EPSG:27700", "lines", "memory")
@@ -698,47 +641,25 @@ def testLineGenerationTerrainTolerance(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 2),
- {
- 675.09: 66.5,
- 675.24: 66.5,
- 1195.73: 49.25,
- 1195.74: 49.25,
- 1223.14: 50.0,
- 1223.15: 50.0,
- 1271.97: 53.75,
- 1271.99: 53.75,
- 1339.33: 58.25,
- 1339.51: 58.25,
- 1444.18: 58.25,
- 1444.59: 58.25,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 66.5, 2)
- else:
- # TODO find a way to test with an older proj version
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 2),
- {
- 675.09: 66.5,
- 675.24: 66.5,
- 1195.73: 49.25,
- 1195.74: 49.25,
- 1223.14: 50.0,
- 1223.15: 50.0,
- 1271.97: 53.75,
- 1271.99: 53.75,
- 1339.33: 58.25,
- 1339.51: 58.25,
- 1444.18: 58.25,
- 1444.59: 58.25,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 52.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 2),
+ {
+ 675.09: 66.5,
+ 675.24: 66.5,
+ 1195.73: 49.25,
+ 1195.74: 49.25,
+ 1223.14: 50.0,
+ 1223.15: 50.0,
+ 1271.97: 53.75,
+ 1271.99: 53.75,
+ 1339.33: 58.25,
+ 1339.51: 58.25,
+ 1444.18: 58.25,
+ 1444.59: 58.25,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 66.5, 2)
# 1 meter tolerance
tolerance = 1
@@ -748,47 +669,25 @@ def testLineGenerationTerrainTolerance(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 2),
- {
- 674.43: 66.5,
- 675.91: 66.5,
- 1195.73: 49.25,
- 1195.91: 49.25,
- 1223.06: 50.0,
- 1223.23: 50.0,
- 1271.86: 53.75,
- 1272.1: 53.75,
- 1338.5: 58.25,
- 1340.34: 58.25,
- 1442.29: 56.75,
- 1446.48: 57.5,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 66.5, 2)
- else:
- # TODO find a way to test with an older proj version
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 2),
- {
- 675.09: 66.5,
- 675.24: 66.5,
- 1195.73: 49.25,
- 1195.74: 49.25,
- 1223.14: 50.0,
- 1223.15: 50.0,
- 1271.97: 53.75,
- 1271.99: 53.75,
- 1339.33: 58.25,
- 1339.51: 58.25,
- 1444.18: 58.25,
- 1444.59: 58.25,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 52.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 2),
+ {
+ 674.43: 66.5,
+ 675.91: 66.5,
+ 1195.73: 49.25,
+ 1195.91: 49.25,
+ 1223.06: 50.0,
+ 1223.23: 50.0,
+ 1271.86: 53.75,
+ 1272.1: 53.75,
+ 1338.5: 58.25,
+ 1340.34: 58.25,
+ 1442.29: 56.75,
+ 1446.48: 57.5,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 66.5, 2)
# 15 meters tolerance
tolerance = 15
@@ -798,47 +697,25 @@ def testLineGenerationTerrainTolerance(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 2),
- {
- 664.1: 65.75,
- 686.24: 67.25,
- 1195.73: 49.25,
- 1198.44: 49.25,
- 1221.85: 50.0,
- 1224.44: 49.25,
- 1270.21: 54.5,
- 1273.75: 53.0,
- 1325.61: 59.0,
- 1353.23: 57.5,
- 1412.92: 56.0,
- 1475.85: 57.5,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 67.25, 2)
- else:
- # TODO find a way to test with an older proj version
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 2),
- {
- 675.09: 66.5,
- 675.24: 66.5,
- 1195.73: 49.25,
- 1195.74: 49.25,
- 1223.14: 50.0,
- 1223.15: 50.0,
- 1271.97: 53.75,
- 1271.99: 53.75,
- 1339.33: 58.25,
- 1339.51: 58.25,
- 1444.18: 58.25,
- 1444.59: 58.25,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 52.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 62.7499, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 2),
+ {
+ 664.1: 65.75,
+ 686.24: 67.25,
+ 1195.73: 49.25,
+ 1198.44: 49.25,
+ 1221.85: 50.0,
+ 1224.44: 49.25,
+ 1270.21: 54.5,
+ 1273.75: 53.0,
+ 1325.61: 59.0,
+ 1353.23: 57.5,
+ 1412.92: 56.0,
+ 1475.85: 57.5,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 67.25, 2)
def testLineGenerationRelative(self):
vl = QgsVectorLayer("LineStringZ?crs=EPSG:27700", "lines", "memory")
@@ -881,34 +758,19 @@ def testLineGenerationRelative(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 675.2: 84.2,
- 1195.7: 86.8,
- 1223.1: 81.4,
- 1272.0: 90.0,
- 1339.4: 98.7,
- 1444.4: 100.0,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 81.358, 2)
- self.assertAlmostEqual(results.zRange().upper(), 100.009, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 675.2: 80.5,
- 1195.7: 90.5,
- 1223.1: 87.4,
- 1272.0: 94.5,
- 1339.4: 98.0,
- 1444.4: 94.0,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 80.4564, 2)
- self.assertAlmostEqual(results.zRange().upper(), 97.9811, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {
+ 675.2: 84.2,
+ 1195.7: 86.8,
+ 1223.1: 81.4,
+ 1272.0: 90.0,
+ 1339.4: 98.7,
+ 1444.4: 100.0,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 81.358, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 100.009, 2)
def testLineGenerationRelativeExtrusion(self):
vl = QgsVectorLayer("LineStringZ?crs=EPSG:27700", "lines", "memory")
@@ -953,59 +815,31 @@ def testLineGenerationRelativeExtrusion(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 675.2: 84.2,
- 1195.7: 86.8,
- 1223.1: 81.4,
- 1272.0: 90.0,
- 1339.4: 98.7,
- 1444.4: 100.0,
- },
- )
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 675.2: 80.5,
- 1195.7: 90.5,
- 1223.1: 87.4,
- 1272.0: 94.5,
- 1339.4: 98.0,
- 1444.4: 94.0,
- },
- )
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {
+ 675.2: 84.2,
+ 1195.7: 86.8,
+ 1223.1: 81.4,
+ 1272.0: 90.0,
+ 1339.4: 98.7,
+ 1444.4: 100.0,
+ },
+ )
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "LineString Z (-346549.8 6632363.9 81.4, -346549.8 6632363.9 88.4)",
- "LineString Z (-346501.4 6632357.8 90, -346501.4 6632357.8 97)",
- "LineString Z (-346434.5 6632349.2 98.7, -346434.5 6632349.2 105.7)",
- "LineString Z (-346384.6 6632279.1 100, -346384.6 6632279.1 107)",
- "LineString Z (-346577 6632367.4 86.8, -346577 6632367.4 93.8)",
- "LineString Z (-347062.8 6632554.4 84.2, -347062.8 6632554.4 91.2)",
- ],
- )
- self.assertAlmostEqual(results.zRange().lower(), 81.3588, 2)
- self.assertAlmostEqual(results.zRange().upper(), 107.009, 2)
- else:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "LineString Z (-346549.8 6632363.9 87.4, -346549.8 6632363.9 94.4)",
- "LineString Z (-346501.4 6632357.8 94.5, -346501.4 6632357.8 101.5)",
- "LineString Z (-346434.5 6632349.2 98, -346434.5 6632349.2 105)",
- "LineString Z (-346384.6 6632279.1 94, -346384.6 6632279.1 101)",
- "LineString Z (-346577 6632367.4 90.5, -346577 6632367.4 97.5)",
- "LineString Z (-347062.8 6632554.4 80.5, -347062.8 6632554.4 87.5)",
- ],
- )
- self.assertAlmostEqual(results.zRange().lower(), 80.45645, 2)
- self.assertAlmostEqual(results.zRange().upper(), 104.9811499, 2)
+ self.assertCountEqual(
+ [g.asWkt(1) for g in results.asGeometries()],
+ [
+ "LineString Z (-346549.8 6632363.9 81.4, -346549.8 6632363.9 88.4)",
+ "LineString Z (-346501.4 6632357.8 90, -346501.4 6632357.8 97)",
+ "LineString Z (-346434.5 6632349.2 98.7, -346434.5 6632349.2 105.7)",
+ "LineString Z (-346384.6 6632279.1 100, -346384.6 6632279.1 107)",
+ "LineString Z (-346577 6632367.4 86.8, -346577 6632367.4 93.8)",
+ "LineString Z (-347062.8 6632554.4 84.2, -347062.8 6632554.4 91.2)",
+ ],
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 81.3588, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 107.009, 2)
def testPolygonGenerationAbsolute(self):
vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory")
@@ -1110,54 +944,29 @@ def testPolygonGenerationTerrain(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.8: 55.3,
- 1042.4: 55.2,
- 1049.5: 55.2,
- 1070.2: 55.2,
- 1073.1: 55.2,
- 1074.8: 55.3,
- 1078.9: 54.5,
- 1083.9: 54.5,
- 1091.1: 54.5,
- 1186.8: 49.3,
- 1189.8: 49.2,
- 1192.7: 49.2,
- 1199.2: 49.2,
- 1450.0: 53.0,
- 1455.6: 53.0,
- 1458.1: 53.0,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 55.250, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.8: 48.5,
- 1042.4: 48.5,
- 1049.5: 48.5,
- 1070.2: 48.5,
- 1073.1: 48.5,
- 1074.8: 48.5,
- 1078.9: 48.5,
- 1083.9: 48.5,
- 1091.1: 48.5,
- 1186.8: 52.3,
- 1189.8: 52.2,
- 1192.7: 52.2,
- 1199.2: 52.2,
- 1450.0: 54.5,
- 1455.6: 54.5,
- 1458.1: 54.5,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 48.5, 2)
- self.assertAlmostEqual(results.zRange().upper(), 54.500000, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {
+ 1041.8: 55.3,
+ 1042.4: 55.2,
+ 1049.5: 55.2,
+ 1070.2: 55.2,
+ 1073.1: 55.2,
+ 1074.8: 55.3,
+ 1078.9: 54.5,
+ 1083.9: 54.5,
+ 1091.1: 54.5,
+ 1186.8: 49.3,
+ 1189.8: 49.2,
+ 1192.7: 49.2,
+ 1199.2: 49.2,
+ 1450.0: 53.0,
+ 1455.6: 53.0,
+ 1458.1: 53.0,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 49.25, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 55.250, 2)
def testPolygonGenerationRelative(self):
vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory")
@@ -1199,76 +1008,39 @@ def testPolygonGenerationRelative(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.8: 60.3,
- 1042.4: 60.2,
- 1049.5: 60.2,
- 1070.2: 60.2,
- 1073.1: 60.2,
- 1074.8: 60.3,
- 1078.9: 62.0,
- 1083.9: 62.0,
- 1091.1: 62.0,
- 1186.8: 59.3,
- 1189.8: 59.2,
- 1192.7: 59.2,
- 1199.2: 59.2,
- 1450.0: 65.5,
- 1455.6: 65.5,
- 1458.1: 65.5,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2)
- self.assertAlmostEqual(results.zRange().upper(), 65.5000, 2)
-
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.8: 53.5,
- 1042.4: 53.5,
- 1049.5: 53.5,
- 1070.2: 53.5,
- 1073.1: 53.5,
- 1074.8: 53.5,
- 1078.9: 56.0,
- 1083.9: 56.0,
- 1091.1: 56.0,
- 1186.8: 62.3,
- 1189.8: 62.3,
- 1192.7: 62.3,
- 1199.2: 62.2,
- 1450.0: 67.0,
- 1455.6: 67.0,
- 1458.1: 67.0,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 53.5, 2)
- self.assertAlmostEqual(results.zRange().upper(), 67.000, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {
+ 1041.8: 60.3,
+ 1042.4: 60.2,
+ 1049.5: 60.2,
+ 1070.2: 60.2,
+ 1073.1: 60.2,
+ 1074.8: 60.3,
+ 1078.9: 62.0,
+ 1083.9: 62.0,
+ 1091.1: 62.0,
+ 1186.8: 59.3,
+ 1189.8: 59.2,
+ 1192.7: 59.2,
+ 1199.2: 59.2,
+ 1450.0: 65.5,
+ 1455.6: 65.5,
+ 1458.1: 65.5,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 65.5000, 2)
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "MultiLineString Z ((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3),(-346719.3 6632420 60.3, -346718.7 6632419.8 60.2),(-346689.7 6632409.5 60.3, -346688.2 6632409 60.3),(-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3))",
- "MultiLineString Z ((-346684.3 6632407.6 62, -346679.6 6632406 62),(-346679.6 6632406 62, -346672.8 6632403.6 62))",
- "MultiLineString Z ((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3),(-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3))",
- "MultiLineString Z ((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5),(-346384.8 6632219 65.5, -346383.5 6632216.9 65.5))",
- ],
- )
- else:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "MultiLineString Z ((-346684.3 6632407.6 56, -346679.6 6632406 56),(-346679.6 6632406 56, -346672.8 6632403.6 56))",
- "MultiLineString Z ((-346718.7 6632419.8 53.5, -346712 6632417.4 53.5),(-346719.3 6632420 53.5, -346718.7 6632419.8 53.5),(-346689.7 6632409.5 53.5, -346688.2 6632409 53.5),(-346692.5 6632410.5 53.5, -346689.7 6632409.5 53.5))",
- "MultiLineString Z ((-346387.6 6632223.9 67, -346384.8 6632219 67),(-346384.8 6632219 67, -346383.5 6632216.9 67))",
- "MultiLineString Z ((-346582.6 6632371.7 62.3, -346579.7 6632370.7 62.3),(-346579.7 6632370.7 62.3, -346577 6632369.7 62.3, -346570.8 6632367.9 62.3))",
- ],
- )
+ self.assertCountEqual(
+ [g.asWkt(1) for g in results.asGeometries()],
+ [
+ "MultiLineString Z ((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3),(-346719.3 6632420 60.3, -346718.7 6632419.8 60.2),(-346689.7 6632409.5 60.3, -346688.2 6632409 60.3),(-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3))",
+ "MultiLineString Z ((-346684.3 6632407.6 62, -346679.6 6632406 62),(-346679.6 6632406 62, -346672.8 6632403.6 62))",
+ "MultiLineString Z ((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3),(-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3))",
+ "MultiLineString Z ((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5),(-346384.8 6632219 65.5, -346383.5 6632216.9 65.5))",
+ ],
+ )
def testPolygonGenerationRelativeExtrusion(self):
vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory")
@@ -1312,75 +1084,39 @@ def testPolygonGenerationRelativeExtrusion(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.8: 60.3,
- 1042.4: 60.2,
- 1049.5: 60.2,
- 1070.2: 60.2,
- 1073.1: 60.2,
- 1074.8: 60.3,
- 1078.9: 62.0,
- 1083.9: 62.0,
- 1091.1: 62.0,
- 1186.8: 59.3,
- 1189.8: 59.2,
- 1192.7: 59.2,
- 1199.2: 59.2,
- 1450.0: 65.5,
- 1455.6: 65.5,
- 1458.1: 65.5,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2)
- self.assertAlmostEqual(results.zRange().upper(), 72.50000, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.8: 53.5,
- 1042.4: 53.5,
- 1049.5: 53.5,
- 1070.2: 53.5,
- 1073.1: 53.5,
- 1074.8: 53.5,
- 1078.9: 56.0,
- 1083.9: 56.0,
- 1091.1: 56.0,
- 1186.8: 62.3,
- 1189.8: 62.3,
- 1192.7: 62.3,
- 1199.2: 62.2,
- 1450.0: 67.0,
- 1455.6: 67.0,
- 1458.1: 67.0,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 53.5, 2)
- self.assertAlmostEqual(results.zRange().upper(), 74.00000, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {
+ 1041.8: 60.3,
+ 1042.4: 60.2,
+ 1049.5: 60.2,
+ 1070.2: 60.2,
+ 1073.1: 60.2,
+ 1074.8: 60.3,
+ 1078.9: 62.0,
+ 1083.9: 62.0,
+ 1091.1: 62.0,
+ 1186.8: 59.3,
+ 1189.8: 59.2,
+ 1192.7: 59.2,
+ 1199.2: 59.2,
+ 1450.0: 65.5,
+ 1455.6: 65.5,
+ 1458.1: 65.5,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 59.2499, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 72.50000, 2)
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "MultiPolygon Z (((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3, -346712 6632417.4 67.3, -346718.7 6632419.8 67.3, -346718.7 6632419.8 60.3)),((-346719.3 6632420 60.3, -346718.7 6632419.8 60.2, -346718.7 6632419.8 67.3, -346719.3 6632420 67.3, -346719.3 6632420 60.3)),((-346689.7 6632409.5 60.3, -346688.2 6632409 60.3, -346688.2 6632409 67.3, -346689.7 6632409.5 67.3, -346689.7 6632409.5 60.3)),((-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3, -346689.7 6632409.5 67.3, -346692.5 6632410.5 67.3, -346692.5 6632410.5 60.3)))",
- "MultiPolygon Z (((-346684.3 6632407.6 62, -346679.6 6632406 62, -346679.6 6632406 69, -346684.3 6632407.6 69, -346684.3 6632407.6 62)),((-346679.6 6632406 62, -346672.8 6632403.6 62, -346672.8 6632403.6 69, -346679.6 6632406 69, -346679.6 6632406 62)))",
- "MultiPolygon Z (((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3, -346579.7 6632370.7 66.3, -346582.6 6632371.7 66.3, -346582.6 6632371.7 59.3)),((-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3, -346570.8 6632367.9 66.3, -346577 6632369.7 66.3, -346579.7 6632370.7 66.3, -346579.7 6632370.7 59.3)))",
- "MultiPolygon Z (((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5, -346384.8 6632219 72.5, -346387.6 6632223.9 72.5, -346387.6 6632223.9 65.5)),((-346384.8 6632219 65.5, -346383.5 6632216.9 65.5, -346383.5 6632216.9 72.5, -346384.8 6632219 72.5, -346384.8 6632219 65.5)))",
- ],
- )
- else:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "MultiPolygon Z (((-346684.3 6632407.6 56, -346679.6 6632406 56, -346679.6 6632406 63, -346684.3 6632407.6 63, -346684.3 6632407.6 56)),((-346679.6 6632406 56, -346672.8 6632403.6 56, -346672.8 6632403.6 63, -346679.6 6632406 63, -346679.6 6632406 56)))",
- "MultiPolygon Z (((-346718.7 6632419.8 53.5, -346712 6632417.4 53.5, -346712 6632417.4 60.5, -346718.7 6632419.8 60.5, -346718.7 6632419.8 53.5)),((-346719.3 6632420 53.5, -346718.7 6632419.8 53.5, -346718.7 6632419.8 60.5, -346719.3 6632420 60.5, -346719.3 6632420 53.5)),((-346689.7 6632409.5 53.5, -346688.2 6632409 53.5, -346688.2 6632409 60.5, -346689.7 6632409.5 60.5, -346689.7 6632409.5 53.5)),((-346692.5 6632410.5 53.5, -346689.7 6632409.5 53.5, -346689.7 6632409.5 60.5, -346692.5 6632410.5 60.5, -346692.5 6632410.5 53.5)))",
- "MultiPolygon Z (((-346387.6 6632223.9 67, -346384.8 6632219 67, -346384.8 6632219 74, -346387.6 6632223.9 74, -346387.6 6632223.9 67)),((-346384.8 6632219 67, -346383.5 6632216.9 67, -346383.5 6632216.9 74, -346384.8 6632219 74, -346384.8 6632219 67)))",
- "MultiPolygon Z (((-346582.6 6632371.7 62.3, -346579.7 6632370.7 62.3, -346579.7 6632370.7 69.3, -346582.6 6632371.7 69.3, -346582.6 6632371.7 62.3)),((-346579.7 6632370.7 62.3, -346577 6632369.7 62.3, -346570.8 6632367.9 62.3, -346570.8 6632367.9 69.3, -346577 6632369.7 69.3, -346579.7 6632370.7 69.3, -346579.7 6632370.7 62.3)))",
- ],
- )
+ self.assertCountEqual(
+ [g.asWkt(1) for g in results.asGeometries()],
+ [
+ "MultiPolygon Z (((-346718.7 6632419.8 60.3, -346712 6632417.4 60.3, -346712 6632417.4 67.3, -346718.7 6632419.8 67.3, -346718.7 6632419.8 60.3)),((-346719.3 6632420 60.3, -346718.7 6632419.8 60.2, -346718.7 6632419.8 67.3, -346719.3 6632420 67.3, -346719.3 6632420 60.3)),((-346689.7 6632409.5 60.3, -346688.2 6632409 60.3, -346688.2 6632409 67.3, -346689.7 6632409.5 67.3, -346689.7 6632409.5 60.3)),((-346692.5 6632410.5 60.3, -346689.7 6632409.5 60.3, -346689.7 6632409.5 67.3, -346692.5 6632410.5 67.3, -346692.5 6632410.5 60.3)))",
+ "MultiPolygon Z (((-346684.3 6632407.6 62, -346679.6 6632406 62, -346679.6 6632406 69, -346684.3 6632407.6 69, -346684.3 6632407.6 62)),((-346679.6 6632406 62, -346672.8 6632403.6 62, -346672.8 6632403.6 69, -346679.6 6632406 69, -346679.6 6632406 62)))",
+ "MultiPolygon Z (((-346582.6 6632371.7 59.3, -346579.7 6632370.7 59.3, -346579.7 6632370.7 66.3, -346582.6 6632371.7 66.3, -346582.6 6632371.7 59.3)),((-346579.7 6632370.7 59.3, -346577 6632369.7 59.2, -346570.8 6632367.9 59.3, -346570.8 6632367.9 66.3, -346577 6632369.7 66.3, -346579.7 6632370.7 66.3, -346579.7 6632370.7 59.3)))",
+ "MultiPolygon Z (((-346387.6 6632223.9 65.5, -346384.8 6632219 65.5, -346384.8 6632219 72.5, -346387.6 6632223.9 72.5, -346387.6 6632223.9 65.5)),((-346384.8 6632219 65.5, -346383.5 6632216.9 65.5, -346383.5 6632216.9 72.5, -346384.8 6632219 72.5, -346384.8 6632219 65.5)))",
+ ],
+ )
def testPolygonGenerationRelativeExtrusionTolerance(self):
vl = QgsVectorLayer("PolygonZ?crs=EPSG:27700", "lines", "memory")
@@ -1428,81 +1164,45 @@ def testPolygonGenerationRelativeExtrusionTolerance(self):
self.assertTrue(generator.generateProfile())
results = generator.takeResults()
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.0: 60.2,
- 1042.2: 60.2,
- 1042.9: 60.2,
- 1048.2: 60.2,
- 1050.8: 60.2,
- 1066.9: 60.2,
- 1073.4: 60.2,
- 1076.2: 60.2,
- 1077.9: 62.0,
- 1079.9: 62.0,
- 1089.9: 62.0,
- 1092.2: 62.0,
- 1185.4: 59.2,
- 1188.2: 59.2,
- 1192.6: 59.2,
- 1192.7: 59.2,
- 1197.9: 59.2,
- 1200.4: 59.2,
- 1449.3: 65.5,
- 1450.1: 65.5,
- 1451.1: 65.5,
- 1458.1: 65.5,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 59.25, 2)
- self.assertAlmostEqual(results.zRange().upper(), 65.5, 2)
- else:
- self.assertEqual(
- self.round_dict(results.distanceToHeightMap(), 1),
- {
- 1041.8: 53.5,
- 1042.4: 53.5,
- 1049.5: 53.5,
- 1070.2: 53.5,
- 1073.1: 53.5,
- 1074.8: 53.5,
- 1078.9: 56.0,
- 1083.9: 56.0,
- 1091.1: 56.0,
- 1186.8: 62.3,
- 1189.8: 62.3,
- 1192.7: 62.3,
- 1199.2: 62.2,
- 1450.0: 67.0,
- 1455.6: 67.0,
- 1458.1: 67.0,
- },
- )
- self.assertAlmostEqual(results.zRange().lower(), 53.5, 2)
- self.assertAlmostEqual(results.zRange().upper(), 74.00000, 2)
+ self.assertEqual(
+ self.round_dict(results.distanceToHeightMap(), 1),
+ {
+ 1041.0: 60.2,
+ 1042.2: 60.2,
+ 1042.9: 60.2,
+ 1048.2: 60.2,
+ 1050.8: 60.2,
+ 1066.9: 60.2,
+ 1073.4: 60.2,
+ 1076.2: 60.2,
+ 1077.9: 62.0,
+ 1079.9: 62.0,
+ 1089.9: 62.0,
+ 1092.2: 62.0,
+ 1185.4: 59.2,
+ 1188.2: 59.2,
+ 1192.6: 59.2,
+ 1192.7: 59.2,
+ 1197.9: 59.2,
+ 1200.4: 59.2,
+ 1449.3: 65.5,
+ 1450.1: 65.5,
+ 1451.1: 65.5,
+ 1458.1: 65.5,
+ },
+ )
+ self.assertAlmostEqual(results.zRange().lower(), 59.25, 2)
+ self.assertAlmostEqual(results.zRange().upper(), 65.5, 2)
- if QgsProjUtils.projVersionMajor() >= 8:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "MultiLineString Z ((-346696.3 6632409.8 60.2, -346688.9 6632411.2 60.2, -346687.5 6632406.6 60.2),(-346718.9 6632417.7 60.2, -346719.5 6632421.6 60.2, -346718.2 6632421.7 60.2, -346712.5 6632419.7 60.2, -346711.5 6632415.1 60.2))",
- "LineString Z (-346684.1 6632405.4 62, -346684.6 6632409.8 62, -346673.3 6632405.9 62, -346672.4 6632401.3 62)",
- "LineString Z (-346571.4 6632370.2 59.3, -346570.2 6632365.6 59.3, -346577.6 6632367.8 59.3, -346577.7 6632367.9 59.3, -346581.9 6632369.4 59.3, -346583.2 6632374 59.3, -346576.4 6632371.6 59.3)",
- "LineString Z (-346381.8 6632217.9 65.5, -346385.3 6632215.9 65.5, -346388.7 6632221.9 65.5, -346387 6632224.9 65.5, -346385.8 6632224.7 65.5)",
- ],
- )
- else:
- self.assertCountEqual(
- [g.asWkt(1) for g in results.asGeometries()],
- [
- "MultiPolygon Z (((-346684.3 6632407.6 56, -346679.6 6632406 56, -346679.6 6632406 63, -346684.3 6632407.6 63, -346684.3 6632407.6 56)),((-346679.6 6632406 56, -346672.8 6632403.6 56, -346672.8 6632403.6 63, -346679.6 6632406 63, -346679.6 6632406 56)))",
- "MultiPolygon Z (((-346718.7 6632419.8 53.5, -346712 6632417.4 53.5, -346712 6632417.4 60.5, -346718.7 6632419.8 60.5, -346718.7 6632419.8 53.5)),((-346719.3 6632420 53.5, -346718.7 6632419.8 53.5, -346718.7 6632419.8 60.5, -346719.3 6632420 60.5, -346719.3 6632420 53.5)),((-346689.7 6632409.5 53.5, -346688.2 6632409 53.5, -346688.2 6632409 60.5, -346689.7 6632409.5 60.5, -346689.7 6632409.5 53.5)),((-346692.5 6632410.5 53.5, -346689.7 6632409.5 53.5, -346689.7 6632409.5 60.5, -346692.5 6632410.5 60.5, -346692.5 6632410.5 53.5)))",
- "MultiPolygon Z (((-346387.6 6632223.9 67, -346384.8 6632219 67, -346384.8 6632219 74, -346387.6 6632223.9 74, -346387.6 6632223.9 67)),((-346384.8 6632219 67, -346383.5 6632216.9 67, -346383.5 6632216.9 74, -346384.8 6632219 74, -346384.8 6632219 67)))",
- "MultiPolygon Z (((-346582.6 6632371.7 62.3, -346579.7 6632370.7 62.3, -346579.7 6632370.7 69.3, -346582.6 6632371.7 69.3, -346582.6 6632371.7 62.3)),((-346579.7 6632370.7 62.3, -346577 6632369.7 62.3, -346570.8 6632367.9 62.3, -346570.8 6632367.9 69.3, -346577 6632369.7 69.3, -346579.7 6632370.7 69.3, -346579.7 6632370.7 62.3)))",
- ],
- )
+ self.assertCountEqual(
+ [g.asWkt(1) for g in results.asGeometries()],
+ [
+ "MultiLineString Z ((-346696.3 6632409.8 60.2, -346688.9 6632411.2 60.2, -346687.5 6632406.6 60.2),(-346718.9 6632417.7 60.2, -346719.5 6632421.6 60.2, -346718.2 6632421.7 60.2, -346712.5 6632419.7 60.2, -346711.5 6632415.1 60.2))",
+ "LineString Z (-346684.1 6632405.4 62, -346684.6 6632409.8 62, -346673.3 6632405.9 62, -346672.4 6632401.3 62)",
+ "LineString Z (-346571.4 6632370.2 59.3, -346570.2 6632365.6 59.3, -346577.6 6632367.8 59.3, -346577.7 6632367.9 59.3, -346581.9 6632369.4 59.3, -346583.2 6632374 59.3, -346576.4 6632371.6 59.3)",
+ "LineString Z (-346381.8 6632217.9 65.5, -346385.3 6632215.9 65.5, -346388.7 6632221.9 65.5, -346387 6632224.9 65.5, -346385.8 6632224.7 65.5)",
+ ],
+ )
def test25DPolygonGeneration(self):
vl = QgsVectorLayer("PolygonZ?crs=EPSG:2056", "lines", "memory")
diff --git a/tests/testdata/analysis/idw_interpolation.tif b/tests/testdata/analysis/idw_interpolation.tif
new file mode 100644
index 0000000000000..d961111262f46
Binary files /dev/null and b/tests/testdata/analysis/idw_interpolation.tif differ
diff --git a/tests/testdata/analysis/tin_interpolation.tif b/tests/testdata/analysis/tin_interpolation.tif
new file mode 100644
index 0000000000000..c3d416147497a
Binary files /dev/null and b/tests/testdata/analysis/tin_interpolation.tif differ
diff --git a/tests/testdata/vector_tile/z16.mbtiles b/tests/testdata/vector_tile/z16.mbtiles
new file mode 100644
index 0000000000000..d113b2853f1c8
Binary files /dev/null and b/tests/testdata/vector_tile/z16.mbtiles differ