mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
#6597: Provide sensible defaults for elastic property scaling.
This commit is contained in:
parent
c16348eaaa
commit
5e31df53bc
@ -44,11 +44,11 @@ void RicNewElasticPropertyScalingFeature::onActionTriggered( bool isChecked )
|
||||
RimElasticPropertyScalingCollection* scalingColl = elasticProperties->scalingCollection();
|
||||
if ( !scalingColl ) return;
|
||||
|
||||
RimElasticPropertyScaling* fractureModelTemplate = new RimElasticPropertyScaling;
|
||||
RimElasticPropertyScaling* elasticPropertyScaling = new RimElasticPropertyScaling;
|
||||
|
||||
scalingColl->addElasticPropertyScaling( fractureModelTemplate );
|
||||
scalingColl->addElasticPropertyScaling( elasticPropertyScaling );
|
||||
scalingColl->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( fractureModelTemplate );
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( elasticPropertyScaling );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -44,7 +44,8 @@ RimElasticPropertyScaling::RimElasticPropertyScaling()
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_formation, "Formation", "Formation", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "Facies", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_property, "Property", "Property", "", "", "" );
|
||||
caf::AppEnum<RiaDefines::CurveProperty> defaultProperty = RiaDefines::CurveProperty::YOUNGS_MODULUS;
|
||||
CAF_PDM_InitScriptableField( &m_property, "Property", defaultProperty, "Property", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_scale, "Scale", 1.0, "Scale", "", "", "" );
|
||||
|
||||
nameField()->uiCapability()->setUiReadOnly( true );
|
||||
@ -69,10 +70,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
if ( fieldNeedingOptions == &m_formation )
|
||||
{
|
||||
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
|
||||
if ( !eclipseCaseData ) return options;
|
||||
|
||||
std::vector<QString> formationNames = eclipseCaseData->formationNames();
|
||||
std::vector<QString> formationNames = getFormationNames();
|
||||
for ( const QString& formationName : formationNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( formationName, formationName ) );
|
||||
@ -80,14 +78,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_facies )
|
||||
{
|
||||
RimFractureModelTemplate* fractureModelTemplate;
|
||||
firstAncestorOrThisOfType( fractureModelTemplate );
|
||||
if ( !fractureModelTemplate ) return options;
|
||||
|
||||
RimFaciesProperties* faciesProperties = fractureModelTemplate->faciesProperties();
|
||||
if ( !faciesProperties ) return options;
|
||||
|
||||
RimColorLegend* faciesColors = faciesProperties->colorLegend();
|
||||
RimColorLegend* faciesColors = getFaciesColorLegend();
|
||||
if ( !faciesColors ) return options;
|
||||
|
||||
for ( RimColorLegendItem* item : faciesColors->colorLegendItems() )
|
||||
@ -105,6 +96,8 @@ QList<caf::PdmOptionItemInfo>
|
||||
}
|
||||
}
|
||||
|
||||
if ( useOptionsOnly ) *useOptionsOnly = true;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@ -143,6 +136,9 @@ RigEclipseCaseData* RimElasticPropertyScaling::getEclipseCaseData()
|
||||
return eclipseCase->eclipseCaseData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticPropertyScaling::updateAutoName()
|
||||
{
|
||||
QString name = QString( "%1/%2 - %3: %4" )
|
||||
@ -153,6 +149,32 @@ void RimElasticPropertyScaling::updateAutoName()
|
||||
setName( name );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegend* RimElasticPropertyScaling::getFaciesColorLegend()
|
||||
{
|
||||
RimFractureModelTemplate* fractureModelTemplate;
|
||||
firstAncestorOrThisOfType( fractureModelTemplate );
|
||||
if ( !fractureModelTemplate ) return nullptr;
|
||||
|
||||
RimFaciesProperties* faciesProperties = fractureModelTemplate->faciesProperties();
|
||||
if ( !faciesProperties ) return nullptr;
|
||||
|
||||
return faciesProperties->colorLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimElasticPropertyScaling::getFormationNames()
|
||||
{
|
||||
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
|
||||
if ( !eclipseCaseData ) return std::vector<QString>();
|
||||
|
||||
return eclipseCaseData->formationNames();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -220,3 +242,23 @@ double RimElasticPropertyScaling::scale() const
|
||||
{
|
||||
return m_scale;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticPropertyScaling::ensureDefaultFormationAndFacies()
|
||||
{
|
||||
RimColorLegend* faciesColorLegend = getFaciesColorLegend();
|
||||
if ( faciesColorLegend && !faciesColorLegend->colorLegendItems().empty() )
|
||||
{
|
||||
m_facies = faciesColorLegend->colorLegendItems().front()->categoryName();
|
||||
}
|
||||
|
||||
std::vector<QString> formationNames = getFormationNames();
|
||||
if ( !formationNames.empty() )
|
||||
{
|
||||
m_formation = formationNames.front();
|
||||
}
|
||||
|
||||
updateAutoName();
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
class RimEclipseCase;
|
||||
class RigEclipseCaseData;
|
||||
class RimColorLegend;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -46,6 +47,12 @@ public:
|
||||
RiaDefines::CurveProperty property() const;
|
||||
double scale() const;
|
||||
|
||||
void setFormation( const QString& formation );
|
||||
void setFacies( const QString& facies );
|
||||
void setScale( double m_scale );
|
||||
void setProperty( RiaDefines::CurveProperty property );
|
||||
void ensureDefaultFormationAndFacies();
|
||||
|
||||
caf::Signal<> changed;
|
||||
|
||||
protected:
|
||||
@ -57,16 +64,12 @@ protected:
|
||||
static RigEclipseCaseData* getEclipseCaseData();
|
||||
|
||||
private:
|
||||
void updateAutoName();
|
||||
RimColorLegend* getFaciesColorLegend();
|
||||
std::vector<QString> getFormationNames();
|
||||
|
||||
caf::PdmField<QString> m_formation;
|
||||
caf::PdmField<QString> m_facies;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::CurveProperty>> m_property;
|
||||
caf::PdmField<double> m_scale;
|
||||
|
||||
void updateAutoName();
|
||||
|
||||
public:
|
||||
void setFormation( const QString& formation );
|
||||
void setFacies( const QString& facies );
|
||||
void setScale( double m_scale );
|
||||
void setProperty( RiaDefines::CurveProperty property );
|
||||
};
|
||||
|
@ -72,6 +72,7 @@ void RimElasticPropertyScalingCollection::addElasticPropertyScaling( RimElasticP
|
||||
{
|
||||
scaling->changed.connect( this, &RimElasticPropertyScalingCollection::elasticPropertyScalingChanged );
|
||||
m_elasticPropertyScalings.push_back( scaling );
|
||||
scaling->ensureDefaultFormationAndFacies();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user