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:
Magne Sjaastad 2022-05-23 14:25:53 +02:00 committed by GitHub
parent 329e1e8b69
commit 01e670a3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 417 additions and 100 deletions

View File

@ -96,6 +96,7 @@
#include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
#include "cafUiProcess.h"
#include "cafUtils.h"
@ -163,6 +164,8 @@ RiaApplication::RiaApplication()
RiaApplication::~RiaApplication()
{
RiaFontCache::clear();
caf::SelectionManager::instance()->setPdmRootObject( nullptr );
}
//--------------------------------------------------------------------------------------------------
@ -1505,6 +1508,8 @@ void RiaApplication::initialize()
m_project = std::make_unique<RimProject>();
m_project->setScriptDirectories( m_preferences->scriptDirectories() );
m_project->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
caf::SelectionManager::instance()->setPdmRootObject( project() );
}
//--------------------------------------------------------------------------------------------------

View File

@ -788,7 +788,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
mainPlotWnd->loadWinGeoAndDockToolBarLayout();
}
RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout();
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout();
return ApplicationStatus::EXIT_COMPLETED;
}
@ -1140,7 +1140,7 @@ void RiaGuiApplication::clearAllSelections()
void RiaGuiApplication::showFormattedTextInMessageBoxOrConsole( const QString& text )
{
// Create a message dialog with cut/paste friendly text
QDialog dlg( RiuMainWindow::instance() );
QDialog dlg;
dlg.setModal( true );
QGridLayout* layout = new QGridLayout;
@ -1478,7 +1478,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
rim3dView->updateScaling();
if ( rim3dView == activeViewWindow() )
{
RiuMainWindow::instance()->updateScaleValue();
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->updateScaleValue();
}
}

View File

