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:
@@ -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})
|
||||
|
||||
@@ -63,7 +63,7 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC
|
||||
newCurve->loadDataAndUpdate( true );
|
||||
newCurve->updateConnectedEditors();
|
||||
|
||||
summaryPlot->summaryCurveCollection()->updateAllRequiredEditors();
|
||||
summaryPlot->updateAllRequiredEditors();
|
||||
|
||||
return newCurve;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
Reference in New Issue
Block a user