diff --git a/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp b/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp index a8b71fad14..e433a40253 100644 --- a/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp +++ b/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp @@ -87,6 +87,11 @@ void RicElasticPropertiesImportTools::importElasticPropertiesFromFile( const QSt RimElasticProperties* rimElasticProperties = stimPlanModelTemplate->elasticProperties(); if ( !rimElasticProperties ) rimElasticProperties = new RimElasticProperties; + + // Clear the properties to avoid keeping data which has been deleted + // from the file since the last import. + rimElasticProperties->clearProperties(); + for ( FaciesKey key : faciesKeys ) { std::vector matchingFacies; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp index 4fb5010481..666bb57a11 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp @@ -108,6 +108,14 @@ const RigElasticProperties& RimElasticProperties::propertiesForFacies( FaciesKey return m_properties.find( key )->second; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimElasticProperties::clearProperties() +{ + m_properties.clear(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.h index bb9a820c8d..12721b5983 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.h @@ -52,6 +52,7 @@ public: void setPropertiesForFacies( FaciesKey& key, const RigElasticProperties& properties ); bool hasPropertiesForFacies( FaciesKey& key ) const; const RigElasticProperties& propertiesForFacies( FaciesKey& key ) const; + void clearProperties(); void loadDataAndUpdate();