mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Python: Create summary plot from string
This commit is contained in:
parent
6b289f0db2
commit
2853308a4a
@ -81,6 +81,7 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Measurement
|
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Measurement
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Surfaces
|
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Surfaces
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModelCommands
|
||||||
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
|
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
||||||
@ -148,7 +149,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
|||||||
ProjectDataModel/Measurement/CMakeLists_files.cmake
|
ProjectDataModel/Measurement/CMakeLists_files.cmake
|
||||||
ProjectDataModel/PlotTemplates/CMakeLists_files.cmake
|
ProjectDataModel/PlotTemplates/CMakeLists_files.cmake
|
||||||
ProjectDataModel/Surfaces/CMakeLists_files.cmake
|
ProjectDataModel/Surfaces/CMakeLists_files.cmake
|
||||||
|
ProjectDataModelCommands/CMakeLists_files.cmake
|
||||||
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
||||||
|
|
||||||
ModelVisualization/CMakeLists_files.cmake
|
ModelVisualization/CMakeLists_files.cmake
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "RicNewSummaryEnsembleCurveSetFeature.h"
|
#include "RicNewSummaryEnsembleCurveSetFeature.h"
|
||||||
#include "RicSummaryPlotEditorDialog.h"
|
#include "RicSummaryPlotEditorDialog.h"
|
||||||
#include "RicSummaryPlotEditorUi.h"
|
#include "RicSummaryPlotEditorUi.h"
|
||||||
|
#include "RicSummaryPlotFeatureImpl.h"
|
||||||
|
|
||||||
#include "RimEnsembleCurveFilter.h"
|
#include "RimEnsembleCurveFilter.h"
|
||||||
#include "RimEnsembleCurveFilterCollection.h"
|
#include "RimEnsembleCurveFilterCollection.h"
|
||||||
@ -40,8 +41,6 @@
|
|||||||
|
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
|
|
||||||
#include "cafPdmFieldIOScriptability.h"
|
|
||||||
#include "cafPdmFieldScriptability.h"
|
|
||||||
#include "cafSelectionManagerTools.h"
|
#include "cafSelectionManagerTools.h"
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
@ -288,42 +287,3 @@ void RicNewDefaultSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
|||||||
}
|
}
|
||||||
actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) );
|
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 "RicfCommandObject.h"
|
||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
#include "cafPdmPtrArrayField.h"
|
|
||||||
|
|
||||||
class RimSummaryPlotCollection;
|
class RimSummaryPlotCollection;
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
@ -59,21 +58,3 @@ protected:
|
|||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered( bool isChecked ) override;
|
||||||
void setupActionLook( QAction* actionToSetup ) 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 isNormalizedY = options.contains( "-n" );
|
||||||
bool isSinglePlot = options.contains( "-s" );
|
bool isSinglePlot = options.contains( "-s" );
|
||||||
|
|
||||||
enum EnsembleColoringType
|
EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE;
|
||||||
{
|
|
||||||
SINGLE_COLOR,
|
|
||||||
PARAMETER,
|
|
||||||
LOG_PARAMETER,
|
|
||||||
NONE
|
|
||||||
};
|
|
||||||
EnsembleColoringType ensembleColoringStyle = NONE;
|
|
||||||
{
|
{
|
||||||
int e_pos = options.lastIndexOf( "-e" );
|
int e_pos = options.lastIndexOf( "-e" );
|
||||||
int c_pos = options.lastIndexOf( "-c" );
|
int c_pos = options.lastIndexOf( "-c" );
|
||||||
@ -364,21 +357,21 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
|||||||
if ( e_pos > lastEnsembleOptionPos )
|
if ( e_pos > lastEnsembleOptionPos )
|
||||||
{
|
{
|
||||||
lastEnsembleOptionPos = e_pos;
|
lastEnsembleOptionPos = e_pos;
|
||||||
ensembleColoringStyle = SINGLE_COLOR;
|
ensembleColoringStyle = EnsembleColoringType::SINGLE_COLOR;
|
||||||
}
|
}
|
||||||
if ( c_pos > lastEnsembleOptionPos )
|
if ( c_pos > lastEnsembleOptionPos )
|
||||||
{
|
{
|
||||||
lastEnsembleOptionPos = c_pos;
|
lastEnsembleOptionPos = c_pos;
|
||||||
ensembleColoringStyle = PARAMETER;
|
ensembleColoringStyle = EnsembleColoringType::PARAMETER;
|
||||||
}
|
}
|
||||||
if ( cl_pos > lastEnsembleOptionPos )
|
if ( cl_pos > lastEnsembleOptionPos )
|
||||||
{
|
{
|
||||||
lastEnsembleOptionPos = cl_pos;
|
lastEnsembleOptionPos = cl_pos;
|
||||||
ensembleColoringStyle = LOG_PARAMETER;
|
ensembleColoringStyle = EnsembleColoringType::LOG_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEnsembleMode = ensembleColoringStyle != NONE;
|
bool isEnsembleMode = ensembleColoringStyle != EnsembleColoringType::NONE;
|
||||||
|
|
||||||
std::vector<RimSummaryCase*> summaryCasesToUse;
|
std::vector<RimSummaryCase*> summaryCasesToUse;
|
||||||
|
|
||||||
@ -419,129 +412,38 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
|||||||
|
|
||||||
if ( isSinglePlot )
|
if ( isSinglePlot )
|
||||||
{
|
{
|
||||||
RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle();
|
RimSummaryPlot* newPlot = createSummaryPlotFromAddresses( sumPlotColl,
|
||||||
|
summaryCasesToUse,
|
||||||
if ( isEnsembleMode )
|
ensemble,
|
||||||
{
|
summaryAddressFilters,
|
||||||
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases =
|
addHistoryCurves,
|
||||||
applySummaryAddressFiltersToCases( summaryCasesToUse, summaryAddressFilters );
|
ensembleColoringStyle,
|
||||||
|
ensembleColoringParameter );
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lastPlotCreated = newPlot;
|
lastPlotCreated = newPlot;
|
||||||
|
|
||||||
newPlot->setLegendsVisible( !hideLegend );
|
newPlot->setLegendsVisible( !hideLegend );
|
||||||
newPlot->setNormalizationEnabled( isNormalizedY );
|
newPlot->setNormalizationEnabled( isNormalizedY );
|
||||||
|
|
||||||
newPlot->applyDefaultCurveAppearances();
|
|
||||||
newPlot->loadDataAndUpdate();
|
newPlot->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
else // Multiplot, one for each separate summary address
|
else // Multiplot, one for each separate summary address
|
||||||
{
|
{
|
||||||
std::set<RifEclipseSummaryAddress> filteredAdressesFromCases =
|
std::vector<RimSummaryPlot*> summaryPlots =
|
||||||
applySummaryAddressFiltersToCases( summaryCasesToUse, summaryAddressFilters );
|
createMultipleSummaryPlotsFromAddresses( sumPlotColl,
|
||||||
|
summaryCasesToUse,
|
||||||
|
ensemble,
|
||||||
|
summaryAddressFilters,
|
||||||
|
addHistoryCurves,
|
||||||
|
ensembleColoringStyle,
|
||||||
|
ensembleColoringParameter );
|
||||||
|
|
||||||
for ( const auto& addr : filteredAdressesFromCases )
|
lastPlotCreated = summaryPlots.back();
|
||||||
|
|
||||||
|
for ( auto summaryPlot : summaryPlots )
|
||||||
{
|
{
|
||||||
std::vector<RimSummaryCurve*> createdCurves;
|
summaryPlot->setLegendsVisible( !hideLegend );
|
||||||
std::vector<RimEnsembleCurveSet*> createdEnsembleCurveSets;
|
summaryPlot->setNormalizationEnabled( isNormalizedY );
|
||||||
if ( isEnsembleMode )
|
summaryPlot->loadDataAndUpdate();
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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 "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ class PdmObject;
|
|||||||
class RimSummaryCurve;
|
class RimSummaryCurve;
|
||||||
class RimSummaryPlot;
|
class RimSummaryPlot;
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
|
class RimSummaryCaseCollection;
|
||||||
class RimSummaryPlotCollection;
|
class RimSummaryPlotCollection;
|
||||||
|
|
||||||
class QStringList;
|
class QStringList;
|
||||||
@ -37,6 +40,14 @@ class QStringList;
|
|||||||
class RicSummaryPlotFeatureImpl
|
class RicSummaryPlotFeatureImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum class EnsembleColoringType
|
||||||
|
{
|
||||||
|
SINGLE_COLOR,
|
||||||
|
PARAMETER,
|
||||||
|
LOG_PARAMETER,
|
||||||
|
NONE
|
||||||
|
};
|
||||||
|
|
||||||
static RimSummaryCurve* addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
static RimSummaryCurve* addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||||
static std::vector<RimSummaryCurve*> addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
static std::vector<RimSummaryCurve*> addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||||
static void ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase );
|
static void ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase );
|
||||||
@ -44,6 +55,24 @@ public:
|
|||||||
|
|
||||||
static void createSummaryPlotsFromArgumentLine( const QStringList& arguments );
|
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,
|
static void filteredSummaryAdressesFromCase( const QStringList& curveFilters,
|
||||||
const std::set<RifEclipseSummaryAddress>& allAddressesInCase,
|
const std::set<RifEclipseSummaryAddress>& allAddressesInCase,
|
||||||
std::set<RifEclipseSummaryAddress>* setToInsertFilteredAddressesIn,
|
std::set<RifEclipseSummaryAddress>* setToInsertFilteredAddressesIn,
|
||||||
|
@ -7,7 +7,5 @@ project = resinsight.project
|
|||||||
|
|
||||||
summary_cases = project.descendants(rips.SummaryCase)
|
summary_cases = project.descendants(rips.SummaryCase)
|
||||||
summary_plot_collection = project.descendants(rips.SummaryPlotCollection)[0]
|
summary_plot_collection = project.descendants(rips.SummaryPlotCollection)[0]
|
||||||
|
if len(summary_cases) > 0:
|
||||||
|
summary_plot = summary_plot_collection.new_summary_plot(summary_cases=summary_cases, address="FOP*")
|
||||||
|
|
||||||
summary_plot = summary_plot_collection.new_summary_plot(summary_cases=summary_cases)
|
|
||||||
|
@ -528,7 +528,7 @@ grpc::Status RiaGrpcPdmObjectService::CallPdmObjectMethod( grpc::ServerContext*
|
|||||||
|
|
||||||
caf::PdmObjectHandle* result = method->execute();
|
caf::PdmObjectHandle* result = method->execute();
|
||||||
copyPdmObjectFromCafToRips( result, reply );
|
copyPdmObjectFromCafToRips( result, reply );
|
||||||
if ( method->deleteObjectAfterReply() )
|
if ( !method->resultIsPersistent() )
|
||||||
{
|
{
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "qwt_plot_textlabel.h"
|
#include "qwt_plot_textlabel.h"
|
||||||
|
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
|
#include "cafPdmPtrArrayField.h"
|
||||||
#include "cafPdmPtrField.h"
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
#include <QPointer>
|
#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<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
|
||||||
QList<QPointer<RiuQwtPlotLegend>> legends = this->legendsForVisiblePlots();
|
QList<QPointer<RiuQwtPlotLegend>> legends = this->legendsForVisiblePlots();
|
||||||
int rowCount = this->m_gridLayout->rowCount();
|
|
||||||
int colCount = this->m_gridLayout->columnCount();
|
int colCount = this->m_gridLayout->columnCount();
|
||||||
|
|
||||||
m_gridLayout->addLayout( m_trackScrollBarLayout, 2, colCount, 1, 1 );
|
m_gridLayout->addLayout( m_trackScrollBarLayout, 2, colCount, 1, 1 );
|
||||||
|
@ -39,6 +39,7 @@ target_include_directories(${PROJECT_NAME}
|
|||||||
|
|
||||||
target_link_libraries ( ${PROJECT_NAME}
|
target_link_libraries ( ${PROJECT_NAME}
|
||||||
cafProjectDataModel
|
cafProjectDataModel
|
||||||
|
cafPdmCvf
|
||||||
LibCore
|
LibCore
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -109,7 +109,10 @@ void PdmFieldScriptabilityIOHandler<QString>::writeToField( QString&
|
|||||||
// Could interpret as unquoted text
|
// Could interpret as unquoted text
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldValue = accumulatedFieldValue;
|
if ( accumulatedFieldValue != "None" )
|
||||||
|
{
|
||||||
|
fieldValue = accumulatedFieldValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -342,6 +342,8 @@ struct PdmFieldScriptabilityIOHandler<DataType*>
|
|||||||
QTextStream& inputStream,
|
QTextStream& inputStream,
|
||||||
PdmScriptIOMessages* errorMessageContainer )
|
PdmScriptIOMessages* errorMessageContainer )
|
||||||
{
|
{
|
||||||
|
fieldValue = nullptr; // Default initialized to nullptr
|
||||||
|
|
||||||
QString fieldString;
|
QString fieldString;
|
||||||
PdmFieldScriptabilityIOHandler<QString>::writeToField( fieldString, inputStream, errorMessageContainer, true );
|
PdmFieldScriptabilityIOHandler<QString>::writeToField( fieldString, inputStream, errorMessageContainer, true );
|
||||||
|
|
||||||
@ -355,11 +357,12 @@ struct PdmFieldScriptabilityIOHandler<DataType*>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( fieldString.isEmpty() ) return;
|
||||||
|
|
||||||
QStringList classAndAddress = fieldString.split( ":" );
|
QStringList classAndAddress = fieldString.split( ":" );
|
||||||
CAF_ASSERT( classAndAddress.size() == 2 );
|
CAF_ASSERT( classAndAddress.size() == 2 );
|
||||||
|
|
||||||
qulonglong address = classAndAddress[1].toULongLong();
|
qulonglong address = classAndAddress[1].toULongLong();
|
||||||
fieldValue = nullptr;
|
|
||||||
for ( DataType* object : allObjectsOfType )
|
for ( DataType* object : allObjectsOfType )
|
||||||
{
|
{
|
||||||
if ( reinterpret_cast<qulonglong>( object ) == address )
|
if ( reinterpret_cast<qulonglong>( object ) == address )
|
||||||
@ -448,13 +451,10 @@ public:
|
|||||||
std::vector<DataType*> allObjectsOfType;
|
std::vector<DataType*> allObjectsOfType;
|
||||||
existingObjectsRoot->descendantsIncludingThisOfType( allObjectsOfType );
|
existingObjectsRoot->descendantsIncludingThisOfType( allObjectsOfType );
|
||||||
|
|
||||||
DataType* object;
|
DataType* object = nullptr;
|
||||||
PdmFieldScriptabilityIOHandler<std::vector<DataType*>>::writeToField( object,
|
PdmFieldScriptabilityIOHandler<DataType*>::writeToField( object, allObjectsOfType, inputStream, errorMessageContainer );
|
||||||
allObjectsOfType,
|
|
||||||
inputStream,
|
|
||||||
errorMessageContainer );
|
|
||||||
|
|
||||||
if ( this->isIOWriteable() )
|
if ( object && this->isIOWriteable() )
|
||||||
{
|
{
|
||||||
m_field->setValue( object );
|
m_field->setValue( object );
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,9 @@ public:
|
|||||||
virtual PdmObjectHandle* execute() = 0;
|
virtual PdmObjectHandle* execute() = 0;
|
||||||
virtual QString selfClassKeyword() const { return m_self->xmlCapability()->classKeyword(); }
|
virtual QString selfClassKeyword() const { return m_self->xmlCapability()->classKeyword(); }
|
||||||
|
|
||||||
// False if object is a persistent project tree item. True if the object is to be deleted on completion.
|
// True if object is a persistent project tree item. False if the object is to be deleted on completion.
|
||||||
virtual bool deleteObjectAfterReply() const = 0;
|
virtual bool resultIsPersistent() const = 0;
|
||||||
|
virtual std::unique_ptr<PdmObjectHandle> defaultResult() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Basically the "this" pointer to the object the method belongs to
|
// Basically the "this" pointer to the object the method belongs to
|
||||||
|
@ -251,6 +251,12 @@ QString PdmPythonGenerator::generate( PdmObjectFactory* factory ) const
|
|||||||
QStringList argumentComments;
|
QStringList argumentComments;
|
||||||
|
|
||||||
outputArgumentStrings.push_back( QString( "\"%1\"" ).arg( methodName ) );
|
outputArgumentStrings.push_back( QString( "\"%1\"" ).arg( methodName ) );
|
||||||
|
QString returnComment( "Data object" );
|
||||||
|
if ( method->resultIsPersistent() )
|
||||||
|
{
|
||||||
|
returnComment = method->defaultResult()->xmlCapability()->classKeyword();
|
||||||
|
}
|
||||||
|
|
||||||
for ( auto field : arguments )
|
for ( auto field : arguments )
|
||||||
{
|
{
|
||||||
bool isList = field->xmlCapability()->isVectorField();
|
bool isList = field->xmlCapability()->isVectorField();
|
||||||
@ -266,10 +272,11 @@ QString PdmPythonGenerator::generate( PdmObjectFactory* factory ) const
|
|||||||
.arg( dataType )
|
.arg( dataType )
|
||||||
.arg( field->uiCapability()->uiWhatsThis() ) );
|
.arg( field->uiCapability()->uiWhatsThis() ) );
|
||||||
}
|
}
|
||||||
QString fullComment =
|
QString fullComment = QString( " \"\"\"\n %1\n Arguments:\n "
|
||||||
QString( " \"\"\"\n %1\n Arguments:\n %2\n \"\"\"" )
|
"%2\n Returns:\n %3\n \"\"\"" )
|
||||||
.arg( methodComment )
|
.arg( methodComment )
|
||||||
.arg( argumentComments.join( "\n " ) );
|
.arg( argumentComments.join( "\n " ) )
|
||||||
|
.arg( returnComment );
|
||||||
|
|
||||||
QString methodCode = QString( " def %1(self, %2):\n%3\n return "
|
QString methodCode = QString( " def %1(self, %2):\n%3\n return "
|
||||||
"self._call_pdm_method(%4)\n" )
|
"self._call_pdm_method(%4)\n" )
|
||||||
|
Loading…
Reference in New Issue
Block a user