#2349 Elm Props: Only add files which are not already added

This commit is contained in:
Rebecca Cox 2018-01-12 11:00:46 +01:00
parent fe17d0edd4
commit 6aa2d99587

View File

@ -332,16 +332,32 @@ void RimGeoMechCase::setFormationNames(RimFormationNames* formationNames)
//--------------------------------------------------------------------------------------------------
void RimGeoMechCase::addElementPropertyFiles(const std::vector<QString>& fileNames)
{
for (const QString& fileName : fileNames)
std::vector<QString> newFileNames;
for (const QString& newFileNameToPossiblyAdd : fileNames)
{
m_elementPropertyFileNames.v().push_back(fileName);
bool fileAlreadyAdded = false;
for (const QString& existingFileName : m_elementPropertyFileNames.v())
{
if (existingFileName == newFileNameToPossiblyAdd)
{
fileAlreadyAdded = true;
break;
}
}
if (!fileAlreadyAdded)
{
newFileNames.push_back(newFileNameToPossiblyAdd);
m_elementPropertyFileNames.v().push_back(newFileNameToPossiblyAdd);
}
}
this->updateConnectedEditors();
if (m_geoMechCaseData.notNull())
{
geoMechData()->femPartResults()->addElementPropertyFiles(fileNames);
geoMechData()->femPartResults()->addElementPropertyFiles(newFileNames);
}
}