mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
[processing] Add a new panel for raster layer advanced options, like reference scale and dpi, which can be used to retrieve a tailored raster from a source (e.g., WMS server).
This commit is contained in:
parent
d7f16d3c5b
commit
0da7183f98
@ -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<double>( &QgsScaleWidget::scaleChanged ), this, &QgsPanelWidget::widgetChanged );
|
||||||
|
connect( mDpiSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsProcessingRasterSourceOptionsWidget::setReferenceScale( long scale )
|
||||||
|
{
|
||||||
|
mReferenceScale->setScale( static_cast<double>( 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
|
78
src/gui/processing/qgsprocessingrastersourceoptionswidget.h
Normal file
78
src/gui/processing/qgsprocessingrastersourceoptionswidget.h
Normal file
@ -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
|
144
src/ui/processing/qgsprocessingrastersourceoptionsbase.ui
Normal file
144
src/ui/processing/qgsprocessingrastersourceoptionsbase.ui
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>QgsProcessingRasterSourceOptionsBase</class>
|
||||||
|
<widget class="QgsPanelWidget" name="QgsProcessingRasterSourceOptionsBase">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>448</width>
|
||||||
|
<height>197</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true">Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QgsScrollArea" name="scrollArea">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>448</width>
|
||||||
|
<height>197</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Service resolution</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QgsScaleWidget" name="mReferenceScale">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>If set, gives the algorithm a hint on the reference scale that should be used to retrieve an image from the WMS server</string>
|
||||||
|
</property>
|
||||||
|
<property name="showCurrentScaleButton">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="scale">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minScale">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reference scale</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QgsSpinBox" name="mDpiSpinBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>If set, gives the algorithm a hint on the DPI used by the WMS server</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> dpi</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>3000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>96</number>
|
||||||
|
</property>
|
||||||
|
<property name="expressionsEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QgsScaleWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>qgsscalewidget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>QgsSpinBox</class>
|
||||||
|
<extends>QSpinBox</extends>
|
||||||
|
<header>qgsspinbox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>QgsScrollArea</class>
|
||||||
|
<extends>QScrollArea</extends>
|
||||||
|
<header>qgsscrollarea.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>QgsPanelWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>qgspanelwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
x
Reference in New Issue
Block a user