mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
More 3d and use jsonobject attrs in exporter
This commit is contained in:
parent
be8822ed8b
commit
75537a4365
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user