Skip to content
Permalink
Browse files

[FEATURE] allow to configure maximum request size for WMS requests (f…

…ixes #16182)

Hardwired setting was 2000, which is still default.
  • Loading branch information
jef-n committed Feb 21, 2017
1 parent 4a74176 commit baa5d90ddc58e469b5bdbb602793f00ec74bcb91
@@ -312,6 +312,10 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
static QString identifyFormatLabel( QgsRaster::IdentifyFormat format );
static Capability identifyFormatToCapability( QgsRaster::IdentifyFormat format );

//! Step width and height for raster iterations
virtual int stepWidth() const;
virtual int stepHeight() const;

signals:
/** Emit a signal to notify of the progress event.
* Emitted theProgress is in percents (0.0-100.0) */
@@ -441,6 +441,10 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
static QString identifyFormatLabel( QgsRaster::IdentifyFormat format );
static Capability identifyFormatToCapability( QgsRaster::IdentifyFormat format );

//! Step width and height for raster iterations
virtual int stepWidth() const { return 2000; }
virtual int stepHeight() const { return 2000; }

signals:

/** Emit a signal to notify of the progress event.
@@ -16,13 +16,24 @@
#include "qgsrasterinterface.h"
#include "qgsrasterprojector.h"
#include "qgsrasterviewport.h"
#include "qgsrasterdataprovider.h"

QgsRasterIterator::QgsRasterIterator( QgsRasterInterface* input )
: mInput( input )
, mFeedback( nullptr )
, mMaximumTileWidth( 2000 )
, mMaximumTileHeight( 2000 )
{
for ( QgsRasterInterface *ri = input; ri; ri = ri->input() )
{
QgsRasterDataProvider *rdp = dynamic_cast<QgsRasterDataProvider*>( ri );
if ( rdp )
{
mMaximumTileWidth = rdp->stepWidth();
mMaximumTileHeight = rdp->stepHeight();
break;
}
}
}

void QgsRasterIterator::startRasterRead( int bandNumber, int nCols, int nRows, const QgsRectangle& extent, QgsRasterBlockFeedback* feedback )
@@ -117,6 +117,14 @@ bool QgsWmsSettings::parseUri( const QString& uriString )
mMaxHeight = uri.param( QStringLiteral( "maxHeight" ) ).toInt();
}

mStepWidth = 2000;
mStepHeight = 2000;
if ( uri.hasParam( QStringLiteral( "stepWidth" ) ) && uri.hasParam( QStringLiteral( "stepHeight" ) ) )
{
mStepWidth = uri.param( QStringLiteral( "stepWidth" ) ).toInt();
mStepHeight = uri.param( QStringLiteral( "stepHeight" ) ).toInt();
}

if ( uri.hasParam( QStringLiteral( "tileMatrixSet" ) ) )
{
mTiled = true;
@@ -566,6 +566,12 @@ class QgsWmsSettings
int mMaxWidth;
int mMaxHeight;

/**
* Step size when iterating the layer
*/
int mStepWidth;
int mStepHeight;

//! Data source URI of the WMS for this layer
QString mHttpUri;

@@ -226,6 +226,9 @@ class QgsWmsProvider : public QgsRasterDataProvider
*/
static QString prepareUri( QString uri );

int stepWidth() const override { return mSettings.mStepWidth; }
int stepHeight() const override { return mSettings.mStepHeight; }

//! Helper struct for tile requests
struct TileRequest
{
@@ -309,7 +312,6 @@ class QgsWmsProvider : public QgsRasterDataProvider

void parseOperationMetadata( QDomElement const &e );


/**
* \brief Calculates the combined extent of the layers selected by layersDrawn
*
@@ -75,6 +75,8 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WindowFlags fl, bo

mTileWidth->setValidator( new QIntValidator( 0, 9999, this ) );
mTileHeight->setValidator( new QIntValidator( 0, 9999, this ) );
mStepWidth->setValidator( new QIntValidator( 0, 999999, this ) );
mStepHeight->setValidator( new QIntValidator( 0, 999999, this ) );
mFeatureCount->setValidator( new QIntValidator( 0, 9999, this ) );

mImageFormatGroup = new QButtonGroup;
@@ -492,6 +494,12 @@ void QgsWMSSourceSelect::addClicked()
uri.setParam( QStringLiteral( "maxHeight" ), mTileHeight->text() );
}

if ( mStepWidth->text().toInt() > 0 && mStepHeight->text().toInt() > 0 )
{
uri.setParam( QStringLiteral( "stepWidth" ), mStepWidth->text() );
uri.setParam( QStringLiteral( "stepHeight" ), mStepHeight->text() );
}

if ( lstTilesets->selectedItems().isEmpty() )
{
collectSelectedLayers( layers, styles, titles );
@@ -15,8 +15,7 @@
</property>
<property name="windowIcon">
<iconset>
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
@@ -66,12 +65,12 @@
</item>
<item row="1" column="0" colspan="2">
<widget class="QPushButton" name="btnConnect">
<property name="toolTip">
<string>Connect to selected service</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Connect to selected service</string>
</property>
<property name="text">
<string>C&amp;onnect</string>
</property>
@@ -89,25 +88,25 @@
</item>
<item row="1" column="4">
<widget class="QPushButton" name="btnEdit">
<property name="toolTip">
<string>Edit selected service connection</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Edit selected service connection</string>
</property>
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="btnDelete">
<property name="toolTip">
<string>Remove connection to selected service</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove connection to selected service</string>
</property>
<property name="text">
<string>Remove</string>
</property>
@@ -220,17 +219,44 @@
<string>Options</string>
</property>
<layout class="QGridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Tile size</string>
</property>
<property name="buddy">
<cstring>mTileWidth</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="mContextualLegendCheckbox">
<property name="text">
<string>Use contextual WMS Legend</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="labelCoordRefSys">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Coordinate Reference System</string>
<string>Feature limit for GetFeatureInfo</string>
</property>
<property name="buddy">
<cstring>btnChangeSpatialRefSys</cstring>
<cstring>mFeatureCount</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mTileWidth"/>
</item>
<item row="3" column="2">
<widget class="QLineEdit" name="mFeatureCount">
<property name="text">
<string>10</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="btnChangeSpatialRefSys">
<property name="enabled">
<bool>false</bool>
@@ -240,45 +266,34 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mTileWidth"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="labelCoordRefSys">
<property name="text">
<string>Tile size</string>
<string>Coordinate Reference System</string>
</property>
<property name="buddy">
<cstring>mTileWidth</cstring>
<cstring>btnChangeSpatialRefSys</cstring>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="mTileHeight"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Feature limit for GetFeatureInfo</string>
<string>Request step size</string>
</property>
<property name="buddy">
<cstring>mFeatureCount</cstring>
<cstring>mTileWidth</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="mFeatureCount">
<property name="text">
<string>10</string>
</property>
</widget>
<item row="2" column="1">
<widget class="QLineEdit" name="mStepWidth"/>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="mContextualLegendCheckbox">
<property name="text">
<string>Use contextual WMS Legend</string>
</property>
</widget>
<item row="2" column="2">
<widget class="QLineEdit" name="mStepHeight"/>
</item>
</layout>
</widget>
@@ -496,19 +511,20 @@
<tabstop>lstLayers</tabstop>
<tabstop>mTileWidth</tabstop>
<tabstop>mTileHeight</tabstop>
<tabstop>mStepWidth</tabstop>
<tabstop>mStepHeight</tabstop>
<tabstop>mFeatureCount</tabstop>
<tabstop>btnChangeSpatialRefSys</tabstop>
<tabstop>mContextualLegendCheckbox</tabstop>
<tabstop>mLayerUpButton</tabstop>
<tabstop>mLayerDownButton</tabstop>
<tabstop>mLayerOrderTreeWidget</tabstop>
<tabstop>leLayerName</tabstop>
<tabstop>lstTilesets</tabstop>
<tabstop>leSearchTerm</tabstop>
<tabstop>btnSearch</tabstop>
<tabstop>tableWidgetWMSList</tabstop>
<tabstop>btnAddWMS</tabstop>
<tabstop>leLayerName</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>mLayerOrderTreeWidget</tabstop>
<tabstop>mLayerDownButton</tabstop>
<tabstop>mLayerUpButton</tabstop>
</tabstops>
<resources/>
<connections>

3 comments on commit baa5d90

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Feb 21, 2017

@jef-n , this commit has broken XYZ support (verified through git dissect).

Symptoms: if you add a XYZ layer in a non WGS84 projection (I'm seeing it with a UTM projection), the XYZ layer goes into an infinite loop, never rendering its content.

@jef-n

This comment has been minimized.

Copy link
Member Author

@jef-n jef-n replied Feb 21, 2017

@nirvn fixed in f924578

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Feb 21, 2017

@jef-n , thanks.

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