More 3d and use jsonobject attrs in exporter

This commit is contained in:
Alessandro Pasotti 2019-04-08 10:42:19 +02:00
parent be8822ed8b
commit 75537a4365
2 changed files with 7 additions and 4 deletions

View File

@ -136,7 +136,10 @@ QJsonObject QgsMultiPoint::asJsonObject( int precision ) const
if ( qgsgeometry_cast<const QgsPoint *>( geom ) )
{
const QgsPoint *point = static_cast<const QgsPoint *>( geom );
coordinates.append( QJsonArray( { point->x(), point->y() } ) );
if ( point->is3D() )
coordinates.append( QJsonArray( { qgsRound( point->x(), precision ), qgsRound( point->y(), precision ), qgsRound( point->z(), precision ) } ) );
else
coordinates.append( QJsonArray( { qgsRound( point->x(), precision ), qgsRound( point->y(), precision ) } ) );
}
}
return

View File

@ -301,8 +301,8 @@ QJsonObject QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &featur
if ( mLayer )
{
QgsEditorWidgetSetup setup = fields.at( i ).editorWidgetSetup();
QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() );
const QgsEditorWidgetSetup setup = fields.at( i ).editorWidgetSetup();
const QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() );
if ( formattersWhiteList.contains( fieldFormatter->id() ) )
val = fieldFormatter->representValue( mLayer.data(), i, setup.config(), QVariant(), val );
}
@ -353,7 +353,7 @@ QJsonObject QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &featur
QgsFeature relatedFet;
while ( it.nextFeature( relatedFet ) )
{
relatedFeatureAttributes += QgsJsonUtils::exportAttributes( relatedFet, childLayer, attributeWidgetCaches );
relatedFeatureAttributes += QgsJsonUtils::exportAttributesToJsonObject( relatedFet, childLayer, attributeWidgetCaches );
}
}
properties[ relation.name() ] = relatedFeatureAttributes;