mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
WIP: Started to create the summary plot Rim data structures.
This commit is contained in:
@@ -133,6 +133,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
|||||||
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
||||||
Commands/ViewLink/CMakeLists_files.cmake
|
Commands/ViewLink/CMakeLists_files.cmake
|
||||||
Commands/WellLogCommands/CMakeLists_files.cmake
|
Commands/WellLogCommands/CMakeLists_files.cmake
|
||||||
|
Commands/SummaryPlotCommands/CMakeLists_files.cmake
|
||||||
Commands/WellPathCommands/CMakeLists_files.cmake
|
Commands/WellPathCommands/CMakeLists_files.cmake
|
||||||
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||||
|
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||||
|
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.cpp
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
${SOURCE_GROUP_HEADER_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_SOURCE_FILES
|
||||||
|
${SOURCE_GROUP_SOURCE_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND QT_MOC_HEADERS
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
source_group( "CommandFeature\\SummaryPlot" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicNewSummaryPlotFeature.h"
|
||||||
|
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicNewSummaryPlotFeature, "RicNewSummaryPlotFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicNewSummaryPlotFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSummaryPlotFeature::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 = new RimSummaryPlot();
|
||||||
|
summaryPlotColl->m_summaryPlots().push_back(plot);
|
||||||
|
|
||||||
|
plot->setDescription(QString("Well Log Plot %1").arg(summaryPlotColl->m_summaryPlots.size()));
|
||||||
|
summaryPlotColl->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSummaryPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("New Summary Plot");
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicNewSummaryPlotFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered( bool isChecked );
|
||||||
|
virtual void setupActionLook( QAction* actionToSetup );
|
||||||
|
};
|
||||||
@@ -76,6 +76,10 @@ ${CEE_CURRENT_LIST_DIR}RimCrossSection.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.h
|
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.h
|
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.h
|
${CEE_CURRENT_LIST_DIR}RimGridCollection.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -150,6 +154,9 @@ ${CEE_CURRENT_LIST_DIR}RimCrossSection.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.cpp
|
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
if (uiItems.size() == 0)
|
if (uiItems.size() == 0)
|
||||||
{
|
{
|
||||||
commandIds << "RicNewWellLogPlotFeature";
|
commandIds << "RicNewWellLogPlotFeature";
|
||||||
|
commandIds << "RicNewSummaryPlotFeature";
|
||||||
}
|
}
|
||||||
else if (uiItems.size() > 1)
|
else if (uiItems.size() > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,10 +19,13 @@
|
|||||||
|
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimWellLogPlotCollection.h"
|
#include "RimWellLogPlotCollection.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include "cafPdmUiTreeView.h"
|
#include "cafPdmUiTreeView.h"
|
||||||
|
#include "RiuProjectPropertyView.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimMainPlotCollection, "MainPlotCollection");
|
CAF_PDM_SOURCE_INIT(RimMainPlotCollection, "MainPlotCollection");
|
||||||
|
|
||||||
@@ -33,13 +36,20 @@ RimMainPlotCollection::RimMainPlotCollection()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Plots", "", "", "");
|
CAF_PDM_InitObject("Plots", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&show, "Show", true, "Show plots", "", "", "");
|
CAF_PDM_InitField(&show, "Show", true, "Show 2D Plot Window", "", "", "");
|
||||||
show.uiCapability()->setUiHidden(true);
|
show.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_wellLogPlotCollection, "WellLogPlotCollection", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_wellLogPlotCollection, "WellLogPlotCollection", "", "", "", "");
|
||||||
m_wellLogPlotCollection.uiCapability()->setUiHidden(true);
|
m_wellLogPlotCollection.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots", "", "", "");
|
||||||
|
m_summaryPlotCollection.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
||||||
|
m_summaryPlotCollection = new RimSummaryPlotCollection();
|
||||||
|
|
||||||
|
//m_plotMainWindow = NULL;
|
||||||
|
//m_plotManagerMainWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -48,6 +58,10 @@ RimMainPlotCollection::RimMainPlotCollection()
|
|||||||
RimMainPlotCollection::~RimMainPlotCollection()
|
RimMainPlotCollection::~RimMainPlotCollection()
|
||||||
{
|
{
|
||||||
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
|
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
|
||||||
|
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
|
||||||
|
|
||||||
|
//m_plotManagerMainWindow->close();
|
||||||
|
//m_plotManagerMainWindow->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -55,8 +69,62 @@ RimMainPlotCollection::~RimMainPlotCollection()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimMainPlotCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimMainPlotCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
if (changedField == &showWindow)
|
||||||
|
{
|
||||||
|
if (showWindow)
|
||||||
|
{
|
||||||
|
showPlotWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hidePlotWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::showPlotWindow()
|
||||||
|
{
|
||||||
|
if (!m_plotManagerMainWindow)
|
||||||
|
{
|
||||||
|
m_plotManagerMainWindow = new QMainWindow;
|
||||||
|
m_plotManagerMainWindow->setDockNestingEnabled(true);
|
||||||
|
|
||||||
|
m_plotMainWindow = new QMainWindow;
|
||||||
|
m_plotMainWindow->setDockNestingEnabled(true);
|
||||||
|
|
||||||
|
// NOTE! setCentralWidget takes ownership of widget
|
||||||
|
m_plotManagerMainWindow->setCentralWidget(m_plotMainWindow);
|
||||||
|
|
||||||
|
{
|
||||||
|
QDockWidget* dockWidget = new QDockWidget("Plots", m_plotManagerMainWindow);
|
||||||
|
dockWidget->setObjectName("dockWidget");
|
||||||
|
|
||||||
|
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||||
|
|
||||||
|
RiuProjectAndPropertyView* projPropView = new RiuProjectAndPropertyView(dockWidget);
|
||||||
|
dockWidget->setWidget(projPropView);
|
||||||
|
|
||||||
|
RimProject* proj = NULL;
|
||||||
|
this->firstAnchestorOrThisOfType(proj);
|
||||||
|
|
||||||
|
projPropView->setPdmItem(this);
|
||||||
|
|
||||||
|
m_plotManagerMainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_plotMainWindow->show();
|
||||||
|
|
||||||
|
m_plotManagerMainWindow->showNormal();
|
||||||
|
m_plotManagerMainWindow->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -72,3 +140,124 @@ RimWellLogPlotCollection* RimMainPlotCollection::wellLogPlotCollection()
|
|||||||
{
|
{
|
||||||
return m_wellLogPlotCollection();
|
return m_wellLogPlotCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlotCollection* RimMainPlotCollection::summaryPlotCollection()
|
||||||
|
{
|
||||||
|
return m_summaryPlotCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::createDockWindowsForAllPlots()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_graphPlots.size(); i++)
|
||||||
|
{
|
||||||
|
if (!dockWidgetFromPlot(m_graphPlots[i]))
|
||||||
|
{
|
||||||
|
createPlotDockWidget(m_graphPlots[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QDockWidget* RimMainPlotCollection::dockWidgetFromPlot(RimSummaryPlot* graphPlot)
|
||||||
|
{
|
||||||
|
foreach(QDockWidget* dockW, m_plotViewDockWidgets)
|
||||||
|
{
|
||||||
|
if (dockW && dockW->widget() == graphPlot->widget())
|
||||||
|
{
|
||||||
|
return dockW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::createPlotDockWidget(RimSummaryPlot* graphPlot)
|
||||||
|
{
|
||||||
|
assert(m_plotMainWindow != NULL);
|
||||||
|
|
||||||
|
QDockWidget* dockWidget = new QDockWidget(QString("Plot Widget Tree (%1)").arg(m_plotViewDockWidgets.size() + 1), m_plotMainWindow);
|
||||||
|
dockWidget->setObjectName("dockWidget");
|
||||||
|
// dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
|
|
||||||
|
QWidget* widget = graphPlot->createPlotWidget(m_plotMainWindow);
|
||||||
|
|
||||||
|
dockWidget->setWidget(widget);
|
||||||
|
|
||||||
|
m_plotMainWindow->addDockWidget(Qt::RightDockWidgetArea, dockWidget);
|
||||||
|
|
||||||
|
m_plotViewDockWidgets.push_back(dockWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::eraseDockWidget(RimSummaryPlot* graphPlot)
|
||||||
|
{
|
||||||
|
QDockWidget* dockW = dockWidgetFromPlot(graphPlot);
|
||||||
|
if (dockW)
|
||||||
|
{
|
||||||
|
m_plotMainWindow->removeDockWidget(dockW);
|
||||||
|
dockW->setWidget(NULL);
|
||||||
|
dockW->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::redrawAllPlots()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_graphPlots.size(); i++)
|
||||||
|
{
|
||||||
|
m_graphPlots[i]->redrawAllCurves();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QMainWindow* RimMainPlotCollection::windowWithGraphPlots()
|
||||||
|
{
|
||||||
|
return m_plotMainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::initAfterRead()
|
||||||
|
{
|
||||||
|
if (show())
|
||||||
|
{
|
||||||
|
showPlotWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hidePlotWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::hidePlotWindow()
|
||||||
|
{
|
||||||
|
if (m_plotManagerMainWindow)
|
||||||
|
{
|
||||||
|
m_plotManagerMainWindow->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -23,7 +23,15 @@
|
|||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmChildField.h"
|
#include "cafPdmChildField.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QDockWidget>
|
||||||
|
|
||||||
|
|
||||||
class RimWellLogPlotCollection;
|
class RimWellLogPlotCollection;
|
||||||
|
class RimSummaryPlotCollection;
|
||||||
|
class RimSummaryPlot;
|
||||||
|
class RifReaderEclipseSummary;
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -38,16 +46,38 @@ public:
|
|||||||
virtual ~RimMainPlotCollection();
|
virtual ~RimMainPlotCollection();
|
||||||
|
|
||||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||||
|
RimSummaryPlotCollection* summaryPlotCollection();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Separate Window stuff
|
||||||
|
void showPlotWindow();
|
||||||
|
void hidePlotWindow();
|
||||||
|
|
||||||
|
void redrawAllPlots();
|
||||||
|
void createDockWindowsForAllPlots();
|
||||||
|
QMainWindow* windowWithGraphPlots();
|
||||||
|
private:
|
||||||
|
|
||||||
|
QDockWidget* dockWidgetFromPlot(RimSummaryPlot* graphPlot);
|
||||||
|
void createPlotDockWidget(RimSummaryPlot* graphPlot);
|
||||||
|
void eraseDockWidget(RimSummaryPlot* graphPlot);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMainWindow* m_plotManagerMainWindow; // Outer main Window
|
||||||
|
QMainWindow* m_plotMainWindow; // Inner main window
|
||||||
|
|
||||||
|
std::vector<QPointer<QDockWidget> > m_plotViewDockWidgets; // ChildPlotWidgets
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
private:
|
//virtual void initAfterRead();
|
||||||
|
|
||||||
|
|
||||||
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
||||||
|
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
|
||||||
|
|
||||||
caf::PdmField<bool> show;
|
caf::PdmField<bool> show;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimScriptCollection.h"
|
#include "RimScriptCollection.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
#include "RimView.h"
|
#include "RimView.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
@@ -728,6 +729,10 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
|||||||
{
|
{
|
||||||
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
|
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
|
||||||
}
|
}
|
||||||
|
if (mainPlotCollection->summaryPlotCollection())
|
||||||
|
{
|
||||||
|
uiTreeOrdering.add(mainPlotCollection->summaryPlotCollection());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uiTreeOrdering.add(scriptCollection());
|
uiTreeOrdering.add(scriptCollection());
|
||||||
|
|||||||
169
ApplicationCode/ProjectDataModel/RimSummaryCurve.cpp
Normal file
169
ApplicationCode/ProjectDataModel/RimSummaryCurve.cpp
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimSummaryCurve.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
#include "RimDefines.h"
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
#include "RiuResultQwtPlot.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
|
#include "cafPdmUiListEditor.h"
|
||||||
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryCurve, "SummaryCurve");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCurve::RimSummaryCurve()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Summary Curve", ":/WellLogCurve16x16.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "ReferencedEclipseCase", "Eclipse Case", "", "", "");
|
||||||
|
m_eclipseCase.uiCapability()->setUiChildrenHidden(true);
|
||||||
|
|
||||||
|
// TODO: Implement setUiTreeHidden
|
||||||
|
//m_eclipseCase.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_variableName, "SummaryVariableName", "Variable Name", "", "", "");
|
||||||
|
|
||||||
|
m_variableName.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCurve::~RimSummaryCurve()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||||
|
{
|
||||||
|
QList<caf::PdmOptionItemInfo> optionList;
|
||||||
|
if (fieldNeedingOptions == &m_variableName)
|
||||||
|
{
|
||||||
|
if (m_eclipseCase)
|
||||||
|
{
|
||||||
|
RifReaderEclipseSummary* reader = summaryReader();
|
||||||
|
if (reader)
|
||||||
|
{
|
||||||
|
std::vector<std::string> varNames = reader->variableNames();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < varNames.size(); i++)
|
||||||
|
{
|
||||||
|
std::string name = varNames[i];
|
||||||
|
|
||||||
|
QString s = QString::fromStdString(name);
|
||||||
|
optionList.push_back(caf::PdmOptionItemInfo(s, s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), RimDefines::undefinedResultName()));
|
||||||
|
|
||||||
|
if (useOptionsOnly) *useOptionsOnly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fieldNeedingOptions == &m_eclipseCase)
|
||||||
|
{
|
||||||
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
|
std::vector<RimCase*> cases;
|
||||||
|
|
||||||
|
proj->allCases(cases);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < cases.size(); i++)
|
||||||
|
{
|
||||||
|
RimCase* rimCase = cases[i];
|
||||||
|
|
||||||
|
optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseUserDescription(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optionList.size() > 0)
|
||||||
|
{
|
||||||
|
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return optionList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (changedField == &m_variableName)
|
||||||
|
{
|
||||||
|
RimSummaryPlot* summaryPlot = NULL;
|
||||||
|
this->firstAnchestorOrThisOfType(summaryPlot);
|
||||||
|
if (summaryPlot)
|
||||||
|
{
|
||||||
|
//summaryPlot->redrawAllCurves();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryCurve::summaryReader()
|
||||||
|
{
|
||||||
|
RimSummaryPlotCollection* plotCollection = NULL;
|
||||||
|
this->firstAnchestorOrThisOfType(plotCollection);
|
||||||
|
|
||||||
|
return plotCollection->getOrCreateSummaryFileReader(m_eclipseCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||||
|
{
|
||||||
|
// TODO: Used to hide the entry for a case in the tree view as we have no
|
||||||
|
// setUiTreeHidden(true)
|
||||||
|
uiTreeOrdering.setForgetRemainingFields(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values)
|
||||||
|
{
|
||||||
|
RifReaderEclipseSummary* reader = summaryReader();
|
||||||
|
|
||||||
|
if (timeSteps)
|
||||||
|
{
|
||||||
|
std::vector<time_t> times = reader->timeSteps();
|
||||||
|
*timeSteps = RifReaderEclipseSummary::fromTimeT(times);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (values)
|
||||||
|
{
|
||||||
|
std::string keyword = m_variableName().toStdString();
|
||||||
|
reader->values(keyword, values);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
ApplicationCode/ProjectDataModel/RimSummaryCurve.h
Normal file
60
ApplicationCode/ProjectDataModel/RimSummaryCurve.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
class RifReaderEclipseSummary;
|
||||||
|
class RiuLineSegmentQwtPlotCurve;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimSummaryCurve : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimSummaryCurve();
|
||||||
|
virtual ~RimSummaryCurve();
|
||||||
|
|
||||||
|
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseCase;
|
||||||
|
|
||||||
|
caf::PdmField<QString> m_variableName;
|
||||||
|
|
||||||
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||||
|
|
||||||
|
void curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values);
|
||||||
|
|
||||||
|
private:
|
||||||
|
RifReaderEclipseSummary* summaryReader();
|
||||||
|
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||||
|
|
||||||
|
private:
|
||||||
|
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
|
||||||
|
|
||||||
|
};
|
||||||
166
ApplicationCode/ProjectDataModel/RimSummaryPlot.cpp
Normal file
166
ApplicationCode/ProjectDataModel/RimSummaryPlot.cpp
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimSummaryPlot.h"
|
||||||
|
|
||||||
|
#include "RimSummaryCurve.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "RiuResultQwtPlot.h"
|
||||||
|
#include "RiuSelectionColors.h"
|
||||||
|
|
||||||
|
#include "cvfBase.h"
|
||||||
|
#include "cvfColor3.h"
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "GraphPlot");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot::RimSummaryPlot()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Graph", ":/WellLogPlot16x16.png", "", "");
|
||||||
|
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Summary Plot", "", "", "");
|
||||||
|
m_showWindow.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&curves, "SummaryCurves", "", "", "", "");
|
||||||
|
curves.uiCapability()->setUiHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot::~RimSummaryPlot()
|
||||||
|
{
|
||||||
|
deletePlotWidget();
|
||||||
|
|
||||||
|
curves.deleteAllChildObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QWidget* RimSummaryPlot::createPlotWidget(QWidget* parent)
|
||||||
|
{
|
||||||
|
assert(m_viewer.isNull());
|
||||||
|
|
||||||
|
m_viewer = new RiuResultQwtPlot(parent);
|
||||||
|
|
||||||
|
return m_viewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::deletePlotWidget()
|
||||||
|
{
|
||||||
|
if (m_viewer)
|
||||||
|
{
|
||||||
|
m_viewer->deleteLater();
|
||||||
|
m_viewer = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuResultQwtPlot* RimSummaryPlot::viewer()
|
||||||
|
{
|
||||||
|
return m_viewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::loadDataAndUpdate()
|
||||||
|
{
|
||||||
|
m_viewer->deleteAllCurves();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < curves.size(); i++)
|
||||||
|
{
|
||||||
|
RimSummaryCurve* curve = curves[i];
|
||||||
|
|
||||||
|
std::vector<QDateTime> dateTimes;
|
||||||
|
std::vector<double> values;
|
||||||
|
|
||||||
|
curve->curveData(&dateTimes, &values);
|
||||||
|
|
||||||
|
cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable();
|
||||||
|
|
||||||
|
m_viewer->addCurve(curve->m_variableName(), curveColor, dateTimes, values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::setDescription(const QString& description)
|
||||||
|
{
|
||||||
|
m_userName = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::updateViewerWidget()
|
||||||
|
{
|
||||||
|
if (m_showWindow())
|
||||||
|
{
|
||||||
|
if (!m_viewer)
|
||||||
|
{
|
||||||
|
m_viewer = new RiuResultQwtPlot(RiuMainWindow::instance());
|
||||||
|
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->addViewer(m_viewer, std::vector<int>());
|
||||||
|
RiuMainWindow::instance()->setActiveViewer(m_viewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
//updateViewerWidgetWindowTitle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_viewer)
|
||||||
|
{
|
||||||
|
//windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->removeViewer(m_viewer);
|
||||||
|
detachAllCurves();
|
||||||
|
|
||||||
|
delete m_viewer;
|
||||||
|
m_viewer = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::detachAllCurves()
|
||||||
|
{
|
||||||
|
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
||||||
|
{
|
||||||
|
//curves[cIdx]->detachQwtCurve();
|
||||||
|
}
|
||||||
|
}
|
||||||
67
ApplicationCode/ProjectDataModel/RimSummaryPlot.h
Normal file
67
ApplicationCode/ProjectDataModel/RimSummaryPlot.h
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafPdmObject.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmChildArrayField.h"
|
||||||
|
#include "cafAppEnum.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
|
class RiuResultQwtPlot;
|
||||||
|
class RimSummaryCurve;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimSummaryPlot : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimSummaryPlot();
|
||||||
|
virtual ~RimSummaryPlot();
|
||||||
|
|
||||||
|
void setDescription(const QString& description);
|
||||||
|
void loadDataAndUpdate();
|
||||||
|
RiuResultQwtPlot* viewer();
|
||||||
|
|
||||||
|
caf::PdmChildArrayField<RimSummaryCurve*> curves;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overridden PDM methods
|
||||||
|
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||||
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateViewerWidget();
|
||||||
|
|
||||||
|
void detachAllCurves();
|
||||||
|
|
||||||
|
QWidget* createPlotWidget(QWidget* parent);
|
||||||
|
void deletePlotWidget();
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_showWindow;
|
||||||
|
caf::PdmField<QString> m_userName;
|
||||||
|
|
||||||
|
QPointer<RiuResultQwtPlot> m_viewer;
|
||||||
|
};
|
||||||
117
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.cpp
Normal file
117
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.cpp
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "RifEclipseSummaryTools.h"
|
||||||
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
|
#include "RiuProjectPropertyView.h"
|
||||||
|
|
||||||
|
#include <QDockWidget>
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryPlotCollection, "RimGraphPlotCollection");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Summary Plots", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "");
|
||||||
|
m_summaryPlots.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlotCollection::~RimSummaryPlotCollection()
|
||||||
|
{
|
||||||
|
m_summaryPlots.deleteAllChildObjects();
|
||||||
|
|
||||||
|
for (auto it = m_summaryFileReaders.begin(); it != m_summaryFileReaders.end(); it++)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
m_summaryFileReaders.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryPlotCollection::getOrCreateSummaryFileReader(const QString& eclipseCase)
|
||||||
|
{
|
||||||
|
auto it = m_summaryFileReaders.find(eclipseCase);
|
||||||
|
if (it != m_summaryFileReaders.end())
|
||||||
|
{
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return createSummaryFileReader(eclipseCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryPlotCollection::getOrCreateSummaryFileReader(const RimEclipseResultCase* eclipseCase)
|
||||||
|
{
|
||||||
|
if (!eclipseCase) return NULL;
|
||||||
|
|
||||||
|
QString caseName = eclipseCase->gridFileName();
|
||||||
|
QString caseNameWithNoExtension = caseName.remove(".egrid", Qt::CaseInsensitive);
|
||||||
|
|
||||||
|
QString caseNameAbsPath = caseNameWithNoExtension.replace("/", "\\");
|
||||||
|
|
||||||
|
return this->getOrCreateSummaryFileReader(caseNameAbsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryPlotCollection::createSummaryFileReader(const QString& eclipseCase)
|
||||||
|
{
|
||||||
|
std::string headerFile;
|
||||||
|
bool isFormatted = false;
|
||||||
|
RifEclipseSummaryTools::findSummaryHeaderFile(eclipseCase.toStdString(), &headerFile, &isFormatted);
|
||||||
|
|
||||||
|
std::vector<std::string> dataFiles = RifEclipseSummaryTools::findSummaryDataFiles(eclipseCase.toStdString());
|
||||||
|
|
||||||
|
RifReaderEclipseSummary* reader = new RifReaderEclipseSummary;
|
||||||
|
if (!reader->open(headerFile, dataFiles))
|
||||||
|
{
|
||||||
|
delete reader;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_summaryFileReaders.insert(std::make_pair(eclipseCase, reader));
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
55
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.h
Normal file
55
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafPdmChildArrayField.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QDockWidget>
|
||||||
|
|
||||||
|
class RimSummaryPlot;
|
||||||
|
class RicDropEnabledMainWindow;
|
||||||
|
class RifReaderEclipseSummary;
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimSummaryPlotCollection : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimSummaryPlotCollection();
|
||||||
|
virtual ~RimSummaryPlotCollection();
|
||||||
|
|
||||||
|
RifReaderEclipseSummary* getOrCreateSummaryFileReader(const RimEclipseResultCase* eclipseCase);
|
||||||
|
|
||||||
|
caf::PdmChildArrayField<RimSummaryPlot*> m_summaryPlots;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RifReaderEclipseSummary* createSummaryFileReader(const QString& eclipseCase);
|
||||||
|
RifReaderEclipseSummary* getOrCreateSummaryFileReader(const QString& eclipseCase);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Map from path to case to summary file reader objects
|
||||||
|
std::map<QString, RifReaderEclipseSummary*> m_summaryFileReaders;
|
||||||
|
};
|
||||||
@@ -36,7 +36,71 @@ class RiuLineSegmentQwtPlotCurve;
|
|||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
|
#if 0
|
||||||
|
class RimPlotCurve : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
enum LineStyleEnum
|
||||||
|
{
|
||||||
|
STYLE_NONE,
|
||||||
|
STYLE_SOLID,
|
||||||
|
STYLE_DASH,
|
||||||
|
STYLE_DOT,
|
||||||
|
STYLE_DASH_DOT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum PointSymbolEnum
|
||||||
|
{
|
||||||
|
SYMBOL_NONE,
|
||||||
|
SYMBOL_ELLIPSE,
|
||||||
|
SYMBOL_RECT,
|
||||||
|
SYMBOL_DIAMOND,
|
||||||
|
SYMBOL_TRIANGLE,
|
||||||
|
SYMBOL_CROSS,
|
||||||
|
SYMBOL_XCROSS
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
RimPlotCurve();
|
||||||
|
virtual ~RimPlotCurve();
|
||||||
|
|
||||||
|
void setColor(const cvf::Color3f& color);
|
||||||
|
void detachQwtCurve();
|
||||||
|
|
||||||
|
bool isCurveVisible() const;
|
||||||
|
|
||||||
|
QwtPlotCurve* plotCurve() const;
|
||||||
|
|
||||||
|
QString name() const { return m_curveName; }
|
||||||
|
void updateCurveName();
|
||||||
|
void updatePlotTitle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void updatePlotConfiguration();
|
||||||
|
void updateCurveVisibility();
|
||||||
|
void updateOptionSensitivity();
|
||||||
|
void updateCurveAppearance();
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Overridden PDM methods
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||||
|
protected:
|
||||||
|
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_showCurve;
|
||||||
|
caf::PdmField<QString> m_curveName;
|
||||||
|
caf::PdmField<QString> m_customCurveName;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_autoName;
|
||||||
|
caf::PdmField<cvf::Color3f> m_curveColor;
|
||||||
|
caf::PdmField<float> m_curveThickness;
|
||||||
|
|
||||||
|
caf::PdmField< caf::AppEnum< PointSymbolEnum > > m_pointSymbol;
|
||||||
|
caf::PdmField< caf::AppEnum< LineStyleEnum > > m_lineStyle;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user