#6234 Use color legend from template.

This commit is contained in:
Kristian Bendiksen 2020-09-24 09:19:20 +02:00
parent 851e245f83
commit a7b2a28df7
6 changed files with 67 additions and 20 deletions

View File

@ -33,10 +33,12 @@
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimElasticPropertiesCurve.h"
#include "RimFaciesProperties.h"
#include "RimFractureModel.h"
#include "RimFractureModelCurve.h"
#include "RimFractureModelPlot.h"
#include "RimFractureModelPlotCollection.h"
#include "RimFractureModelTemplate.h"
#include "RimLayerCurve.h"
#include "RimMainPlotCollection.h"
#include "RimModeledWellPath.h"
@ -268,8 +270,19 @@ void RicNewFractureModelPlotFeature::createFaciesTrack( RimFractureModelPlot* pl
faciesTrack->setOverburdenHeight( fractureModel->overburdenHeight() );
faciesTrack->setUnderburdenHeight( fractureModel->underburdenHeight() );
RimColorLegend* faciesColors =
RimProject::current()->colorLegendCollection()->findByName( RiaDefines::faciesColorLegendName() );
RimFractureModelTemplate* fractureModelTemplate = fractureModel->fractureModelTemplate();
if ( !fractureModelTemplate )
{
return;
}
RimFaciesProperties* faciesProperties = fractureModelTemplate->faciesProperties();
if ( !faciesProperties )
{
return;
}
RimColorLegend* faciesColors = faciesProperties->colorLegend();
if ( faciesColors )
{
faciesTrack->setColorShadingLegend( faciesColors );
@ -319,8 +332,19 @@ void RicNewFractureModelPlotFeature::createLayersTrack( RimFractureModelPlot* pl
faciesTrack->setFormationWellPath( fractureModel->thicknessDirectionWellPath() );
faciesTrack->setFormationCase( eclipseCase );
RimColorLegend* faciesColors =
RimProject::current()->colorLegendCollection()->findByName( RiaDefines::faciesColorLegendName() );
RimFractureModelTemplate* fractureModelTemplate = fractureModel->fractureModelTemplate();
if ( !fractureModelTemplate )
{
return;
}
RimFaciesProperties* faciesProperties = fractureModelTemplate->faciesProperties();
if ( !faciesProperties )
{
return;
}
RimColorLegend* faciesColors = faciesProperties->colorLegend();
if ( faciesColors )
{
faciesTrack->setColorShadingLegend( faciesColors );

View File

@ -95,6 +95,8 @@ void RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( const QStri
colorLegendCollection->appendCustomColorLegend( colorLegend );
colorLegendCollection->updateConnectedEditors();
faciesProperties->setColorLegend( colorLegend );
}
faciesProperties->setFilePath( filePath );

View File

@ -42,12 +42,8 @@
#include "RimEllipseFractureTemplate.h"
#include "RimFaciesProperties.h"
#include "RimFractureModelPlot.h"
#include "RimModeledWellPath.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimStimPlanColors.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimTools.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@ -188,8 +184,9 @@ QList<caf::PdmOptionItemInfo>
}
else if ( fieldNeedingOptions == &m_overburdenFacies || fieldNeedingOptions == &m_underburdenFacies )
{
RimColorLegend* faciesColors =
RimProject::current()->colorLegendCollection()->findByName( RiaDefines::faciesColorLegendName() );
if ( !m_faciesProperties ) return options;
RimColorLegend* faciesColors = m_faciesProperties->colorLegend();
if ( faciesColors )
{
for ( RimColorLegendItem* item : faciesColors->colorLegendItems() )

View File

@ -32,6 +32,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimElasticProperties.h"
#include "RimFaciesProperties.h"
#include "RimFractureModel.h"
#include "RimFractureModelPlot.h"
#include "RimFractureModelTemplate.h"
@ -203,16 +204,6 @@ void RimElasticPropertiesCurve::performDataExtraction( bool* isUsingPseudoLength
return;
}
// TODO: make this settable??
QString colorLegendName = RiaDefines::faciesColorLegendName();
RimColorLegend* colorLegend = RimProject::current()->colorLegendCollection()->findByName( colorLegendName );
if ( !colorLegend )
{
RiaLogging::error(
QString( "No color legend found when extracting elastic properties. Looked for '%1'" ).arg( colorLegendName ) );
return;
}
RimFractureModelTemplate* fractureModelTemplate = m_fractureModel->fractureModelTemplate();
if ( !fractureModelTemplate )
{
@ -220,6 +211,20 @@ void RimElasticPropertiesCurve::performDataExtraction( bool* isUsingPseudoLength
return;
}
RimFaciesProperties* faciesProperties = fractureModelTemplate->faciesProperties();
if ( !faciesProperties )
{
RiaLogging::error( QString( "No facies properties found when extracting elastic properties." ) );
return;
}
RimColorLegend* colorLegend = faciesProperties->colorLegend();
if ( !colorLegend )
{
RiaLogging::error( QString( "No color legend found when extracting elastic properties." ) );
return;
}
RimElasticProperties* elasticProperties = fractureModelTemplate->elasticProperties();
if ( !elasticProperties )
{

View File

@ -202,3 +202,19 @@ void RimFaciesProperties::setEclipseCase( RimEclipseCase* eclipseCase )
{
m_faciesDefinition->setEclipseCase( eclipseCase );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimColorLegend* RimFaciesProperties::colorLegend() const
{
return m_colorLegend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaciesProperties::setColorLegend( RimColorLegend* colorLegend )
{
m_colorLegend = colorLegend;
}

View File

@ -50,6 +50,9 @@ public:
void loadDataAndUpdate();
RimColorLegend* colorLegend() const;
void setColorLegend( RimColorLegend* colorLegend );
protected:
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,