Create a new, empty summaryplot from empty MDI area (#9823)

* Enable context menu in empty MDI area to create a new, empty summaryplot
This commit is contained in:
jonjenssen 2023-02-07 17:47:49 +01:00 committed by GitHub
parent f5ee8d269a
commit bbd732e84d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 110 additions and 0 deletions

View File

@ -12,6 +12,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryAddressesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryAddressesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSplitMultiPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewEmptySummaryMultiPlotFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -28,6 +29,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSplitMultiPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewEmptySummaryMultiPlotFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewEmptySummaryMultiPlotFeature.h"
#include "RicSummaryPlotBuilder.h"
#include "RimProject.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryMultiPlotCollection.h"
#include "RimSummaryPlot.h"
#include "RicSummaryPlotBuilder.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewEmptySummaryMultiPlotFeature, "RicNewEmptySummaryMultiPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewEmptySummaryMultiPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewEmptySummaryMultiPlotFeature::onActionTriggered( bool isChecked )
{
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
std::vector<RimSummaryCaseCollection*> selectedEnsembles;
bool skipCreationOfPlotBasedOnPreferences = true;
RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( selectedIndividualSummaryCases,
selectedEnsembles,
skipCreationOfPlotBasedOnPreferences );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewEmptySummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Add Summary Plot" );
actionToSetup->setIcon( QIcon( ":/MultiPlot16x16.png" ) );
}

View File

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

View File

@ -48,6 +48,7 @@
#include "SummaryPlotCommands/RicSummaryCurveCalculatorDialog.h"
#include "SummaryPlotCommands/RicSummaryPlotEditorDialog.h"
#include "RiuContextMenuLauncher.h"
#include "RiuDockWidgetTools.h"
#include "RiuDragDrop.h"
#include "RiuMdiArea.h"
@ -60,6 +61,7 @@
#include "cafCmdExecCommandManager.h"
#include "cafCmdFeatureManager.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiPropertyView.h"
#include "cafPdmUiToolBarEditor.h"
@ -91,6 +93,10 @@ RiuPlotMainWindow::RiuPlotMainWindow()
m_mdiArea = new RiuMdiArea( this );
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
caf::CmdFeatureMenuBuilder menuForMdiArea;
menuForMdiArea << "RicNewEmptySummaryMultiPlotFeature";
new RiuContextMenuLauncher( m_mdiArea, menuForMdiArea );
ads::CDockWidget* cWidget =
RiuDockWidgetTools::createDockWidget( "Plot Window", RiuDockWidgetTools::mainPlotWindowName(), this );