Remove old polygon annotations. (#11404)

* Remove old polygon annotations from GUI. 
* Upgrade old annotation objects to new polygon objects on load.
This commit is contained in:
jonjenssen
2024-05-01 10:50:19 +02:00
committed by GitHub
parent 4617bcc673
commit 2e4ca390c7
24 changed files with 119 additions and 1084 deletions

View File

@@ -1207,28 +1207,6 @@ std::vector<RimReachCircleAnnotation*> RimProject::reachCircleAnnotations() cons
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPolylinesAnnotation*> RimProject::polylineAnnotations() const
{
std::vector<RimPolylinesAnnotation*> annotations;
for ( const auto& oilField : oilFields() )
{
auto annotationColl = oilField->annotationCollection();
for ( const auto& annotation : annotationColl->userDefinedPolylineAnnotations() )
{
annotations.push_back( annotation );
}
for ( const auto& annotation : annotationColl->polylinesFromFileAnnotations() )
{
annotations.push_back( annotation );
}
}
return annotations;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1593,6 +1571,36 @@ void RimProject::transferPathsToGlobalPathList()
m_globalPathList = variableMapper.variableTableAsText();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimProject::updatedFilePathFromPathId( QString filePath, RiaVariableMapper* pathListMapper /*=nullptr*/ ) const
{
std::unique_ptr<RiaVariableMapper> internalMapper;
if ( pathListMapper == nullptr )
{
internalMapper.reset( new RiaVariableMapper( m_globalPathList ) );
pathListMapper = internalMapper.get();
}
QString returnValue = filePath;
QString pathIdCandidate = filePath.trimmed();
QStringList pathIdComponents = pathIdCandidate.split( RiaVariableMapper::variableToken() );
if ( pathIdComponents.size() == 3 && pathIdComponents[0].size() == 0 && pathIdComponents[1].size() > 0 && pathIdComponents[2].size() == 0 )
{
bool isFound = false;
QString path = pathListMapper->valueForVariable( pathIdCandidate, &isFound );
if ( isFound )
{
returnValue = path;
}
}
return returnValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1602,19 +1610,7 @@ void RimProject::distributePathsFromGlobalPathList()
for ( caf::FilePath* filePath : allFilePaths() )
{
QString pathIdCandidate = filePath->path().trimmed();
QStringList pathIdComponents = pathIdCandidate.split( RiaVariableMapper::variableToken() );
if ( pathIdComponents.size() == 3 && pathIdComponents[0].size() == 0 && pathIdComponents[1].size() > 0 &&
pathIdComponents[2].size() == 0 )
{
bool isFound = false;
QString path = pathListMapper.valueForVariable( pathIdCandidate, &isFound );
if ( isFound )
{
filePath->setPath( path );
}
}
filePath->setPath( updatedFilePathFromPathId( filePath->path(), &pathListMapper ) );
}
for ( auto summaryCase : allSummaryCases() )