@ -367,7 +367,7 @@ int RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl( const QStr
if ( RiaGuiApplication::isRunning() )
{
RiuMainWindow::instance()->selectAsCurrentItem( riv->cellResult() );
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( riv->cellResult() );
}
}
else
@ -479,7 +479,8 @@ bool RiaImportEclipseCaseTools::addEclipseCases( const QStringList& fil
if ( RiaGuiApplication::isRunning() && gridCaseGroup && !gridCaseGroup->statisticsCaseCollection()->reservoirs.empty() )
{
RiuMainWindow::instance()->selectAsCurrentItem( gridCaseGroup->statisticsCaseCollection()->reservoirs[0] );
if ( RiuMainWindow::instance() )
RiuMainWindow::instance()->selectAsCurrentItem( gridCaseGroup->statisticsCaseCollection()->reservoirs[0] );
}
return true;

View File

@ -39,6 +39,6 @@ RicfSetMainWindowSize::RicfSetMainWindowSize()
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicfSetMainWindowSize::execute()
{
RiuMainWindow::instance()->resize( m_width, m_height );
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->resize( m_width, m_height );
return caf::PdmScriptResponse();
}

View File

@ -60,11 +60,16 @@ void RicExitApplicationFeature::onActionTriggered( bool isChecked )
{
topLevelWidget->hide();
}
// Close just the main window, it'll take care of closing the plot window
if ( app->mainWindow() )
{
app->mainWindow()->close();
}
if ( app->mainPlotWindow() )
{
app->mainPlotWindow()->close();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -84,6 +84,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorUi.h
${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.h
${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.h
${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -171,6 +172,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.cpp
${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@ -59,8 +59,7 @@ void RicExecuteScriptForCasesFeature::onActionTriggered( bool isChecked )
{
QString scriptAbsolutePath = userData().toString();
RiuMainWindow* mainWindow = RiuMainWindow::instance();
mainWindow->showProcessMonitorDockPanel();
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->showProcessMonitorDockPanel();
RiaApplication* app = RiaApplication::instance();

View File

@ -30,6 +30,7 @@
#include "RimGridCrossPlotDataSet.h"
#include "RimMimeData.h"
#include "RimModeledWellPath.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
@ -124,63 +125,37 @@ bool RicCopyReferencesToClipboardFeature::isAnyCopyableObjectSelected()
//--------------------------------------------------------------------------------------------------
bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported( caf::PdmObject* pdmObject )
{
// Copy support based on direct dynamic cast
if ( dynamic_cast<RimGeoMechView*>( pdmObject ) ) return true;
if ( dynamic_cast<RimEclipseView*>( pdmObject ) ) return true;
if ( dynamic_cast<RimEclipseCase*>( pdmObject ) ) return true;
if ( dynamic_cast<RimExtrudedCurveIntersection*>( pdmObject ) ) return true;
if ( dynamic_cast<RimBoxIntersection*>( pdmObject ) ) return true;
if ( dynamic_cast<RimSummaryPlot*>( pdmObject ) ) return true;
if ( dynamic_cast<RimFractureTemplate*>( pdmObject ) ) return true;
if ( dynamic_cast<RimEnsembleCurveSet*>( pdmObject ) ) return true;
if ( dynamic_cast<RimGridCrossPlotDataSet*>( pdmObject ) ) return true;
if ( dynamic_cast<RimModeledWellPath*>( pdmObject ) ) return true;
if ( dynamic_cast<RimSummaryMultiPlot*>( pdmObject ) ) return true;
// Copy support based combined logic
RimWellAllocationPlot* wellAllocPlot = nullptr;
RimWellRftPlot* rftPlot = nullptr;
pdmObject->firstAncestorOrThisOfType( wellAllocPlot );
pdmObject->firstAncestorOrThisOfType( rftPlot );
if ( dynamic_cast<RimGeoMechView*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimEclipseView*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimEclipseCase*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimExtrudedCurveIntersection*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimBoxIntersection*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimSummaryPlot*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimPlotCurve*>( pdmObject ) && !dynamic_cast<RimGridCrossPlotCurve*>( pdmObject ) )
if ( dynamic_cast<RimPlotCurve*>( pdmObject ) && !dynamic_cast<RimGridCrossPlotCurve*>( pdmObject ) )
{
if ( !rftPlot ) return true;
}
else if ( dynamic_cast<RimWellLogTrack*>( pdmObject ) )
if ( dynamic_cast<RimWellLogTrack*>( pdmObject ) )
{
if ( !wellAllocPlot && !rftPlot ) return true;
}
else if ( dynamic_cast<RimWellLogPlot*>( pdmObject ) )
if ( dynamic_cast<RimWellLogPlot*>( pdmObject ) )
{
if ( !wellAllocPlot && !rftPlot ) return true;
}
else if ( dynamic_cast<RimFractureTemplate*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimEnsembleCurveSet*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimGridCrossPlotDataSet*>( pdmObject ) )
{
return true;
}
else if ( dynamic_cast<RimModeledWellPath*>( pdmObject ) )
{
return true;
}
return false;
}

View File

@ -297,10 +297,13 @@ std::vector<RimSummaryPlot*> RicAppendSummaryPlotsForObjectsFeature::plotsForOne
}
else if ( objectType == RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE )
{
auto curves = sourcePlots.back()->summaryCurves();
if ( !curves.empty() )
if ( !sourcePlots.empty() )
{
caseIdToMatch = curves.front()->summaryCaseY()->caseId();
auto curves = sourcePlots.back()->summaryCurves();
if ( !curves.empty() )
{
caseIdToMatch = curves.front()->summaryCaseY()->caseId();
}
}
}

View File

@ -86,7 +86,7 @@ void RicCloseCaseFeature::onActionTriggered( bool isChecked )
{
deleteEclipseCase( eclipseCase );
}
RiuMainWindow::instance()->cleanupGuiCaseClose();
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->cleanupGuiCaseClose();
}
}
@ -96,7 +96,7 @@ void RicCloseCaseFeature::onActionTriggered( bool isChecked )
{
deleteGeoMechCase( geoMechCase );
}
RiuMainWindow::instance()->cleanupGuiCaseClose();
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->cleanupGuiCaseClose();
}
}

View File

@ -0,0 +1,89 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RicShowDataSourcesForRealization.h"
#include "RimSummaryCase.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicShowDataSourcesForRealization, "RicShowDataSourcesForRealization" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowDataSourcesForRealization::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Show Data Sources" );
actionToSetup->setCheckable( true );
actionToSetup->setChecked( isCommandChecked() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowDataSourcesForRealization::isCommandChecked()
{
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( !selection.empty() )
{
return selection.front()->showRealizationDataSources();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowDataSourcesForRealization::isCommandEnabled()
{
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
for ( RimSummaryCase* summaryCase : selection )
{
if ( summaryCase->ensemble() )
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowDataSourcesForRealization::onActionTriggered( bool isChecked )
{
std::vector<RimSummaryCase*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.empty() ) return;
bool enableDataSources = !selection.front()->showRealizationDataSources();
for ( auto summaryCase : selection )
{
summaryCase->setShowRealizationDataSource( enableDataSources );
}
}

View File

@ -0,0 +1,35 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 RicShowDataSourcesForRealization : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
bool isCommandChecked() override;
};

View File

@ -42,6 +42,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteSummaryMultiPlotFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -88,6 +89,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteSummaryMultiPlotFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -63,7 +63,7 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC
newCurve->loadDataAndUpdate( true );
newCurve->updateConnectedEditors();
summaryPlot->summaryCurveCollection()->updateAllRequiredEditors();
summaryPlot->updateAllRequiredEditors();
return newCurve;
}

View File

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- 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 "RicPasteSummaryMultiPlotFeature.h"
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
#include "RiaSummaryTools.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryMultiPlotCollection.h"
#include "cafPdmDefaultObjectFactory.h"
#include "cafPdmObjectGroup.h"
#include "cafSelectionManagerTools.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicPasteSummaryMultiPlotFeature, "RicPasteSummaryMultiPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPasteSummaryMultiPlotFeature::isCommandEnabled()
{
auto multiPlots = caf::selectedObjectsByTypeStrict<RimSummaryMultiPlot*>();
return !multiPlots.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteSummaryMultiPlotFeature::onActionTriggered( bool isChecked )
{
auto sourceObjects = RicPasteSummaryMultiPlotFeature::summaryMultiPlots();
for ( const auto& sourceObject : sourceObjects )
{
RiaSummaryTools::summaryMultiPlotCollection()->duplicatePlot( sourceObject );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteSummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Paste Summary Plot" );
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmPointer<RimSummaryMultiPlot>> RicPasteSummaryMultiPlotFeature::summaryMultiPlots()
{
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
std::vector<caf::PdmPointer<RimSummaryMultiPlot>> typedObjects;
objectGroup.objectsByType( &typedObjects );
return typedObjects;
}

View File

@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022- 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"
#include "cafPdmPointer.h"
#include <vector>
class RimSummaryMultiPlot;
//==================================================================================================
///
//==================================================================================================
class RicPasteSummaryMultiPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static std::vector<caf::PdmPointer<RimSummaryMultiPlot>> summaryMultiPlots();
};

View File

@ -76,7 +76,7 @@ void RimMeasurement::setMeasurementMode( MeasurementMode measurementMode )
}
}
RiuMainWindow::instance()->refreshViewActions();
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->refreshViewActions();
}
//--------------------------------------------------------------------------------------------------

View File

@ -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;
}

View File

@ -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";

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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;

View File

@ -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 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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();

View File

@ -38,10 +38,7 @@ QWidget* Riu3DMainWindowTools::mainWindowWidget()
//--------------------------------------------------------------------------------------------------
void Riu3DMainWindowTools::setActiveViewer( QWidget* subWindow )
{
if ( RiuMainWindow::instance() )
{
RiuMainWindow::instance()->setActiveViewer( subWindow );
}
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->setActiveViewer( subWindow );
}
//--------------------------------------------------------------------------------------------------
@ -49,10 +46,7 @@ void Riu3DMainWindowTools::setActiveViewer( QWidget* subWindow )
//--------------------------------------------------------------------------------------------------
void Riu3DMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem, bool expanded /*= true*/ )
{
if ( RiuMainWindow::instance() )
{
RiuMainWindow::instance()->setExpanded( uiItem, expanded );
}
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->setExpanded( uiItem, expanded );
}
//--------------------------------------------------------------------------------------------------
@ -60,10 +54,7 @@ void Riu3DMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem, bool expan
//--------------------------------------------------------------------------------------------------
void Riu3DMainWindowTools::selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange /*= true*/ )
{
if ( RiuMainWindow::instance() )
{
RiuMainWindow::instance()->selectAsCurrentItem( object, allowActiveViewChange );
}
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( object, allowActiveViewChange );
}
//--------------------------------------------------------------------------------------------------

