Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Sep 16, 2016
1 parent c56915c commit 9ae12c8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.h
Expand Up @@ -218,7 +218,7 @@ struct CORE_EXPORT QgsVectorJoinInfo
* - version=auto/1.0.0/1.1.0/2.0.0
* -sql=string: full SELECT SQL statement with optional WHERE, ORDER BY and possibly with JOIN if supported on server
* - filter=string: QGIS expression or OGC/FES filter
* - retrictToRequestBBOX=1: to download only features in the view extent (or more generally
* - restrictToRequestBBOX=1: to download only features in the view extent (or more generally
* in the bounding box of the feature iterator)
* - maxNumFeatures=number
* - IgnoreAxisOrientation=1: to ignore EPSG axis order for WFS 1.1 or 2.0
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfsconstants.cpp
Expand Up @@ -31,7 +31,7 @@ const QString QgsWFSConstants::URI_PARAM_TYPENAME( "typename" );
const QString QgsWFSConstants::URI_PARAM_SRSNAME( "srsname" );
const QString QgsWFSConstants::URI_PARAM_BBOX( "bbox" );
const QString QgsWFSConstants::URI_PARAM_FILTER( "filter" );
const QString QgsWFSConstants::URI_PARAM_RESTRICT_TO_REQUEST_BBOX( "retrictToRequestBBOX" );
const QString QgsWFSConstants::URI_PARAM_RESTRICT_TO_REQUEST_BBOX( "restrictToRequestBBOX" );
const QString QgsWFSConstants::URI_PARAM_MAXNUMFEATURES( "maxNumFeatures" );
const QString QgsWFSConstants::URI_PARAM_IGNOREAXISORIENTATION( "IgnoreAxisOrientation" );
const QString QgsWFSConstants::URI_PARAM_INVERTAXISORIENTATION( "InvertAxisOrientation" );
Expand Down
11 changes: 9 additions & 2 deletions src/providers/wfs/qgswfsdatasourceuri.cpp
Expand Up @@ -193,8 +193,15 @@ void QgsWFSDataSourceURI::setSql( const QString& sql )

bool QgsWFSDataSourceURI::isRestrictedToRequestBBOX() const
{
return mURI.hasParam( QgsWFSConstants::URI_PARAM_RESTRICT_TO_REQUEST_BBOX ) &&
mURI.param( QgsWFSConstants::URI_PARAM_RESTRICT_TO_REQUEST_BBOX ).toInt() == 1;
if ( mURI.hasParam( QgsWFSConstants::URI_PARAM_RESTRICT_TO_REQUEST_BBOX ) &&
mURI.param( QgsWFSConstants::URI_PARAM_RESTRICT_TO_REQUEST_BBOX ).toInt() == 1 )
return true;

// accept previously used version with typo
if ( mURI.hasParam( "retrictToRequestBBOX" ) && mURI.param( "retrictToRequestBBOX" ).toInt() == 1 )
return true;

return false;
}

bool QgsWFSDataSourceURI::ignoreAxisOrientation() const
Expand Down
6 changes: 3 additions & 3 deletions tests/src/python/test_provider_wfs.py
Expand Up @@ -892,7 +892,7 @@ def testWFSGetOnlyFeaturesInViewExtent(self):
""".encode('UTF-8'))

# Create test layer
vl = QgsVectorLayer(u"url='http://" + endpoint + u"' typename='my:typename' retrictToRequestBBOX=1", u'test', u'WFS')
vl = QgsVectorLayer(u"url='http://" + endpoint + u"' typename='my:typename' restrictToRequestBBOX=1", u'test', u'WFS')
assert vl.isValid()
self.assertEqual(vl.wkbType(), QgsWKBTypes.Point)

Expand Down Expand Up @@ -1872,8 +1872,8 @@ def testWrongCapabilityExtent(self):
vl_extent = QgsGeometry.fromRect(vl.extent())
assert QgsGeometry.compare(vl_extent.asPolygon()[0], reference.asPolygon()[0], 0.00001), 'Expected {}, got {}'.format(reference.exportToWkt(), vl_extent.exportToWkt())

# Same with retrictToRequestBBOX=1
vl = QgsVectorLayer(u"url='http://" + endpoint + u"' typename='my:typename' version='2.0.0' retrictToRequestBBOX=1", u'test', u'WFS')
# Same with restrictToRequestBBOX=1
vl = QgsVectorLayer(u"url='http://" + endpoint + u"' typename='my:typename' version='2.0.0' restrictToRequestBBOX=1", u'test', u'WFS')
assert vl.isValid()

# First request that will be attempted
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_provider_wfs_gui.py
Expand Up @@ -225,7 +225,7 @@ def test(self):
self.addWfsLayer_layer_name = None
main_dialog.addWfsLayer.connect(self.slotAddWfsLayer)
QTest.mouseClick(buttonAdd, Qt.LeftButton)
self.assertEqual(self.addWfsLayer_uri, ' retrictToRequestBBOX=\'1\' srsname=\'EPSG:4326\' typename=\'my:typename\' url=\'' + "http://" + expected_endpoint + '\' version=\'auto\' table="" sql=')
self.assertEqual(self.addWfsLayer_uri, ' restrictToRequestBBOX=\'1\' srsname=\'EPSG:4326\' typename=\'my:typename\' url=\'' + "http://" + expected_endpoint + '\' version=\'auto\' table="" sql=')
self.assertEqual(self.addWfsLayer_layer_name, 'my:typename')

# Click on Build Query
Expand Down Expand Up @@ -298,7 +298,7 @@ def test(self):
self.addWfsLayer_layer_name = None
main_dialog.addWfsLayer.connect(self.slotAddWfsLayer)
QTest.mouseClick(buttonAdd, Qt.LeftButton)
self.assertEqual(self.addWfsLayer_uri, ' retrictToRequestBBOX=\'1\' srsname=\'EPSG:4326\' typename=\'my:typename\' url=\'' + "http://" + expected_endpoint + '\' version=\'auto\' table="" sql=SELECT * FROM typename WHERE 1 = 1')
self.assertEqual(self.addWfsLayer_uri, ' restrictToRequestBBOX=\'1\' srsname=\'EPSG:4326\' typename=\'my:typename\' url=\'' + "http://" + expected_endpoint + '\' version=\'auto\' table="" sql=SELECT * FROM typename WHERE 1 = 1')
self.assertEqual(self.addWfsLayer_layer_name, 'my:typename')

#main_dialog.setProperty("hideDialogs", None)
Expand Down

0 comments on commit 9ae12c8

Please sign in to comment.