diff --git a/src/gui/processing/qgsprocessingrastersourceoptionswidget.cpp b/src/gui/processing/qgsprocessingrastersourceoptionswidget.cpp new file mode 100644 index 00000000000..544015f42d5 --- /dev/null +++ b/src/gui/processing/qgsprocessingrastersourceoptionswidget.cpp @@ -0,0 +1,55 @@ +/*************************************************************************** + qgsprocessingrastersourceoptionswidget.cpp + -------------------------- + begin : August 2025 + copyright : (C) 2025 by Germán Carrillo + email : german at opengis dot ch + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgsprocessingrastersourceoptionswidget.h" + +///@cond NOT_STABLE + +QgsProcessingRasterSourceOptionsWidget::QgsProcessingRasterSourceOptionsWidget( QWidget *parent ) + : QgsPanelWidget( parent ) +{ + setupUi( this ); + + mDpiSpinBox->setClearValue( 0, tr( "Not set" ) ); + mDpiSpinBox->clear(); + + connect( mReferenceScale, qOverload( &QgsScaleWidget::scaleChanged ), this, &QgsPanelWidget::widgetChanged ); + connect( mDpiSpinBox, qOverload( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged ); +} + +void QgsProcessingRasterSourceOptionsWidget::setReferenceScale( long scale ) +{ + mReferenceScale->setScale( static_cast( scale ) ); +} + +void QgsProcessingRasterSourceOptionsWidget::setDpi( int dpi ) +{ + mDpiSpinBox->setValue( dpi ); +} + +long QgsProcessingRasterSourceOptionsWidget::referenceScale() const +{ + return static_cast< long >( mReferenceScale->scale() ); +} + +int QgsProcessingRasterSourceOptionsWidget::dpi() const +{ + return mDpiSpinBox->value(); +} + + +///@endcond diff --git a/src/gui/processing/qgsprocessingrastersourceoptionswidget.h b/src/gui/processing/qgsprocessingrastersourceoptionswidget.h new file mode 100644 index 00000000000..3c455d0c3de --- /dev/null +++ b/src/gui/processing/qgsprocessingrastersourceoptionswidget.h @@ -0,0 +1,78 @@ +/*************************************************************************** + qgsprocessingrastersourceoptionswidget.h + -------------------------- + begin : August 2025 + copyright : (C) 2025 by Germán Carrillo + email : german at opengis dot ch + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef QGSPROCESSINGRASTERSOURCEOPTIONSWIDGET_H +#define QGSPROCESSINGRASTERSOURCEOPTIONSWIDGET_H + +#include "qgspanelwidget.h" +#include "ui_qgsprocessingrastersourceoptionsbase.h" + +#define SIP_NO_FILE + +///@cond NOT_STABLE + +/** + * \ingroup gui + * \brief Widget for configuring advanced settings for a raster layer. + * \note Not stable API + * \since QGIS 4.0 + */ +class GUI_EXPORT QgsProcessingRasterSourceOptionsWidget : public QgsPanelWidget, private Ui::QgsProcessingRasterSourceOptionsBase +{ + Q_OBJECT + public: + /** + * Constructor for QgsProcessingRasterSourceOptionsWidget, with the specified \a parent widget. + */ + QgsProcessingRasterSourceOptionsWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr ); + + /** + * Sets a reference scale for the raster. + * + * \param scale Reference scale at which a raster (e.g., a WMS) should be requested or rendered. + * + * \see referenceScale() + */ + void setReferenceScale( long scale ); + + /** + * Sets the resolution of the raster source (e.g., a WMS server). + * + * \param dpi Dots per inch used by the raster source. + * + * \see dpi() + */ + void setDpi( int dpi ); + + /** + * Reference scale at which a raster (e.g., a WMS) should be requested or rendered. + * + * \see setReferenceScale() + */ + long referenceScale() const; + + /** + * Resolution of the raster source (e.g., a WMS server). + * + * \see setDpi() + */ + int dpi() const; +}; + +///@endcond + +#endif // QGSPROCESSINGRASTERSOURCEOPTIONSWIDGET_H diff --git a/src/ui/processing/qgsprocessingrastersourceoptionsbase.ui b/src/ui/processing/qgsprocessingrastersourceoptionsbase.ui new file mode 100644 index 00000000000..b11d7e31ca5 --- /dev/null +++ b/src/ui/processing/qgsprocessingrastersourceoptionsbase.ui @@ -0,0 +1,144 @@ + + + QgsProcessingRasterSourceOptionsBase + + + + 0 + 0 + 448 + 197 + + + + Form + + + + 2 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 448 + 197 + + + + + + + Service resolution + + + + + + + If set, gives the algorithm a hint on the reference scale that should be used to retrieve an image from the WMS server + + + true + + + true + + + false + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Reference scale + + + + + + + If set, gives the algorithm a hint on the DPI used by the WMS server + + + dpi + + + 3000 + + + 96 + + + false + + + + + + + + + + + + QgsScaleWidget + QWidget +
qgsscalewidget.h
+
+ + QgsSpinBox + QSpinBox +
qgsspinbox.h
+
+ + QgsScrollArea + QScrollArea +
qgsscrollarea.h
+ 1 +
+ + QgsPanelWidget + QWidget +
qgspanelwidget.h
+ 1 +
+
+ + +