Skip to content
Permalink
Browse files
[Server] Enhance WFS mapLayerFromTypeName
  • Loading branch information
rldhont committed Mar 20, 2017
1 parent 313d7ff commit d1e8c261c7cdd1ac01e92d445cba43b62b2248ae
Showing with 13 additions and 7 deletions.
  1. +13 −7 src/server/qgswfsprojectparser.cpp
@@ -564,18 +564,24 @@ QList<QgsMapLayer*> QgsWFSProjectParser::mapLayerFromTypeName( const QString& aT
QString type = elem.attribute( "type" );
if ( type == "vector" )
{
QString id = mProjectParser->layerId( elem );
if ( !wfsLayersId.contains( id ) )
continue;

QString typeName = mProjectParser->layerShortName( elem );
if ( typeName.isEmpty() )
typeName = mProjectParser->layerName( elem );
typeName = typeName.replace( " ", "_" );

if ( !aTypeName.isEmpty() && !typeNameList.contains( typeName ) )
continue;

QgsMapLayer *mLayer = mProjectParser->createLayerFromElement( elem );
QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( mLayer );
if ( !layer )
continue;

QString typeName = layer->name();
if ( !layer->shortName().isEmpty() )
typeName = layer->shortName();
typeName = typeName.replace( " ", "_" );

if ( wfsLayersId.contains( layer->id() ) && ( aTypeName == "" || typeNameList.contains( typeName ) ) )
layerList.push_back( mLayer );
layerList.push_back( mLayer );
}
}
return layerList;

0 comments on commit d1e8c26

Please sign in to comment.