mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add copy/paste of Summary Multi Plot (#8942)
* Guard use of back() on empty vector * Add "Show Data Sources" to ensemble realizations * Update summary plot as summary curve collection is not visible in tree view * Set selection manager root in RiaApplication * Always close both main windows if present * Add copy/paste of summary multi plot * Add test for RiuMainWindow::instance() before use * Remove duplicated code * Multiple Tree Views : Use getTreeViewWithItem() to find correct tree view * Minor UI adjustments
This commit is contained in:
@@ -76,7 +76,7 @@ void RimMeasurement::setMeasurementMode( MeasurementMode measurementMode )
|
||||
}
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->refreshViewActions();
|
||||
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->refreshViewActions();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -419,7 +419,7 @@ bool Rim2dIntersectionView::handleOverlayItemPicked( const cvf::OverlayItem* pic
|
||||
{
|
||||
if ( m_legendObjectToSelect )
|
||||
{
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( m_legendObjectToSelect );
|
||||
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( m_legendObjectToSelect );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -564,6 +564,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicPasteSummaryPlotFeature";
|
||||
menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature";
|
||||
menuBuilder << "RicPasteSummaryMultiPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicShowSummaryCurveCalculatorFeature";
|
||||
}
|
||||
@@ -1035,6 +1036,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicSnapshotViewToPdfFeature";
|
||||
menuBuilder << "RicSaveMultiPlotTemplateFeature";
|
||||
menuBuilder << "RicPasteSummaryMultiPlotFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimMultiPlot*>( firstUiItem ) )
|
||||
{
|
||||
@@ -1104,6 +1106,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicReloadSummaryCaseFeature";
|
||||
menuBuilder << "RicReplaceSummaryCaseFeature";
|
||||
menuBuilder << "RicCreateSummaryCaseCollectionFeature";
|
||||
menuBuilder << "RicShowDataSourcesForRealization";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCutReferencesToClipboardFeature";
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@ RimEclipseCase::RimEclipseCase()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultAddressCollections, "ResultAddressCollections", "Result Addresses" );
|
||||
m_resultAddressCollections.uiCapability()->setUiHidden( true );
|
||||
m_resultAddressCollections.uiCapability()->setUiTreeHidden( true );
|
||||
m_resultAddressCollections.xmlCapability()->disableIO();
|
||||
|
||||
// Init
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RimEclipseResultAddress.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" );
|
||||
|
||||
@@ -30,8 +31,13 @@ RimEclipseResultAddress::RimEclipseResultAddress()
|
||||
CAF_PDM_InitObject( "EclipseResultAddress", ":/DataVector.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultName, "ResultName", "Result Name" );
|
||||
m_resultName.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" );
|
||||
m_resultType.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" );
|
||||
m_eclipseCase.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -88,3 +94,29 @@ RimEclipseCase* RimEclipseResultAddress::eclipseCase() const
|
||||
{
|
||||
return m_eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimEclipseResultAddress::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_eclipseCase )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
{
|
||||
std::vector<RimEclipseCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
for ( auto* c : cases )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ public:
|
||||
void setEclipseCase( RimEclipseCase* eclipseCase );
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
|
||||
private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_resultName;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::ResultCatType>> m_resultType;
|
||||
|
||||
@@ -112,6 +112,23 @@ bool RimSummaryCase::isObservedData() const
|
||||
return m_isObservedData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCase::showRealizationDataSources() const
|
||||
{
|
||||
return m_showSubNodesInTree();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCase::setShowRealizationDataSource( bool enable )
|
||||
{
|
||||
m_showSubNodesInTree = enable;
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -78,6 +78,9 @@ public:
|
||||
|
||||
bool isObservedData() const;
|
||||
|
||||
bool showRealizationDataSources() const;
|
||||
void setShowRealizationDataSource( bool enable );
|
||||
|
||||
void setCaseRealizationParameters( const std::shared_ptr<RigCaseRealizationParameters>& crlParameters );
|
||||
std::shared_ptr<RigCaseRealizationParameters> caseRealizationParameters() const;
|
||||
bool hasCaseRealizationParameters() const;
|
||||
|
||||
@@ -105,21 +105,7 @@ size_t RimSummaryMultiPlotCollection::plotCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlotCollection::onDuplicatePlot( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotToDuplicate )
|
||||
{
|
||||
if ( !plotToDuplicate ) return;
|
||||
|
||||
auto plotCopy = dynamic_cast<RimSummaryMultiPlot*>(
|
||||
plotToDuplicate->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
addSummaryMultiPlot( plotCopy );
|
||||
|
||||
plotCopy->resolveReferencesRecursively();
|
||||
plotCopy->initAfterReadRecursively();
|
||||
plotCopy->updateAllRequiredEditors();
|
||||
plotCopy->loadDataAndUpdate();
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plotCopy, true );
|
||||
duplicatePlot( plotToDuplicate );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -160,6 +146,28 @@ void RimSummaryMultiPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionIt
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlotCollection::duplicatePlot( RimSummaryMultiPlot* plotToDuplicate )
|
||||
{
|
||||
if ( !plotToDuplicate ) return;
|
||||
|
||||
auto plotCopy = dynamic_cast<RimSummaryMultiPlot*>(
|
||||
plotToDuplicate->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
addSummaryMultiPlot( plotCopy );
|
||||
|
||||
plotCopy->resolveReferencesRecursively();
|
||||
plotCopy->initAfterReadRecursively();
|
||||
plotCopy->updateAllRequiredEditors();
|
||||
plotCopy->loadDataAndUpdate();
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plotCopy, true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
std::vector<RimSummaryMultiPlot*> multiPlots() const;
|
||||
|
||||
void addSummaryMultiPlot( RimSummaryMultiPlot* plot );
|
||||
|
||||
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
|
||||
void duplicatePlot( RimSummaryMultiPlot* plotToDuplicate );
|
||||
|
||||
void updateSummaryNameHasChanged();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user