mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Summary Plot Editor: Context menu update (#9289)
* Summary plot editor context menu update
This commit is contained in:
parent
3cdc69d1a7
commit
c685b7e9b5
@ -149,5 +149,13 @@ RimSummaryPlot* RicEditSummaryPlotFeature::selectedSummaryPlot()
|
||||
sumPlot = RiaSummaryTools::parentSummaryPlot( selObj );
|
||||
}
|
||||
|
||||
if ( !sumPlot )
|
||||
{
|
||||
RimSummaryMultiPlot* multiPlot = RiaSummaryTools::parentSummaryMultiPlot( selObj );
|
||||
if ( multiPlot )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return sumPlot;
|
||||
}
|
||||
|
@ -29,11 +29,13 @@
|
||||
#include "RimCustomObjectiveFunctionCollection.h"
|
||||
#include "RimEnsembleCurveFilter.h"
|
||||
#include "RimEnsembleCurveFilterCollection.h"
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
@ -54,20 +56,27 @@ bool RicOpenSummaryPlotEditorFeature::isCommandEnabled()
|
||||
RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
multiPlot = RiaSummaryTools::parentSummaryMultiPlot( selObj );
|
||||
selObj->firstAncestorOrThisOfType( customObjFuncCollection );
|
||||
}
|
||||
if ( !selObj ) return false;
|
||||
|
||||
selObj->firstAncestorOrThisOfType( customObjFuncCollection );
|
||||
|
||||
auto ensembleFilter = dynamic_cast<RimEnsembleCurveFilter*>( selObj );
|
||||
auto ensembleFilterColl = dynamic_cast<RimEnsembleCurveFilterCollection*>( selObj );
|
||||
auto legendConfig = dynamic_cast<RimRegularLegendConfig*>( selObj );
|
||||
auto sumPlot = dynamic_cast<RimSummaryPlot*>( selObj );
|
||||
|
||||
if ( ensembleFilter || ensembleFilterColl || legendConfig || customObjFuncCollection ) return false;
|
||||
if ( ensembleFilter || ensembleFilterColl || legendConfig || customObjFuncCollection || sumPlot ) return false;
|
||||
|
||||
multiPlot = RiaSummaryTools::parentSummaryMultiPlot( selObj );
|
||||
if ( multiPlot ) return true;
|
||||
|
||||
return true;
|
||||
auto summaryCase = dynamic_cast<RimSummaryCase*>( selObj );
|
||||
auto summaryCaseColl = dynamic_cast<RimSummaryCaseCollection*>( selObj );
|
||||
auto obsColl = dynamic_cast<RimObservedDataCollection*>( selObj );
|
||||
|
||||
if ( summaryCase || summaryCaseColl || obsColl ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -78,6 +87,9 @@ void RicOpenSummaryPlotEditorFeature::onActionTriggered( bool isChecked )
|
||||
RimProject* project = RimProject::current();
|
||||
CVF_ASSERT( project );
|
||||
|
||||
RimSummaryMultiPlot* multiPlot =
|
||||
dynamic_cast<RimSummaryMultiPlot*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
|
||||
std::vector<RimSummaryCase*> selectedCases = caf::selectedObjectsByType<RimSummaryCase*>();
|
||||
std::vector<RimSummaryCaseCollection*> selectedGroups = caf::selectedObjectsByType<RimSummaryCaseCollection*>();
|
||||
|
||||
@ -126,7 +138,21 @@ void RicOpenSummaryPlotEditorFeature::onActionTriggered( bool isChecked )
|
||||
dialog->raise();
|
||||
}
|
||||
|
||||
dialog->updateFromDefaultCases( sourcesToSelect );
|
||||
if ( multiPlot )
|
||||
{
|
||||
if ( multiPlot->summaryPlots().size() > 0 )
|
||||
{
|
||||
dialog->updateFromSummaryPlot( multiPlot->summaryPlots()[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog->updateFromSummaryMultiPlot( multiPlot );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog->updateFromDefaultCases( sourcesToSelect );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -67,6 +67,15 @@ void RicSummaryPlotEditorDialog::updateFromSummaryPlot( RimSummaryPlot* summaryP
|
||||
m_curveCreatorSplitterUi->updateUi();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryPlotEditorDialog::updateFromSummaryMultiPlot( RimSummaryMultiPlot* summaryPlot )
|
||||
{
|
||||
m_curveCreatorSplitterUi->updateFromSummaryMultiPlot( summaryPlot );
|
||||
m_curveCreatorSplitterUi->updateUi();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -27,6 +27,7 @@ class PdmObject;
|
||||
|
||||
class RicSummaryPlotEditorWidgetCreator;
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryMultiPlot;
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
@ -41,6 +42,7 @@ public:
|
||||
~RicSummaryPlotEditorDialog() override;
|
||||
|
||||
void updateFromSummaryPlot( RimSummaryPlot* summaryPlot );
|
||||
void updateFromSummaryMultiPlot( RimSummaryMultiPlot* summaryPlot );
|
||||
void updateFromDefaultCases( const std::vector<caf::PdmObject*> defaultSources );
|
||||
|
||||
private slots:
|
||||
|
@ -165,7 +165,7 @@ void RicSummaryPlotEditorUi::updateFromSummaryPlot( RimSummaryPlot*
|
||||
if ( m_targetPlot )
|
||||
{
|
||||
RimSummaryMultiPlot* parentPlot = nullptr;
|
||||
targetPlot->firstAncestorOfType( parentPlot );
|
||||
m_targetPlot->firstAncestorOfType( parentPlot );
|
||||
m_plotContainer = parentPlot;
|
||||
|
||||
populateCurveCreator( *m_targetPlot );
|
||||
@ -184,6 +184,23 @@ void RicSummaryPlotEditorUi::updateFromSummaryPlot( RimSummaryPlot*
|
||||
caf::PdmUiItem::updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryPlotEditorUi::updateFromSummaryMultiPlot( RimSummaryMultiPlot* summaryMultiPlot,
|
||||
const std::vector<SummarySource*>& defaultSources )
|
||||
{
|
||||
resetAllFields();
|
||||
|
||||
m_useAutoAppearanceAssignment = true;
|
||||
|
||||
m_plotContainer = summaryMultiPlot;
|
||||
|
||||
setDefaultCurveSelection( defaultSources );
|
||||
|
||||
caf::PdmUiItem::updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
void updateFromSummaryPlot( RimSummaryPlot* targetPlot,
|
||||
const std::vector<caf::PdmObject*>& defaultSources = std::vector<caf::PdmObject*>() );
|
||||
|
||||
void updateFromSummaryMultiPlot( RimSummaryMultiPlot* summaryMultiPlot,
|
||||
const std::vector<caf::PdmObject*>& defaultSources = std::vector<caf::PdmObject*>() );
|
||||
|
||||
QWidget* addressSelectionWidget( QWidget* parent );
|
||||
|
||||
bool isCloseButtonPressed() const;
|
||||
|
@ -66,6 +66,14 @@ void RicSummaryPlotEditorWidgetCreator::updateFromSummaryPlot( RimSummaryPlot* s
|
||||
m_summaryCurveCreator->updateFromSummaryPlot( summaryPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryPlotEditorWidgetCreator::updateFromSummaryMultiPlot( RimSummaryMultiPlot* summaryMultiPlot )
|
||||
{
|
||||
m_summaryCurveCreator->updateFromSummaryMultiPlot( summaryMultiPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryMultiPlot;
|
||||
class RimSummaryCase;
|
||||
class RicSummaryPlotEditorUi;
|
||||
|
||||
@ -54,6 +55,7 @@ public:
|
||||
~RicSummaryPlotEditorWidgetCreator() override;
|
||||
|
||||
void updateFromSummaryPlot( RimSummaryPlot* summaryPlot );
|
||||
void updateFromSummaryMultiPlot( RimSummaryMultiPlot* summaryMultiPlot );
|
||||
void updateFromDefaultSources( const std::vector<caf::PdmObject*> defaultSources );
|
||||
|
||||
private:
|
||||
|
@ -1121,6 +1121,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicShowTotalAllocationDataFeature";
|
||||
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
menuBuilder << "RicOpenSummaryPlotEditorFeature";
|
||||
menuBuilder << "RicNewDerivedEnsembleFeature";
|
||||
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
||||
menuBuilder << "RicSummaryCurveSwitchAxisFeature";
|
||||
|
Loading…
Reference in New Issue
Block a user