Skip to content

Commit

Permalink
More 3d and use jsonobject attrs in exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Apr 16, 2019
1 parent be8822e commit 75537a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/core/geometry/qgsmultipoint.cpp
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsjsonutils.cpp
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 75537a4

Please sign in to comment.