Skip to content
Permalink
Browse files

wfs: minor cleanups and a fixed error message

  • Loading branch information
jef-n committed Jul 13, 2013
1 parent ff7aaba commit d64ab2145b89a8fc0c785285537bed972806b163
@@ -113,7 +113,7 @@ int QgsGml::getFeatures( const QString& uri, QGis::WkbType* wkbType, QgsRectangl
.arg( XML_ErrorString( errorCode ) )
.arg( XML_GetCurrentLineNumber( p ) )
.arg( XML_GetCurrentColumnNumber( p ) );
QgsMessageLog::instance()->logMessage( errorString, tr( "WFS" ) );
QgsMessageLog::logMessage( errorString, tr( "WFS" ) );
}
}
QCoreApplication::processEvents();
@@ -1482,7 +1482,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )

QDomElement mesElem = doc.createElement( "Message" );
QStringList mesErrors;
mesErrors << QString( "ERROR: %n feature(s) not added." ).arg( inFeatList.size() );
mesErrors << QString( "ERROR: %1 feature(s) not added." ).arg( inFeatList.size() );
if ( provider->hasErrors() )
{
mesErrors << "\n Provider errors:" << provider->errors();
@@ -25,11 +25,9 @@

static const QString WFS_NAMESPACE = "http://www.opengis.net/wfs";

QgsWFSCapabilities::QgsWFSCapabilities( QString theUri ) :
//QObject( parent ),
//mConnName( connName ),
mCapabilitiesReply( 0 ),
mErrorCode( QgsWFSCapabilities::NoError )
QgsWFSCapabilities::QgsWFSCapabilities( QString theUri )
: mCapabilitiesReply( 0 )
, mErrorCode( QgsWFSCapabilities::NoError )
{
mUri.setEncodedUri( theUri );
QgsDebugMsg( "theUri = " + theUri );
@@ -38,7 +36,7 @@ QgsWFSCapabilities::QgsWFSCapabilities( QString theUri ) :
QgsDebugMsg( "mBaseUrl = " + mBaseUrl );

//find out the server URL
/*
#if 0
QSettings settings;
QString key = "/Qgis/connections-wfs/" + mConnName + "/url";
mUri = settings.value( key ).toString();
@@ -54,7 +52,7 @@ QgsWFSCapabilities::QgsWFSCapabilities( QString theUri ) :
{
mUri.append( "&" );
}
*/
#endif
}

QString QgsWFSCapabilities::prepareUri( QString uri )
@@ -148,8 +146,7 @@ void QgsWFSCapabilities::requestCapabilities()

void QgsWFSCapabilities::capabilitiesReplyFinished()
{
QNetworkReply* reply = mCapabilitiesReply;

QNetworkReply *reply = mCapabilitiesReply;
reply->deleteLater();
mCapabilitiesReply = 0;

@@ -93,7 +93,7 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri )
if ( describeFeatureType( uri, mGeometryAttribute, mFields, mWKBType ) )
{
mValid = false;
QgsMessageLog::instance()->logMessage( tr( "DescribeFeatureType failed for url %1" ).arg( uri ), tr( "WFS" ) );
QgsMessageLog::logMessage( tr( "DescribeFeatureType failed for url %1" ).arg( uri ), tr( "WFS" ) );
return;
}

@@ -789,12 +789,14 @@ int QgsWFSProvider::describeFeatureTypeGET( const QString& uri, QString& geometr
}

mNetworkRequestFinished = false;

QUrl describeFeatureUrl( uri );
describeFeatureUrl.removeQueryItem( "SRSNAME" );
describeFeatureUrl.removeQueryItem( "REQUEST" );
describeFeatureUrl.addQueryItem( "REQUEST", "DescribeFeatureType" );
QNetworkRequest request( describeFeatureUrl.toString() );
QNetworkReply* reply = QgsNetworkAccessManager::instance()->get( request );

connect( reply, SIGNAL( finished() ), this, SLOT( networkRequestFinished() ) );
while ( !mNetworkRequestFinished )
{
@@ -814,7 +816,7 @@ int QgsWFSProvider::describeFeatureTypeGET( const QString& uri, QString& geometr
if ( readAttributesFromSchema( describeFeatureDocument,
geometryAttribute, fields, geomType ) != 0 )
{
QgsDebugMsg( QString( "FAILED: readAttributesFromSchema" ) );
QgsDebugMsg( "FAILED: readAttributesFromSchema" );
return 3;
}

@@ -1511,8 +1513,6 @@ void QgsWFSProvider::getLayerCapabilities()
}
mNetworkRequestFinished = false;


//get capabilities document
QString uri = dataSourceUri();
uri.replace( QString( "GetFeature" ), QString( "GetCapabilities" ) );
QNetworkRequest request( uri );
@@ -1523,6 +1523,7 @@ void QgsWFSProvider::getLayerCapabilities()
{
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents, WFS_THRESHOLD );
}

QByteArray response = reply->readAll();
reply->deleteLater();

@@ -1542,11 +1543,7 @@ void QgsWFSProvider::getLayerCapabilities()
return;
}

QDomElement operationsElem = featureTypeListElem.firstChildElement( "Operations" );
if ( !operationsElem.isNull() )
{
appendSupportedOperations( operationsElem, capabilities );
}
appendSupportedOperations( featureTypeListElem.firstChildElement( "Operations" ), capabilities );

//find the <FeatureType> for this layer
QString thisLayerName = parameterFromUrl( "typename" );

0 comments on commit d64ab21

Please sign in to comment.
You can’t perform that action at this time.