22 changes: 14 additions & 8 deletions src/providers/wfs/qgswfsprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "qgsvectordataprovider.h"
#include "qgsmaplayer.h"
#include "qgsvectorlayer.h"
#include "qgswfsfeatureiterator.h"

class QgsRectangle;
class QgsSpatialIndex;
Expand All @@ -46,6 +47,8 @@ class QgsWFSProvider: public QgsVectorDataProvider

/* Inherited from QgsVectorDataProvider */

QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() );

/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
Expand Down Expand Up @@ -83,7 +86,8 @@ class QgsWFSProvider: public QgsVectorDataProvider

QGis::WkbType geometryType() const;
long featureCount() const;
const QgsFieldMap & fields() const;

const QgsFields& fields() const;
void rewind();

virtual QgsCoordinateReferenceSystem crs();
Expand Down Expand Up @@ -143,7 +147,7 @@ class QgsWFSProvider: public QgsVectorDataProvider

/**Collects information about the field types. Is called internally from QgsWFSProvider ctor. The method delegates the work to request specific ones and gives back the name of the geometry attribute and the thematic attributes with their types*/
int describeFeatureType( const QString& uri, QString& geometryAttribute,
QgsFieldMap& fields, QGis::WkbType& geomType );
QgsFields& fields, QGis::WkbType& geomType );

signals:
void dataReadProgressMessage( QString message );
Expand All @@ -158,10 +162,12 @@ class QgsWFSProvider: public QgsVectorDataProvider

private:
bool mNetworkRequestFinished;
friend class QgsWFSFeatureIterator;
QgsWFSFeatureIterator* mActiveIterator;

protected:
/**Thematic attributes*/
QgsFieldMap mFields;
QgsFields mFields;
/**Name of geometry attribute*/
QString mGeometryAttribute;
/**The encoding used for request/response. Can be GET, POST or SOAP*/
Expand Down Expand Up @@ -208,13 +214,13 @@ class QgsWFSProvider: public QgsVectorDataProvider
int getFeatureSOAP( const QString& uri, const QString& geometryAttribute );
int getFeatureFILE( const QString& uri, const QString& geometryAttribute );
//encoding specific methods of describeFeatureType
int describeFeatureTypeGET( const QString& uri, QString& geometryAttribute, QgsFieldMap& fields, QGis::WkbType& geomType );
int describeFeatureTypePOST( const QString& uri, QString& geometryAttribute, QgsFieldMap& fields );
int describeFeatureTypeSOAP( const QString& uri, QString& geometryAttribute, QgsFieldMap& fields );
int describeFeatureTypeFile( const QString& uri, QString& geometryAttribute, QgsFieldMap& fields, QGis::WkbType& geomType );
int describeFeatureTypeGET( const QString& uri, QString& geometryAttribute, QgsFields& fields, QGis::WkbType& geomType );
int describeFeatureTypePOST( const QString& uri, QString& geometryAttribute, QgsFields& fields );
int describeFeatureTypeSOAP( const QString& uri, QString& geometryAttribute, QgsFields& fields );
int describeFeatureTypeFile( const QString& uri, QString& geometryAttribute, QgsFields& fields, QGis::WkbType& geomType );

/**Reads the name of the geometry attribute, the thematic attributes and their types from a dom document. Returns 0 in case of success*/
int readAttributesFromSchema( QDomDocument& schemaDoc, QString& geometryAttribute, QgsFieldMap& fields, QGis::WkbType& geomType );
int readAttributesFromSchema( QDomDocument& schemaDoc, QString& geometryAttribute, QgsFields& fields, QGis::WkbType& geomType );
/**This method tries to guess the geometry attribute and the other attribute names from the .gml file if no schema is present. Returns 0 in case of success*/
int guessAttributesFromFile( const QString& uri, QString& geometryAttribute, std::list<QString>& thematicAttributes, QGis::WkbType& geomType ) const;

Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfssourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void QgsWFSSourceSelect::on_treeWidget_itemDoubleClicked( QTreeWidgetItem* item,
QgsWFSCapabilities conn( connection.uri().encodedUri() );
QString uri = conn.uriDescribeFeatureType( item->text( 1 ) );

QgsFieldMap fields;
QgsFields fields;
QString geometryAttribute;
QGis::WkbType geomType;
if ( p.describeFeatureType( uri, geometryAttribute, fields, geomType ) != 0 )
Expand Down