Skip to content
Permalink
Browse files
port wfs provider to QgsSpatialIndex
git-svn-id: http://svn.osgeo.org/qgis/trunk@9083 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 20, 2008
1 parent 1c3927b commit abdda51d5c86ce56aa84b256b31c573b4f27c219
@@ -22,6 +22,7 @@ QT4_WRAP_CPP(WFS_MOC_SRCS ${WFS_MOC_HDRS})

INCLUDE_DIRECTORIES (
../../core
../../core/spatialindex
${GEOS_INCLUDE_DIR}
${GEOS_INCLUDE_DIR}/geos
${EXPAT_INCLUDE_DIR}
@@ -17,14 +17,32 @@
#include "qgsspatialrefsys.h"
#include <QBuffer>
#include <QUrl>
#include <QList>
#include <QSet>

//just for a test
//#include <QProgressDialog>

const char NS_SEPARATOR = '?';
const QString GML_NAMESPACE = "http://www.opengis.net/gml";

QgsWFSData::QgsWFSData(const QString& uri, QgsRect* extent, QgsSpatialRefSys* srs, std::list<QgsFeature*>* features, const QString& geometryAttribute, const std::set<QString>& thematicAttributes, QGis::WKBTYPE* wkbType): QObject(), mUri(uri), mExtent(extent), mSrs(srs), mFeatures(features), mGeometryAttribute(geometryAttribute), mThematicAttributes(thematicAttributes), mWkbType(wkbType), mFinished(false), mFeatureCount(0)
QgsWFSData::QgsWFSData(
const QString& uri, QgsRect* extent,
QgsSpatialRefSys* srs,
QList<QgsFeature*> &features,
const QString& geometryAttribute,
const QSet<QString>& thematicAttributes,
QGis::WKBTYPE* wkbType)
: QObject(),
mUri(uri),
mExtent(extent),
mSrs(srs),
mFeatures(features),
mGeometryAttribute(geometryAttribute),
mThematicAttributes(thematicAttributes),
mWkbType(wkbType),
mFinished(false),
mFeatureCount(0)
{
//qWarning("Name of the geometry attribute is:");
//qWarning(mGeometryAttribute.toLocal8Bit().data());
@@ -51,11 +69,6 @@ QgsWFSData::~QgsWFSData()

}

QgsWFSData::QgsWFSData()
{

}

int QgsWFSData::getWFSData()
{
XML_Parser p = XML_ParserCreateNS(NULL, NS_SEPARATOR);
@@ -237,7 +250,7 @@ void QgsWFSData::endElement(const XML_Char* el)
else if(elementName == GML_NAMESPACE + NS_SEPARATOR + "featureMember")
{
mCurrentFeature->setGeometryAndOwnership(mCurrentWKB, mCurrentWKBSize);
mFeatures->push_back(mCurrentFeature);
mFeatures << mCurrentFeature;
++mFeatureCount;
//qWarning("Removing featureMember from stack");
mParseModeStack.pop();
@@ -34,7 +34,14 @@ class QgsWFSData: public QObject
{
Q_OBJECT
public:
QgsWFSData(const QString& uri, QgsRect* extent, QgsSpatialRefSys* srs, std::list<QgsFeature*>* features, const QString& geometryAttribute, const std::set<QString>& thematicAttributes, QGis::WKBTYPE* wkbType);
QgsWFSData(
const QString& uri,
QgsRect* extent,
QgsSpatialRefSys* srs,
QList<QgsFeature*> &features,
const QString& geometryAttribute,
const QSet<QString>& thematicAttributes,
QGis::WKBTYPE* wkbType);
~QgsWFSData();

/**Does the Http GET request to the wfs server
@@ -74,17 +81,17 @@ class QgsWFSData: public QObject
void endElement(const XML_Char* el);
void characters(const XML_Char* chars, int len);
static void start(void* data, const XML_Char* el, const XML_Char** attr)
{
static_cast<QgsWFSData*>(data)->startElement(el, attr);
}
{
static_cast<QgsWFSData*>(data)->startElement(el, attr);
}
static void end(void* data, const XML_Char* el)
{
static_cast<QgsWFSData*>(data)->endElement(el);
}
{
static_cast<QgsWFSData*>(data)->endElement(el);
}
static void chars(void* data, const XML_Char* chars, int len)
{
static_cast<QgsWFSData*>(data)->characters(chars, len);
}
{
static_cast<QgsWFSData*>(data)->characters(chars, len);
}

//helper routines
/**Reads attribute srsName="EPSG:..."
@@ -126,10 +133,10 @@ class QgsWFSData: public QObject
/**Source srs of the layer*/
QgsSpatialRefSys* mSrs;
/**The features of the layer*/
std::list<QgsFeature*>* mFeatures;
QList<QgsFeature*> &mFeatures;
/**Name of geometry attribute*/
QString mGeometryAttribute;
std::set<QString> mThematicAttributes;
const QSet<QString> &mThematicAttributes;
QGis::WKBTYPE* mWkbType;
/**True if the request is finished*/
bool mFinished;

0 comments on commit abdda51

Please sign in to comment.