mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2610 New command, display ensamble curves with single color
This commit is contained in:
@@ -32,6 +32,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorDialog.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotCurveFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsambleCurveSetFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -67,6 +68,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorDialog.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotCurveFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsambleCurveSetFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicNewSummaryEnsambleCurveSetFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimEnsambleCurveSet.h"
|
||||
#include "RimEnsambleCurveSetCollection.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewSummaryEnsambleCurveSetFeature, "RicNewSummaryEnsambleCurveSetFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryEnsambleCurveSetFeature::isCommandEnabled()
|
||||
{
|
||||
return (selectedSummaryPlot());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryEnsambleCurveSetFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimSummaryPlot* plot = selectedSummaryPlot();
|
||||
if (plot)
|
||||
{
|
||||
RimEnsambleCurveSet* curveSet = new RimEnsambleCurveSet();
|
||||
|
||||
plot->ensambleCurveSets()->addCurveSet(curveSet);
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(curveSet);
|
||||
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryEnsambleCurveSetFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("New Summary Ensamble Curve Set");
|
||||
actionToSetup->setIcon(QIcon(":/SummaryCurve16x16.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicNewSummaryEnsambleCurveSetFeature::selectedSummaryPlot() const
|
||||
{
|
||||
RimSummaryPlot* sumPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||
if (selObj)
|
||||
{
|
||||
sumPlot = RiaSummaryTools::parentSummaryPlot(selObj);
|
||||
}
|
||||
|
||||
return sumPlot;
|
||||
}
|
||||
@@ -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 RicNewSummaryEnsambleCurveSetFeature : 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;
|
||||
};
|
||||
@@ -40,6 +40,8 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimEnsambleCurveSetCollection.h"
|
||||
#include "RimEnsambleCurveSet.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuSummaryCurveDefSelection.h"
|
||||
@@ -540,6 +542,23 @@ void RicSummaryCurveCreator::updateTargetPlot()
|
||||
copyCurveAndAddToPlot(editedCurve, m_targetPlot);
|
||||
}
|
||||
|
||||
// DEBUG
|
||||
//{
|
||||
// m_targetPlot->ensambleCurveSets()->deleteAllCurveSets();
|
||||
|
||||
// RimEnsambleCurveSet* curveSet = new RimEnsambleCurveSet();
|
||||
// m_targetPlot->ensambleCurveSets()->addCurveSet(curveSet);
|
||||
|
||||
// for (const auto& editedCurve : m_previewPlot->summaryCurves())
|
||||
// {
|
||||
// if (!editedCurve->isCurveVisible())
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// copyEnsambleCurveAndAddToPlot(editedCurve, curveSet);
|
||||
// }
|
||||
//}
|
||||
|
||||
m_targetPlot->enableAutoPlotTitle(m_useAutoPlotTitleProxy());
|
||||
|
||||
m_targetPlot->loadDataAndUpdate();
|
||||
@@ -570,6 +589,30 @@ void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve *curve,
|
||||
curveCopy->loadDataAndUpdate(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::copyEnsambleCurveAndAddToPlot(const RimSummaryCurve *curve, RimEnsambleCurveSet *curveSet, bool forceVisible)
|
||||
{
|
||||
RimSummaryCurve* curveCopy = dynamic_cast<RimSummaryCurve*>(curve->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(curveCopy);
|
||||
|
||||
if (forceVisible)
|
||||
{
|
||||
curveCopy->setCurveVisiblity(true);
|
||||
}
|
||||
|
||||
curveSet->addCurve(curveCopy);
|
||||
|
||||
// Resolve references after object has been inserted into the project data model
|
||||
curveCopy->resolveReferencesRecursively();
|
||||
|
||||
// The curve creator is not a descendant of the project, and need to be set manually
|
||||
curveCopy->setSummaryCaseY(curve->summaryCaseY());
|
||||
curveCopy->initAfterReadRecursively();
|
||||
curveCopy->loadDataAndUpdate(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,7 @@ class RimSummaryCase;
|
||||
class RimSummaryCurveAutoName;
|
||||
class RimSummaryPlot;
|
||||
class RiaSummaryCurveDefinition;
|
||||
class RimEnsambleCurveSet;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -85,6 +86,7 @@ private:
|
||||
void populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot);
|
||||
void updateTargetPlot();
|
||||
static void copyCurveAndAddToPlot(const RimSummaryCurve *curve, RimSummaryPlot *plot, bool forceVisible = false);
|
||||
static void copyEnsambleCurveAndAddToPlot(const RimSummaryCurve *curve, RimEnsambleCurveSet* curveSet, bool forceVisible = false);
|
||||
void setDefaultCurveSelection();
|
||||
|
||||
void resetAllFields();
|
||||
|
||||
Reference in New Issue
Block a user