mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#756 Startingpoint for Curve Filter in place, with command to create
This commit is contained in:
@@ -8,11 +8,13 @@ endif()
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFilterFeature.cpp
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil 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 "RicNewSummaryCurveFilterFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewSummaryCurveFilterFeature, "RicNewSummaryCurveFilterFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryCurveFilterFeature::isCommandEnabled()
|
||||
{
|
||||
return (selectedSummaryPlot());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryCurveFilterFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||
CVF_ASSERT(mainPlotColl);
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
||||
CVF_ASSERT(summaryPlotColl);
|
||||
|
||||
RimSummaryPlot* plot = selectedSummaryPlot();
|
||||
if (plot)
|
||||
{
|
||||
RimSummaryCurveFilter* newCurveFilter = new RimSummaryCurveFilter();
|
||||
plot->addCurveFilter(newCurveFilter);
|
||||
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newCurveFilter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryCurveFilterFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("New Summary Curve Filter");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicNewSummaryCurveFilterFeature::selectedSummaryPlot() const
|
||||
{
|
||||
std::vector<RimSummaryPlot*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
return selection.size() > 0 ? selection[0] : NULL;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil 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 <vector>
|
||||
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewSummaryCurveFilterFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
RimSummaryPlot* selectedSummaryPlot() const;
|
||||
};
|
||||
@@ -270,6 +270,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "RicNewSummaryCurveFilterFeature";
|
||||
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCurve*>(uiItem))
|
||||
|
||||
@@ -276,6 +276,7 @@ void RimSummaryCurveFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
||||
}
|
||||
curveVarSelectionGroup->add(&m_uiFilterResultMultiSelection);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -306,3 +307,25 @@ RifReaderEclipseSummary* RimSummaryCurveFilter::summaryReader()
|
||||
return m_selectedSummaryCase()->caseData()->summaryReader();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveFilter::setParentQwtPlot(QwtPlot* plot)
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setParentQwtPlot(plot);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveFilter::detachQwtCurve()
|
||||
{
|
||||
for(RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->detachQwtCurve();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
virtual ~RimSummaryCurveFilter();
|
||||
|
||||
void loadDataAndUpdate() {}
|
||||
void setParentQwtPlot(QwtPlot* plot);
|
||||
void detachQwtCurve();
|
||||
|
||||
private:
|
||||
RifReaderEclipseSummary* summaryReader();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
@@ -44,8 +45,12 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_curveFilters, "SummaryCurveFilters", "", "", "", "");
|
||||
m_curveFilters.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_curves, "SummaryCurves", "", "", "", "");
|
||||
m_curves.uiCapability()->setUiHidden(true);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -58,6 +63,7 @@ RimSummaryPlot::~RimSummaryPlot()
|
||||
deletePlotWidget();
|
||||
|
||||
m_curves.deleteAllChildObjects();
|
||||
m_curveFilters.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -104,6 +110,21 @@ void RimSummaryPlot::addCurve(RimSummaryCurve* curve)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::addCurveFilter(RimSummaryCurveFilter* curveFilter)
|
||||
{
|
||||
if(curveFilter)
|
||||
{
|
||||
m_curveFilters.push_back(curveFilter);
|
||||
if(m_qwtPlot)
|
||||
{
|
||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -142,10 +163,13 @@ void RimSummaryPlot::loadDataAndUpdate()
|
||||
{
|
||||
updateViewerWidget();
|
||||
|
||||
for (size_t i = 0; i < m_curves.size(); i++)
|
||||
for (RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||
{
|
||||
RimSummaryCurve* curve = m_curves[i];
|
||||
curveFilter->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
@@ -170,15 +194,19 @@ void RimSummaryPlot::updateViewerWidget()
|
||||
if (!m_qwtPlot)
|
||||
{
|
||||
m_qwtPlot = new RiuSummaryQwtPlot(this, RiuMainWindow::instance());
|
||||
for (size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||
|
||||
for(RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||
{
|
||||
m_curves[cIdx]->setParentQwtPlot(m_qwtPlot);
|
||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
for(RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->addViewer(m_qwtPlot, this->mdiWindowGeometry());
|
||||
RiuMainWindow::instance()->setActiveViewer(m_qwtPlot);
|
||||
|
||||
}
|
||||
|
||||
//updateViewerWidgetWindowTitle();
|
||||
@@ -202,8 +230,13 @@ void RimSummaryPlot::updateViewerWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::detachAllCurves()
|
||||
{
|
||||
for (size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx)
|
||||
for(RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||
{
|
||||
m_curves[cIdx]->detachQwtCurve();
|
||||
curveFilter->detachQwtCurve();
|
||||
}
|
||||
|
||||
for(RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->detachQwtCurve();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
class RiuSummaryQwtPlot;
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryCurveFilter;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -45,6 +46,8 @@ public:
|
||||
|
||||
void setDescription(const QString& description);
|
||||
void addCurve(RimSummaryCurve* curve);
|
||||
void addCurveFilter(RimSummaryCurveFilter* curveFilter);
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void handleViewerDeletion();
|
||||
|
||||
@@ -63,6 +66,7 @@ private:
|
||||
caf::PdmField<bool> m_showWindow;
|
||||
caf::PdmField<QString> m_userName;
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||
caf::PdmChildArrayField<RimSummaryCurveFilter*> m_curveFilters;
|
||||
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user