Skip to content
Permalink
Browse files

Update method's name and add doc

  • Loading branch information
pblottiere committed Jan 18, 2019
1 parent 03447f8 commit 5da6004b7835245314f17c6131768f399168e327
Showing with 16 additions and 5 deletions.
  1. +1 −1 src/core/qgsjsonutils.cpp
  2. +14 −3 src/core/qgsjsonutils.h
  3. +1 −1 src/server/services/wms/qgswmsrenderer.cpp
@@ -238,7 +238,7 @@ QString QgsJsonExporter::exportFeatures( const QgsFeatureList &features ) const
}

QString layerName;
if ( mIncludeLayerName )
if ( mIncludeName )
layerName.append( QStringLiteral( "\n \"name\": \"%1\",\n" ).arg( mLayer->name() ) );

return QStringLiteral( "{%1 \"type\": \"FeatureCollection\",\n \"features\":[\n%2\n]}" ).arg( layerName, featureJSON.join( QStringLiteral( ",\n" ) ) );
@@ -75,9 +75,20 @@ class CORE_EXPORT QgsJsonExporter
*/
bool includeGeometry() const { return mIncludeGeometry; }

void setIncludeLayerName( bool includeLayerName ) { mIncludeLayerName = includeLayerName; }
/**
* Sets whether to include layer's name in the JSON exports.
* \param includeName set to false to prevent name inclusion
* \see includeName()
* \since QGIS 3.6
*/
void setIncludeName( bool includeName ) { mIncludeName = includeName; }

bool includeLayerName() const { return mIncludeLayerName; }
/**
* Returns whether layer's name will be included in the JSON exports.
* \see setIncludeName()
* \since QGIS 3.6
*/
bool includeName() const { return mIncludeName; }

/**
* Sets whether to include attributes in the JSON exports.
@@ -227,7 +238,7 @@ class CORE_EXPORT QgsJsonExporter

QgsCoordinateTransform mTransform;

bool mIncludeLayerName = false;
bool mIncludeName = false;
};

/**
@@ -2340,7 +2340,7 @@ namespace QgsWms
QgsJsonExporter exporter( vl );
exporter.setAttributes( attributes );
exporter.setIncludeGeometry( withGeometry );
exporter.setIncludeLayerName( true );
exporter.setIncludeName( true );

if ( i > 0 )
json.append( QStringLiteral( "," ) );

0 comments on commit 5da6004

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