Skip to content
Permalink
Browse files
Support writing filters by hand, remove namespace from filter element…
…, better comments
  • Loading branch information
mhugent committed Dec 9, 2011
1 parent 2e9a379 commit b4fb1ef3c6b2ad0145b57166bdc6ad63009685ac
Showing with 14 additions and 6 deletions.
  1. +1 −1 src/core/qgsexpression.cpp
  2. +2 −2 src/core/qgsexpression.h
  3. +10 −3 src/providers/wfs/qgswfsconnection.cpp
  4. +1 −0 src/providers/wfs/qgswfsconnection.h
@@ -978,7 +978,7 @@ bool QgsExpression::toOGCFilter( QDomDocument& doc ) const
}

doc.clear();
QDomElement filterElem = doc.createElementNS( "http://www.opengis.net/fes/2.0", "Filter" );
QDomElement filterElem = doc.createElement( "Filter" );
doc.appendChild( filterElem );
return mRootNode->toOGCFilter( doc, filterElem );
}
@@ -122,8 +122,8 @@ class CORE_EXPORT QgsExpression

//! Return the parsed expression as a string - useful for debugging
QString dump() const;
//! Creates ogc filter xml document
//! @return true in case of success
//! Creates ogc filter xml document. Supports minimum standard filter according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)
//! @return true in case of success. False if string contains something that goes beyond the minimum standard filter
bool toOGCFilter( QDomDocument& doc ) const;

//! Return calculator used for distance and area calculations
@@ -55,12 +55,19 @@ QString QgsWFSConnection::uriGetFeature( QString typeName, QString crsString, QS
QString filterString;
if ( !filter.isEmpty() )
{
QgsExpression filterExpression( filter );
//test if filterString is already an OGC filter xml
QDomDocument filterDoc;
if ( filterExpression.toOGCFilter( filterDoc ) )
if( !filterDoc.setContent( filter ) )
{
filterString = "&FILTER=" + filterDoc.toString();
//if not, if must be a QGIS expression
QgsExpression filterExpression( filter );
if( !filterExpression.toOGCFilter( filterDoc ) )
{
//error
}

}
filterString = "&FILTER=" + filterDoc.toString();
}

QString bBoxString;
@@ -27,6 +27,7 @@ class QgsWFSConnection : public QObject
//! URI to get schema of wfs layer
QString uriDescribeFeatureType( const QString& typeName ) const;
//! URI to get features
//! @param filter can be an OGC filter xml or a QGIS expression (containing =,!=, <,>,<=, >=, AND, OR, NOT )
QString uriGetFeature( QString typeName,
QString crs = QString(),
QString filter = QString(),

0 comments on commit b4fb1ef

Please sign in to comment.