Skip to content
Permalink
Browse files

Better support of TypeName and FeatureId in QGIS Server WFS

  • Loading branch information
rldhont committed Nov 16, 2012
1 parent bfa08c5 commit 845edd90e8b36322443b46d8275696604d504f5f
@@ -46,6 +46,8 @@ class QgsConfigParser
virtual void featureTypeList( QDomElement& parentElement, QDomDocument& doc ) const = 0;

virtual void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const = 0;
/**Returns one or possibly several maplayers for a given type name. If no layers/style are found, an empty list is returned*/
virtual QList<QgsMapLayer*> mapLayerFromTypeName( const QString& tName, bool useCache = true ) const = 0;

/**Returns one or possibly several maplayers for a given layer name and style. If there are several layers, the layers should be drawn in inverse list order.
If no layers/style are found, an empty list is returned
@@ -384,6 +384,37 @@ void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElemen
return;
}

QList<QgsMapLayer*> QgsProjectParser::mapLayerFromTypeName( const QString& tName, bool useCache ) const
{
QList<QgsMapLayer*> layerList;

if ( mProjectLayerElements.size() < 1 )
{
return layerList;
}

QStringList wfsLayersId = wfsLayers();

foreach ( const QDomElement &elem, mProjectLayerElements )
{
QString type = elem.attribute( "type" );
if ( type == "vector" )
{
QgsMapLayer *mLayer = createLayerFromElement( elem, useCache );
QgsVectorLayer* layer = dynamic_cast<QgsVectorLayer*>( mLayer );

QString typeName = layer->name();
typeName = typeName.replace( QString( " " ), QString( "_" ) );
if ( tName == typeName )
{
layerList.push_back( mLayer );
return layerList;
}
}
}
return layerList;
}

void QgsProjectParser::addLayers( QDomDocument &doc,
QDomElement &parentElem,
const QDomElement &legendElem,
@@ -46,6 +46,8 @@ class QgsProjectParser: public QgsConfigParser
virtual void featureTypeList( QDomElement& parentElement, QDomDocument& doc ) const;

virtual void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const;
/**Returns one or possibly several maplayers for a given type name. If no layers/style are found, an empty list is returned*/
virtual QList<QgsMapLayer*> mapLayerFromTypeName( const QString& tName, bool useCache = true ) const;

int numberOfLayers() const;

@@ -59,6 +59,8 @@ class QgsSLDParser: public QgsConfigParser
void featureTypeList( QDomElement &, QDomDocument & ) const {}

void describeFeatureType( const QString& , QDomElement& , QDomDocument& ) const {}
/**Returns one or possibly several maplayers for a given type name. If no layers/style are found, an empty list is returned*/
QList<QgsMapLayer*> mapLayerFromTypeName( const QString&, bool ) const { QList<QgsMapLayer*> layerList; return layerList; }

/**Returns number of layers in configuration*/
int numberOfLayers() const;

0 comments on commit 845edd9

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