#2187 Summary Plot : Add summary plot tool bar for stepping

This commit is contained in:
Magne Sjaastad 2017-11-29 12:55:42 +01:00
parent 3f55d4f1f0
commit f2bd87762c
6 changed files with 87 additions and 2 deletions

View File

@ -242,6 +242,14 @@ void RimSummaryCurveCollection::applyPreviousIdentifier()
m_sourceStepping->applyPreviousIdentifier();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle*> RimSummaryCurveCollection::fieldsToShowInToolbar()
{
return m_sourceStepping()->fieldsToShowInToolbar();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -62,6 +62,7 @@ public:
void applyNextIdentifier();
void applyPreviousIdentifier();
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
QString compileAutoPlotTitle() const;

View File

@ -159,6 +159,47 @@ void RimSummaryPlotSourceStepping::applyPreviousIdentifier()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::fieldsToShowInToolbar()
{
std::vector<caf::PdmFieldHandle*> fields;
RimSummaryCurveCollection* curveCollection = nullptr;
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
RiaSummaryCurveAnalyzer analyzer;
analyzer.analyzeCurves(curveCollection);
if (analyzer.summaryCases().size() == 1)
{
fields.push_back(&m_summaryCase);
}
if (analyzer.wellNames().size() == 1)
{
fields.push_back(&m_wellName);
}
if (analyzer.wellGroupNames().size() == 1)
{
fields.push_back(&m_wellGroupName);
}
if (analyzer.regionNumbers().size() == 1)
{
fields.push_back(&m_region);
}
if (analyzer.quantities().size() == 1)
{
fields.push_back(&m_quantity);
}
return fields;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -41,6 +41,8 @@ public:
void applyNextIdentifier();
void applyPreviousIdentifier();
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
private:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;

View File

@ -23,6 +23,7 @@
#include "RiaPreferences.h"
#include "RimProject.h"
#include "RimSummaryCurveCollection.h"
#include "RimSummaryPlot.h"
#include "RimViewWindow.h"
#include "RimWellAllocationPlot.h"
@ -38,6 +39,7 @@
#include "cafCmdFeatureManager.h"
#include "cafPdmUiPropertyView.h"
#include "cafPdmUiToolBarEditor.h"
#include "cafPdmUiTreeView.h"
#include "cafQTreeViewStateSerializer.h"
@ -308,6 +310,8 @@ void RiuMainPlotWindow::createToolBars()
toolbar->addAction(cmdFeatureMgr->action(s));
}
}
m_summaryPlotToolBar = new caf::PdmUiToolBarEditor("Summary Plot", this);
}
//--------------------------------------------------------------------------------------------------
@ -587,6 +591,20 @@ void RiuMainPlotWindow::selectedObjectsChanged()
}
m_pdmUiPropertyView->showProperties(firstSelectedObject);
std::vector<caf::PdmFieldHandle*> toolBarFields;
if (firstSelectedObject)
{
RimSummaryPlot* summaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType(summaryPlot);
if (summaryPlot)
{
toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
}
}
m_summaryPlotToolBar->setFields(toolBarFields);
m_summaryPlotToolBar->updateUi();
if (uiItems.size() == 1)
{
// Find the reservoir view or the Plot that the selected item is within
@ -671,6 +689,20 @@ void RiuMainPlotWindow::restoreTreeViewState()
void RiuMainPlotWindow::selectAsCurrentItem(caf::PdmObject* object)
{
m_projectTreeView->selectAsCurrentItem(object);
std::vector<caf::PdmFieldHandle*> toolBarFields;
/*
RimSummaryPlot* summaryPlot = nullptr;
object->firstAncestorOrThisOfType(summaryPlot);
if (summaryPlot)
{
toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
}
m_summaryPlotToolBar->setFields(toolBarFields);
m_summaryPlotToolBar->updateUi();
*/
}
//--------------------------------------------------------------------------------------------------

View File

@ -39,6 +39,7 @@ namespace caf
class PdmObject;
class PdmUiPropertyView;
class PdmUiItem;
class PdmUiToolBarEditor;
}
//==================================================================================================
@ -121,7 +122,7 @@ private:
QMenu* m_windowMenu;
caf::PdmUiTreeView* m_projectTreeView;
caf::PdmUiToolBarEditor* m_summaryPlotToolBar;
std::unique_ptr<caf::PdmUiDragDropInterface> m_dragDropInterface;
caf::PdmObject* m_pdmRoot;