Navigation Menu

Skip to content

Commit

Permalink
Better support of TypeName and FeatureId in QGIS Server WFS
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Nov 16, 2012
1 parent bfa08c5 commit 845edd9
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 200 deletions.
2 changes: 2 additions & 0 deletions src/mapserver/qgsconfigparser.h
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/mapserver/qgsprojectparser.h
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions src/mapserver/qgssldparser.h
Expand Up @@ -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;
Expand Down

0 comments on commit 845edd9

Please sign in to comment.