Skip to content
Permalink
Browse files
Re-enable GetCapabilities in WFS server
  • Loading branch information
mhugent committed Apr 2, 2014
1 parent db87e4d commit 1a7ad762e94fbcb574e89fd1b4a0d6cdde57fc72
@@ -50,12 +50,30 @@ QgsWCSProjectParser* QgsConfigCache::wcsConfiguration( const QString& filePath )

QgsWFSProjectParser* QgsConfigCache::wfsConfiguration( const QString& filePath )
{
return 0; //todo...
QgsWFSProjectParser* p = mWFSConfigCache.object( filePath );
if ( p )
{
return p;
}

QDomDocument* doc = xmlDocument( filePath );
if ( !doc )
{
return 0;
}

p = new QgsWFSProjectParser( doc, filePath );
mWFSConfigCache.insert( filePath, p );
return p;
}

QgsWMSConfigParser* QgsConfigCache::wmsConfiguration( const QString& filePath )
{
QgsWMSConfigParser* p = mWMSConfigCache.object( filePath );
if ( p )
{
return p;
}

QDomDocument* doc = xmlDocument( filePath );
if ( !doc )
@@ -25,6 +25,7 @@

#include <QDomDocument>
#include <QDomElement>
#include <QFile>
#include <QString>

#include <sqlite3.h>
@@ -184,3 +185,21 @@ QStringList QgsConfigParserUtils::createCRSListForLayer( QgsMapLayer* theMapLaye
sqlite3_close( myDatabase );
return crsNumbers;
}

void QgsConfigParserUtils::fallbackServiceCapabilities( QDomElement& parentElement, QDomDocument& doc )
{
Q_UNUSED( doc );
QFile wmsService( "wms_metadata.xml" );
if ( wmsService.open( QIODevice::ReadOnly ) )
{
QDomDocument externServiceDoc;
QString parseError;
int errorLineNo;
if ( externServiceDoc.setContent( &wmsService, false, &parseError, &errorLineNo ) )
{
wmsService.close();
QDomElement service = externServiceDoc.firstChildElement();
parentElement.appendChild( service );
}
}
}
@@ -38,6 +38,9 @@ class QgsConfigParserUtils
const QgsCoordinateReferenceSystem& layerCRS );
/**Returns a list of supported EPSG coordinate system numbers from a layer*/
static QStringList createCRSListForLayer( QgsMapLayer* theMapLayer );

/**Returns default service capabilities from wms_metadata.xml if nothing else is defined*/
static void fallbackServiceCapabilities( QDomElement& parentElement, QDomDocument& doc );
};

#endif // QGSCONFIGPARSERUTILS_H
@@ -303,6 +303,27 @@ QString QgsServerProjectParser::layerName( const QDomElement& layerElem ) const
return nameElem.text().replace( "," , "%60" ); //commas are not allowed in layer names
}

QString QgsServerProjectParser::serviceUrl() const
{
QString url;

if ( !mXMLDoc )
{
return url;
}

QDomElement propertiesElement = propertiesElem();
if ( !propertiesElement.isNull() )
{
QDomElement wmsUrlElem = propertiesElement.firstChildElement( "WMSUrl" );
if ( !wmsUrlElem.isNull() )
{
url = wmsUrlElem.text();
}
}
return url;
}

void QgsServerProjectParser::combineExtentAndCrsOfGroupChildren( QDomElement& groupElem, QDomDocument& doc, bool considerMapExtent ) const
{
QgsRectangle combinedBBox;
@@ -101,6 +101,10 @@ class QgsServerProjectParser
@return id or a null string in case of error*/
QString layerName( const QDomElement& layerElem ) const;

QString serviceUrl() const;

QStringList wfsLayers() const;

private:

/**Content of project file*/
@@ -135,8 +139,6 @@ class QgsServerProjectParser

/**Adds sublayers of an embedded group to layer set*/
static void sublayersOfEmbeddedGroup( const QString& projectFilePath, const QString& groupName, QSet<QString>& layerSet );

QStringList wfsLayers() const;
};

#endif // QGSSERVERPROJECTPARSER_H

0 comments on commit 1a7ad76

Please sign in to comment.