View File

@ -277,6 +277,8 @@ QAction* RiuDockWidgetTools::toggleActionForWidget( const QObject* parent, const
//--------------------------------------------------------------------------------------------------
void RiuDockWidgetTools::setVisibleDockingWindowsForEclipse()
{
if ( !RiuMainWindow::instance() ) return;
RiuMainWindow* mainWindow = RiuMainWindow::instance();
auto widgetVisibilities = widgetVisibilitiesForEclipse();
@ -288,6 +290,8 @@ void RiuDockWidgetTools::setVisibleDockingWindowsForEclipse()
//--------------------------------------------------------------------------------------------------
void RiuDockWidgetTools::setVisibleDockingWindowsForGeoMech()
{
if ( !RiuMainWindow::instance() ) return;
RiuMainWindow* mainWindow = RiuMainWindow::instance();
auto widgetVisibilities = widgetVisibilitiesForGeoMech();
@ -348,6 +352,8 @@ QVariant RiuDockWidgetTools::defaultDockWidgetVisibilities()
//--------------------------------------------------------------------------------------------------
void RiuDockWidgetTools::workaroundForQwtDockWidgets()
{
if ( !RiuMainWindow::instance() ) return;
RiuMainWindow* mainWindow = RiuMainWindow::instance();
QList<QDockWidget*> dockWidgets = mainWindow->findChildren<QDockWidget*>();

View File

@ -1230,8 +1230,6 @@ void RiuMainWindow::setPdmRoot( caf::PdmObject* pdmRoot )
projPropView->setPdmItem( pdmRoot );
}
}
caf::SelectionManager::instance()->setPdmRootObject( pdmRoot );
}
//--------------------------------------------------------------------------------------------------
@ -1343,7 +1341,10 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
if ( is3dViewCurrentlySelected && ( previousActiveReservoirView != activatedView ) )
{
QModelIndex newViewModelIndex = projectTreeView( 0 )->findModelIndex( activatedView );
auto tv = getTreeViewWithItem( activatedView );
if ( !tv ) return;
QModelIndex newViewModelIndex = tv->findModelIndex( activatedView );
if ( !newViewModelIndex.isValid() ) return;
QModelIndex newSelectionIndex = newViewModelIndex;
@ -1352,8 +1353,8 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
{
// Try to select the same entry in the new View, as was selected in the previous
QModelIndex previousViewModelIndex = projectTreeView( 0 )->findModelIndex( previousActiveReservoirView );
QModelIndex currentSelectionIndex = projectTreeView( 0 )->treeView()->selectionModel()->currentIndex();
QModelIndex previousViewModelIndex = tv->findModelIndex( previousActiveReservoirView );
QModelIndex currentSelectionIndex = tv->treeView()->selectionModel()->currentIndex();
if ( currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid() )
{
@ -1376,8 +1377,7 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
QModelIndex tmp = route[i];
if ( newSelectionIndex.isValid() )
{
newSelectionIndex =
projectTreeView( 0 )->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex );
newSelectionIndex = tv->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex );
}
}
@ -1389,10 +1389,10 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
}
}
projectTreeView( 0 )->treeView()->setCurrentIndex( newSelectionIndex );
tv->treeView()->setCurrentIndex( newSelectionIndex );
if ( newSelectionIndex != newViewModelIndex )
{
projectTreeView( 0 )->treeView()->setExpanded( newViewModelIndex, true );
tv->treeView()->setExpanded( newViewModelIndex, true );
}
}
}
@ -1484,8 +1484,11 @@ void RiuMainWindow::slotBuildWindowActions()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::selectedObjectsChanged()
{
caf::PdmUiTreeView* projectTree = dynamic_cast<caf::PdmUiTreeView*>( sender() );
if ( !projectTree ) return;
std::vector<caf::PdmUiItem*> uiItems;
projectTreeView( 0 )->selectedUiItems( uiItems );
projectTree->selectedUiItems( uiItems );
caf::PdmObjectHandle* firstSelectedObject = nullptr;
if ( !uiItems.empty() )
@ -1543,7 +1546,7 @@ void RiuMainWindow::selectedObjectsChanged()
// The only way to get to this code is by selection change initiated from the project tree view
// As we are activating an MDI-window, the focus is given to this MDI-window
// Set focus back to the tree view to be able to continue keyboard tree view navigation
projectTreeView( 0 )->treeView()->setFocus();
projectTree->treeView()->setFocus();
}
}
}
@ -1906,8 +1909,11 @@ void RiuMainWindow::slotCreateCommandObject()
RiaApplication* app = RiaApplication::instance();
if ( !app->project() ) return;
caf::PdmUiTreeView* projectTree = dynamic_cast<caf::PdmUiTreeView*>( sender() );
if ( !projectTree ) return;
std::vector<caf::PdmUiItem*> selectedUiItems;
projectTreeView( 0 )->selectedUiItems( selectedUiItems );
projectTree->selectedUiItems( selectedUiItems );
caf::PdmObjectGroup selectedObjects;
for ( auto* selectedUiItem : selectedUiItems )

