Skip to content
Permalink
Browse files

More 3d and use jsonobject attrs in exporter

  • Loading branch information
elpaso committed Apr 8, 2019
1 parent be8822e commit 75537a4365ba64d7b6cc7aaf9ca49b1ba1198ad1
Showing with 7 additions and 4 deletions.
  1. +4 −1 src/core/geometry/qgsmultipoint.cpp
  2. +3 −3 src/core/qgsjsonutils.cpp
@@ -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
@@ -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;

0 comments on commit 75537a4

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