mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add import/export grid calculations to Grid Calculator
Refactoring
This commit is contained in:
parent
f49053c61d
commit
69f132ffa5
@ -229,6 +229,8 @@ RiaPreferences::RiaPreferences()
|
||||
CAF_PDM_InitField( &m_useQtChartsPlotByDefault, "useQtChartsPlotByDefault", false, "Use QtChart as Default Plot Type" );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useQtChartsPlotByDefault );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_gridCalculationExpressionFolder, "gridCalculationExpressionFolder", "Grid Calculation Expression Folder" );
|
||||
|
||||
CAF_PDM_InitField( &m_surfaceImportResamplingDistance,
|
||||
"SurfaceImportResamplingDistance",
|
||||
100.0,
|
||||
@ -292,6 +294,10 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field, QS
|
||||
myAttr->m_selectDirectory = true;
|
||||
myAttr->m_appendUiSelectedFolderToText = true;
|
||||
}
|
||||
else if ( field == &m_gridCalculationExpressionFolder )
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -448,6 +454,9 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
exportGroup->add( &csvTextExportFieldSeparator );
|
||||
exportGroup->add( &m_openExportedPdfInViewer );
|
||||
exportGroup->add( &m_writeEchoInGrdeclFiles );
|
||||
|
||||
caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup( "Other" );
|
||||
otherGroup->add( &m_gridCalculationExpressionFolder );
|
||||
}
|
||||
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
|
||||
{
|
||||
@ -838,6 +847,14 @@ QString RiaPreferences::defaultMultiLateralWellNamePattern()
|
||||
return "?*Y*";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::gridCalculationExpressionFolder() const
|
||||
{
|
||||
return m_gridCalculationExpressionFolder().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
QString multiLateralWellNamePattern() const;
|
||||
static QString defaultMultiLateralWellNamePattern();
|
||||
|
||||
QString gridCalculationExpressionFolder() const;
|
||||
|
||||
// 3D view
|
||||
RiaDefines::MeshModeType defaultMeshModeType() const;
|
||||
RiaDefines::RINavigationPolicy navigationPolicy() const;
|
||||
@ -193,6 +195,8 @@ private:
|
||||
caf::PdmField<caf::FilePath> m_lastUsedPlotTemplate;
|
||||
caf::PdmField<bool> m_useQtChartsPlotByDefault;
|
||||
|
||||
caf::PdmField<caf::FilePath> m_gridCalculationExpressionFolder;
|
||||
|
||||
// Script paths
|
||||
caf::PdmField<QString> m_octaveExecutable;
|
||||
caf::PdmField<QString> m_pythonExecutable;
|
||||
|
@ -89,6 +89,8 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportRevealSummaryCaseFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportStimPlanSummaryCaseFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCopyGridStatisticsToClipboardFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportGridCalculationExpressionsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportGridCalculationExpressionsFeature.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -181,6 +183,8 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportRevealSummaryCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportStimPlanSummaryCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCopyGridStatisticsToClipboardFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicExportGridCalculationExpressionsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportGridCalculationExpressionsFeature.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_USE_QT_CHARTS)
|
||||
|
@ -0,0 +1,91 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicExportGridCalculationExpressionsFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimGridCalculationCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuFileDialogTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicExportGridCalculationExpressionsFeature, "RicExportGridCalculationExpressionsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicExportGridCalculationExpressionsFeature::gridCalculationExpressionId()
|
||||
{
|
||||
return "GRID_CALCULATION_EXPRESSION";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportGridCalculationExpressionsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto proj = RimProject::current();
|
||||
auto calcColl = proj->gridCalculationCollection();
|
||||
|
||||
if ( calcColl->calculations().empty() ) return;
|
||||
|
||||
auto objectAsText = calcColl->writeObjectToXmlString();
|
||||
if ( objectAsText.isEmpty() ) return;
|
||||
|
||||
QString fallbackPath = RiaPreferences::current()->gridCalculationExpressionFolder();
|
||||
auto app = RiaGuiApplication::instance();
|
||||
QString startPath =
|
||||
app->lastUsedDialogDirectoryWithFallback( RicExportGridCalculationExpressionsFeature::gridCalculationExpressionId(), fallbackPath );
|
||||
|
||||
QString fileName = RiuFileDialogTools::getSaveFileName( nullptr,
|
||||
"Select File for Grid Calculation Expression Export",
|
||||
startPath,
|
||||
"Xml File(*.xml);;All files(*.*)" );
|
||||
if ( fileName.isEmpty() ) return;
|
||||
|
||||
QFile exportFile( fileName );
|
||||
if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||
{
|
||||
RiaLogging::errorInMessageBox( nullptr,
|
||||
"Export Grid Calculation Expressions",
|
||||
QString( "Could not save to the file: %1" ).arg( fileName ) );
|
||||
return;
|
||||
}
|
||||
|
||||
QString absPath = QFileInfo( fileName ).absolutePath();
|
||||
|
||||
app->setLastUsedDialogDirectory( RicExportGridCalculationExpressionsFeature::gridCalculationExpressionId(), absPath );
|
||||
QTextStream stream( &exportFile );
|
||||
stream << objectAsText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportGridCalculationExpressionsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Export Grid Calculation Expressions" );
|
||||
actionToSetup->setIcon( QIcon( ":/Calculator.svg" ) );
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicExportGridCalculationExpressionsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
static QString gridCalculationExpressionId();
|
||||
|
||||
private:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -22,6 +22,9 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimUserDefinedCalculationCollection.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicGridCalculatorUi, "RicGridCalculator" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -30,6 +33,12 @@ CAF_PDM_SOURCE_INIT( RicGridCalculatorUi, "RicGridCalculator" );
|
||||
RicGridCalculatorUi::RicGridCalculatorUi()
|
||||
{
|
||||
CAF_PDM_InitObject( "RicGridCalculator" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_importCalculations, "ImportCalculations", "Import Calculations" );
|
||||
RicUserDefinedCalculatorUi::assignPushButtonEditor( &m_importCalculations );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_exportCalculations, "ExportCalculations", "Export Calculations" );
|
||||
RicUserDefinedCalculatorUi::assignPushButtonEditor( &m_exportCalculations );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -55,6 +64,68 @@ void RicGridCalculatorUi::notifyCalculatedNameChanged( int id, const QString& ne
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridCalculatorUi::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RicUserDefinedCalculatorUi::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
caf::PdmUiGroup* group = uiOrdering.findGroup( calculationsGroupName() );
|
||||
if ( group )
|
||||
{
|
||||
caf::PdmUiOrdering::LayoutOptions layoutOptions;
|
||||
layoutOptions.newRow = false;
|
||||
|
||||
group->add( &m_importCalculations );
|
||||
group->add( &m_exportCalculations, layoutOptions );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridCalculatorUi::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RicUserDefinedCalculatorUi::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_importCalculations )
|
||||
{
|
||||
if ( auto feature = caf::CmdFeatureManager::instance()->getCommandFeature( "RicImportGridCalculationExpressionsFeature" ) )
|
||||
{
|
||||
feature->action()->trigger();
|
||||
}
|
||||
|
||||
m_importCalculations = false;
|
||||
}
|
||||
else if ( changedField == &m_exportCalculations )
|
||||
{
|
||||
if ( auto feature = caf::CmdFeatureManager::instance()->getCommandFeature( "RicExportGridCalculationExpressionsFeature" ) )
|
||||
{
|
||||
feature->action()->trigger();
|
||||
}
|
||||
|
||||
m_exportCalculations = false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGridCalculatorUi::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
RicUserDefinedCalculatorUi::defineEditorAttribute( field, uiConfigName, attribute );
|
||||
|
||||
if ( &m_importCalculations == field )
|
||||
{
|
||||
RicUserDefinedCalculatorUi::assignPushButtonEditorText( attribute, "Import Calculations" );
|
||||
}
|
||||
else if ( &m_exportCalculations == field )
|
||||
{
|
||||
RicUserDefinedCalculatorUi::assignPushButtonEditorText( attribute, "Export Calculations" );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -36,4 +36,13 @@ public:
|
||||
QString calulationGroupName() const override;
|
||||
RimUserDefinedCalculationCollection* calculationCollection() const override;
|
||||
void notifyCalculatedNameChanged( int id, const QString& newName ) const override;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_exportCalculations;
|
||||
caf::PdmField<bool> m_importCalculations;
|
||||
};
|
||||
|
@ -0,0 +1,96 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicImportGridCalculationExpressionsFeature.h"
|
||||
#include "RicExportGridCalculationExpressionsFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimEclipseCaseTools.h"
|
||||
#include "RimGridCalculationCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuFileDialogTools.h"
|
||||
|
||||
#include "cafPdmDefaultObjectFactory.h"
|
||||
#include "cafPdmXmlObjectHandle.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QTextStream>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportGridCalculationExpressionsFeature, "RicImportGridCalculationExpressionsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportGridCalculationExpressionsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto app = RiaGuiApplication::instance();
|
||||
|
||||
QString defaultDir = app->lastUsedDialogDirectoryWithFallback( RicExportGridCalculationExpressionsFeature::gridCalculationExpressionId(),
|
||||
RiaPreferences::current()->gridCalculationExpressionFolder() );
|
||||
|
||||
QString fileName =
|
||||
RiuFileDialogTools::getOpenFileName( nullptr, "Import Grid Calculation Expressions", defaultDir, "Xml File(*.xml);;All files(*.*)" );
|
||||
|
||||
if ( fileName.isEmpty() ) return;
|
||||
|
||||
QFile importFile( fileName );
|
||||
if ( !importFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
{
|
||||
RiaLogging::error( QString( "Import Grid Calculation Expressions : Could not open the file: %1" ).arg( fileName ) );
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream stream( &importFile );
|
||||
QString objectAsText = stream.readAll();
|
||||
|
||||
auto proj = RimProject::current();
|
||||
auto calcColl = proj->gridCalculationCollection();
|
||||
|
||||
RimEclipseCase* firstCase = nullptr;
|
||||
auto eclCases = RimEclipseCaseTools::allEclipseGridCases();
|
||||
if ( !eclCases.empty() ) firstCase = eclCases.front();
|
||||
|
||||
RimGridCalculationCollection tmp;
|
||||
tmp.xmlCapability()->readObjectFromXmlString( objectAsText, caf::PdmDefaultObjectFactory::instance() );
|
||||
for ( auto calc : tmp.calculations() )
|
||||
{
|
||||
auto gridCalculation = dynamic_cast<RimGridCalculation*>( calcColl->addCalculationCopy( calc ) );
|
||||
if ( gridCalculation && firstCase )
|
||||
{
|
||||
gridCalculation->assignEclipseCaseForNullPointers( firstCase );
|
||||
}
|
||||
}
|
||||
|
||||
QString absPath = QFileInfo( fileName ).absolutePath();
|
||||
app->setLastUsedDialogDirectory( RicExportGridCalculationExpressionsFeature::gridCalculationExpressionId(), absPath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportGridCalculationExpressionsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Import Grid Calculation Expressions" );
|
||||
actionToSetup->setIcon( QIcon( ":/Calculator.svg" ) );
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportGridCalculationExpressionsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
private:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -133,7 +133,10 @@ void RicUserDefinedCalculatorUi::defineUiOrdering( QString uiConfigName, caf::Pd
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroupWithKeyword( "Calculations", calculationsGroupName() );
|
||||
group->add( &m_currentCalculation );
|
||||
group->add( &m_newCalculation );
|
||||
group->add( &m_deleteCalculation );
|
||||
|
||||
caf::PdmUiOrdering::LayoutOptions layoutOptions;
|
||||
layoutOptions.newRow = false;
|
||||
group->add( &m_deleteCalculation, layoutOptions );
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -48,18 +48,19 @@ public:
|
||||
virtual RimUserDefinedCalculationCollection* calculationCollection() const = 0;
|
||||
virtual void notifyCalculatedNameChanged( int id, const QString& newName ) const = 0;
|
||||
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void onEditorWidgetsCreated() override;
|
||||
|
||||
private:
|
||||
// TODO : Move to a common caf helper class
|
||||
static void assignPushButtonEditor( caf::PdmFieldHandle* fieldHandle );
|
||||
static void assignPushButtonEditorText( caf::PdmUiEditorAttribute* attribute, const QString& text );
|
||||
|
||||
private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
void onEditorWidgetsCreated() override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimUserDefinedCalculation*> m_currentCalculation;
|
||||
|
||||
|
@ -655,6 +655,28 @@ bool RimGridCalculation::calculateForCases( const std::vector<RimEclipseCase*>&
|
||||
return !anyErrorsDetected;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCalculation::assignEclipseCaseForNullPointers( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
if ( m_destinationCase() == nullptr )
|
||||
{
|
||||
m_destinationCase = eclipseCase;
|
||||
}
|
||||
|
||||
for ( auto v : m_variables )
|
||||
{
|
||||
if ( auto gridVar = dynamic_cast<RimGridCalculationVariable*>( v.p() ) )
|
||||
{
|
||||
if ( gridVar->eclipseCase() == nullptr )
|
||||
{
|
||||
gridVar->setEclipseCase( eclipseCase );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
std::vector<RimEclipseCase*> outputEclipseCases() const;
|
||||
RigEclipseResultAddress outputAddress() const;
|
||||
bool calculateForCases( const std::vector<RimEclipseCase*>& calculationCases, std::optional<std::vector<size_t>> timeSteps );
|
||||
void assignEclipseCaseForNullPointers( RimEclipseCase* eclipseCase );
|
||||
|
||||
std::vector<RimEclipseCase*> inputCases() const;
|
||||
|
||||
|
@ -73,6 +73,14 @@ QString RimGridCalculationVariable::displayString() const
|
||||
return nameComponents.join( " - " );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCalculationVariable::setEclipseCase( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
m_eclipseCase = eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
|
||||
QString displayString() const override;
|
||||
|
||||
void setEclipseCase( RimEclipseCase* eclipseCase );
|
||||
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
RiaDefines::ResultCatType resultCategoryType() const;
|
||||
QString resultVariable() const;
|
||||
|
Loading…
Reference in New Issue
Block a user