Replace RiaApplication::instance()->project() with RimProject::current().

Also remove uneccessary includes of RiaApplication.h.
This commit is contained in:
Kristian Bendiksen
2020-05-12 09:50:38 +02:00
committed by Magne Sjaastad
parent 7972ff8c02
commit c016c02e40
263 changed files with 320 additions and 610 deletions

View File

@@ -18,7 +18,6 @@
#include "RicfApplicationTools.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaWellNameComparer.h"
@@ -39,7 +38,7 @@ std::vector<RimWellPath*> RicfApplicationTools::wellPathsFromNames( const QStrin
QStringList* wellsNotFound )
{
std::vector<RimWellPath*> wellPaths;
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
auto allWellPaths = RimProject::current()->allWellPaths();
if ( !wellPathNames.empty() )
{
@@ -98,7 +97,7 @@ QStringList RicfApplicationTools::toQStringList( const std::vector<QString>& v )
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RicfApplicationTools::caseFromId( int caseId )
{
auto eclipseCases = RiaApplication::instance()->project()->eclipseCases();
auto eclipseCases = RimProject::current()->eclipseCases();
if ( caseId < 0 )
{
if ( !eclipseCases.empty() ) return eclipseCases.front();
@@ -118,7 +117,7 @@ RimEclipseCase* RicfApplicationTools::caseFromId( int caseId )
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewName( int caseId, const QString& viewName )
{
for ( RimEclipseCase* c : RiaApplication::instance()->project()->eclipseCases() )
for ( RimEclipseCase* c : RimProject::current()->eclipseCases() )
{
if ( c->caseId() == caseId )
{
@@ -140,7 +139,7 @@ RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewName( int caseId, con
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewId( int caseId, int viewId )
{
for ( RimEclipseCase* c : RiaApplication::instance()->project()->eclipseCases() )
for ( RimEclipseCase* c : RimProject::current()->eclipseCases() )
{
if ( c->caseId() == caseId )
{

View File

@@ -1,6 +1,5 @@
#include "RicfCloneView.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RicfCreateView.h"
@@ -34,7 +33,7 @@ RicfCloneView::RicfCloneView()
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicfCloneView::execute()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
std::vector<Rim3dView*> allViews;
project->descendantsIncludingThisOfType( allViews );

View File

@@ -27,7 +27,6 @@
#include "RimOilField.h"
#include "RimProject.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "cafPdmFieldIOScriptability.h"
@@ -54,8 +53,7 @@ caf::PdmScriptResponse RicfComputeCaseGroupStatistics::execute()
if ( m_groupId() >= 0 )
{
for ( RimIdenticalGridCaseGroup* group :
RiaApplication::instance()->project()->activeOilField()->analysisModels()->caseGroups )
for ( RimIdenticalGridCaseGroup* group : RimProject::current()->activeOilField()->analysisModels()->caseGroups )
{
for ( RimEclipseCase* c : group->statisticsCaseCollection->reservoirs )
{
@@ -67,8 +65,7 @@ caf::PdmScriptResponse RicfComputeCaseGroupStatistics::execute()
for ( int caseId : caseIds )
{
bool foundCase = false;
for ( RimIdenticalGridCaseGroup* group :
RiaApplication::instance()->project()->activeOilField()->analysisModels()->caseGroups )
for ( RimIdenticalGridCaseGroup* group : RimProject::current()->activeOilField()->analysisModels()->caseGroups )
{
for ( RimEclipseCase* c : group->statisticsCaseCollection->reservoirs )
{

View File

@@ -33,7 +33,6 @@
#include "RimProject.h"
#include "RimWellPath.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaWellNameComparer.h"
@@ -93,7 +92,7 @@ caf::PdmScriptResponse RicfCreateLgrForCompletions::execute()
RimEclipseCase* eclipseCase = nullptr;
{
for ( RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases() )
for ( RimEclipseCase* c : RimProject::current()->activeOilField()->analysisModels->cases() )
{
if ( c->caseId() == m_caseId() )
{

View File

@@ -33,7 +33,6 @@
#include "RimProject.h"
#include "RimWellPath.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaWellNameComparer.h"
@@ -83,7 +82,7 @@ caf::PdmScriptResponse RicfCreateMultipleFractures::execute()
{
using TOOLS = RicfApplicationTools;
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
RiuCreateMultipleFractionsUi* settings = project->dialogData()->multipleFractionsData();
// Get case and fracture template
@@ -184,7 +183,7 @@ bool RicfCreateMultipleFractures::validateArguments() const
//--------------------------------------------------------------------------------------------------
RimFractureTemplate* RicfCreateMultipleFractures::fractureTemplateFromId( int templateId ) const
{
for ( RimFractureTemplate* t : RiaApplication::instance()->project()->allFractureTemplates() )
for ( RimFractureTemplate* t : RimProject::current()->allFractureTemplates() )
{
if ( t->id() == templateId ) return t;
}

View File

@@ -49,7 +49,7 @@ caf::PdmScriptResponse RicfCreateSaturationPressurePlots::execute()
std::vector<int> caseIds = m_caseIds();
if ( caseIds.empty() )
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
if ( project )
{
auto eclipeCases = project->eclipseCases();
@@ -67,7 +67,7 @@ caf::PdmScriptResponse RicfCreateSaturationPressurePlots::execute()
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
}
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
if ( !project )
{
QString error( "No project loaded" );

View File

@@ -24,7 +24,6 @@
#include "RimIdenticalGridCaseGroup.h"
#include "RimProject.h"
#include "RiaApplication.h"
#include "Riu3DMainWindowTools.h"
#include "cafPdmFieldIOScriptability.h"
@@ -58,7 +57,7 @@ RicfCreateStatisticsCase::RicfCreateStatisticsCase()
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicfCreateStatisticsCase::execute()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups;
project->descendantsIncludingThisOfType( gridCaseGroups );

View File

@@ -1,6 +1,5 @@
#include "RicfCreateView.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "Rim3dView.h"
@@ -43,7 +42,7 @@ RicfCreateView::RicfCreateView()
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicfCreateView::execute()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
std::vector<RimCase*> allCases;
project->allCases( allCases );

View File

@@ -17,7 +17,6 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RicfCreateWellBoreStabilityPlotFeature.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "WellLogCommands/RicNewWellBoreStabilityPlotFeature.h"
@@ -63,7 +62,7 @@ RicfCreateWellBoreStabilityPlotFeature::RicfCreateWellBoreStabilityPlotFeature()
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicfCreateWellBoreStabilityPlotFeature::execute()
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
std::vector<RimGeoMechCase*> geoMechCases;
project->descendantsIncludingThisOfType( geoMechCases );

View File

@@ -89,7 +89,7 @@ caf::PdmScriptResponse RicfExportFlowCharacteristics::execute()
}
RimFlowPlotCollection* flowPlotColl =
RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
RimProject::current()->mainPlotCollection->flowPlotCollection();
if ( flowPlotColl )
{
RimFlowCharacteristicsPlot* plot = flowPlotColl->defaultFlowCharacteristicsPlot();

View File

@@ -89,7 +89,7 @@ caf::PdmScriptResponse RicfExportMsw::execute()
exportSettings.includeFractures = m_includeFractures;
exportSettings.fileSplit = m_fileSplit;
RimWellPath* wellPath = RiaApplication::instance()->project()->wellPathByName( m_wellPathName );
RimWellPath* wellPath = RimProject::current()->wellPathByName( m_wellPathName );
if ( !wellPath )
{
QString error = QString( "exportMsw: Could not find well path with name %1" ).arg( m_wellPathName() );

View File

@@ -18,7 +18,6 @@
#include "RicfExportProperty.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "ExportCommands/RicEclipseCellResultToFileImpl.h"

View File

@@ -20,7 +20,6 @@
#include "ExportCommands/RicEclipseCellResultToFileImpl.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RicfApplicationTools.h"

View File

@@ -80,7 +80,7 @@ caf::PdmScriptResponse RicfExportSimWellFractureCompletions::execute()
{
using TOOLS = RicfApplicationTools;
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
exportSettings->timeStep = m_timeStep;

View File

@@ -17,7 +17,6 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RicfExportWellLogPlotData.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "ExportCommands/RicExportToLasFileFeature.h"
@@ -83,7 +82,7 @@ caf::PdmScriptResponse RicfExportWellLogPlotData::execute()
if ( QFileInfo::exists( m_folder ) )
{
std::vector<RimWellLogPlot*> plots;
RiaApplication::instance()->project()->descendantsIncludingThisOfType( plots );
RimProject::current()->descendantsIncludingThisOfType( plots );
RicfExportWellLogPlotDataResult* result = new RicfExportWellLogPlotDataResult;
for ( RimWellLogPlot* plot : plots )

View File

@@ -119,7 +119,7 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
{
using TOOLS = RicfApplicationTools;
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
if ( m_timeStep < 0 )
@@ -171,7 +171,7 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
std::vector<RimWellPath*> wellPaths;
if ( m_wellPathNames().empty() )
{
for ( auto wellPath : RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths() )
for ( auto wellPath : RimProject::current()->activeOilField()->wellPathCollection->wellPaths() )
{
if ( wellPath->showWellPath() )
{
@@ -184,7 +184,7 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
for ( const QString& wellPathName : m_wellPathNames() )
{
RimWellPath* wellPath =
RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPathByName( wellPathName );
RimProject::current()->activeOilField()->wellPathCollection->wellPathByName( wellPathName );
if ( wellPath )
{
wellPaths.push_back( wellPath );

View File

@@ -17,7 +17,6 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RicfImportFormationNames.h"
#include "RiaApplication.h"
#include "RicImportFormationNamesFeature.h"
#include "RimCase.h"
@@ -68,7 +67,7 @@ caf::PdmScriptResponse RicfImportFormationNames::execute()
{
bool foundCase = false;
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases( cases );
RimProject::current()->allCases( cases );
for ( RimCase* rimCase : cases )
{
if ( rimCase->caseId() == m_applyToCaseId() )

View File

@@ -53,7 +53,7 @@ caf::PdmScriptResponse RicfRunOctaveScript::execute()
std::vector<int> caseIds = m_caseIds();
if ( caseIds.empty() )
{
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
if ( project )
{
auto eclipeCases = project->eclipseCases();

View File

@@ -19,7 +19,6 @@
#include "RicfScaleFractureTemplate.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimFractureTemplate.h"
@@ -60,7 +59,7 @@ caf::PdmScriptResponse RicfScaleFractureTemplate::execute()
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
}
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
if ( !project )
{

View File

@@ -18,7 +18,6 @@
#include "RicfSetExportFolder.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "cafPdmFieldIOScriptability.h"

View File

@@ -19,7 +19,6 @@
#include "RicfSetFractureContainment.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimFractureTemplate.h"
@@ -52,7 +51,7 @@ caf::PdmScriptResponse RicfSetFractureContainment::execute()
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error );
}
RimProject* project = RiaApplication::instance()->project();
RimProject* project = RimProject::current();
if ( !project )
{

View File

@@ -24,7 +24,6 @@
#include "RimOilField.h"
#include "RimProject.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "cafPdmFieldIOScriptability.h"
@@ -74,7 +73,7 @@ caf::PdmScriptResponse RicfSetTimeStep::execute()
std::vector<RimCase*> allCases;
{
RiaApplication::instance()->project()->allCases( allCases );
RimProject::current()->allCases( allCases );
bool foundCase = false;
for ( RimCase* c : allCases )