Skip to content

Commit

Permalink
render first datasetgroup instead of mesh frame
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jan 24, 2019
1 parent abda6c4 commit a83a1b2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/core/mesh/qgsmeshlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,24 @@ QgsMeshLayer::QgsMeshLayer( const QString &meshLayerPath,
}

setLegend( QgsMapLayerLegend::defaultMeshLegend( this ) );

// show at least the mesh by default so we render something
QgsMeshRendererMeshSettings meshSettings;
meshSettings.setEnabled( true );
mRendererSettings.setNativeMeshSettings( meshSettings );

setDefaultRendererSettings();
} // QgsMeshLayer ctor


void QgsMeshLayer::setDefaultRendererSettings()
{
if ( mDataProvider && mDataProvider->datasetGroupCount() > 0 )
{
// show data from the first dataset group
mRendererSettings.setActiveScalarDataset( QgsMeshDatasetIndex( 0, 0 ) );
}
else
{
// show at least the mesh by default
QgsMeshRendererMeshSettings meshSettings;
meshSettings.setEnabled( true );
mRendererSettings.setNativeMeshSettings( meshSettings );
}
}

QgsMeshLayer::~QgsMeshLayer()
{
Expand Down
1 change: 1 addition & 0 deletions src/core/mesh/qgsmeshlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ class CORE_EXPORT QgsMeshLayer : public QgsMapLayer
private:
void fillNativeMesh();
void assignDefaultStyleToDatasetGroup( int groupIndex );
void setDefaultRendererSettings();

private slots:
void onDatasetGroupsAdded( int count );
Expand Down

0 comments on commit a83a1b2

Please sign in to comment.