View File

@ -79,6 +79,8 @@ RiuSelectionChangedHandler::~RiuSelectionChangedHandler()
//--------------------------------------------------------------------------------------------------
void RiuSelectionChangedHandler::handleSelectionDeleted() const
{
if ( !RiuMainWindow::instance() ) return;
RiuMainWindow::instance()->resultPlot()->deleteAllCurves();
RiuRelativePermeabilityPlotUpdater* relPermPlotUpdater =
@ -101,6 +103,8 @@ void RiuSelectionChangedHandler::handleSelectionDeleted() const
//--------------------------------------------------------------------------------------------------
void RiuSelectionChangedHandler::handleItemAppended( const RiuSelectionItem* item ) const
{
if ( !RiuMainWindow::instance() ) return;
addCurveFromSelectionItem( item );
RiuRelativePermeabilityPlotUpdater* relPermUpdater =
@ -123,6 +127,8 @@ void RiuSelectionChangedHandler::handleItemAppended( const RiuSelectionItem* ite
//--------------------------------------------------------------------------------------------------
void RiuSelectionChangedHandler::handleSetSelectedItem( const RiuSelectionItem* item ) const
{
if ( !RiuMainWindow::instance() ) return;
RiuMainWindow::instance()->resultPlot()->deleteAllCurves();
RiuMohrsCirclePlot* mohrsCirclePlot = RiuMainWindow::instance()->mohrsCirclePlot();