#5665 Fix import of element properties in saved projects.

The RigFemPartResultsCollection result cache could contain entries without data if
a query for that particular result had been made before the file had been
imported.
This commit is contained in:
Kristian Bendiksen 2020-04-03 22:29:19 +02:00 committed by Gaute Lindkvist
parent 2a11e8f4a1
commit a0014f9d05

View File

@ -165,9 +165,23 @@ const RigFormationNames* RigFemPartResultsCollection::activeFormationNames() con
//--------------------------------------------------------------------------------------------------
void RigFemPartResultsCollection::addElementPropertyFiles( const std::vector<QString>& filenames )
{
std::vector<RigFemResultAddress> newAddresses;
for ( const QString& filename : filenames )
{
m_elementPropertyReader->addFile( filename.toStdString() );
// Collect all addresses which was added in this file
std::vector<std::string> fields = m_elementPropertyReader->fieldsInFile( filename.toStdString() );
for ( const std::string& field : fields )
{
newAddresses.push_back( RigFemResultAddress( RIG_ELEMENT, field, "" ) );
}
}
// Invalidate previous result if already in cache
for ( const RigFemResultAddress& address : newAddresses )
{
this->deleteResult( address );
}
}