Refactor: use new base class WellLog where possible.

This commit is contained in:
Kristian Bendiksen committed 2024-06-14 17:31:22 +02:00
1 parent a0ebb6e496
commit 0477371e0d
10 files changed
+81 -51

No files matched your search

@@ -74,7 +74,7 @@ void RicImportWellLogCsvFileFeature::onActionTriggered( bool isChecked )
QString errorMessage;
if ( !wellLogCsvFile->readFile( &errorMessage ) )
{
wellPath->deleteWellLogFile( wellLogCsvFile );
wellPath->deleteWellLog( wellLogCsvFile );
QString displayMessage = "Errors opening the CSV file: \n" + errorMessage;
RiaLogging::errorInMessageBox( Riu3DMainWindowTools::mainWindowWidget(), "File open error", displayMessage );
return;
@@ -160,14 +160,14 @@ void RicWellLogTools::addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::selectedWellPathWithLogFile()
RimWellPath* RicWellLogTools::selectedWellPathWithLog()
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( !selection.empty() )
{
RimWellPath* wellPath = selection[0];
if ( !wellPath->wellLogFiles().empty() )
if ( !wellPath->wellLogs().empty() )
{
return wellPath;
}
@@ -179,10 +179,10 @@ RimWellPath* RicWellLogTools::selectedWellPathWithLogFile()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
RimWellPath* RicWellLogTools::findWellPathWithLogFromSelection()
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( wellPath && !wellPath->wellLogFiles().empty() )
if ( wellPath && !wellPath->wellLogs().empty() )
{
return wellPath;
}
@@ -51,8 +51,8 @@ public:
static bool hasRftDataForWell( const QString& wellName );
static bool isWellPathOrSimWellSelectedInView();
static void addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack, const std::vector<RimWellLogChannel*>& wellLogFileChannels );
static RimWellPath* selectedWellPathWithLogFile();
static RimWellPath* findWellPathWithLogFileFromSelection();
static RimWellPath* selectedWellPathWithLog();
static RimWellPath* findWellPathWithLogFromSelection();
static RimWellLogRftCurve* addRftCurve( RimWellLogTrack* plotTrack, const RimSimWellInView* simWell, bool showPlotWindow = true );
static RimWellLogLasFileCurve* addFileCurve( RimWellLogTrack* plotTrack, bool showPlotWindow = true );
@@ -38,7 +38,7 @@ bool RicAdd3dWellLogFileCurveFeature::isCommandEnabled() const
std::vector<RimCase*> cases = RimProject::current()->allGridCases();
if ( cases.empty() ) return false;
return ( RicWellLogTools::findWellPathWithLogFileFromSelection() != nullptr );
return ( RicWellLogTools::findWellPathWithLogFromSelection() != nullptr );
}
//--------------------------------------------------------------------------------------------------
@@ -46,7 +46,7 @@ bool RicAdd3dWellLogFileCurveFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogFileCurveFeature::onActionTriggered( bool isChecked )
{
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathWithLogFileFromSelection();
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathWithLogFromSelection();
if ( !selectedWellPath ) return;
Rim3dWellLogFileCurve* rim3dWellLogFileCurve = new Rim3dWellLogFileCurve();
@@ -61,8 +61,8 @@ void RicMoveWellLogFilesFeature::onActionTriggered( bool isChecked )
if ( !destWellPath || !wellLogFile || !sourceWellPath ) return;
sourceWellPath->detachWellLogFile( wellLogFile );
destWellPath->addWellLogFile( wellLogFile );
sourceWellPath->detachWellLog( wellLogFile );
destWellPath->addWellLog( wellLogFile );
sourceWellPath->updateConnectedEditors();
destWellPath->updateConnectedEditors();
@@ -48,7 +48,7 @@ bool RicNewWellLogFileCurveFeature::isCommandEnabled() const
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
return ( caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>() != nullptr && wellLogFilesAvailable() ) ||
RicWellLogTools::selectedWellPathWithLogFile() != nullptr;
RicWellLogTools::selectedWellPathWithLog() != nullptr;
}
//--------------------------------------------------------------------------------------------------
@@ -63,7 +63,7 @@ void RicNewWellLogFileCurveFeature::onActionTriggered( bool isChecked )
}
else
{
RimWellPath* wellPath = RicWellLogTools::selectedWellPathWithLogFile();
RimWellPath* wellPath = RicWellLogTools::selectedWellPathWithLog();
if ( wellPath )
{
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
@@ -59,7 +59,7 @@ void RicWellLogFileCloseFeature::onActionTriggered( bool isChecked )
if ( parentWellPath )
{
std::set<RimViewWindow*> referringPlots = referringWellLogPlots( wellLogFile );
parentWellPath->deleteWellLogFile( wellLogFile );
parentWellPath->deleteWellLog( wellLogFile );
for ( RimViewWindow* plot : referringPlots )
{