mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
Python: Create summary plot from string
This commit is contained in:
1 parent
6b289f0db2
commit
2853308a4a
17 files changed
+415
-205
No files matched your search
@@ -81,6 +81,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Measurement
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Surfaces
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModelCommands
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
||||
@@ -148,7 +149,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
ProjectDataModel/Measurement/CMakeLists_files.cmake
|
||||
ProjectDataModel/PlotTemplates/CMakeLists_files.cmake
|
||||
ProjectDataModel/Surfaces/CMakeLists_files.cmake
|
||||
|
||||
ProjectDataModelCommands/CMakeLists_files.cmake
|
||||
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
||||
|
||||
ModelVisualization/CMakeLists_files.cmake
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "RicNewSummaryEnsembleCurveSetFeature.h"
|
||||
#include "RicSummaryPlotEditorDialog.h"
|
||||
#include "RicSummaryPlotEditorUi.h"
|
||||
#include "RicSummaryPlotFeatureImpl.h"
|
||||
|
||||
#include "RimEnsembleCurveFilter.h"
|
||||
#include "RimEnsembleCurveFilterCollection.h"
|
||||
@@ -40,8 +41,6 @@
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafPdmFieldScriptability.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@@ -288,42 +287,3 @@ void RicNewDefaultSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
}
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryPlotCollection, RimSummaryPlotCollection_newSummaryPlot, "NewSummaryPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotCollection_newSummaryPlot::RimSummaryPlotCollection_newSummaryPlot( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Create Summary Plot", "", "", "Create a new Summary Plot" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_summaryCases, "SummaryCases", "", "", "", "Summary Cases" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_ensembles, "Ensembles", "", "", "", "Ensembles" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimSummaryPlotCollection_newSummaryPlot::execute()
|
||||
{
|
||||
if ( !m_summaryCases.empty() )
|
||||
{
|
||||
return RicNewDefaultSummaryPlotFeature::createFromSummaryCases( self<RimSummaryPlotCollection>(),
|
||||
m_summaryCases.ptrReferencedObjects() );
|
||||
}
|
||||
else if ( !m_ensembles.empty() )
|
||||
{
|
||||
return RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( m_ensembles.ptrReferencedObjects() );
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotCollection_newSummaryPlot::deleteObjectAfterReply() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
|
||||
class RimSummaryPlotCollection;
|
||||
class RimSummaryCase;
|
||||
@@ -59,21 +58,3 @@ protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryPlotCollection_newSummaryPlot : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSummaryPlotCollection_newSummaryPlot( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute();
|
||||
bool deleteObjectAfterReply() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrArrayField<RimSummaryCase*> m_summaryCases;
|
||||
caf::PdmPtrArrayField<RimSummaryCaseCollection*> m_ensembles;
|
||||
};
|
||||
@@ -347,14 +347,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
bool isNormalizedY = options.contains( "-n" );
|
||||
bool isSinglePlot = options.contains( "-s" );
|
||||
|
||||
enum EnsembleColoringType
|
||||
{
|
||||
SINGLE_COLOR,
|
||||
PARAMETER,
|
||||
LOG_PARAMETER,
|
||||
NONE
|
||||
};
|
||||
EnsembleColoringType ensembleColoringStyle = NONE;
|
||||
EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE;
|
||||
{
|
||||
int e_pos = options.lastIndexOf( "-e" );
|
||||
int c_pos = options.lastIndexOf( "-c" );
|
||||
@@ -364,21 +357,21 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
if ( e_pos > lastEnsembleOptionPos )
|
||||
{
|
||||
lastEnsembleOptionPos = e_pos;
|
||||
ensembleColoringStyle = SINGLE_COLOR;
|
||||
ensembleColoringStyle = EnsembleColoringType::SINGLE_COLOR;
|
||||
}
|
||||
if ( c_pos > lastEnsembleOptionPos )
|
||||
{
|
||||
lastEnsembleOptionPos = c_pos;
|
||||
ensembleColoringStyle = PARAMETER;
|
||||
ensembleColoringStyle = EnsembleColoringType::PARAMETER;
|
||||
}
|
||||
if ( cl_pos > lastEnsembleOptionPos )
|
||||
{
|
||||
lastEnsembleOptionPos = cl_pos;
|
||||
ensembleColoringStyle = LOG_PARAMETER;
|
||||
ensembleColoringStyle = EnsembleColoringType::LOG_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
bool isEnsembleMode = ensembleColoringStyle != NONE;
|
||||
bool isEnsembleMode = ensembleColoringStyle != EnsembleColoringType::NONE;
|
||||
|
||||
std::vector<RimSummaryCase*> summaryCasesToUse;
|
||||
|
||||
@@ -419,129 +412,38 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
|
||||
if ( isSinglePlot )
|
||||
{
|
||||
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
|
||||
|
||||
if ( isEnsembleMode )
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases =
|
||||
applySummaryAddressFiltersToCases( summaryCasesToUse, summaryAddressFilters );
|
||||
|
||||
for ( const auto& addr : filteredAdressesFromCases )
|
||||
{
|
||||
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
|
||||
curveSet->setSummaryCaseCollection( ensemble );
|
||||
curveSet->setSummaryAddress( addr );
|
||||
|
||||
if ( ensembleColoringStyle == PARAMETER || ensembleColoringStyle == LOG_PARAMETER )
|
||||
{
|
||||
curveSet->setColorMode( RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM );
|
||||
curveSet->setEnsembleParameter( ensembleColoringParameter );
|
||||
|
||||
if ( ensembleColoringStyle == LOG_PARAMETER )
|
||||
{
|
||||
curveSet->legendConfig()->setMappingMode( RimRegularLegendConfig::LOG10_CONTINUOUS );
|
||||
}
|
||||
}
|
||||
|
||||
newPlot->ensembleCurveSetCollection()->addCurveSet( curveSet );
|
||||
|
||||
if ( addHistoryCurves )
|
||||
{
|
||||
RimSummaryCurve* historyCurve = createHistoryCurve( addr, summaryCasesToUse[0] );
|
||||
|
||||
if ( historyCurve ) newPlot->addCurveNoUpdate( historyCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( RimSummaryCase* sumCase : summaryCasesToUse )
|
||||
{
|
||||
RicSummaryPlotFeatureImpl::addCurvesFromAddressFiltersToPlot( summaryAddressFilters,
|
||||
newPlot,
|
||||
sumCase,
|
||||
addHistoryCurves );
|
||||
addHistoryCurves = false;
|
||||
}
|
||||
}
|
||||
RimSummaryPlot* newPlot = createSummaryPlotFromAddresses( sumPlotColl,
|
||||
summaryCasesToUse,
|
||||
ensemble,
|
||||
summaryAddressFilters,
|
||||
addHistoryCurves,
|
||||
ensembleColoringStyle,
|
||||
ensembleColoringParameter );
|
||||
|
||||
lastPlotCreated = newPlot;
|
||||
|
||||
newPlot->setLegendsVisible( !hideLegend );
|
||||
newPlot->setNormalizationEnabled( isNormalizedY );
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
newPlot->loadDataAndUpdate();
|
||||
}
|
||||
else // Multiplot, one for each separate summary address
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases =
|
||||
applySummaryAddressFiltersToCases( summaryCasesToUse, summaryAddressFilters );
|
||||
std::vector<RimSummaryPlot*> summaryPlots =
|
||||
createMultipleSummaryPlotsFromAddresses( sumPlotColl,
|
||||
summaryCasesToUse,
|
||||
ensemble,
|
||||
summaryAddressFilters,
|
||||
addHistoryCurves,
|
||||
ensembleColoringStyle,
|
||||
ensembleColoringParameter );
|
||||
|
||||
for ( const auto& addr : filteredAdressesFromCases )
|
||||
lastPlotCreated = summaryPlots.back();
|
||||
|
||||
for ( auto summaryPlot : summaryPlots )
|
||||
{
|
||||
std::vector<RimSummaryCurve*> createdCurves;
|
||||
std::vector<RimEnsembleCurveSet*> createdEnsembleCurveSets;
|
||||
if ( isEnsembleMode )
|
||||
{
|
||||
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
|
||||
|
||||
curveSet->setSummaryCaseCollection( ensemble );
|
||||
curveSet->setSummaryAddress( addr );
|
||||
if ( ensembleColoringStyle == PARAMETER || ensembleColoringStyle == LOG_PARAMETER )
|
||||
{
|
||||
curveSet->setColorMode( RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM );
|
||||
curveSet->setEnsembleParameter( ensembleColoringParameter );
|
||||
if ( ensembleColoringStyle == LOG_PARAMETER )
|
||||
{
|
||||
curveSet->legendConfig()->setMappingMode( RimRegularLegendConfig::LOG10_CONTINUOUS );
|
||||
}
|
||||
}
|
||||
createdEnsembleCurveSets.push_back( curveSet );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( RimSummaryCase* sumCase : summaryCasesToUse )
|
||||
{
|
||||
const std::set<RifEclipseSummaryAddress>& allAddrsInCase =
|
||||
sumCase->summaryReader()->allResultAddresses();
|
||||
if ( allAddrsInCase.count( addr ) )
|
||||
{
|
||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||
newCurve->setSummaryCaseY( sumCase );
|
||||
newCurve->setSummaryAddressYAndApplyInterpolation( addr );
|
||||
createdCurves.push_back( newCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( addHistoryCurves )
|
||||
{
|
||||
RimSummaryCurve* historyCurve = createHistoryCurve( addr, summaryCasesToUse[0] );
|
||||
if ( historyCurve ) createdCurves.push_back( historyCurve );
|
||||
}
|
||||
|
||||
if ( createdCurves.size() || createdEnsembleCurveSets.size() )
|
||||
{
|
||||
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
|
||||
|
||||
for ( auto curve : createdCurves )
|
||||
{
|
||||
newPlot->addCurveNoUpdate( curve );
|
||||
}
|
||||
|
||||
for ( auto curveSet : createdEnsembleCurveSets )
|
||||
{
|
||||
newPlot->ensembleCurveSetCollection()->addCurveSet( curveSet );
|
||||
}
|
||||
|
||||
newPlot->setLegendsVisible( !hideLegend );
|
||||
newPlot->setNormalizationEnabled( isNormalizedY );
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
newPlot->loadDataAndUpdate();
|
||||
lastPlotCreated = newPlot;
|
||||
}
|
||||
summaryPlot->setLegendsVisible( !hideLegend );
|
||||
summaryPlot->setNormalizationEnabled( isNormalizedY );
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -689,6 +591,148 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
}
|
||||
}
|
||||
|
||||
RimSummaryPlot*
|
||||
RicSummaryPlotFeatureImpl::createSummaryPlotFromAddresses( RimSummaryPlotCollection* sumPlotColl,
|
||||
const std::vector<RimSummaryCase*>& summaryCasesToUse,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
QStringList summaryAddressFilters,
|
||||
bool addHistoryCurves,
|
||||
EnsembleColoringType ensembleColoringStyle,
|
||||
QString ensembleColoringParameter )
|
||||
{
|
||||
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
|
||||
|
||||
if ( ensemble )
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases =
|
||||
applySummaryAddressFiltersToCases( summaryCasesToUse, summaryAddressFilters );
|
||||
|
||||
for ( const auto& addr : filteredAdressesFromCases )
|
||||
{
|
||||
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
|
||||
curveSet->setSummaryCaseCollection( ensemble );
|
||||
curveSet->setSummaryAddress( addr );
|
||||
|
||||
if ( ensembleColoringStyle == EnsembleColoringType::PARAMETER ||
|
||||
ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER )
|
||||
{
|
||||
curveSet->setColorMode( RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM );
|
||||
curveSet->setEnsembleParameter( ensembleColoringParameter );
|
||||
|
||||
if ( ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER )
|
||||
{
|
||||
curveSet->legendConfig()->setMappingMode( RimRegularLegendConfig::LOG10_CONTINUOUS );
|
||||
}
|
||||
}
|
||||
|
||||
newPlot->ensembleCurveSetCollection()->addCurveSet( curveSet );
|
||||
|
||||
if ( addHistoryCurves )
|
||||
{
|
||||
RimSummaryCurve* historyCurve = createHistoryCurve( addr, summaryCasesToUse[0] );
|
||||
|
||||
if ( historyCurve ) newPlot->addCurveNoUpdate( historyCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( RimSummaryCase* sumCase : summaryCasesToUse )
|
||||
{
|
||||
RicSummaryPlotFeatureImpl::addCurvesFromAddressFiltersToPlot( summaryAddressFilters,
|
||||
newPlot,
|
||||
sumCase,
|
||||
addHistoryCurves );
|
||||
addHistoryCurves = false;
|
||||
}
|
||||
}
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
|
||||
return newPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RicSummaryPlotFeatureImpl::createMultipleSummaryPlotsFromAddresses(
|
||||
RimSummaryPlotCollection* sumPlotColl,
|
||||
const std::vector<RimSummaryCase*>& summaryCasesToUse,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
QStringList summaryAddressFilters,
|
||||
bool addHistoryCurves,
|
||||
EnsembleColoringType ensembleColoringStyle /*= EnsembleColoringType::NONE*/,
|
||||
QString ensembleColoringParameter /*= "" */ )
|
||||
{
|
||||
std::vector<RimSummaryPlot*> newSummaryPlots;
|
||||
|
||||
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases =
|
||||
applySummaryAddressFiltersToCases( summaryCasesToUse, summaryAddressFilters );
|
||||
|
||||
for ( const auto& addr : filteredAdressesFromCases )
|
||||
{
|
||||
std::vector<RimSummaryCurve*> createdCurves;
|
||||
std::vector<RimEnsembleCurveSet*> createdEnsembleCurveSets;
|
||||
if ( ensemble )
|
||||
{
|
||||
RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet();
|
||||
|
||||
curveSet->setSummaryCaseCollection( ensemble );
|
||||
curveSet->setSummaryAddress( addr );
|
||||
if ( ensembleColoringStyle == EnsembleColoringType::PARAMETER ||
|
||||
ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER )
|
||||
{
|
||||
curveSet->setColorMode( RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM );
|
||||
curveSet->setEnsembleParameter( ensembleColoringParameter );
|
||||
if ( ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER )
|
||||
{
|
||||
curveSet->legendConfig()->setMappingMode( RimRegularLegendConfig::LOG10_CONTINUOUS );
|
||||
}
|
||||
}
|
||||
createdEnsembleCurveSets.push_back( curveSet );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( RimSummaryCase* sumCase : summaryCasesToUse )
|
||||
{
|
||||
const std::set<RifEclipseSummaryAddress>& allAddrsInCase = sumCase->summaryReader()->allResultAddresses();
|
||||
if ( allAddrsInCase.count( addr ) )
|
||||
{
|
||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||
newCurve->setSummaryCaseY( sumCase );
|
||||
newCurve->setSummaryAddressYAndApplyInterpolation( addr );
|
||||
createdCurves.push_back( newCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( addHistoryCurves )
|
||||
{
|
||||
RimSummaryCurve* historyCurve = createHistoryCurve( addr, summaryCasesToUse[0] );
|
||||
if ( historyCurve ) createdCurves.push_back( historyCurve );
|
||||
}
|
||||
|
||||
if ( createdCurves.size() || createdEnsembleCurveSets.size() )
|
||||
{
|
||||
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
|
||||
|
||||
for ( auto curve : createdCurves )
|
||||
{
|
||||
newPlot->addCurveNoUpdate( curve );
|
||||
}
|
||||
|
||||
for ( auto curveSet : createdEnsembleCurveSets )
|
||||
{
|
||||
newPlot->ensembleCurveSetCollection()->addCurveSet( curveSet );
|
||||
}
|
||||
|
||||
newPlot->applyDefaultCurveAppearances();
|
||||
newSummaryPlots.push_back( newPlot );
|
||||
}
|
||||
}
|
||||
return newSummaryPlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
@@ -30,6 +32,7 @@ class PdmObject;
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimSummaryPlotCollection;
|
||||
|
||||
class QStringList;
|
||||
@@ -37,6 +40,14 @@ class QStringList;
|
||||
class RicSummaryPlotFeatureImpl
|
||||
{
|
||||
public:
|
||||
enum class EnsembleColoringType
|
||||
{
|
||||
SINGLE_COLOR,
|
||||
PARAMETER,
|
||||
LOG_PARAMETER,
|
||||
NONE
|
||||
};
|
||||
|
||||
static RimSummaryCurve* addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||
static std::vector<RimSummaryCurve*> addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||
static void ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase );
|
||||
@@ -44,6 +55,24 @@ public:
|
||||
|
||||
static void createSummaryPlotsFromArgumentLine( const QStringList& arguments );
|
||||
|
||||
static RimSummaryPlot*
|
||||
createSummaryPlotFromAddresses( RimSummaryPlotCollection* sumPlotColl,
|
||||
const std::vector<RimSummaryCase*>& summaryCasesToUse,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
QStringList summaryAddressFilters,
|
||||
bool addHistoryCurves = false,
|
||||
EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE,
|
||||
QString ensembleColoringParameter = "" );
|
||||
|
||||
static std::vector<RimSummaryPlot*>
|
||||
createMultipleSummaryPlotsFromAddresses( RimSummaryPlotCollection* sumPlotColl,
|
||||
const std::vector<RimSummaryCase*>& summaryCasesToUse,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
QStringList summaryAddressFilters,
|
||||
bool addHistoryCurves = false,
|
||||
EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE,
|
||||
QString ensembleColoringParameter = "" );
|
||||
|
||||
static void filteredSummaryAdressesFromCase( const QStringList& curveFilters,
|
||||
const std::set<RifEclipseSummaryAddress>& allAddressesInCase,
|
||||
std::set<RifEclipseSummaryAddress>* setToInsertFilteredAddressesIn,
|
||||
|
||||
@@ -7,7 +7,5 @@ project = resinsight.project
|
||||
|
||||
summary_cases = project.descendants(rips.SummaryCase)
|
||||
summary_plot_collection = project.descendants(rips.SummaryPlotCollection)[0]
|
||||
|
||||
|
||||
|
||||
summary_plot = summary_plot_collection.new_summary_plot(summary_cases=summary_cases)
|
||||
if len(summary_cases) > 0:
|
||||
summary_plot = summary_plot_collection.new_summary_plot(summary_cases=summary_cases, address="FOP*")
|
||||
@@ -528,7 +528,7 @@ grpc::Status RiaGrpcPdmObjectService::CallPdmObjectMethod( grpc::ServerContext*
|
||||
|
||||
caf::PdmObjectHandle* result = method->execute();
|
||||
copyPdmObjectFromCafToRips( result, reply );
|
||||
if ( method->deleteObjectAfterReply() )
|
||||
if ( !method->resultIsPersistent() )
|
||||
{
|
||||
delete result;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "qwt_plot_textlabel.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModelCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,114 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RimcSummaryPlotCollection.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
||||
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafPdmFieldScriptability.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryPlotCollection, RimcSummaryPlotCollection_newSummaryPlot, "NewSummaryPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcSummaryPlotCollection_newSummaryPlot::RimcSummaryPlotCollection_newSummaryPlot( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Create Summary Plot", "", "", "Create a new Summary Plot" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_summaryCases, "SummaryCases", "", "", "", "Summary Cases" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_ensemble, "Ensemble", "", "", "", "Ensemble" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_addressString,
|
||||
"Address",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Formatted address string specifying the plot options" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute()
|
||||
{
|
||||
QStringList addressStrings = m_addressString().split( ";", QString::SkipEmptyParts );
|
||||
|
||||
RimSummaryPlot* newPlot = nullptr;
|
||||
if ( m_ensemble )
|
||||
{
|
||||
if ( !addressStrings.empty() )
|
||||
{
|
||||
newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotFromAddresses( self<RimSummaryPlotCollection>(),
|
||||
std::vector<RimSummaryCase*>(),
|
||||
m_ensemble,
|
||||
addressStrings );
|
||||
}
|
||||
else
|
||||
{
|
||||
newPlot = RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( {m_ensemble} );
|
||||
}
|
||||
}
|
||||
if ( !m_summaryCases.empty() )
|
||||
{
|
||||
std::vector<RimSummaryCase*> summaryCases = m_summaryCases.ptrReferencedObjects();
|
||||
if ( !addressStrings.empty() )
|
||||
{
|
||||
newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotFromAddresses( self<RimSummaryPlotCollection>(),
|
||||
summaryCases,
|
||||
nullptr,
|
||||
addressStrings );
|
||||
}
|
||||
else
|
||||
{
|
||||
newPlot = RicNewDefaultSummaryPlotFeature::createFromSummaryCases( self<RimSummaryPlotCollection>(),
|
||||
summaryCases );
|
||||
}
|
||||
}
|
||||
|
||||
if ( newPlot )
|
||||
{
|
||||
newPlot->loadDataAndUpdate();
|
||||
self<RimSummaryPlotCollection>()->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
return newPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcSummaryPlotCollection_newSummaryPlot::resultIsPersistent() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcSummaryPlotCollection_newSummaryPlot::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimSummaryPlot );
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RimSummaryCase;
|
||||
class RimSummaryPlotCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcSummaryPlotCollection_newSummaryPlot : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcSummaryPlotCollection_newSummaryPlot( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute();
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_addressString;
|
||||
caf::PdmPtrArrayField<RimSummaryCase*> m_summaryCases;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
|
||||
};
|
||||
@@ -88,7 +88,6 @@ void RiuWellLogPlot::reinsertScrollbar()
|
||||
{
|
||||
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
|
||||
QList<QPointer<RiuQwtPlotLegend>> legends = this->legendsForVisiblePlots();
|
||||
int rowCount = this->m_gridLayout->rowCount();
|
||||
int colCount = this->m_gridLayout->columnCount();
|
||||
|
||||
m_gridLayout->addLayout( m_trackScrollBarLayout, 2, colCount, 1, 1 );
|
||||
|
||||
Reference in new issue
Block a user