mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5310 Fix wrong use of new path id.
Used last used instead of first unused
This commit is contained in:
@@ -1399,7 +1399,7 @@ class GlobalPathListMapper
|
||||
public:
|
||||
GlobalPathListMapper( const QString& globalPathListTable )
|
||||
{
|
||||
m_nextValidIdNumber = 1;
|
||||
m_maxUsedIdNumber = 0;
|
||||
QStringList pathPairs = globalPathListTable.split( ";", QString::SkipEmptyParts );
|
||||
|
||||
for ( const QString& pathIdPathPair : pathPairs )
|
||||
@@ -1422,7 +1422,7 @@ public:
|
||||
|
||||
if ( isOk )
|
||||
{
|
||||
m_nextValidIdNumber = std::max( m_nextValidIdNumber, idNumber );
|
||||
m_maxUsedIdNumber = std::max( m_maxUsedIdNumber, idNumber );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1516,13 +1516,15 @@ public:
|
||||
private:
|
||||
QString createUnusedId()
|
||||
{
|
||||
QString numberString = QString( "%1" ).arg( (uint)m_nextValidIdNumber, 3, 10, QChar( '0' ) );
|
||||
m_maxUsedIdNumber++;
|
||||
|
||||
QString numberString = QString( "%1" ).arg( (uint)m_maxUsedIdNumber, 3, 10, QChar( '0' ) );
|
||||
QString pathIdentifier = PATHIDCHAR + pathIdBaseString + numberString + PATHIDCHAR;
|
||||
m_nextValidIdNumber++;
|
||||
|
||||
return pathIdentifier;
|
||||
}
|
||||
|
||||
size_t m_nextValidIdNumber; // Set when parsing the globalPathListTable. Increment while creating new id's
|
||||
size_t m_maxUsedIdNumber; // Set when parsing the globalPathListTable. Increment while creating new id's
|
||||
|
||||
std::map<QString, QString> m_newPathIdToPathMap;
|
||||
std::map<QString, QString> m_newPathToPathIdMap;
|
||||
|
||||
@@ -193,7 +193,7 @@ protected:
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
void fieldContentsByType( caf::PdmObjectHandle* object, std::vector<T*>& typedFields );
|
||||
void fieldContentsByType( caf::PdmObjectHandle* object, std::vector<T*>& fieldContents );
|
||||
|
||||
void transferPathsToGlobalPathList();
|
||||
void distributePathsFromGlobalPathList();
|
||||
@@ -225,7 +225,7 @@ private:
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void RimProject::fieldContentsByType( caf::PdmObjectHandle* object, std::vector<T*>& typedFields )
|
||||
void RimProject::fieldContentsByType( caf::PdmObjectHandle* object, std::vector<T*>& fieldContents )
|
||||
{
|
||||
if ( !object ) return;
|
||||
|
||||
@@ -237,14 +237,14 @@ void RimProject::fieldContentsByType( caf::PdmObjectHandle* object, std::vector<
|
||||
for ( const auto& field : allFieldsInObject )
|
||||
{
|
||||
caf::PdmField<T>* typedField = dynamic_cast<caf::PdmField<T>*>( field );
|
||||
if ( typedField ) typedFields.push_back( &typedField->v() );
|
||||
if ( typedField ) fieldContents.push_back( &typedField->v() );
|
||||
|
||||
caf::PdmField<std::vector<T>>* typedFieldInVector = dynamic_cast<caf::PdmField<std::vector<T>>*>( field );
|
||||
if ( typedFieldInVector )
|
||||
{
|
||||
for ( T& typedFieldFromVector : typedFieldInVector->v() )
|
||||
{
|
||||
typedFields.push_back( &typedFieldFromVector );
|
||||
fieldContents.push_back( &typedFieldFromVector );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +253,6 @@ void RimProject::fieldContentsByType( caf::PdmObjectHandle* object, std::vector<
|
||||
|
||||
for ( const auto& child : children )
|
||||
{
|
||||
fieldContentsByType( child, typedFields );
|
||||
fieldContentsByType( child, fieldContents );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user