Skip to content

Commit

Permalink
[afs] Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 20, 2018
1 parent 1e95433 commit 394e1a1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 224 deletions.
13 changes: 2 additions & 11 deletions src/providers/arcgisrest/qgsafsfeatureiterator.cpp
Expand Up @@ -70,18 +70,9 @@ bool QgsAfsFeatureIterator::fetchFeature( QgsFeature &f )
if ( mFeatureIterator >= mSource->sharedData()->featureCount() )
return false;

QgsAttributeList fetchAttribures;
if ( ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) != 0 )
fetchAttribures = mRequest.subsetOfAttributes();
else
{
for ( int i = 0; i < mSource->sharedData()->fields().size(); ++i )
fetchAttribures.append( i );
}

if ( mRequest.filterType() == QgsFeatureRequest::FilterFid )
{
bool result = mSource->sharedData()->getFeature( mRequest.filterFid(), f, fetchAttribures );
bool result = mSource->sharedData()->getFeature( mRequest.filterFid(), f );
geometryToDestinationCrs( f, mTransform );
f.setValid( result );
return result;
Expand All @@ -93,7 +84,7 @@ bool QgsAfsFeatureIterator::fetchFeature( QgsFeature &f )
filterRect = filterRect.intersect( &mFilterRect );
while ( mFeatureIterator < mSource->sharedData()->featureCount() )
{
bool success = mSource->sharedData()->getFeature( mFeatureIterator, f, fetchAttribures, filterRect );
bool success = mSource->sharedData()->getFeature( mFeatureIterator, f, filterRect );
++mFeatureIterator;
if ( !success )
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/arcgisrest/qgsafsshareddata.cpp
Expand Up @@ -23,7 +23,7 @@ void QgsAfsSharedData::clearCache()
mCache.clear();
}

bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, const QList<int> & /*fetchAttributes*/, const QgsRectangle &filterRect )
bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, const QgsRectangle &filterRect )
{
QMutexLocker locker( &mMutex );

Expand Down
2 changes: 1 addition & 1 deletion src/providers/arcgisrest/qgsafsshareddata.h
Expand Up @@ -36,7 +36,7 @@ class QgsAfsSharedData : public QObject
QgsCoordinateReferenceSystem crs() const { return mSourceCRS; }
void clearCache();

bool getFeature( QgsFeatureId id, QgsFeature &f, const QList<int> &fetchAttributes, const QgsRectangle &filterRect = QgsRectangle() );
bool getFeature( QgsFeatureId id, QgsFeature &f, const QgsRectangle &filterRect = QgsRectangle() );

private:
friend class QgsAfsProvider;
Expand Down
211 changes: 0 additions & 211 deletions tests/src/python/test_provider_afs.py
Expand Up @@ -223,217 +223,6 @@ def setUpClass(cls):
]
}""".encode('UTF-8'))

with open(sanitize(endpoint, '?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&RESULTTYPE=hits'), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:my="http://my"
numberMatched="5" numberReturned="0" timeStamp="2016-03-25T14:51:48.998Z">
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:And>
<fes:PropertyIsGreaterThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>100</fes:Literal>
</fes:PropertyIsGreaterThan>
<fes:PropertyIsLessThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>410</fes:Literal>
</fes:PropertyIsLessThan>
</fes:And>
</fes:Filter>
&RESULTTYPE=hits"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
numberMatched="3" numberReturned="0" timeStamp="2016-03-25T14:51:48.998Z">
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&SRSNAME=urn:ogc:def:crs:EPSG::4326&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:And>
<fes:PropertyIsGreaterThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>100</fes:Literal>
</fes:PropertyIsGreaterThan>
<fes:PropertyIsLessThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>410</fes:Literal>
</fes:PropertyIsLessThan>
</fes:And>
</fes:Filter>
"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:my="http://my"
numberMatched="3" numberReturned="3" timeStamp="2016-03-25T14:51:48.998Z">
<wfs:member>
<my:typename gml:id="typename.1">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>70.8 -68.2</gml:lowerCorner><gml:upperCorner>70.8 -68.2</gml:upperCorner></gml:Envelope></gml:boundedBy>
<my:geometryProperty><gml:Point srsName="urn:ogc:def:crs:EPSG::4326" gml:id="typename.geom.1"><gml:pos>70.8 -68.2</gml:pos></gml:Point></my:geometryProperty>
<my:pk>2</my:pk>
<my:cnt>200</my:cnt>
<my:name>Apple</my:name>
<my:name2>Apple</my:name2>
<my:num_char>2</my:num_char>
</my:typename>
</wfs:member>
<wfs:member>
<my:typename gml:id="typename.2">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>78.3 -65.32</gml:lowerCorner><gml:upperCorner>78.3 -65.32</gml:upperCorner></gml:Envelope></gml:boundedBy>
<my:geometryProperty><gml:Point srsName="urn:ogc:def:crs:EPSG::4326" gml:id="typename.geom.2"><gml:pos>78.3 -65.32</gml:pos></gml:Point></my:geometryProperty>
<my:pk>4</my:pk>
<my:cnt>400</my:cnt>
<my:name>Honey</my:name>
<my:name2>Honey</my:name2>
<my:num_char>4</my:num_char>
</my:typename>
</wfs:member>
<wfs:member>
<my:typename gml:id="typename.3">
<my:pk>3</my:pk>
<my:cnt>300</my:cnt>
<my:name>Pear</my:name>
<my:name2>PEaR</my:name2>
<my:num_char>3</my:num_char>
</my:typename>
</wfs:member>
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:And>
<fes:PropertyIsGreaterThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>100</fes:Literal>
</fes:PropertyIsGreaterThan>
<fes:PropertyIsLessThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>400</fes:Literal>
</fes:PropertyIsLessThan>
</fes:And>
</fes:Filter>
&RESULTTYPE=hits"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
numberMatched="2" numberReturned="0" timeStamp="2016-03-25T14:51:48.998Z">
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&SRSNAME=urn:ogc:def:crs:EPSG::4326&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:And>
<fes:PropertyIsGreaterThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>100</fes:Literal>
</fes:PropertyIsGreaterThan>
<fes:PropertyIsLessThan>
<fes:ValueReference>cnt</fes:ValueReference>
<fes:Literal>400</fes:Literal>
</fes:PropertyIsLessThan>
</fes:And>
</fes:Filter>
"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:my="http://my"
numberMatched="2" numberReturned="2" timeStamp="2016-03-25T14:51:48.998Z">
<wfs:member>
<my:typename gml:id="typename.1">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>70.8 -68.2</gml:lowerCorner><gml:upperCorner>70.8 -68.2</gml:upperCorner></gml:Envelope></gml:boundedBy>
<my:geometryProperty><gml:Point srsName="urn:ogc:def:crs:EPSG::4326" gml:id="typename.geom.1"><gml:pos>70.8 -68.2</gml:pos></gml:Point></my:geometryProperty>
<my:pk>2</my:pk>
<my:cnt>200</my:cnt>
<my:name>Apple</my:name>
<my:name2>Apple</my:name2>
<my:num_char>2</my:num_char>
</my:typename>
</wfs:member>
<wfs:member>
<my:typename gml:id="typename.3">
<my:pk>3</my:pk>
<my:cnt>300</my:cnt>
<my:name>Pear</my:name>
<my:name2>PEaR</my:name2>
<my:num_char>3</my:num_char>
</my:typename>
</wfs:member>
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:PropertyIsEqualTo>
<fes:ValueReference>name</fes:ValueReference>
<fes:Literal>Apple</fes:Literal>
</fes:PropertyIsEqualTo>
</fes:Filter>
&RESULTTYPE=hits"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
numberMatched="1" numberReturned="0" timeStamp="2016-03-25T14:51:48.998Z">
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&SRSNAME=urn:ogc:def:crs:EPSG::4326&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:PropertyIsEqualTo>
<fes:ValueReference>name</fes:ValueReference>
<fes:Literal>Apple</fes:Literal>
</fes:PropertyIsEqualTo>
</fes:Filter>
"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:my="http://my"
numberMatched="1" numberReturned="1" timeStamp="2016-03-25T14:51:48.998Z">
<wfs:member>
<my:typename gml:id="typename.1">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>70.8 -68.2</gml:lowerCorner><gml:upperCorner>70.8 -68.2</gml:upperCorner></gml:Envelope></gml:boundedBy>
<my:geometryProperty><gml:Point srsName="urn:ogc:def:crs:EPSG::4326" gml:id="typename.geom.1"><gml:pos>70.8 -68.2</gml:pos></gml:Point></my:geometryProperty>
<my:pk>2</my:pk>
<my:cnt>200</my:cnt>
<my:name>Apple</my:name>
<my:name2>Apple</my:name2>
<my:num_char>2</my:num_char>
</my:typename>
</wfs:member>
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:PropertyIsEqualTo>
<fes:ValueReference>name</fes:ValueReference>
<fes:Literal>AppleBearOrangePear</fes:Literal>
</fes:PropertyIsEqualTo>
</fes:Filter>
&RESULTTYPE=hits"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
numberMatched="0" numberReturned="0" timeStamp="2016-03-25T14:51:48.998Z">
</wfs:FeatureCollection>""".encode('UTF-8'))

with open(sanitize(endpoint, """?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=my:typename&SRSNAME=urn:ogc:def:crs:EPSG::4326&FILTER=<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">
<fes:PropertyIsEqualTo>
<fes:ValueReference>name</fes:ValueReference>
<fes:Literal>AppleBearOrangePear</fes:Literal>
</fes:PropertyIsEqualTo>
</fes:Filter>
"""), 'wb') as f:
f.write("""
<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:my="http://my"
numberMatched="0" numberReturned="0" timeStamp="2016-03-25T14:51:48.998Z">
</wfs:FeatureCollection>""".encode('UTF-8'))

@classmethod
def tearDownClass(cls):
"""Run after all tests"""
Expand Down

0 comments on commit 394e1a1

Please sign in to comment.