mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' into pre-proto
This commit is contained in:
commit
8255a3aaa3
@ -51,6 +51,7 @@
|
||||
#include "RimFaultCollection.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
@ -85,6 +86,7 @@
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
#include "RiuFlowCharacteristicsPlot.h"
|
||||
|
||||
#include "RicImportSummaryCaseFeature.h"
|
||||
#include "RicSnapshotViewToClipboardFeature.h"
|
||||
@ -1139,6 +1141,25 @@ RimView* RiaApplication::activeReservoirView()
|
||||
return m_activeReservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow* RiaApplication::activePlotWindow() const
|
||||
{
|
||||
RimViewWindow* viewWindow = nullptr;
|
||||
|
||||
if ( m_mainPlotWindow )
|
||||
{
|
||||
QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if ( subwindows.size() > 0 )
|
||||
{
|
||||
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||
}
|
||||
}
|
||||
|
||||
return viewWindow;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1147,54 +1168,6 @@ void RiaApplication::setActiveReservoirView(RimView* rv)
|
||||
m_activeReservoirView = rv;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setActiveWellLogPlot(RimWellLogPlot* wlp)
|
||||
{
|
||||
m_activeWellLogPlot = wlp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot* RiaApplication::activeWellLogPlot()
|
||||
{
|
||||
return m_activeWellLogPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setActiveSummaryPlot(RimSummaryPlot* sp)
|
||||
{
|
||||
m_activeSummaryPlot = sp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RiaApplication::activeSummaryPlot()
|
||||
{
|
||||
return m_activeSummaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setActiveWellAllocationPlot(RimWellAllocationPlot* wap)
|
||||
{
|
||||
m_activeWellAllocationPlot = wap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RiaApplication::activeWellAllocationPlot()
|
||||
{
|
||||
return m_activeWellAllocationPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1643,36 +1616,20 @@ RimViewWindow* RiaApplication::activeViewWindow()
|
||||
{
|
||||
RimViewWindow* viewWindow = NULL;
|
||||
|
||||
QWidget* topLevelWidget = RiaApplication::activeWindow();
|
||||
QWidget* mainWindowWidget = RiaApplication::activeWindow();
|
||||
|
||||
if (dynamic_cast<RiuMainWindow*>(topLevelWidget))
|
||||
if (dynamic_cast<RiuMainWindow*>(mainWindowWidget))
|
||||
{
|
||||
viewWindow = RiaApplication::instance()->activeReservoirView();
|
||||
}
|
||||
|
||||
if (dynamic_cast<RiuMainPlotWindow*>(topLevelWidget))
|
||||
else if (dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget))
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget);
|
||||
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget);
|
||||
|
||||
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if (subwindows.size() > 0)
|
||||
{
|
||||
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
||||
if (summaryQwtPlot)
|
||||
{
|
||||
viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
||||
}
|
||||
|
||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
||||
if (wellLogPlot)
|
||||
{
|
||||
viewWindow = wellLogPlot->ownerPlotDefinition();
|
||||
}
|
||||
|
||||
RiuWellAllocationPlot* wellAllocationPlot = dynamic_cast<RiuWellAllocationPlot*>(subwindows.back()->widget());
|
||||
if (wellAllocationPlot)
|
||||
{
|
||||
viewWindow = wellAllocationPlot->ownerPlotDefinition();
|
||||
}
|
||||
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,14 +96,7 @@ public:
|
||||
RimView* activeReservoirView();
|
||||
const RimView* activeReservoirView() const;
|
||||
|
||||
void setActiveWellLogPlot(RimWellLogPlot*);
|
||||
RimWellLogPlot* activeWellLogPlot();
|
||||
|
||||
void setActiveSummaryPlot(RimSummaryPlot*);
|
||||
RimSummaryPlot* activeSummaryPlot();
|
||||
|
||||
void setActiveWellAllocationPlot(RimWellAllocationPlot*);
|
||||
RimWellAllocationPlot* activeWellAllocationPlot();
|
||||
RimViewWindow* activePlotWindow() const;
|
||||
|
||||
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
|
||||
|
||||
@ -228,9 +221,6 @@ private slots:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimWellLogPlot> m_activeWellLogPlot;
|
||||
caf::PdmPointer<RimSummaryPlot> m_activeSummaryPlot;
|
||||
caf::PdmPointer<RimWellAllocationPlot> m_activeWellAllocationPlot;
|
||||
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
|
@ -424,3 +424,30 @@ const caf::ColorTable& RiaColorTables::selectionPaletteColors()
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::timestepsPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{
|
||||
cvf::Color3ub( 56, 56, 255), // Vivid Blue
|
||||
cvf::Color3ub( 0, 143, 239), // Dark Light Blue
|
||||
cvf::Color3ub( 0, 112, 136), // Dark Green-Blue
|
||||
cvf::Color3ub( 51, 204, 255), // Bluer Turquoise
|
||||
cvf::Color3ub( 0, 221, 221), // Turquoise
|
||||
cvf::Color3ub( 0, 205, 68), // Bluish Green
|
||||
cvf::Color3ub( 78, 204, 0), // Clear Green
|
||||
cvf::Color3ub(164, 193, 0), // Mid Yellowish Green
|
||||
cvf::Color3ub(236, 188, 0), // Mid Yellow
|
||||
cvf::Color3ub(236, 118, 0), // Orange
|
||||
cvf::Color3ub(202, 0, 0), // Red
|
||||
cvf::Color3ub(248, 0, 170), // Magenta
|
||||
cvf::Color3ub(201, 168, 206), // Light Violet
|
||||
cvf::Color3ub(169, 2, 240), // Purple
|
||||
};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable(colors);
|
||||
|
||||
return colorTable;
|
||||
}
|
||||
|
@ -49,4 +49,6 @@ public:
|
||||
static const caf::ColorTable& summaryCurveNoneRedGreenBlueBrownPaletteColors();
|
||||
static const caf::ColorTable& wellLogPlotPaletteColors();
|
||||
static const caf::ColorTable& selectionPaletteColors();
|
||||
static const caf::ColorTable& timestepsPaletteColors();
|
||||
|
||||
};
|
||||
|
@ -191,7 +191,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
uiOrdering.add(&defaultCurveFilter);
|
||||
}
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -17,6 +17,7 @@ ${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -32,6 +33,7 @@ ${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
@ -42,10 +44,10 @@ list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
#set (QT_MOC_HEADERS
|
||||
#${QT_MOC_HEADERS}
|
||||
#${CEE_CURRENT_LIST_DIR}RicBoxManipulatorEventHandler.h
|
||||
#)
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
|
||||
)
|
||||
|
||||
|
||||
source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
||||
|
@ -0,0 +1,232 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RicShowPlotDataFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QBoxLayout>
|
||||
#include <QClipboard>
|
||||
#include <QMenu>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowPlotDataFeature, "RicShowPlotDataFeature");
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowPlotDataFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimSummaryPlot*> selectedSummaryPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
|
||||
if (selectedSummaryPlots.size() > 0) return true;
|
||||
|
||||
std::vector<RimWellLogPlot*> wellLogPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
|
||||
if (wellLogPlots.size() > 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowPlotDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimSummaryPlot*> selectedSummaryPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
|
||||
|
||||
std::vector<RimWellLogPlot*> wellLogPlots;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
|
||||
|
||||
if (selectedSummaryPlots.size() == 0 && wellLogPlots.size() == 0)
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
CVF_ASSERT(plotwindow);
|
||||
|
||||
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
|
||||
{
|
||||
QString title = summaryPlot->description();
|
||||
QString text = summaryPlot->asciiDataForPlotExport();
|
||||
|
||||
RicShowPlotDataFeature::showTextWindow(title, text);
|
||||
}
|
||||
|
||||
for (RimWellLogPlot* wellLogPlot : wellLogPlots)
|
||||
{
|
||||
QString title = wellLogPlot->description();
|
||||
QString text = wellLogPlot->asciiDataForPlotExport();
|
||||
|
||||
RicShowPlotDataFeature::showTextWindow(title, text);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowPlotDataFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Plot Data");
|
||||
actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowPlotDataFeature::showTextWindow(const QString& title, const QString& text)
|
||||
{
|
||||
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
CVF_ASSERT(plotwindow);
|
||||
|
||||
RicTextWidget* textWiget = new RicTextWidget(plotwindow);
|
||||
textWiget->setMinimumSize(400, 600);
|
||||
|
||||
textWiget->setWindowTitle(title);
|
||||
textWiget->setText(text);
|
||||
|
||||
textWiget->show();
|
||||
|
||||
plotwindow->addToTemporaryWidgets(textWiget);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicTextWidget::RicTextWidget(QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
{
|
||||
m_textEdit = new QPlainTextEdit(this);
|
||||
m_textEdit->setReadOnly(true);
|
||||
m_textEdit->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
|
||||
QFont font("Courier", 8);
|
||||
m_textEdit->setFont(font);
|
||||
|
||||
m_textEdit->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->addWidget(m_textEdit);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextWidget::setText(const QString& text)
|
||||
{
|
||||
m_textEdit->setPlainText(text);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextWidget::slotCopyContentToClipboard()
|
||||
{
|
||||
QTextCursor cursor(m_textEdit->textCursor());
|
||||
|
||||
QString textForClipboard;
|
||||
|
||||
QString selText = cursor.selectedText();
|
||||
if (!selText.isEmpty())
|
||||
{
|
||||
QTextDocument doc;
|
||||
doc.setPlainText(selText);
|
||||
|
||||
textForClipboard = doc.toPlainText();
|
||||
}
|
||||
|
||||
if (textForClipboard.isEmpty())
|
||||
{
|
||||
textForClipboard = m_textEdit->toPlainText();
|
||||
}
|
||||
|
||||
if (!textForClipboard.isEmpty())
|
||||
{
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
if (clipboard)
|
||||
{
|
||||
clipboard->setText(textForClipboard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextWidget::slotSelectAll()
|
||||
{
|
||||
m_textEdit->selectAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextWidget::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
|
||||
{
|
||||
QAction* actionToSetup = new QAction(this);
|
||||
|
||||
actionToSetup->setText("Copy");
|
||||
actionToSetup->setIcon(QIcon(":/Copy.png"));
|
||||
actionToSetup->setShortcuts(QKeySequence::Copy);
|
||||
|
||||
connect(actionToSetup, SIGNAL(triggered()), this, SLOT(slotCopyContentToClipboard()));
|
||||
|
||||
menu.addAction(actionToSetup);
|
||||
}
|
||||
|
||||
{
|
||||
QAction* actionToSetup = new QAction(this);
|
||||
|
||||
actionToSetup->setText("Select All");
|
||||
actionToSetup->setShortcuts(QKeySequence::SelectAll);
|
||||
|
||||
connect(actionToSetup, SIGNAL(triggered()), this, SLOT(slotSelectAll()));
|
||||
|
||||
menu.addAction(actionToSetup);
|
||||
}
|
||||
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 <QDialog>
|
||||
|
||||
class QPlainTextEdit;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RicTextWidget : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RicTextWidget(QWidget* parent = 0);
|
||||
|
||||
void setText(const QString& text);
|
||||
|
||||
private slots:
|
||||
void slotCopyContentToClipboard();
|
||||
void slotSelectAll();
|
||||
|
||||
private:
|
||||
QPlainTextEdit* m_textEdit;
|
||||
protected:
|
||||
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowPlotDataFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
static void showTextWindow(const QString& title, const QString& text);
|
||||
};
|
||||
|
||||
|
@ -116,7 +116,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseInputPropertyFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Save Property To File");
|
||||
actionToSetup->setText("Export Property To File");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -60,7 +60,7 @@ RicSaveEclipseResultAsInputPropertyExec::~RicSaveEclipseResultAsInputPropertyExe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicSaveEclipseResultAsInputPropertyExec::name()
|
||||
{
|
||||
return "Save Property To File";
|
||||
return "Export Property To File";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,7 +61,7 @@ void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecke
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseResultAsInputPropertyFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Save Property To File");
|
||||
actionToSetup->setText("Export Property To File");
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowFlowCharacteristicsPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
|
||||
@ -16,6 +17,7 @@ ${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowFlowCharacteristicsPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
|
||||
|
@ -47,7 +47,7 @@ bool RicAddStoredWellAllocationPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
if (flowPlotColl->defaultPlot() == wellAllocationPlot)
|
||||
if (flowPlotColl->defaultWellAllocPlot() == wellAllocationPlot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -72,7 +72,7 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(sourceObject->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(wellAllocationPlot);
|
||||
|
||||
flowPlotColl->addPlot(wellAllocationPlot);
|
||||
flowPlotColl->addWellAllocPlotToStoredPlots(wellAllocationPlot);
|
||||
wellAllocationPlot->resolveReferencesRecursively();
|
||||
|
||||
wellAllocationPlot->loadDataAndUpdate();
|
||||
|
@ -89,7 +89,7 @@ void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
|
||||
RimEclipseResultCase* eclipseResultCase = nullptr;
|
||||
well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
|
||||
|
||||
RimEclipseView* modifiedView = RicShowContributingWellsFeatureImpl::showViewSelection(eclipseResultCase, well->name(), eclipseView->currentTimeStep());
|
||||
RimEclipseView* modifiedView = RicShowContributingWellsFeatureImpl::maniuplateSelectedView(eclipseResultCase, well->name(), eclipseView->currentTimeStep());
|
||||
if (modifiedView)
|
||||
{
|
||||
modifiedView->createDisplayModelAndRedraw();
|
||||
|
@ -46,7 +46,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicShowContributingWellsFeatureImpl::showViewSelection(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
|
||||
RimEclipseView* RicShowContributingWellsFeatureImpl::maniuplateSelectedView(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
|
||||
{
|
||||
const QString lastUsedViewKey("lastUsedViewKey");
|
||||
|
||||
|
@ -34,7 +34,7 @@ class RimFlowDiagSolution;
|
||||
class RicShowContributingWellsFeatureImpl
|
||||
{
|
||||
public:
|
||||
static RimEclipseView* showViewSelection(RimEclipseResultCase* wellAllocationResultCase, QString wellName, int timeStep);
|
||||
static RimEclipseView* maniuplateSelectedView(RimEclipseResultCase* wellAllocationResultCase, QString wellName, int timeStep);
|
||||
|
||||
private:
|
||||
static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep);
|
||||
|
@ -35,7 +35,11 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||
|
||||
if (wellAllocationPlot) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -43,7 +47,8 @@ bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||
|
||||
if (!wellAllocationPlot) return;
|
||||
|
||||
int timeStep = wellAllocationPlot->timeStep();
|
||||
@ -52,7 +57,7 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
||||
RimEclipseResultCase* wellAllocationResultCase = nullptr;
|
||||
wellAllocationPlot->flowDiagSolution()->firstAncestorOrThisOfTypeAsserted(wellAllocationResultCase);
|
||||
|
||||
RicShowContributingWellsFeatureImpl::showViewSelection(wellAllocationResultCase, wellName, timeStep);
|
||||
RicShowContributingWellsFeatureImpl::maniuplateSelectedView(wellAllocationResultCase, wellName, timeStep);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -0,0 +1,98 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RicShowFlowCharacteristicsPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowFlowCharacteristicsPlotFeature, "RicShowFlowCharacteristicsPlotFeature");
|
||||
|
||||
RimEclipseResultCase* activeEclipseResultCase()
|
||||
{
|
||||
RimView * activeView = RiaApplication::instance()->activeReservoirView();
|
||||
|
||||
auto eclView = dynamic_cast<RimEclipseView*>(activeView);
|
||||
|
||||
if (!eclView) return nullptr;
|
||||
|
||||
auto eclCase = dynamic_cast<RimEclipseResultCase*>(eclView->ownerCase());
|
||||
|
||||
return eclCase;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowFlowCharacteristicsPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseResultCase* eclCase = activeEclipseResultCase();
|
||||
|
||||
if (!eclCase) return false;
|
||||
|
||||
if (!eclCase->defaultFlowDiagSolution()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowFlowCharacteristicsPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimEclipseResultCase* eclCase = activeEclipseResultCase();
|
||||
|
||||
if (eclCase && eclCase->defaultFlowDiagSolution())
|
||||
{
|
||||
if (RiaApplication::instance()->project())
|
||||
{
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
|
||||
flowPlotColl->defaultFlowCharacteristicsPlot()->setFromFlowSolution(eclCase->defaultFlowDiagSolution());
|
||||
flowPlotColl->defaultFlowCharacteristicsPlot()->updateConnectedEditors();
|
||||
|
||||
// Make sure the summary plot window is created and visible
|
||||
plotwindow->selectAsCurrentItem(flowPlotColl->defaultFlowCharacteristicsPlot());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowFlowCharacteristicsPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
|
||||
actionToSetup->setText("Plot Flow Characteristics");
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 RimEclipseWell;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowFlowCharacteristicsPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -69,12 +69,12 @@ void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
flowPlotColl->defaultPlot()->setFromSimulationWell(eclWell);
|
||||
flowPlotColl->defaultPlot()->updateConnectedEditors();
|
||||
flowPlotColl->defaultWellAllocPlot()->setFromSimulationWell(eclWell);
|
||||
flowPlotColl->defaultWellAllocPlot()->updateConnectedEditors();
|
||||
|
||||
// Make sure the summary plot window is created and visible
|
||||
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
plotwindow->selectAsCurrentItem(flowPlotColl->defaultPlot());
|
||||
plotwindow->selectAsCurrentItem(flowPlotColl->defaultWellAllocPlot());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,9 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimMimeData.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
@ -142,7 +140,7 @@ bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(PdmObject* pdm
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCurve*>(pdmObject))
|
||||
else if (dynamic_cast<RimPlotCurve*>(pdmObject))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -150,10 +148,6 @@ bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(PdmObject* pdm
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogCurve*>(pdmObject))
|
||||
{
|
||||
if (!wellAllocPlot) return true;
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogTrack*>(pdmObject))
|
||||
{
|
||||
if (!wellAllocPlot) return true;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
@ -91,6 +92,7 @@ bool isDeletable(PdmUiItem * uiItem)
|
||||
if (dynamic_cast<RimWellLogCurve*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimSummaryPlot*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimSummaryCurve*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimGridTimeHistoryCurve*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimSummaryCurveFilter*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimIntersection*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimIntersectionBox*>(uiItem)) return true;
|
||||
|
@ -93,11 +93,11 @@ void RicSnapshotViewToFileFeature::saveSnapshotAs(const QString& fileName, RimVi
|
||||
{
|
||||
if (image.save(fileName))
|
||||
{
|
||||
qDebug() << "Saved snapshot image to " << fileName;
|
||||
qDebug() << "Exported snapshot image to " << fileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Error when trying to save snapshot image to " << fileName;
|
||||
qDebug() << "Error when trying to export snapshot image to " << fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
startPath += "/image.png";
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save File"), startPath, tr("Image files (*.bmp *.png * *.jpg)"));
|
||||
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath, tr("Image files (*.bmp *.png * *.jpg)"));
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
@ -208,7 +208,16 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(QStrin
|
||||
{
|
||||
if (viewWindow->isMdiWindow() && viewWindow->viewWidget())
|
||||
{
|
||||
QString fileName = viewWindow->userDescriptionField()->uiCapability()->uiValue().toString();
|
||||
QString fileName;
|
||||
if ( viewWindow->userDescriptionField())
|
||||
{
|
||||
fileName = viewWindow->userDescriptionField()->uiCapability()->uiValue().toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = viewWindow->uiCapability()->uiName();
|
||||
}
|
||||
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||
|
@ -14,6 +14,9 @@ ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAsciiExportSummaryPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewGridTimeHistoryCurveFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSelectSummaryPlotUI.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteTimeHistoryCurveFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -25,6 +28,9 @@ ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAsciiExportSummaryPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewGridTimeHistoryCurveFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSelectSummaryPlotUI.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteTimeHistoryCurveFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -35,8 +37,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <vector>
|
||||
#include "cafUtils.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -65,19 +66,16 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("PLOT_ASCIIEXPORT_DIR", projectFolder);
|
||||
|
||||
|
||||
caf::ProgressInfo pi(selectedSummaryPlots.size(), QString("Exporting to csv"));
|
||||
caf::ProgressInfo pi(selectedSummaryPlots.size(), QString("Exporting plot data to ASCII"));
|
||||
size_t progress = 0;
|
||||
|
||||
|
||||
bool isOk = false;
|
||||
if (selectedSummaryPlots.size() == 1)
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = selectedSummaryPlots.at(0);
|
||||
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((summaryPlot->description())) + ".csv";
|
||||
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Summary Plot Export", defaultFileName, "All files(*.*)");
|
||||
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((summaryPlot->description())) + ".ascii";
|
||||
QString fileName = QFileDialog::getSaveFileName(nullptr, "Select File for Summary Plot Export", defaultFileName, "Text File(*.ascii);;All files(*.*)");
|
||||
if (fileName.isEmpty()) return;
|
||||
isOk = writeAsciiExportForSummaryPlots(fileName, summaryPlot);
|
||||
RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot(fileName, summaryPlot);
|
||||
|
||||
progress++;
|
||||
pi.setProgress(progress);
|
||||
@ -87,7 +85,7 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
std::vector<QString> fileNames;
|
||||
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
|
||||
{
|
||||
QString fileName = caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".csv";
|
||||
QString fileName = caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".ascii";
|
||||
fileNames.push_back(fileName);
|
||||
}
|
||||
|
||||
@ -95,20 +93,15 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir);
|
||||
if (!writeFiles) return;
|
||||
|
||||
RiaLogging::debug(QString("Writing to directory %!").arg(saveDir));
|
||||
RiaLogging::debug(QString("Writing to directory %1").arg(saveDir));
|
||||
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
|
||||
{
|
||||
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".csv";
|
||||
isOk = writeAsciiExportForSummaryPlots(fileName, summaryPlot);
|
||||
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".ascii";
|
||||
RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot(fileName, summaryPlot);
|
||||
progress++;
|
||||
pi.setProgress(progress);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
QMessageBox::critical(NULL, "File export", "Failed to export summary plots to csv");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -116,30 +109,31 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAsciiExportSummaryPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Export Summary Plot Data");
|
||||
actionToSetup->setText("Export Plot Data to Text File");
|
||||
actionToSetup->setIcon(QIcon(":/Save.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAsciiExportSummaryPlotFeature::writeAsciiExportForSummaryPlots(const QString& fileName, const RimSummaryPlot* summaryPlot)
|
||||
bool RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot(const QString& fileName, const RimSummaryPlot* summaryPlot)
|
||||
{
|
||||
RiaLogging::info(QString("Writing ascii values for summary plot(s) to file: %1").arg(fileName));
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RiaLogging::info(QString("Writing values for summary plot(s) to file: %1").arg(fileName));
|
||||
|
||||
QTextStream out(&file);
|
||||
|
||||
out << summaryPlot->description();
|
||||
out << summaryPlot->asciiDataForPlotExport();
|
||||
out << "\n\n";
|
||||
|
||||
RiaLogging::info(QString("Competed writing ascii values for summary plot(s) to file %1").arg(fileName));
|
||||
RiaLogging::info(QString("Competed writing values for summary plot(s) to file %1").arg(fileName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RimSummaryPlot;
|
||||
|
||||
@ -30,13 +29,11 @@ class RicAsciiExportSummaryPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
bool writeAsciiExportForSummaryPlots(const QString& fileName, const RimSummaryPlot* selectedSummaryPlots);
|
||||
static bool exportAsciiForSummaryPlot(const QString& fileName, const RimSummaryPlot* selectedSummaryPlots);
|
||||
};
|
||||
|
@ -0,0 +1,251 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RicNewGridTimeHistoryCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicNewSummaryCurveFeature.h"
|
||||
#include "RicSelectSummaryPlotUI.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
#include "cafPdmReferenceHelper.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewGridTimeHistoryCurveFeature, "RicNewGridTimeHistoryCurveFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem(const RiuSelectionItem* selectionItem, RimSummaryPlot* plot)
|
||||
{
|
||||
CVF_ASSERT(selectionItem);
|
||||
CVF_ASSERT(plot);
|
||||
|
||||
RimGridTimeHistoryCurve* newCurve = new RimGridTimeHistoryCurve();
|
||||
newCurve->setFromSelectionItem(selectionItem);
|
||||
newCurve->setLineThickness(2);
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plot->curveCount());
|
||||
newCurve->setColor(curveColor);
|
||||
|
||||
plot->addGridTimeHistoryCurve(newCurve);
|
||||
|
||||
newCurve->loadDataAndUpdate();
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
{
|
||||
const QString lastUsedSummaryPlotKey("lastUsedSummaryPlotKey");
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||
CVF_ASSERT(mainPlotColl);
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
||||
CVF_ASSERT(summaryPlotColl);
|
||||
|
||||
RimSummaryPlot* defaultSelectedPlot = nullptr;
|
||||
{
|
||||
QString lastUsedPlotRef = RiaApplication::instance()->cacheDataObject(lastUsedSummaryPlotKey).toString();
|
||||
RimSummaryPlot* lastUsedPlot = dynamic_cast<RimSummaryPlot*>(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedPlotRef));
|
||||
if (lastUsedPlot)
|
||||
{
|
||||
defaultSelectedPlot = lastUsedPlot;
|
||||
}
|
||||
|
||||
if (!defaultSelectedPlot)
|
||||
{
|
||||
defaultSelectedPlot = dynamic_cast<RimSummaryPlot*>( RiaApplication::instance()->activePlotWindow() );
|
||||
}
|
||||
|
||||
if (!defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0)
|
||||
{
|
||||
defaultSelectedPlot = summaryPlotColl->summaryPlots()[0];
|
||||
}
|
||||
}
|
||||
|
||||
RicSelectSummaryPlotUI featureUi;
|
||||
if (defaultSelectedPlot)
|
||||
{
|
||||
featureUi.setDefaultSummaryPlot(defaultSelectedPlot);
|
||||
}
|
||||
|
||||
QString newPlotName = RicNewGridTimeHistoryCurveFeature::suggestedNewPlotName();
|
||||
featureUi.setSuggestedPlotName(newPlotName);
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Select Destination Plot", "");
|
||||
propertyDialog.resize(QSize(400, 200));
|
||||
|
||||
if (propertyDialog.exec() != QDialog::Accepted) return nullptr;
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
if (featureUi.isCreateNewPlotChecked())
|
||||
{
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
summaryPlotColl->summaryPlots().push_back(plot);
|
||||
|
||||
plot->setDescription(featureUi.newPlotName());
|
||||
|
||||
summaryPlotColl->updateConnectedEditors();
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
summaryPlot = plot;
|
||||
}
|
||||
else
|
||||
{
|
||||
summaryPlot = featureUi.selectedSummaryPlot();
|
||||
}
|
||||
|
||||
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), summaryPlot);
|
||||
RiaApplication::instance()->setCacheDataObject(lastUsedSummaryPlotKey, refFromProjectToView);
|
||||
|
||||
return summaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicNewGridTimeHistoryCurveFeature::suggestedNewPlotName()
|
||||
{
|
||||
|
||||
QString resultName;
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
|
||||
if (eclView)
|
||||
{
|
||||
RimEclipseResultDefinition* resDef = eclView->cellResult();
|
||||
resultName = resDef->resultVariableUiShortName();
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(activeView);
|
||||
if (geoView)
|
||||
{
|
||||
// NOTE: See also RimGeoMechProertyFilter for generation of result name
|
||||
|
||||
RimGeoMechResultDefinition* resultDefinition = geoView->cellResultResultDefinition();
|
||||
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
|
||||
if (resultAddress.resultPosType == RIG_FORMATION_NAMES)
|
||||
{
|
||||
resultName = resultDefinition->resultFieldName();
|
||||
}
|
||||
else
|
||||
{
|
||||
QString posName;
|
||||
|
||||
switch (resultAddress.resultPosType)
|
||||
{
|
||||
case RIG_NODAL: posName = "N"; break;
|
||||
case RIG_ELEMENT_NODAL: posName = "EN"; break;
|
||||
case RIG_INTEGRATION_POINT: posName = "IP"; break;
|
||||
}
|
||||
|
||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||
|
||||
resultName = posName + ", " + fieldUiName + ", " + compoUiName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString plotName = "New Plot Name";
|
||||
if (!resultName.isEmpty())
|
||||
{
|
||||
plotName = QString("Cell Result - %1").arg(resultName);
|
||||
}
|
||||
|
||||
return plotName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewGridTimeHistoryCurveFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
RiuSelectionManager::instance()->selectedItems(items);
|
||||
|
||||
if (items.size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewGridTimeHistoryCurveFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot();
|
||||
if (!summaryPlot) return;
|
||||
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
RiuSelectionManager::instance()->selectedItems(items);
|
||||
CVF_ASSERT(items.size() > 0);
|
||||
|
||||
for (auto item : items)
|
||||
{
|
||||
RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem(item, summaryPlot);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewGridTimeHistoryCurveFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Plot Time History for Selected Cells");
|
||||
actionToSetup->setIcon(QIcon(":/SummaryCurve16x16.png"));
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 RiuSelectionItem;
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewGridTimeHistoryCurveFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
static void createCurveFromSelectionItem(const RiuSelectionItem* selectionItem, RimSummaryPlot* plot);
|
||||
static RimSummaryPlot* userSelectedSummaryPlot();
|
||||
static QString suggestedNewPlotName();
|
||||
};
|
@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicPasteTimeHistoryCurveFeature.h"
|
||||
|
||||
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
|
||||
|
||||
|
||||
#include "cafPdmDefaultObjectFactory.h"
|
||||
#include "cafPdmDocument.h"
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicPasteTimeHistoryCurveFeature, "RicPasteTimeHistoryCurveFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPasteTimeHistoryCurveFeature::isCommandEnabled()
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
if (!destinationObject)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType(summaryPlot);
|
||||
if (!summaryPlot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicPasteTimeHistoryCurveFeature::timeHistoryCurves().size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteTimeHistoryCurveFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
|
||||
CVF_ASSERT(destinationObject);
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType(summaryPlot);
|
||||
if (!summaryPlot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > sourceObjects = RicPasteTimeHistoryCurveFeature::timeHistoryCurves();
|
||||
|
||||
for (size_t i = 0; i < sourceObjects.size(); i++)
|
||||
{
|
||||
RimGridTimeHistoryCurve* newObject = dynamic_cast<RimGridTimeHistoryCurve*>(sourceObjects[i]->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(newObject);
|
||||
|
||||
summaryPlot->addGridTimeHistoryCurve(newObject);
|
||||
|
||||
// Resolve references after object has been inserted into the project data model
|
||||
newObject->resolveReferencesRecursively();
|
||||
|
||||
// If source curve is part of a curve filter, resolve of references to the summary case does not
|
||||
// work when pasting the new curve into a plot. Must set summary case manually.
|
||||
//newObject->setSummaryCase(sourceObjects[i]->summaryCase());
|
||||
|
||||
newObject->initAfterReadRecursively();
|
||||
|
||||
newObject->loadDataAndUpdate();
|
||||
newObject->updateConnectedEditors();
|
||||
|
||||
summaryPlot->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteTimeHistoryCurveFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Paste Time History Curve");
|
||||
|
||||
RicPasteFeatureImpl::setIconAndShortcuts(actionToSetup);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > RicPasteTimeHistoryCurveFeature::timeHistoryCurves()
|
||||
{
|
||||
caf::PdmObjectGroup objectGroup;
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);
|
||||
|
||||
std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > typedObjects;
|
||||
objectGroup.objectsByType(&typedObjects);
|
||||
|
||||
return typedObjects;
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmPointer.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimGridTimeHistoryCurve;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicPasteTimeHistoryCurveFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
static std::vector<caf::PdmPointer<RimGridTimeHistoryCurve> > timeHistoryCurves();
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,147 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RicSelectSummaryPlotUI.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicSelectSummaryPlotUI, "RicSelectSummaryPlotUI");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSelectSummaryPlotUI::RicSelectSummaryPlotUI()
|
||||
{
|
||||
CAF_PDM_InitObject("RicSelectSummaryPlotUI", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedSummaryPlot, "SelectedSummaryPlot", "Select Plot", "", "", "");
|
||||
CAF_PDM_InitField(&m_createNewPlot, "CreateNewPlot", false, "Create New Plot", "", "", "");
|
||||
CAF_PDM_InitField(&m_newSummaryPlotName, "NewViewName", QString("Cell Results"), "New Plot Name", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSelectSummaryPlotUI::setDefaultSummaryPlot(RimSummaryPlot* summaryPlot)
|
||||
{
|
||||
m_selectedSummaryPlot = summaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSelectSummaryPlotUI::setSuggestedPlotName(const QString& name)
|
||||
{
|
||||
m_newSummaryPlotName = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicSelectSummaryPlotUI::selectedSummaryPlot() const
|
||||
{
|
||||
return m_selectedSummaryPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSelectSummaryPlotUI::isCreateNewPlotChecked() const
|
||||
{
|
||||
return m_createNewPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicSelectSummaryPlotUI::newPlotName() const
|
||||
{
|
||||
return m_newSummaryPlotName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RicSelectSummaryPlotUI::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (fieldNeedingOptions == &m_selectedSummaryPlot)
|
||||
{
|
||||
for (RimSummaryPlot* plot : RicSelectSummaryPlotUI::summaryPlots())
|
||||
{
|
||||
QIcon icon = plot->uiCapability()->uiIcon();
|
||||
QString displayName = plot->description();
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(displayName, plot, false, icon));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSelectSummaryPlotUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
if (RicSelectSummaryPlotUI::summaryPlots().size() == 0)
|
||||
{
|
||||
m_createNewPlot = true;
|
||||
}
|
||||
|
||||
if (m_createNewPlot)
|
||||
{
|
||||
m_newSummaryPlotName.uiCapability()->setUiReadOnly(false);
|
||||
m_selectedSummaryPlot.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_newSummaryPlotName.uiCapability()->setUiReadOnly(true);
|
||||
m_selectedSummaryPlot.uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RicSelectSummaryPlotUI::summaryPlots()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||
CVF_ASSERT(mainPlotColl);
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
||||
CVF_ASSERT(summaryPlotColl);
|
||||
|
||||
std::vector<RimSummaryPlot*> sumPlots;
|
||||
summaryPlotColl->descendantsIncludingThisOfType(sumPlots);
|
||||
|
||||
return sumPlots;
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "cafPdmPtrField.h"
|
||||
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSelectSummaryPlotUI : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicSelectSummaryPlotUI();
|
||||
|
||||
void setDefaultSummaryPlot(RimSummaryPlot* summaryPlot);
|
||||
void setSuggestedPlotName(const QString& name);
|
||||
|
||||
RimSummaryPlot* selectedSummaryPlot() const;
|
||||
bool isCreateNewPlotChecked() const;
|
||||
QString newPlotName() const;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
static std::vector<RimSummaryPlot*> summaryPlots();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryPlot*> m_selectedSummaryPlot;
|
||||
caf::PdmField<bool> m_createNewPlot;
|
||||
caf::PdmField<QString> m_newSummaryPlotName;
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicSummaryCurveSwitchAxisFeature.h"
|
||||
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
@ -36,10 +37,14 @@ bool RicSummaryCurveSwitchAxisFeature::isCommandEnabled()
|
||||
{
|
||||
std::set<RimSummaryCurveFilter*> selectedCurveFilters;
|
||||
std::set<RimSummaryCurve*> selectedSoloCurves;
|
||||
std::vector<RimGridTimeHistoryCurve*> gridTimeHistoryCurves;
|
||||
|
||||
RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(&selectedCurveFilters,
|
||||
&selectedSoloCurves);
|
||||
return (selectedCurveFilters.size() || selectedSoloCurves.size());
|
||||
&selectedSoloCurves,
|
||||
&gridTimeHistoryCurves);
|
||||
return ( selectedCurveFilters.size()
|
||||
|| selectedSoloCurves.size()
|
||||
|| gridTimeHistoryCurves.size());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -49,9 +54,11 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::set<RimSummaryCurveFilter*> selectedCurveFilters;
|
||||
std::set<RimSummaryCurve*> selectedSoloCurves;
|
||||
std::vector<RimGridTimeHistoryCurve*> gridTimeHistoryCurves;
|
||||
|
||||
RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(&selectedCurveFilters,
|
||||
&selectedSoloCurves);
|
||||
&selectedSoloCurves,
|
||||
&gridTimeHistoryCurves);
|
||||
|
||||
for (RimSummaryCurveFilter* summaryCurveFilter: selectedCurveFilters)
|
||||
{
|
||||
@ -89,6 +96,26 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered(bool isChecked)
|
||||
summaryCurve->firstAncestorOrThisOfType(plot);
|
||||
if ( plot ) plot->updateAxes();
|
||||
}
|
||||
|
||||
for (RimGridTimeHistoryCurve* timeHistoryCurve : gridTimeHistoryCurves)
|
||||
{
|
||||
RimDefines::PlotAxis plotAxis = timeHistoryCurve->yAxis();
|
||||
|
||||
if (plotAxis == RimDefines::PLOT_AXIS_LEFT)
|
||||
{
|
||||
timeHistoryCurve->setYAxis(RimDefines::PLOT_AXIS_RIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
timeHistoryCurve->setYAxis(RimDefines::PLOT_AXIS_LEFT);
|
||||
}
|
||||
|
||||
timeHistoryCurve->updateConnectedEditors();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
timeHistoryCurve->firstAncestorOrThisOfType(plot);
|
||||
if (plot) plot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -100,19 +127,24 @@ void RicSummaryCurveSwitchAxisFeature::setupActionLook(QAction* actionToSetup)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Solo curves means selected curves that does not have a selected curvefilter as parent
|
||||
/// Solo curves means selected curves that does not have a selected curve filter as parent
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(std::set<RimSummaryCurveFilter*>* selectedCurveFilters,
|
||||
std::set<RimSummaryCurve*>* selectedSoloCurves)
|
||||
std::set<RimSummaryCurve*>* selectedSoloCurves,
|
||||
std::vector<RimGridTimeHistoryCurve*>* gridTimeHistoryCurves)
|
||||
{
|
||||
|
||||
selectedSoloCurves->clear();
|
||||
{
|
||||
std::vector<RimSummaryCurve*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
for (RimSummaryCurve* curve: selection)
|
||||
for (RimSummaryCurve* curve : selection)
|
||||
{
|
||||
selectedSoloCurves->insert(curve);
|
||||
RimSummaryCurveFilter* parentCurveFilter = nullptr;
|
||||
curve->firstAncestorOrThisOfType(parentCurveFilter);
|
||||
if (!parentCurveFilter)
|
||||
{
|
||||
selectedSoloCurves->insert(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,30 +152,12 @@ void RicSummaryCurveSwitchAxisFeature::extractSelectedCurveFiltersAndSoloCurves(
|
||||
{
|
||||
std::vector<RimSummaryCurveFilter*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
for ( RimSummaryCurveFilter* curveFilter: selection )
|
||||
for (RimSummaryCurveFilter* curveFilter : selection)
|
||||
{
|
||||
selectedCurveFilters->insert(curveFilter);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimSummaryCurve*> curvesToRemove;
|
||||
|
||||
for (RimSummaryCurve* curve: (*selectedSoloCurves))
|
||||
{
|
||||
RimSummaryCurveFilter* parentCurveFilter;
|
||||
curve->firstAncestorOrThisOfType(parentCurveFilter);
|
||||
if (parentCurveFilter)
|
||||
{
|
||||
if (selectedCurveFilters->count(parentCurveFilter) > 0 )
|
||||
{
|
||||
curvesToRemove.push_back(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RimSummaryCurve* curve: curvesToRemove)
|
||||
{
|
||||
selectedSoloCurves->erase(curve);
|
||||
}
|
||||
|
||||
}
|
||||
// Read out all time history curves directly from selection manager
|
||||
caf::SelectionManager::instance()->objectsByType(gridTimeHistoryCurves);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryCurveFilter;
|
||||
|
||||
class RimGridTimeHistoryCurve;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@ -41,5 +41,6 @@ protected:
|
||||
|
||||
private:
|
||||
static void extractSelectedCurveFiltersAndSoloCurves(std::set<RimSummaryCurveFilter*>* selectedCurveFilters,
|
||||
std::set<RimSummaryCurve*>* selectedSoloCurves);
|
||||
std::set<RimSummaryCurve*>* selectedSoloCurves,
|
||||
std::vector<RimGridTimeHistoryCurve*>* gridTimeHistoryCurves);
|
||||
};
|
||||
|
@ -23,16 +23,20 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimView.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QClipboard>
|
||||
#include <QMdiSubWindow>
|
||||
#include "RiuFlowCharacteristicsPlot.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicViewZoomAllFeature, "RicViewZoomAllFeature");
|
||||
|
||||
@ -62,21 +66,11 @@ void RicViewZoomAllFeature::onActionTriggered(bool isChecked)
|
||||
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if (subwindows.size() > 0)
|
||||
{
|
||||
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget());
|
||||
if (summaryQwtPlot)
|
||||
{
|
||||
RimViewWindow* viewWindow = summaryQwtPlot->ownerPlotDefinition();
|
||||
RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||
|
||||
viewWindow->zoomAll();
|
||||
summaryQwtPlot->replot();
|
||||
}
|
||||
|
||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
|
||||
if (wellLogPlot)
|
||||
if (viewWindow)
|
||||
{
|
||||
RimViewWindow* viewWindow = wellLogPlot->ownerPlotDefinition();
|
||||
viewWindow->zoomAll();
|
||||
wellLogPlot->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cafUtils.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafUtils.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -36,7 +36,6 @@
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
@ -65,17 +64,16 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedWellLogPlots);
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("PLOT_ASCIIEXPORT_DIR", projectFolder);
|
||||
|
||||
caf::ProgressInfo pi(selectedWellLogPlots.size(), QString("Exporting to csv"));
|
||||
caf::ProgressInfo pi(selectedWellLogPlots.size(), QString("Exporting plot data to ASCII"));
|
||||
size_t progress = 0;
|
||||
|
||||
bool isOk = false;
|
||||
if (selectedWellLogPlots.size() == 1)
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot = selectedWellLogPlots.at(0);
|
||||
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((wellLogPlot->description())) + ".csv";
|
||||
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Well Log Plot Export", defaultFileName, "All files(*.*)");
|
||||
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((wellLogPlot->description())) + ".ascii";
|
||||
QString fileName = QFileDialog::getSaveFileName(nullptr, "Select File for Plot Data Export", defaultFileName, "Text File(*.ascii);;All files(*.*)");
|
||||
if (fileName.isEmpty()) return;
|
||||
isOk = writeAsciiExportForWellLogPlots(fileName, wellLogPlot);
|
||||
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot(fileName, wellLogPlot);
|
||||
|
||||
progress++;
|
||||
pi.setProgress(progress);
|
||||
@ -85,7 +83,7 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||
std::vector<QString> fileNames;
|
||||
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
|
||||
{
|
||||
QString fileName = caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".csv";
|
||||
QString fileName = caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".ascii";
|
||||
fileNames.push_back(fileName);
|
||||
}
|
||||
|
||||
@ -96,19 +94,13 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||
RiaLogging::debug(QString("Writing to directory %!").arg(saveDir));
|
||||
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
|
||||
{
|
||||
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".csv";
|
||||
isOk = writeAsciiExportForWellLogPlots(fileName, wellLogPlot);
|
||||
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".ascii";
|
||||
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot(fileName, wellLogPlot);
|
||||
|
||||
progress++;
|
||||
pi.setProgress(progress);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
QMessageBox::critical(NULL, "File export", "Failed to export well log plot to csv");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -116,19 +108,22 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAsciiExportWellLogPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Export to csv");
|
||||
actionToSetup->setText("Export Plot Data to Text File");
|
||||
actionToSetup->setIcon(QIcon(":/Save.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAsciiExportWellLogPlotFeature::writeAsciiExportForWellLogPlots(const QString& fileName, const RimWellLogPlot* wellLogPlot)
|
||||
bool RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot(const QString& fileName, const RimWellLogPlot* wellLogPlot)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RiaLogging::info(QString("Writing values for plot(s) to file: %1").arg(fileName));
|
||||
|
||||
QTextStream out(&file);
|
||||
|
||||
@ -137,7 +132,8 @@ bool RicAsciiExportWellLogPlotFeature::writeAsciiExportForWellLogPlots(const QSt
|
||||
out << wellLogPlot->asciiDataForPlotExport();
|
||||
out << "\n\n";
|
||||
|
||||
RiaLogging::info(QString("CVS export completed for %1").arg(fileName));
|
||||
RiaLogging::info(QString("Competed writing values for plot(s) to file %1").arg(fileName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RimWellLogPlot;
|
||||
|
||||
@ -30,15 +29,11 @@ class RicAsciiExportWellLogPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
bool writeAsciiExportForWellLogPlots(const QString& fileName, const RimWellLogPlot* wellLogPlot);
|
||||
static bool exportAsciiForWellLogPlot(const QString& fileName, const RimWellLogPlot* wellLogPlot);
|
||||
};
|
||||
|
@ -34,6 +34,8 @@ add_library( ${PROJECT_NAME}
|
||||
RigFemPartGrid.cpp
|
||||
RigFemResultAddress.h
|
||||
RigFemResultPosEnum.h
|
||||
RimGeoMechTopologyItem.h
|
||||
RimGeoMechTopologyItem.cpp
|
||||
)
|
||||
|
||||
target_link_libraries( ${PROJECT_NAME} LibCore cafTensor ResultStatisticsCache)
|
||||
|
@ -0,0 +1,109 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimGeoMechTopologyItem.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechTopologyItem, "RimGeoMechTopologyItem");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechTopologyItem::RimGeoMechTopologyItem()
|
||||
{
|
||||
CAF_PDM_InitObject("GeoMech Topology Item", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_geoMechCase, "GeoMechCase", "Geo Mech Case", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "m_gridIndex", "m_gridIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "m_cellIndex", "m_cellIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_elementFace, "m_elementFace", "m_elementFace", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_hasIntersectionTriangle, "m_hasIntersectionTriangle", "m_hasIntersectionTriangle", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_0, "m_intersectionTriangle_0", "m_intersectionTriangle_0", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_1, "m_intersectionTriangle_1", "m_intersectionTriangle_1", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersectionTriangle_2, "m_intersectionTriangle_2", "m_intersectionTriangle_2", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "m_localIntersectionPoint", "m_localIntersectionPoint", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechTopologyItem::~RimGeoMechTopologyItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechTopologyItem::setFromSelectionItem(const RiuGeoMechSelectionItem* selectionItem)
|
||||
{
|
||||
m_geoMechCase = selectionItem->m_view->geoMechCase();
|
||||
|
||||
m_gridIndex = selectionItem->m_gridIndex;
|
||||
m_cellIndex = selectionItem->m_cellIndex;
|
||||
m_elementFace = selectionItem->m_elementFace;
|
||||
m_hasIntersectionTriangle = selectionItem->m_hasIntersectionTriangle;
|
||||
m_intersectionTriangle_0 = cvf::Vec3d(selectionItem->m_intersectionTriangle[0]);
|
||||
m_intersectionTriangle_1 = cvf::Vec3d(selectionItem->m_intersectionTriangle[1]);
|
||||
m_intersectionTriangle_2 = cvf::Vec3d(selectionItem->m_intersectionTriangle[2]);
|
||||
|
||||
m_localIntersectionPoint = selectionItem->m_localIntersectionPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGeoMechTopologyItem::topologyText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
/*
|
||||
if (m_geoMechCase)
|
||||
{
|
||||
text += m_geoMechCase->caseUserDescription();
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "No case";
|
||||
}
|
||||
|
||||
text += ", ";
|
||||
text += QString("Grid index %1").arg(m_gridIndex);
|
||||
text += ", ";
|
||||
text += RigTimeHistoryResultAccessor::topologyText(m_geoMechCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
|
||||
*/
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechTopologyItem::geoMechCase() const
|
||||
{
|
||||
return m_geoMechCase;
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimPickingTopologyItem.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RiuGeoMechSelectionItem;
|
||||
class RimGeoMechCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGeoMechTopologyItem : public RimPickingTopologyItem
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimGeoMechTopologyItem();
|
||||
virtual ~RimGeoMechTopologyItem() override;
|
||||
|
||||
void setFromSelectionItem(const RiuGeoMechSelectionItem* selectionItem);
|
||||
|
||||
virtual QString topologyText() const override;
|
||||
RimGeoMechCase* geoMechCase() const;
|
||||
|
||||
public:
|
||||
caf::PdmField<size_t> m_gridIndex;
|
||||
caf::PdmField<size_t> m_cellIndex;
|
||||
caf::PdmField<int> m_elementFace;
|
||||
caf::PdmField<bool> m_hasIntersectionTriangle;
|
||||
|
||||
caf::PdmField<cvf::Vec3d> m_intersectionTriangle_0;
|
||||
caf::PdmField<cvf::Vec3d> m_intersectionTriangle_1;
|
||||
caf::PdmField<cvf::Vec3d> m_intersectionTriangle_2;
|
||||
|
||||
caf::PdmField<cvf::Vec3d> m_localIntersectionPoint;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimGeoMechCase*> m_geoMechCase;
|
||||
};
|
||||
|
@ -43,6 +43,7 @@ RivWellConnectionsPartMgr::RivWellConnectionsPartMgr(RimEclipseView* reservoirVi
|
||||
{
|
||||
m_rimReservoirView = reservoirView;
|
||||
m_rimWell = well;
|
||||
m_useCurvedArrows = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -75,8 +76,12 @@ void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasi
|
||||
double mainArrowZHeight;
|
||||
cvf::ref<caf::DisplayCoordTransform> displayCordXf;
|
||||
RigFlowDiagResults* flowResults;
|
||||
|
||||
std::string injectorName;
|
||||
std::string producerName;
|
||||
std::string crossFlowInjectorName;
|
||||
std::string crossFlowProducerName;
|
||||
|
||||
double fluxWidthScale = 0.0;
|
||||
|
||||
{
|
||||
@ -97,38 +102,84 @@ void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasi
|
||||
wellHeadTop.z() += characteristicCellSize;
|
||||
|
||||
cvf::Vec3d activeCellsBoundingBoxMax = displayCordXf->transformToDisplayCoord(m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max());
|
||||
mainArrowZHeight = activeCellsBoundingBoxMax.z() - characteristicCellSize; // Above the bbox somewhat;
|
||||
mainArrowZHeight = activeCellsBoundingBoxMax.z() + 1.5*characteristicCellSize; // Above the bbox somewhat;
|
||||
|
||||
if ( isProducer ) producerName = m_rimWell->name().toStdString();
|
||||
else injectorName = m_rimWell->name().toStdString();
|
||||
if ( isProducer )
|
||||
{
|
||||
producerName = m_rimWell->name().toStdString();
|
||||
crossFlowInjectorName = RimFlowDiagSolution::addCrossFlowEnding(m_rimWell->name()).toStdString();
|
||||
}
|
||||
else
|
||||
{
|
||||
injectorName = m_rimWell->name().toStdString();
|
||||
crossFlowProducerName = RimFlowDiagSolution::addCrossFlowEnding(m_rimWell->name()).toStdString();
|
||||
}
|
||||
|
||||
double maxAbsFlux = flowResults->maxAbsPairFlux(static_cast<int>(frameIndex));
|
||||
if (maxAbsFlux != 0.0) fluxWidthScale = characteristicCellSize / maxAbsFlux;
|
||||
|
||||
}
|
||||
|
||||
RimEclipseWellCollection* wellColl = m_rimReservoirView->wellCollection();
|
||||
bool enableLighting = !m_rimReservoirView->isLightingDisabled();
|
||||
RimEclipseWellCollection* wellColl = m_rimReservoirView->wellCollection();
|
||||
|
||||
// Create potentially two the arrows to/from m_rimWell for each of the other wells in the model.
|
||||
// One arrow for the "official" state of the well, and one to account for cross flow contributions
|
||||
|
||||
for ( RimEclipseWell * otherWell: wellColl->wells )
|
||||
{
|
||||
if ( otherWell == m_rimWell ) continue;
|
||||
if ( !otherWell->showWell() ) continue;
|
||||
if ( !otherWell->wellResults()->hasWellResult(frameIndex) ) continue;
|
||||
if ( !otherWell->wellResults()->wellResultFrame(frameIndex).m_isOpen ) continue;
|
||||
if ( otherWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) continue;
|
||||
|
||||
bool isOtherProducer = (otherWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::PRODUCER);
|
||||
|
||||
if (isProducer == isOtherProducer) continue;
|
||||
|
||||
if ( isOtherProducer ) producerName = otherWell->name().toStdString();
|
||||
else injectorName = otherWell->name().toStdString();
|
||||
{
|
||||
std::string otherWellName = otherWell->name().toStdString();
|
||||
std::string otherWellXfName = RimFlowDiagSolution::addCrossFlowEnding(otherWell->name()).toStdString();
|
||||
|
||||
std::pair<double, double> injProdFluxPair = flowResults->injectorProducerPairFluxes(injectorName, producerName, static_cast<int>(frameIndex));
|
||||
if ( isProducer != isOtherProducer )
|
||||
{
|
||||
if ( isOtherProducer )
|
||||
{
|
||||
producerName = otherWellName;
|
||||
crossFlowInjectorName = otherWellXfName;
|
||||
}
|
||||
else
|
||||
{
|
||||
injectorName = otherWellName;
|
||||
crossFlowProducerName = otherWellXfName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isProducer )
|
||||
{
|
||||
injectorName = otherWellXfName;
|
||||
crossFlowProducerName = otherWellName;
|
||||
}
|
||||
else
|
||||
{
|
||||
producerName = otherWellXfName;
|
||||
crossFlowInjectorName = otherWellName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( fabs(injProdFluxPair.first) < 1e-3 && fabs(injProdFluxPair.second) < 1e-3 ) continue;
|
||||
std::pair<double, double> injProdFluxPair = flowResults->injectorProducerPairFluxes(injectorName, producerName, static_cast<int>(frameIndex));
|
||||
std::pair<double, double> injProdFluxPairXF = flowResults->injectorProducerPairFluxes(crossFlowInjectorName, crossFlowProducerName, static_cast<int>(frameIndex));
|
||||
|
||||
const double fluxThreshold = 0.0; // Todo : Needs threshold in Gui
|
||||
|
||||
if ( fabs(injProdFluxPair.first) <= fluxThreshold
|
||||
&& fabs(injProdFluxPair.second) <= fluxThreshold
|
||||
&& fabs(injProdFluxPairXF.first) <= fluxThreshold
|
||||
&& fabs(injProdFluxPairXF.second)<= fluxThreshold ) continue;
|
||||
|
||||
float width = fluxWidthScale * ( isProducer ? injProdFluxPair.second : injProdFluxPair.first);
|
||||
float widthXf = fluxWidthScale * (!isProducer ? injProdFluxPairXF.second: injProdFluxPairXF.first);
|
||||
|
||||
float width = fluxWidthScale * (isProducer ? injProdFluxPair.second: injProdFluxPair.first);
|
||||
|
||||
cvf::Vec3d otherWellHeadTop;
|
||||
cvf::Vec3d otherWellHeadBottom;
|
||||
{
|
||||
@ -140,118 +191,164 @@ void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasi
|
||||
|
||||
{
|
||||
cvf::Vec3f startPoint = cvf::Vec3f(0.5*(wellHeadTop + otherWellHeadTop));
|
||||
startPoint.z() = mainArrowZHeight;
|
||||
cvf::Vec3f endPoint = cvf::Vec3f(wellHeadTop + (2* pipeRadius * (otherWellHeadTop - wellHeadTop).getNormalized()));
|
||||
if (m_useCurvedArrows) startPoint.z() = mainArrowZHeight;
|
||||
cvf::Vec3f endPoint = cvf::Vec3f(wellHeadTop + (3* pipeRadius * (otherWellHeadTop - wellHeadTop).getNormalized()));
|
||||
cvf::Color4f arrowColor(otherWell->wellPipeColor());
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
cvf::ref<cvf::DrawableGeo> geo = createArrow(startPoint, endPoint, width, isProducer);
|
||||
if ( fabs(injProdFluxPair.first) > fluxThreshold
|
||||
&& fabs(injProdFluxPair.second) > fluxThreshold )
|
||||
{
|
||||
if ( isProducer == isOtherProducer )
|
||||
{
|
||||
startPoint.z() -= 0.5*characteristicCellSize;
|
||||
endPoint.z() -= 0.5*characteristicCellSize;
|
||||
}
|
||||
cvf::ref<cvf::Part> arrowPart = createArrowPart(startPoint, endPoint, width, isProducer, arrowColor, enableLighting);
|
||||
model->addPart(arrowPart.p());
|
||||
}
|
||||
|
||||
part->setDrawable(geo.p());
|
||||
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(otherWell->wellPipeColor()), caf::PO_1);
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
model->addPart(part.p());
|
||||
if ( fabs(injProdFluxPairXF.first) > fluxThreshold
|
||||
&& fabs(injProdFluxPairXF.second) > fluxThreshold )
|
||||
{
|
||||
startPoint.z() -= 0.5*characteristicCellSize;
|
||||
endPoint.z() -= 0.5*characteristicCellSize;
|
||||
cvf::ref<cvf::Part> arrowPart = createArrowPart(startPoint, endPoint, widthXf, !isProducer, arrowColor, enableLighting);
|
||||
model->addPart(arrowPart.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cvf::ref< cvf::DrawableGeo> RivWellConnectionsPartMgr::createArrow(const cvf::Vec3f& startPoint,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> RivWellConnectionsPartMgr::createArrowPart(const cvf::Vec3f& startPoint,
|
||||
const cvf::Vec3f& endPoint,
|
||||
float width,
|
||||
bool isProducer,
|
||||
const cvf::Color4f& arrowColor,
|
||||
bool enableLighting)
|
||||
{
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
cvf::ref<cvf::DrawableGeo> geo = createArrowGeometry(startPoint, endPoint, width, isProducer);
|
||||
|
||||
part->setDrawable(geo.p());
|
||||
caf::SurfaceEffectGenerator surfaceGen(arrowColor, caf::PO_1);
|
||||
surfaceGen.enableLighting(enableLighting);
|
||||
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref< cvf::DrawableGeo> RivWellConnectionsPartMgr::createArrowGeometry(const cvf::Vec3f& startPoint,
|
||||
const cvf::Vec3f& endPoint,
|
||||
double width,
|
||||
bool useArrowEnd)
|
||||
{
|
||||
// 0 2 4 6 8 10 12 14
|
||||
// : flat : : : : flat : : : end
|
||||
// 1 3 5 7 9 11 13 15
|
||||
// Vertex layout
|
||||
// _ - _
|
||||
// __________ - - _
|
||||
// - Producer end: Injector end
|
||||
// 0 2 4 6 8 10 20 12 14 16 16
|
||||
// : flat : : : : : : : : end 18 18
|
||||
// 1 3 5 7 9 11 19 13 15 17 17
|
||||
|
||||
// Producer end:
|
||||
// 16
|
||||
// 18
|
||||
// 17
|
||||
static const cvf::uint producerArrowFaceList[7 * 5 + 4] ={ 4, 0, 1, 3, 2,
|
||||
static const cvf::uint producerArrowFaceList[8 * 5 + 4] ={ 4, 0, 1, 3, 2,
|
||||
4, 2, 3, 5, 4,
|
||||
4, 4, 5, 7, 6,
|
||||
4, 6, 7, 9, 8,
|
||||
4, 8, 9, 11, 10,
|
||||
4, 10, 11, 13, 12,
|
||||
4, 10, 11, 20, 19,
|
||||
4, 19, 20, 13, 12,
|
||||
4, 12, 13, 15, 14,
|
||||
3, 16, 17, 18 };
|
||||
|
||||
// Injector end
|
||||
// 16
|
||||
// 18
|
||||
// 17
|
||||
|
||||
static const cvf::uint injectorArrowFaceList[7 * 5 + 8] ={ 4, 0, 1, 3, 2,
|
||||
static const cvf::uint injectorArrowFaceList[8 * 5 + 8] ={ 4, 0, 1, 3, 2,
|
||||
4, 2, 3, 5, 4,
|
||||
4, 4, 5, 7, 6,
|
||||
4, 6, 7, 9, 8,
|
||||
4, 8, 9, 11, 10,
|
||||
4, 10, 11, 13, 12,
|
||||
4, 10, 11, 20, 19,
|
||||
4, 19, 20, 13, 12,
|
||||
4, 12, 13, 15, 14,
|
||||
3, 14, 18, 16,
|
||||
3, 18, 15, 17 };
|
||||
|
||||
|
||||
cvf::Vec3f endPointInTopPlane = endPoint;
|
||||
endPointInTopPlane.z() = startPoint.z();
|
||||
if (m_useCurvedArrows) endPointInTopPlane.z() = startPoint.z();
|
||||
|
||||
cvf::Vec3f heightDiff = cvf::Vec3f::ZERO;
|
||||
heightDiff.z() = 0.5*(startPoint.z() - endPoint.z());
|
||||
if (m_useCurvedArrows) heightDiff.z() = (startPoint.z() - endPoint.z());
|
||||
|
||||
cvf::Vec3f fromTo = endPointInTopPlane - startPoint;
|
||||
float length = fromTo.length();
|
||||
|
||||
float halfWidth = width * 0.5;
|
||||
cvf::Vec3f widthVector = halfWidth *(fromTo.getNormalized() ^ -cvf::Vec3f::Z_AXIS);
|
||||
|
||||
float heightScale = 0.3*length * 0.15;
|
||||
cvf::Vec3f heightScaleVec = cvf::Vec3f::ZERO;
|
||||
|
||||
if (m_useCurvedArrows) heightScaleVec.z() = heightScale;
|
||||
|
||||
float endStart = 0.4f;
|
||||
float endStep = (1.0f - endStart) / 7.5f;
|
||||
|
||||
cvf::ref< cvf::Vec3fArray> arrowVertexArray = new cvf::Vec3fArray;
|
||||
arrowVertexArray->resize(16+3);
|
||||
arrowVertexArray->resize(18+3);
|
||||
|
||||
(*arrowVertexArray)[0] = 0.0f* fromTo + startPoint + widthVector;
|
||||
(*arrowVertexArray)[1] = 0.0f* fromTo + startPoint - widthVector;
|
||||
(*arrowVertexArray)[0] = 0.0f * fromTo + startPoint + widthVector;
|
||||
(*arrowVertexArray)[1] = 0.0f * fromTo + startPoint - widthVector;
|
||||
(*arrowVertexArray)[2] = endStart * fromTo + startPoint + widthVector;
|
||||
(*arrowVertexArray)[3] = endStart * fromTo + startPoint - widthVector;
|
||||
|
||||
(*arrowVertexArray)[2] = 0.7f* fromTo + startPoint + widthVector;
|
||||
(*arrowVertexArray)[3] = 0.7f* fromTo + startPoint - widthVector;
|
||||
(*arrowVertexArray)[4] = (1*endStep + endStart) * fromTo + startPoint + widthVector + 0.250f * heightScaleVec;//0.0250f * heightDiff;
|
||||
(*arrowVertexArray)[5] = (1*endStep + endStart) * fromTo + startPoint - widthVector + 0.250f * heightScaleVec;//0.0250f * heightDiff;
|
||||
(*arrowVertexArray)[6] = (2*endStep + endStart) * fromTo + startPoint + widthVector + 0.750f * heightScaleVec;//0.0750f * heightDiff;
|
||||
(*arrowVertexArray)[7] = (2*endStep + endStart) * fromTo + startPoint - widthVector + 0.750f * heightScaleVec;//0.0750f * heightDiff;
|
||||
(*arrowVertexArray)[8] = (3*endStep + endStart) * fromTo + startPoint + widthVector + 1.000f * heightScaleVec;//0.1000f * heightDiff;
|
||||
(*arrowVertexArray)[9] = (3*endStep + endStart) * fromTo + startPoint - widthVector + 1.000f * heightScaleVec;//0.1000f * heightDiff;
|
||||
(*arrowVertexArray)[10] = (4*endStep + endStart) * fromTo + startPoint + widthVector + 0.875f * heightScaleVec;//0.0875f * heightDiff;
|
||||
(*arrowVertexArray)[11] = (4*endStep + endStart) * fromTo + startPoint - widthVector + 0.875f * heightScaleVec;//0.0875f * heightDiff;
|
||||
(*arrowVertexArray)[19] = (4.7f*endStep + endStart) * fromTo + startPoint + widthVector + 0.400f * heightScaleVec;//0.0875f * heightDiff;
|
||||
(*arrowVertexArray)[20] = (4.7f*endStep + endStart) * fromTo + startPoint - widthVector + 0.400f * heightScaleVec;//0.0875f * heightDiff;
|
||||
|
||||
(*arrowVertexArray)[4] = (0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.05f * heightDiff;
|
||||
(*arrowVertexArray)[5] = (0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.05f * heightDiff;
|
||||
(*arrowVertexArray)[12] = (5*endStep + endStart) * fromTo + startPoint + widthVector;
|
||||
(*arrowVertexArray)[13] = (5*endStep + endStart) * fromTo + startPoint - widthVector;
|
||||
|
||||
(*arrowVertexArray)[6] = (2*0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.15f * heightDiff;
|
||||
(*arrowVertexArray)[7] = (2*0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.15f * heightDiff;
|
||||
|
||||
(*arrowVertexArray)[8] = (3*0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.2f * heightDiff;
|
||||
(*arrowVertexArray)[9] = (3*0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.2f * heightDiff;
|
||||
|
||||
(*arrowVertexArray)[10] = (4*0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.175f * heightDiff;
|
||||
(*arrowVertexArray)[11] = (4*0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.175f * heightDiff;
|
||||
|
||||
(*arrowVertexArray)[12] = (5*0.04f + 0.7f)* fromTo + startPoint + widthVector;
|
||||
(*arrowVertexArray)[13] = (5*0.04f + 0.7f)* fromTo + startPoint - widthVector;
|
||||
|
||||
(*arrowVertexArray)[14] = (6*0.04f + 0.7f)* fromTo + startPoint + widthVector - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[15] = (6*0.04f + 0.7f)* fromTo + startPoint - widthVector - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[14] = (6*endStep + endStart) * fromTo + startPoint + widthVector - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[15] = (6*endStep + endStart) * fromTo + startPoint - widthVector - 0.5f * heightDiff;
|
||||
|
||||
if ( useArrowEnd )
|
||||
{
|
||||
(*arrowVertexArray)[16] = (6*0.04f + 0.7f)* fromTo + startPoint + 1.1f*widthVector - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[17] = (6*0.04f + 0.7f)* fromTo + startPoint - 1.1f*widthVector - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[18] = 1.0f * fromTo + startPoint - 1.0f * heightDiff;
|
||||
(*arrowVertexArray)[16] = (6*endStep + endStart) * fromTo + startPoint + 1.6f * widthVector - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[17] = (6*endStep + endStart) * fromTo + startPoint - 1.6f * widthVector - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[18] = 1.0f * fromTo + startPoint - 1.0f * heightDiff;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*arrowVertexArray)[16] = 1.0f * fromTo + startPoint + 0.5f*widthVector - 1.0f * heightDiff;
|
||||
(*arrowVertexArray)[17] = 1.0f * fromTo + startPoint - 0.5f*widthVector - 1.0f * heightDiff;
|
||||
(*arrowVertexArray)[18] = (6*0.04f + 0.7f)* fromTo + startPoint - 0.5f * heightDiff;
|
||||
(*arrowVertexArray)[16] = 1.0f * fromTo + startPoint + 0.5f * widthVector - 1.0f * heightDiff;
|
||||
(*arrowVertexArray)[17] = 1.0f * fromTo + startPoint - 0.5f * widthVector - 1.0f * heightDiff;
|
||||
(*arrowVertexArray)[18] = (6*endStep + endStart) * fromTo + startPoint - 0.5f * heightDiff;
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setVertexArray(arrowVertexArray.p());
|
||||
|
||||
if ( useArrowEnd )
|
||||
geo->setFromFaceList(cvf::UIntArray(producerArrowFaceList, 7 * 5 + 4));
|
||||
geo->setFromFaceList(cvf::UIntArray(producerArrowFaceList, 8 * 5 + 4));
|
||||
else
|
||||
geo->setFromFaceList(cvf::UIntArray(injectorArrowFaceList, 7 * 5 + 8));
|
||||
geo->setFromFaceList(cvf::UIntArray(injectorArrowFaceList, 8 * 5 + 8));
|
||||
|
||||
geo->computeNormals();
|
||||
|
||||
return geo;
|
||||
}
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfColor4.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -32,6 +33,7 @@ namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class DrawableGeo;
|
||||
class Part;
|
||||
}
|
||||
|
||||
class RivPipeGeometryGenerator;
|
||||
@ -48,14 +50,24 @@ public:
|
||||
~RivWellConnectionsPartMgr();
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
cvf::ref< cvf::DrawableGeo> createArrow(const cvf::Vec3f& startPoint,
|
||||
cvf::ref<cvf::Part> createArrowPart(const cvf::Vec3f& startPoint,
|
||||
const cvf::Vec3f& endPoint,
|
||||
float width,
|
||||
bool isProducer,
|
||||
const cvf::Color4f& arrowColor,
|
||||
bool enableLighting);
|
||||
cvf::ref< cvf::DrawableGeo> createArrowGeometry(const cvf::Vec3f& startPoint,
|
||||
const cvf::Vec3f& endPoint,
|
||||
double width,
|
||||
bool useArrowEnd);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
|
||||
caf::PdmPointer<RimEclipseWell> m_rimWell;
|
||||
caf::PdmPointer<RimEclipseWell> m_rimWell;
|
||||
|
||||
bool m_useCurvedArrows;
|
||||
};
|
||||
|
@ -88,6 +88,9 @@ ${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimNamedObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPickingTopologyItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseTopologyItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplateCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFracture.h
|
||||
@ -186,6 +189,9 @@ ${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimNamedObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPickingTopologyItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseTopologyItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFractureTemplateCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFracture.cpp
|
||||
|
@ -11,6 +11,7 @@ ${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowCharacteristicsPlot.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -20,6 +21,7 @@ ${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowCharacteristicsPlot.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,309 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuFlowCharacteristicsPlot.h"
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void AppEnum< RimFlowCharacteristicsPlot::TimeSelectionType >::setUp()
|
||||
{
|
||||
addItem(RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All available");
|
||||
addItem(RimFlowCharacteristicsPlot::SELECT_AVAILABLE, "SELECT_AVAILABLE", "Select");
|
||||
setDefault(RimFlowCharacteristicsPlot::ALL_AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFlowCharacteristicsPlot, "FlowCharacteristicsPlot");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
|
||||
{
|
||||
CAF_PDM_InitObject("Flow Characteristics", ":/WellAllocPie16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_case, "FlowCase", "Case", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "");
|
||||
|
||||
this->m_showWindow = false;
|
||||
setAsPlotMdiWindow();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::setFromFlowSolution(RimFlowDiagSolution* flowSolution)
|
||||
{
|
||||
if ( !flowSolution )
|
||||
{
|
||||
m_case = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
flowSolution->firstAncestorOrThisOfType(eclCase);
|
||||
m_case = eclCase;
|
||||
}
|
||||
|
||||
m_flowDiagSolution = flowSolution;
|
||||
m_showWindow = true;
|
||||
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::deleteViewWidget()
|
||||
{
|
||||
if (m_flowCharPlotWidget)
|
||||
{
|
||||
m_flowCharPlotWidget->deleteLater();
|
||||
m_flowCharPlotWidget= nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
|
||||
{
|
||||
if (m_timeStepSelectionType() != ALL_AVAILABLE) return;
|
||||
if (!m_flowDiagSolution()) return;
|
||||
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
|
||||
|
||||
if (m_currentlyPlottedTimeSteps == calculatedTimesteps) return;
|
||||
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if ( proj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType(cases);
|
||||
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_flowDiagSolution )
|
||||
{
|
||||
if ( m_case )
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
|
||||
|
||||
for ( RimFlowDiagSolution* flowSol : flowSols )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_selectedTimeSteps )
|
||||
{
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
|
||||
|
||||
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
|
||||
|
||||
for ( int tsIdx : calculatedTimesteps )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx].toString(), tsIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_case);
|
||||
uiOrdering.add(&m_flowDiagSolution);
|
||||
uiOrdering.add(&m_timeStepSelectionType);
|
||||
|
||||
if (m_timeStepSelectionType == SELECT_AVAILABLE) uiOrdering.add(&m_selectedTimeSteps);
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimFlowCharacteristicsPlot::viewWidget()
|
||||
{
|
||||
return m_flowCharPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::zoomAll()
|
||||
{
|
||||
if (m_flowCharPlotWidget) m_flowCharPlotWidget->zoomAll();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
if ( &m_case == changedField )
|
||||
{
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
m_currentlyPlottedTimeSteps.clear();
|
||||
}
|
||||
|
||||
// All fields update plot
|
||||
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if (m_flowCharPlotWidget)
|
||||
{
|
||||
QPixmap pix = QPixmap::grabWidget(m_flowCharPlotWidget);
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::loadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if (m_flowDiagSolution && m_flowCharPlotWidget)
|
||||
{
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
|
||||
|
||||
if (m_timeStepSelectionType == SELECT_AVAILABLE)
|
||||
{
|
||||
// Find set intersection of selected and available time steps
|
||||
std::set<int> calculatedTimeStepsSet;
|
||||
calculatedTimeStepsSet.insert(calculatedTimesteps.begin(), calculatedTimesteps.end());
|
||||
calculatedTimesteps.clear();
|
||||
|
||||
auto selectedTimeSteps = m_selectedTimeSteps();
|
||||
for (int tsIdx : selectedTimeSteps)
|
||||
{
|
||||
if (calculatedTimeStepsSet.count(tsIdx)) calculatedTimesteps.push_back(tsIdx);
|
||||
}
|
||||
}
|
||||
|
||||
m_currentlyPlottedTimeSteps = calculatedTimesteps;
|
||||
|
||||
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
|
||||
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
|
||||
|
||||
m_flowCharPlotWidget->removeAllCurves();
|
||||
|
||||
for ( int timeStepIdx: calculatedTimesteps )
|
||||
{
|
||||
lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx).m_lorenzCoefficient;
|
||||
}
|
||||
m_flowCharPlotWidget->setLorenzCurve(timeStepDates, lorenzVals);
|
||||
|
||||
for ( int timeStepIdx: calculatedTimesteps )
|
||||
{
|
||||
|
||||
const auto & flowCharResults = flowResult->flowCharacteristicsResults(timeStepIdx);
|
||||
m_flowCharPlotWidget->addFlowCapStorageCapCurve(timeStepDates[timeStepIdx],
|
||||
flowCharResults.m_flowCapStorageCapCurve.first,
|
||||
flowCharResults.m_flowCapStorageCapCurve.second);
|
||||
m_flowCharPlotWidget->addSweepEfficiencyCurve(timeStepDates[timeStepIdx],
|
||||
flowCharResults.m_sweepEfficiencyCurve.first,
|
||||
flowCharResults.m_sweepEfficiencyCurve.second);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimFlowCharacteristicsPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
m_flowCharPlotWidget = new RiuFlowCharacteristicsPlot(this, mainWindowParent);
|
||||
return m_flowCharPlotWidget;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimViewWindow.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RimFlowDiagSolution;
|
||||
class RimEclipseResultCase;
|
||||
|
||||
class RiuFlowCharacteristicsPlot;
|
||||
|
||||
namespace caf {
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
namespace cvf {
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimFlowCharacteristicsPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFlowCharacteristicsPlot();
|
||||
virtual ~RimFlowCharacteristicsPlot();
|
||||
|
||||
void setFromFlowSolution(RimFlowDiagSolution* flowSolution);
|
||||
void updateCurrentTimeStep();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual QWidget* viewWidget() override;
|
||||
virtual void zoomAll() override;
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
enum TimeSelectionType
|
||||
{
|
||||
ALL_AVAILABLE,
|
||||
SELECT_AVAILABLE
|
||||
};
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual void loadDataAndUpdate() override;
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
||||
caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType;
|
||||
caf::PdmField<std::vector<int> > m_selectedTimeSteps;
|
||||
|
||||
std::vector<int> m_currentlyPlottedTimeSteps;
|
||||
|
||||
QPointer<RiuFlowCharacteristicsPlot> m_flowCharPlotWidget;
|
||||
};
|
@ -35,20 +35,22 @@
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
|
||||
|
||||
#define CROSS_FLOW_ENDING "-XF"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool hasCrossFlowEnding(const QString& tracerName)
|
||||
bool RimFlowDiagSolution::hasCrossFlowEnding(const QString& tracerName)
|
||||
{
|
||||
return tracerName.endsWith("-Xf");
|
||||
return tracerName.endsWith(CROSS_FLOW_ENDING);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString removeCrossFlowEnding(const QString& tracerName)
|
||||
QString RimFlowDiagSolution::removeCrossFlowEnding(const QString& tracerName)
|
||||
{
|
||||
if (tracerName.endsWith("-Xf"))
|
||||
if (tracerName.endsWith(CROSS_FLOW_ENDING))
|
||||
{
|
||||
return tracerName.left(tracerName.size() - 3);
|
||||
}
|
||||
@ -61,9 +63,9 @@ QString removeCrossFlowEnding(const QString& tracerName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString addCrossFlowEnding(const QString& wellName)
|
||||
QString RimFlowDiagSolution::addCrossFlowEnding(const QString& wellName)
|
||||
{
|
||||
return wellName + "-Xf";
|
||||
return wellName + CROSS_FLOW_ENDING;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -179,10 +181,10 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
|
||||
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
|
||||
&& wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE);
|
||||
|
||||
std::string wellname = wellResults[wIdx]->m_wellName.toStdString();
|
||||
std::string wellName = wellResults[wIdx]->m_wellName.toStdString();
|
||||
std::string wellNameXf = addCrossFlowEnding(wellResults[wIdx]->m_wellName).toStdString();
|
||||
|
||||
std::vector<int>& tracerCells = tracersWithCells[wellname];
|
||||
std::vector<int>& tracerCells = tracersWithCells[wellName];
|
||||
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
|
||||
|
||||
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
|
||||
@ -208,6 +210,9 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tracerCells.empty()) tracersWithCells.erase(wellName);
|
||||
if (tracerCellsCrossFlow.empty()) tracersWithCells.erase(wellNameXf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ class RimFlowDiagSolution : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
|
||||
RimFlowDiagSolution();
|
||||
virtual ~RimFlowDiagSolution();
|
||||
|
||||
@ -59,6 +60,9 @@ public:
|
||||
TracerStatusType tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex) const;
|
||||
cvf::Color3f tracerColor(const QString& tracerName) const;
|
||||
|
||||
static bool hasCrossFlowEnding(const QString& tracerName);
|
||||
static QString removeCrossFlowEnding(const QString& tracerName);
|
||||
static QString addCrossFlowEnding(const QString& wellName);
|
||||
private:
|
||||
std::map<std::string, std::vector<int> > allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors) const;
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RimFlowPlotCollection.h"
|
||||
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
|
||||
#include "cvfAssert.h"
|
||||
@ -33,10 +34,13 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Flow Diagnostics Plots", ":/WellAllocPlots16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_defaultPlot, "DefaultFlowPlot", "", "", "", "");
|
||||
m_defaultPlot.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "", "", "", "");
|
||||
m_flowCharacteristicsPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowPlots, "FlowPlots", "Stored Plots", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_defaultWellAllocPlot, "DefaultFlowPlot", "", "", "", "");
|
||||
m_defaultWellAllocPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_storedWellAllocPlots, "FlowPlots", "Stored Plots", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -44,9 +48,9 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowPlotCollection::~RimFlowPlotCollection()
|
||||
{
|
||||
delete m_defaultPlot();
|
||||
delete m_defaultWellAllocPlot();
|
||||
|
||||
m_flowPlots.deleteAllChildObjects();
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -54,12 +58,15 @@ RimFlowPlotCollection::~RimFlowPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
{
|
||||
if ( m_defaultPlot )
|
||||
if ( m_defaultWellAllocPlot )
|
||||
{
|
||||
m_defaultPlot->removeFromMdiAreaAndDeleteViewWidget();
|
||||
delete m_defaultPlot();
|
||||
m_defaultWellAllocPlot->removeFromMdiAreaAndDeleteViewWidget();
|
||||
delete m_defaultWellAllocPlot();
|
||||
}
|
||||
m_flowPlots.deleteAllChildObjects();
|
||||
|
||||
delete m_flowCharacteristicsPlot;
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -67,12 +74,12 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
{
|
||||
caf::ProgressInfo plotProgress(m_flowPlots.size() + 1, "");
|
||||
caf::ProgressInfo plotProgress(m_storedWellAllocPlots.size() + 1, "");
|
||||
|
||||
if (m_defaultPlot) m_defaultPlot->loadDataAndUpdate();
|
||||
if (m_defaultWellAllocPlot) m_defaultWellAllocPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
|
||||
for (RimWellAllocationPlot* p : m_flowPlots)
|
||||
for (RimWellAllocationPlot* p : m_storedWellAllocPlots)
|
||||
{
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
@ -85,31 +92,46 @@ void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
size_t RimFlowPlotCollection::plotCount() const
|
||||
{
|
||||
size_t plotCount = 0;
|
||||
if (m_defaultPlot) plotCount = 1;
|
||||
plotCount += m_flowPlots.size();
|
||||
if (m_defaultWellAllocPlot) plotCount = 1;
|
||||
plotCount += m_storedWellAllocPlots.size();
|
||||
return plotCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::addPlot(RimWellAllocationPlot* plot)
|
||||
void RimFlowPlotCollection::addWellAllocPlotToStoredPlots(RimWellAllocationPlot* plot)
|
||||
{
|
||||
m_flowPlots.push_back(plot);
|
||||
m_storedWellAllocPlots.push_back(plot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RimFlowPlotCollection::defaultPlot()
|
||||
RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
|
||||
{
|
||||
if ( !m_defaultPlot() )
|
||||
if ( !m_defaultWellAllocPlot() )
|
||||
{
|
||||
m_defaultPlot = new RimWellAllocationPlot;
|
||||
m_defaultPlot->setDescription("Default Flow Diagnostics Plot");
|
||||
m_defaultWellAllocPlot = new RimWellAllocationPlot;
|
||||
m_defaultWellAllocPlot->setDescription("Default Flow Diagnostics Plot");
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
return m_defaultPlot();
|
||||
return m_defaultWellAllocPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlot()
|
||||
{
|
||||
if ( !m_flowCharacteristicsPlot() )
|
||||
{
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
return m_flowCharacteristicsPlot();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
class RimFlowCharacteristicsPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -39,10 +40,12 @@ public:
|
||||
void loadDataAndUpdate();
|
||||
size_t plotCount() const;
|
||||
|
||||
void addPlot(RimWellAllocationPlot* plot);
|
||||
RimWellAllocationPlot* defaultPlot();
|
||||
void addWellAllocPlotToStoredPlots(RimWellAllocationPlot* plot);
|
||||
RimWellAllocationPlot* defaultWellAllocPlot();
|
||||
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultPlot;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_flowPlots;
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
};
|
||||
|
@ -44,9 +44,9 @@ CAF_PDM_SOURCE_INIT(RimTotalWellAllocationPlot, "TotalWellAllocationPlot");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
|
||||
{
|
||||
CAF_PDM_InitObject("Total Well Allocation Plot", ":/WellAllocPie16x16.png", "", "");
|
||||
CAF_PDM_InitObject("Total Allocation", ":/WellAllocPie16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Total Well Allocation Plot"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Total Allocation"), "Name", "", "", "");
|
||||
m_userName.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||
|
@ -175,7 +175,11 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
CVF_ASSERT(accumulatedWellFlowPlot()->trackCount() == 0);
|
||||
|
||||
accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + m_wellName + ")");
|
||||
QString description;
|
||||
if (m_flowType() == ACCUMULATED) description = "Accumulated Flow";
|
||||
if (m_flowType() == INFLOW) description = "Inflow Rates";
|
||||
|
||||
accumulatedWellFlowPlot()->setDescription(description + " (" + m_wellName + ")");
|
||||
|
||||
if (!m_case) return;
|
||||
|
||||
@ -225,12 +229,6 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
}
|
||||
}
|
||||
|
||||
m_contributingTracerNames.clear();
|
||||
if (wfCalculator)
|
||||
{
|
||||
m_contributingTracerNames = wfCalculator->tracerNames();
|
||||
}
|
||||
|
||||
auto depthType = accumulatedWellFlowPlot()->depthType();
|
||||
|
||||
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return;
|
||||
@ -302,7 +300,8 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
QString wellStatusText = QString("(%1)").arg(RimWellAllocationPlot::wellStatusTextForTimeStep(m_wellName, m_case, m_timeStep));
|
||||
|
||||
setDescription("Well Allocation: " + m_wellName + " " + wellStatusText + ", " + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")");
|
||||
QString flowTypeText = m_flowDiagSolution() ? "Well Allocation": "Well Flow";
|
||||
setDescription(flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")");
|
||||
|
||||
/// Pie chart
|
||||
|
||||
@ -364,7 +363,7 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
|
||||
{
|
||||
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
|
||||
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
|
||||
tracerCellFractionValues[tracerName] = tracerCellFractions;
|
||||
if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -497,6 +496,7 @@ QWidget* RimWellAllocationPlot::viewWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::zoomAll()
|
||||
{
|
||||
m_accumulatedWellFlowPlot()->zoomAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -616,14 +616,6 @@ QString RimWellAllocationPlot::wellName() const
|
||||
return m_wellName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<QString> RimWellAllocationPlot::contributingTracerNames() const
|
||||
{
|
||||
return m_contributingTracerNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -72,7 +72,6 @@ public:
|
||||
int timeStep();
|
||||
|
||||
QString wellName() const;
|
||||
const std::vector<QString> contributingTracerNames() const;
|
||||
|
||||
void removeFromMdiAreaAndDeleteViewWidget();
|
||||
|
||||
@ -125,6 +124,4 @@ private:
|
||||
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
|
||||
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
|
||||
|
||||
std::vector<QString> m_contributingTracerNames;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ CAF_PDM_SOURCE_INIT(RimWellAllocationPlotLegend, "WellAllocationPlotLegend");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlotLegend::RimWellAllocationPlotLegend()
|
||||
{
|
||||
CAF_PDM_InitObject("Well Allocation Plot Legend", ":/WellAllocLegend16x16.png", "", "");
|
||||
CAF_PDM_InitObject("Legend", ":/WellAllocLegend16x16.png", "", "");
|
||||
CAF_PDM_InitField(&m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "");
|
||||
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ void Rim3dOverlayInfoConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
}
|
||||
statGroup->add(&m_statisticsCellRange);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -262,7 +262,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
m_singleVarEdgeResultColors->defineUiOrdering(uiConfigName,uiOrdering );
|
||||
m_singleVarEdgeResultColors->uiOrdering(uiConfigName,uiOrdering );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -273,7 +273,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
uiOrdering.add(&useZVariable);
|
||||
}
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -282,7 +282,7 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
void RimCellEdgeColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.add(legendConfig());
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimFault.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
@ -144,6 +146,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "Separator";
|
||||
|
||||
commandIds << "RicNewViewFeature";
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
commandIds << "RicEclipseCaseNewGroupFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
@ -306,8 +309,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
}
|
||||
else if(dynamic_cast<RimSummaryCurveFilter*>(uiItem))
|
||||
{
|
||||
@ -317,8 +318,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCase*>(uiItem))
|
||||
{
|
||||
@ -371,6 +370,14 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicAddStoredWellAllocationPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowDiagSolution*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPathFracture*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewWellPathFractureFeature";
|
||||
@ -418,7 +425,11 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
// is aware of multiple selected items, move the command to this list
|
||||
// without using dyncamic_cast.
|
||||
|
||||
commandIds << "RicPasteTimeHistoryCurveFeature";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
|
||||
commandIds << "RicShowPlotDataFeature";
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
|
||||
// Work in progress -- End
|
||||
|
||||
@ -435,12 +446,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicExecuteScriptForCasesFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCurve*>(uiItem) ||
|
||||
dynamic_cast<RimSummaryCurveFilter*>(uiItem) )
|
||||
{
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAsciiExportSummaryPlotFeature";
|
||||
@ -534,15 +539,29 @@ void RimContextCommandBuilder::appendCommandsToMenu(const QStringList& commandId
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
for (int i = 0; i < commandIds.size(); i++)
|
||||
{
|
||||
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
||||
CVF_ASSERT(feature);
|
||||
|
||||
if (feature->canFeatureBeExecuted())
|
||||
if (commandIds[i] == "Separator")
|
||||
{
|
||||
QAction* act = commandManager->action(commandIds[i]);
|
||||
CVF_ASSERT(act);
|
||||
menu->addSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
||||
CVF_ASSERT(feature);
|
||||
|
||||
menu->addAction(act);
|
||||
if (feature->canFeatureBeExecuted())
|
||||
{
|
||||
QAction* act = commandManager->action(commandIds[i]);
|
||||
CVF_ASSERT(act);
|
||||
|
||||
for (QAction* existingAct : menu->actions())
|
||||
{
|
||||
// If action exist, continue to make sure the action is positioned at the first
|
||||
// location of a command ID
|
||||
if (existingAct == act) continue;
|
||||
}
|
||||
|
||||
menu->addAction(act);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ QStringList RimEclipseCase::timeStepStrings()
|
||||
{
|
||||
QStringList stringList;
|
||||
|
||||
int timeStepCount = static_cast<int>(results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepCount(0));
|
||||
int timeStepCount = static_cast<int>(results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->maxTimeStepCount());
|
||||
for (int i = 0; i < timeStepCount; i++)
|
||||
{
|
||||
stringList += this->timeStepName(i);
|
||||
@ -576,29 +576,37 @@ QStringList RimEclipseCase::timeStepStrings()
|
||||
|
||||
QString RimEclipseCase::timeStepName(int frameIdx)
|
||||
{
|
||||
std::vector<QDateTime> timeStepDates = this->timeStepDates();
|
||||
CVF_ASSERT(frameIdx < timeStepDates.size());
|
||||
|
||||
if (m_timeStepFormatString.isEmpty())
|
||||
{
|
||||
std::vector<QDateTime> timeStepDates = results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0);
|
||||
|
||||
bool hasHrsAndMinutesInTimesteps = false;
|
||||
bool hasHoursAndMinutesInTimesteps = false;
|
||||
for (size_t i = 0; i < timeStepDates.size(); i++)
|
||||
{
|
||||
if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0)
|
||||
{
|
||||
hasHrsAndMinutesInTimesteps = true;
|
||||
hasHoursAndMinutesInTimesteps = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_timeStepFormatString = "dd.MMM yyyy";
|
||||
if (hasHrsAndMinutesInTimesteps)
|
||||
if (hasHoursAndMinutesInTimesteps)
|
||||
{
|
||||
m_timeStepFormatString += " - hh:mm";
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime date = timeStepDates.at(frameIdx);
|
||||
|
||||
QDateTime date = results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDate(0,frameIdx);
|
||||
return date.toString(m_timeStepFormatString);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QDateTime> RimEclipseCase::timeStepDates()
|
||||
{
|
||||
return results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates();
|
||||
}
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
virtual std::vector<RimView*> views();
|
||||
virtual QStringList timeStepStrings();
|
||||
virtual QString timeStepName(int frameIdx);
|
||||
std::vector<QDateTime> timeStepDates();
|
||||
|
||||
|
||||
virtual cvf::BoundingBox activeCellsBoundingBox() const;
|
||||
virtual cvf::BoundingBox allCellsBoundingBox() const;
|
||||
|
@ -194,7 +194,7 @@ void RimEclipseCellColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOr
|
||||
uiTreeOrdering.add(m_legendConfigPtrField());
|
||||
}
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -241,6 +241,33 @@ RimEclipseView* RimEclipseCellColors::reservoirView()
|
||||
return m_reservoirView;
|
||||
}
|
||||
|
||||
bool operator<(const cvf::Color3ub first, const cvf::Color3ub second)
|
||||
{
|
||||
if (first.r() != second.r()) return first.r() < second.r();
|
||||
if (first.g() != second.g()) return first.g() < second.g();
|
||||
if (first.b() != second.b()) return first.b() < second.b();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class TupleCompare
|
||||
{
|
||||
public :
|
||||
bool operator() (const std::tuple<QString, int, cvf::Color3ub>& t1, const std::tuple<QString, int, cvf::Color3ub>& t2) const
|
||||
{
|
||||
using namespace std;
|
||||
if (get<0>(t1) != get<0>(t2)) return get<0>(t1) < get<0>(t2);
|
||||
if (get<1>(t1) != get<1>(t2)) return get<1>(t1) < get<1>(t2);
|
||||
if (get<2>(t1) != get<2>(t2)) return get<2>(t1) < get<2>(t2);
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -282,32 +309,28 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
|
||||
if (this->hasCategoryResult())
|
||||
{
|
||||
std::vector<std::tuple<QString, int, cvf::Color3ub>> categories;
|
||||
std::set<std::tuple<QString, int, cvf::Color3ub>, TupleCompare > categories;
|
||||
//std::set<std::tuple<QString, int, cvf::Color3ub> > categories;
|
||||
|
||||
std::vector<QString> tracerNames = this->flowDiagSolution()->tracerNames();
|
||||
|
||||
// Loop through the wells to get same ordering as the wells in tree view
|
||||
for (size_t i = 0; i < m_reservoirView->wellCollection()->wells().size(); i++)
|
||||
int tracerIndex = 0;
|
||||
for (const auto& tracerName : tracerNames)
|
||||
{
|
||||
size_t reverseIndex = m_reservoirView->wellCollection()->wells().size() - i - 1;
|
||||
RimEclipseWell* well = m_reservoirView->wellCollection()->findWell(RimFlowDiagSolution::removeCrossFlowEnding(tracerName));
|
||||
cvf::Color3ub color(cvf::Color3::GRAY);
|
||||
if (well) color = cvf::Color3ub(well->wellPipeColor());
|
||||
|
||||
RimEclipseWell* well = m_reservoirView->wellCollection()->wells()[reverseIndex];
|
||||
QString wellName = well->name();
|
||||
|
||||
auto tracer = std::find(begin(tracerNames), end(tracerNames), wellName);
|
||||
if (tracer != end(tracerNames))
|
||||
{
|
||||
// The category value is defined as the index of the tracer name in the tracer name vector
|
||||
size_t categoryValue = std::distance(begin(tracerNames), tracer);
|
||||
|
||||
cvf::Color3ub color(cvf::Color3::SEA_GREEN);
|
||||
color = cvf::Color3ub(well->wellPipeColor());
|
||||
|
||||
categories.push_back(std::make_tuple(wellName, static_cast<int>(categoryValue), color));
|
||||
}
|
||||
categories.insert(std::make_tuple(tracerName, tracerIndex, color));
|
||||
++tracerIndex;
|
||||
}
|
||||
|
||||
this->legendConfig()->setCategoryItems(categories);
|
||||
std::vector<std::tuple<QString, int, cvf::Color3ub>> reverseCategories;
|
||||
for (auto tupIt = categories.rbegin(); tupIt != categories.rend(); ++tupIt)
|
||||
{
|
||||
reverseCategories.push_back(*tupIt);
|
||||
}
|
||||
|
||||
this->legendConfig()->setCategoryItems(reverseCategories);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -111,7 +111,7 @@ caf::PdmFieldHandle* RimEclipseFaultColors::objectToggleField()
|
||||
void RimEclipseFaultColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
m_customFaultResultColors->defineUiOrdering(uiConfigName, *group1);
|
||||
m_customFaultResultColors->uiOrdering(uiConfigName, *group1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -184,7 +184,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
|
||||
// Fields declared in RimResultDefinition
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
resultDefinition->defineUiOrdering(uiConfigName, *group1);
|
||||
resultDefinition->uiOrdering(uiConfigName, *group1);
|
||||
|
||||
// Fields declared in RimCellFilter
|
||||
uiOrdering.add(&filterMode);
|
||||
@ -206,7 +206,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
uiOrdering.add(&m_upperBound);
|
||||
}
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
|
||||
updateReadOnlyStateOfAllFields();
|
||||
updateRangeLabel();
|
||||
@ -279,6 +279,30 @@ bool RimEclipsePropertyFilter::isPropertyFilterControlled()
|
||||
return isPropertyFilterControlled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::setCategoriesFromTracerNames(const std::vector<QString>& tracerNames)
|
||||
{
|
||||
std::vector<std::pair<QString, int>> tracerNameValuesSorted;
|
||||
|
||||
{
|
||||
std::set<std::pair<QString, int>> tracerNameSet;
|
||||
|
||||
for (size_t i = 0; i < tracerNames.size(); i++)
|
||||
{
|
||||
tracerNameSet.insert(std::make_pair(tracerNames[i], static_cast<int>(i)));
|
||||
}
|
||||
|
||||
for (auto it : tracerNameSet)
|
||||
{
|
||||
tracerNameValuesSorted.push_back(it);
|
||||
}
|
||||
}
|
||||
|
||||
setCategoryNamesAndValues(tracerNameValuesSorted);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -337,7 +361,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
||||
|
||||
if ( resultDefinition->hasCategoryResult() )
|
||||
{
|
||||
setCategoryNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
setCategoriesFromTracerNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -423,7 +447,7 @@ void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
|
||||
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
{
|
||||
setCategoryNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
setCategoriesFromTracerNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ private:
|
||||
void updateReadOnlyStateOfAllFields();
|
||||
void updateRangeLabel();
|
||||
bool isPropertyFilterControlled();
|
||||
void setCategoriesFromTracerNames(const std::vector<QString>& tracerNames);
|
||||
|
||||
RimEclipsePropertyFilterCollection* parentContainer();
|
||||
|
||||
|
@ -170,15 +170,12 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
|
||||
CVF_ASSERT(mainEclipseCase && mainEclipseCase->mainGrid());
|
||||
eclipseCase->setMainGrid(mainEclipseCase->mainGrid());
|
||||
|
||||
size_t scalarIndexWithMaxTimeStepCount = cvf::UNDEFINED_SIZE_T;
|
||||
mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount);
|
||||
if (scalarIndexWithMaxTimeStepCount == cvf::UNDEFINED_SIZE_T)
|
||||
std::vector<QDateTime> timeStepDates = mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->timeStepDates();
|
||||
if (timeStepDates.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<QDateTime> timeStepDates = mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->timeStepDates(scalarIndexWithMaxTimeStepCount);
|
||||
|
||||
cvf::ref<RifReaderEclipseOutput> readerEclipseOutput = new RifReaderEclipseOutput;
|
||||
if (!readerEclipseOutput->openAndReadActiveCellData(caseFileName(), timeStepDates, eclipseCase.p()))
|
||||
{
|
||||
|
@ -33,10 +33,10 @@
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimView.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
|
||||
@ -105,6 +105,8 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
|
||||
m_selectedTracersUiField.xmlCapability()->setIOReadable(false);
|
||||
m_selectedTracersUiField.xmlCapability()->setIOWritable(false);
|
||||
m_selectedTracersUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiFieldFilter, "SelectedTracersFilter", "Filter", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -202,10 +204,56 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
if ( &m_selectedTracersUiField == changedField )
|
||||
{
|
||||
m_flowSolution = m_flowSolutionUiField();
|
||||
m_selectedTracers = m_selectedTracersUiField();
|
||||
|
||||
if (m_selectedTracersUiFieldFilter().isEmpty())
|
||||
{
|
||||
m_selectedTracers = m_selectedTracersUiField();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto filteredTracerNames = tracerNamesMatchingFilter();
|
||||
|
||||
// Keep selected strings not part of currently visible selection items
|
||||
std::vector<QString> newSelection;
|
||||
for (auto selectedTracer : m_selectedTracers())
|
||||
{
|
||||
if (std::find(begin(filteredTracerNames), end(filteredTracerNames), selectedTracer) == end(filteredTracerNames))
|
||||
{
|
||||
newSelection.push_back(selectedTracer);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto selectedTracerUi : m_selectedTracersUiField())
|
||||
{
|
||||
newSelection.push_back(selectedTracerUi);
|
||||
}
|
||||
|
||||
m_selectedTracers = newSelection;
|
||||
}
|
||||
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
if (&m_selectedTracersUiFieldFilter == changedField)
|
||||
{
|
||||
auto visibleTracerNames = tracerNamesMatchingFilter();
|
||||
|
||||
std::vector<QString> subSelection;
|
||||
|
||||
// Remove hidden items from selection
|
||||
for (auto selectedTracer : m_selectedTracers())
|
||||
{
|
||||
if (std::find(begin(visibleTracerNames), end(visibleTracerNames), selectedTracer) != end(visibleTracerNames))
|
||||
{
|
||||
subSelection.push_back(selectedTracer);
|
||||
}
|
||||
}
|
||||
|
||||
m_selectedTracersUiField = subSelection;
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
updateAnyFieldHasChanged();
|
||||
}
|
||||
|
||||
@ -242,7 +290,7 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged()
|
||||
cellColors->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimWellLogCurve* curve = nullptr;
|
||||
RimPlotCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
if (curve)
|
||||
{
|
||||
@ -339,7 +387,7 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
RimWellLogCurve* curve = nullptr;
|
||||
RimPlotCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
if (curve)
|
||||
{
|
||||
@ -347,6 +395,19 @@ void RimEclipseResultDefinition::loadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
bool isStringMatch(const QString& filterString, const QString& value)
|
||||
{
|
||||
if (filterString.isEmpty()) return true;
|
||||
if (filterString.trimmed() == "*")
|
||||
{
|
||||
if (!value.isEmpty()) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
QRegExp searcher(filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix);
|
||||
return searcher.exactMatch(value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -356,7 +417,6 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
|
||||
if ( fieldNeedingOptions == &m_resultTypeUiField )
|
||||
{
|
||||
|
||||
bool hasFlowDiagFluxes = false;
|
||||
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
|
||||
if ( eclResCase && eclResCase->eclipseCaseData() )
|
||||
@ -389,7 +449,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_resultVariableUiField )
|
||||
{
|
||||
options = calcOptionsForVariableUiFieldStandard();
|
||||
options = calcOptionsForVariableUiFieldStandard();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -419,7 +479,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
RimFlowDiagSolution* flowSol = m_flowSolutionUiField();
|
||||
if (flowSol)
|
||||
{
|
||||
std::vector<QString> tracerNames = flowSol->tracerNames();
|
||||
std::vector<QString> tracerNames = tracerNamesMatchingFilter();
|
||||
std::map<QString, QString> prefixedTracerNamesMap;
|
||||
for ( const QString& tracerName : tracerNames )
|
||||
{
|
||||
@ -521,7 +581,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
|
||||
|
||||
// Remove Per Cell Face options
|
||||
{
|
||||
RimWellLogCurve* curve = nullptr;
|
||||
RimPlotCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
|
||||
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||
@ -935,6 +995,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
|
||||
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)
|
||||
{
|
||||
uiOrdering.add(&m_selectedTracersUiFieldFilter);
|
||||
uiOrdering.add(&m_selectedTracersUiField);
|
||||
}
|
||||
|
||||
@ -945,7 +1006,23 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
}
|
||||
uiOrdering.add(&m_resultVariableUiField);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (m_resultTypeUiField() == RimDefines::FLOW_DIAGNOSTICS
|
||||
&& field == &m_resultVariableUiField)
|
||||
{
|
||||
caf::PdmUiListEditorAttribute* listEditAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute);
|
||||
if (listEditAttr)
|
||||
{
|
||||
listEditAttr->m_heightHint = 50;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -973,3 +1050,33 @@ void RimEclipseResultDefinition::removePerCellFaceOptionItems(QList<caf::PdmOpti
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimEclipseResultDefinition::tracerNamesMatchingFilter() const
|
||||
{
|
||||
std::vector<QString> matchingNames;
|
||||
|
||||
RimFlowDiagSolution* flowSol = m_flowSolutionUiField();
|
||||
if (flowSol)
|
||||
{
|
||||
std::vector<QString> tracerNames = flowSol->tracerNames();
|
||||
if (m_selectedTracersUiFieldFilter().isEmpty())
|
||||
{
|
||||
matchingNames = tracerNames;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const QString& tracerName : tracerNames)
|
||||
{
|
||||
if (isStringMatch(m_selectedTracersUiFieldFilter, tracerName))
|
||||
{
|
||||
matchingNames.push_back(tracerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return matchingNames;
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,7 @@ public:
|
||||
|
||||
void setTofAndSelectTracer(const QString& tracerName);
|
||||
|
||||
|
||||
protected:
|
||||
virtual void updateLegendCategorySettings() {};
|
||||
|
||||
@ -100,6 +101,7 @@ protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void initAfterRead();
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||
|
||||
protected:
|
||||
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > m_resultType;
|
||||
@ -121,6 +123,8 @@ protected:
|
||||
|
||||
caf::PdmField< caf::AppEnum< FlowTracerSelectionType > > m_flowTracerSelectionMode;
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField;
|
||||
|
||||
caf::PdmField<QString> m_selectedTracersUiFieldFilter;
|
||||
caf::PdmField<std::vector<QString> > m_selectedTracersUiField;
|
||||
|
||||
|
||||
@ -135,5 +139,7 @@ private:
|
||||
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
|
||||
QStringList getResultNamesForCurrentUiResultType();
|
||||
static void removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems);
|
||||
|
||||
std::vector<QString> tracerNamesMatchingFilter() const;
|
||||
};
|
||||
|
||||
|
111
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.cpp
Normal file
111
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimEclipseTopologyItem.h"
|
||||
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseTopologyItem, "RimEclipseTopologyItem");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseTopologyItem::RimEclipseTopologyItem()
|
||||
{
|
||||
CAF_PDM_InitObject("Eclipse Topoloty Item", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridIndex, "m_gridIndex", "m_gridIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_cellIndex, "m_cellIndex", "m_cellIndex", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_localIntersectionPoint, "m_localIntersectionPoint", "m_localIntersectionPoint", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseTopologyItem::~RimEclipseTopologyItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseTopologyItem::setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem)
|
||||
{
|
||||
m_gridIndex = selectionItem->m_gridIndex;
|
||||
m_cellIndex = selectionItem->m_cellIndex;
|
||||
m_localIntersectionPoint = selectionItem->m_localIntersectionPoint;
|
||||
|
||||
m_eclipseCase = selectionItem->m_view->eclipseCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseTopologyItem::topologyText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
if (m_eclipseCase)
|
||||
{
|
||||
text += m_eclipseCase->caseUserDescription();
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "No case";
|
||||
}
|
||||
|
||||
text += ", ";
|
||||
text += QString("Grid index %1").arg(m_gridIndex);
|
||||
text += ", ";
|
||||
text += RigTimeHistoryResultAccessor::topologyText(m_eclipseCase->eclipseCaseData(), m_gridIndex, m_cellIndex);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimEclipseTopologyItem::eclipseCase() const
|
||||
{
|
||||
return m_eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseTopologyItem::gridIndex() const
|
||||
{
|
||||
return m_gridIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseTopologyItem::cellIndex() const
|
||||
{
|
||||
return m_cellIndex;
|
||||
}
|
56
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.h
Normal file
56
ApplicationCode/ProjectDataModel/RimEclipseTopologyItem.h
Normal file
@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimPickingTopologyItem.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimEclipseCase;
|
||||
class RiuEclipseSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEclipseTopologyItem : public RimPickingTopologyItem
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimEclipseTopologyItem();
|
||||
virtual ~RimEclipseTopologyItem() override;
|
||||
|
||||
void setFromSelectionItem(const RiuEclipseSelectionItem* selectionItem);
|
||||
|
||||
virtual QString topologyText() const override;
|
||||
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
size_t gridIndex() const;
|
||||
size_t cellIndex() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
|
||||
caf::PdmField<size_t> m_gridIndex;
|
||||
caf::PdmField<size_t> m_cellIndex;
|
||||
caf::PdmField<cvf::Vec3d> m_localIntersectionPoint;
|
||||
};
|
||||
|
@ -1373,7 +1373,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
uiTreeOrdering.add(m_rangeFilterCollection());
|
||||
uiTreeOrdering.add(m_propertyFilterCollection());
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -186,7 +186,6 @@ void RimEclipseWell::wellHeadTopBottomPosition(size_t frameIndex, cvf::Vec3d* to
|
||||
|
||||
const RigWellResultFrame& wellResultFrame = this->wellResults()->wellResultFrame(frameIndex);
|
||||
const RigCell& whCell = rigReservoir->cellFromWellResultCell(wellResultFrame.m_wellHead);
|
||||
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
|
||||
|
||||
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()
|
||||
|
||||
@ -365,7 +364,7 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -377,7 +376,7 @@ void RimEclipseWell::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
{
|
||||
uiTreeOrdering.add(fracture);
|
||||
}
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
|
||||
const RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
|
@ -475,15 +475,19 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
void RimEclipseWellCollection::assignDefaultWellColors()
|
||||
{
|
||||
const caf::ColorTable& colorTable = RiaColorTables::wellsPaletteColors();
|
||||
cvf::Color3ubArray catColors = colorTable.color3ubArray();
|
||||
cvf::Color3ubArray interpolatedCatColors = caf::ColorTable::interpolateColorArray(catColors, wells.size());
|
||||
cvf::Color3ubArray wellColors = colorTable.color3ubArray();
|
||||
cvf::Color3ubArray interpolatedWellColors = wellColors;
|
||||
if (wells.size() > 1)
|
||||
{
|
||||
interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wells.size());
|
||||
}
|
||||
|
||||
for (size_t wIdx = 0; wIdx < wells.size(); ++wIdx)
|
||||
{
|
||||
RimEclipseWell* well = wells[wIdx];
|
||||
if (well)
|
||||
{
|
||||
cvf::Color3f col = cvf::Color3f(interpolatedCatColors[wIdx]);
|
||||
cvf::Color3f col = cvf::Color3f(interpolatedWellColors[wIdx]);
|
||||
|
||||
well->wellPipeColor = col;
|
||||
well->updateConnectedEditors();
|
||||
|
@ -225,6 +225,6 @@ void RimEllipseFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
propertyGroup->add(&perforationLength);
|
||||
|
||||
uiOrdering.add(&fractureTemplateUnit);
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
uiOrdering.add(&name);
|
||||
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
resultDefinition->defineUiOrdering(uiConfigName, *group1);
|
||||
resultDefinition->uiOrdering(uiConfigName, *group1);
|
||||
|
||||
uiOrdering.add(&isActive);
|
||||
uiOrdering.add(&filterMode);
|
||||
@ -150,7 +150,7 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
|
||||
updateReadOnlyStateOfAllFields();
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
|
||||
@ -119,7 +119,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
if (m_isTimeLapseResultUiField())
|
||||
timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -206,12 +206,11 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
|
||||
// Get the possible property filter owner
|
||||
RimGeoMechPropertyFilter* propFilter = dynamic_cast<RimGeoMechPropertyFilter*>(this->parentField()->ownerObject());
|
||||
RimView* view = NULL;
|
||||
RimView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType(view);
|
||||
RimWellLogCurve* curve = NULL;
|
||||
RimPlotCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
|
||||
|
||||
if (&m_resultVariableUiField == changedField)
|
||||
{
|
||||
QStringList fieldComponentNames = m_resultVariableUiField().split(QRegExp("\\s+"));
|
||||
|
@ -63,8 +63,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void updateLegendCategorySettings() {};
|
||||
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
|
||||
@ -72,7 +71,6 @@ private:
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool * useOptionsOnly);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue);
|
||||
|
@ -641,7 +641,7 @@ void RimGeoMechView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
uiTreeOrdering.add(m_rangeFilterCollection());
|
||||
uiTreeOrdering.add(m_propertyFilterCollection());
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
601
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp
Normal file
601
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp
Normal file
@ -0,0 +1,601 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimGridTimeHistoryCurve.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseTopologyItem.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechTopologyItem.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RiuFemTimeHistoryResultAccessor.h"
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGridTimeHistoryCurve, "TimeHistoryCurve");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridTimeHistoryCurve::RimGridTimeHistoryCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("Grid Time History Curve", ":/SummaryCurve16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_topologyText, "TopologyText", "Topology Reference", "", "", "");
|
||||
m_topologyText.registerGetMethod(this, &RimGridTimeHistoryCurve::topologyText);
|
||||
m_topologyText.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "EclipseResultDefinition", "Eclipse Result definition", "", "", "");
|
||||
m_eclipseResultDefinition.uiCapability()->setUiHidden(true);
|
||||
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_geoMechResultDefinition, "GeoMechResultDefinition", "GeoMech Result definition", "", "", "");
|
||||
m_geoMechResultDefinition.uiCapability()->setUiHidden(true);
|
||||
m_geoMechResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_pickingTopologyItem, "PickingTopologyItem", "Picking Topology Item", "", "", "");
|
||||
m_pickingTopologyItem.uiCapability()->setUiTreeHidden(true);
|
||||
m_pickingTopologyItem.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_plotAxis, "PlotAxis", caf::AppEnum< RimDefines::PlotAxis >(RimDefines::PLOT_AXIS_LEFT), "Axis", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridTimeHistoryCurve::~RimGridTimeHistoryCurve()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::setFromSelectionItem(const RiuSelectionItem* selectionItem)
|
||||
{
|
||||
if (m_pickingTopologyItem())
|
||||
{
|
||||
delete m_pickingTopologyItem();
|
||||
}
|
||||
|
||||
if (m_eclipseResultDefinition())
|
||||
{
|
||||
delete m_eclipseResultDefinition();
|
||||
}
|
||||
|
||||
if (m_geoMechResultDefinition())
|
||||
{
|
||||
delete m_geoMechResultDefinition();
|
||||
}
|
||||
|
||||
const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast<const RiuEclipseSelectionItem*>(selectionItem);
|
||||
if (eclSelectionItem)
|
||||
{
|
||||
RimEclipseTopologyItem* topologyItem = new RimEclipseTopologyItem;
|
||||
m_pickingTopologyItem = topologyItem;
|
||||
|
||||
topologyItem->setFromSelectionItem(eclSelectionItem);
|
||||
|
||||
if (eclSelectionItem->m_view)
|
||||
{
|
||||
m_eclipseResultDefinition = new RimEclipseResultDefinition;
|
||||
m_eclipseResultDefinition->simpleCopy(eclSelectionItem->m_view->cellResult());
|
||||
}
|
||||
}
|
||||
|
||||
const RiuGeoMechSelectionItem* geoMechSelectionItem = dynamic_cast<const RiuGeoMechSelectionItem*>(selectionItem);
|
||||
if (geoMechSelectionItem)
|
||||
{
|
||||
RimGeoMechTopologyItem* topologyItem = new RimGeoMechTopologyItem;
|
||||
m_pickingTopologyItem = topologyItem;
|
||||
|
||||
topologyItem->setFromSelectionItem(geoMechSelectionItem);
|
||||
|
||||
if (geoMechSelectionItem->m_view)
|
||||
{
|
||||
m_geoMechResultDefinition = new RimGeoMechResultDefinition;
|
||||
m_geoMechResultDefinition->setGeoMechCase(geoMechSelectionItem->m_view->geoMechCase());
|
||||
m_geoMechResultDefinition->setResultAddress(geoMechSelectionItem->m_view->cellResultResultDefinition()->resultAddress());
|
||||
}
|
||||
}
|
||||
|
||||
updateResultDefinitionFromCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDefines::PlotAxis RimGridTimeHistoryCurve::yAxis() const
|
||||
{
|
||||
return m_plotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::setYAxis(RimDefines::PlotAxis plotAxis)
|
||||
{
|
||||
m_plotAxis = plotAxis;
|
||||
|
||||
updateQwtPlotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimGridTimeHistoryCurve::yValues() const
|
||||
{
|
||||
std::vector<double> values;
|
||||
|
||||
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
|
||||
if (eclTopItem && eclTopItem->eclipseCase())
|
||||
{
|
||||
size_t cellIndex = eclTopItem->cellIndex();
|
||||
size_t gridIndex = eclTopItem->gridIndex();
|
||||
|
||||
CVF_ASSERT(m_eclipseResultDefinition());
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
|
||||
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
|
||||
|
||||
std::vector<QDateTime> timeStepDates = cellResultsData->timeStepDates();
|
||||
|
||||
values = RigTimeHistoryResultAccessor::timeHistoryValues(eclTopItem->eclipseCase()->eclipseCaseData(), m_eclipseResultDefinition(), gridIndex, cellIndex, timeStepDates.size());
|
||||
}
|
||||
|
||||
if (geoMechTopologyItem() && geoMechTopologyItem()->geoMechCase())
|
||||
{
|
||||
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
|
||||
|
||||
if (timeHistResultAccessor)
|
||||
{
|
||||
values = timeHistResultAccessor->timeHistoryValues();
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridTimeHistoryCurve::quantityName() const
|
||||
{
|
||||
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
|
||||
if (eclTopItem)
|
||||
{
|
||||
CVF_ASSERT(m_eclipseResultDefinition());
|
||||
|
||||
return m_eclipseResultDefinition->resultVariableUiName();
|
||||
}
|
||||
|
||||
if (geoMechTopologyItem())
|
||||
{
|
||||
CVF_ASSERT(m_geoMechResultDefinition());
|
||||
|
||||
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
|
||||
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
|
||||
|
||||
QString text;
|
||||
|
||||
caf::AppEnum<RigFemResultPosEnum> resPosAppEnum = m_geoMechResultDefinition()->resultPositionType();
|
||||
text.append(resPosAppEnum.uiText() + ", ");
|
||||
text.append(m_geoMechResultDefinition()->resultFieldUiName() + ", ");
|
||||
text.append(m_geoMechResultDefinition()->resultComponentUiName() + " ");
|
||||
|
||||
if (resPosAppEnum == RIG_ELEMENT_NODAL_FACE)
|
||||
{
|
||||
if (geoMechTopItem->m_elementFace >= 0)
|
||||
{
|
||||
text.append(", " + caf::AppEnum<cvf::StructGridInterface::FaceType>::textFromIndex(geoMechTopItem->m_elementFace));
|
||||
}
|
||||
else
|
||||
{
|
||||
text.append(", from N[" + QString::number(timeHistResultAccessor->closestNodeId()) + "] transformed onto intersection");
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridTimeHistoryCurve::caseName() const
|
||||
{
|
||||
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
|
||||
if (eclTopItem && eclTopItem->eclipseCase())
|
||||
{
|
||||
return eclTopItem->eclipseCase()->caseUserDescription();
|
||||
}
|
||||
|
||||
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
|
||||
if (geoMechTopItem && geoMechTopItem->geoMechCase())
|
||||
{
|
||||
return geoMechTopItem->geoMechCase()->caseUserDescription();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridTimeHistoryCurve::createCurveAutoName()
|
||||
{
|
||||
QString text;
|
||||
|
||||
text += quantityName();
|
||||
|
||||
QString topoText = topologyText();
|
||||
|
||||
if (!topoText.isEmpty())
|
||||
{
|
||||
text += ", ";
|
||||
text += topoText;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::updateZoomInParentPlot()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::onLoadDataAndUpdate()
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation();
|
||||
|
||||
if (isCurveVisible())
|
||||
{
|
||||
std::vector<time_t> dateTimes;
|
||||
std::vector<double> values;
|
||||
|
||||
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
|
||||
if (eclTopItem && eclTopItem->eclipseCase())
|
||||
{
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
}
|
||||
|
||||
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
|
||||
if (geoMechTopItem && geoMechTopItem->geoMechCase())
|
||||
{
|
||||
m_geoMechResultDefinition->loadResult();
|
||||
}
|
||||
|
||||
dateTimes = timeStepValues();
|
||||
values = yValues();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis());
|
||||
|
||||
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
|
||||
{
|
||||
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve);
|
||||
}
|
||||
else
|
||||
{
|
||||
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();
|
||||
|
||||
std::vector<double> times;
|
||||
if (dateTimes.size())
|
||||
{
|
||||
time_t startDate = dateTimes[0];
|
||||
for (time_t& date : dateTimes)
|
||||
{
|
||||
times.push_back(timeScale*(date - startDate));
|
||||
}
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
|
||||
}
|
||||
|
||||
updateZoomInParentPlot();
|
||||
|
||||
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||
|
||||
updateQwtPlotAxis();
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<time_t> RimGridTimeHistoryCurve::timeStepValues() const
|
||||
{
|
||||
std::vector<time_t> dateTimes;
|
||||
|
||||
RimEclipseTopologyItem* eclTopItem = eclipseTopologyItem();
|
||||
if (eclTopItem && eclTopItem->eclipseCase())
|
||||
{
|
||||
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
|
||||
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
|
||||
|
||||
std::vector<QDateTime> timeStepDates = cellResultsData->timeStepDates();
|
||||
|
||||
for (QDateTime dt : timeStepDates)
|
||||
{
|
||||
dateTimes.push_back(dt.toTime_t());
|
||||
}
|
||||
}
|
||||
|
||||
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
|
||||
if (geoMechTopItem && geoMechTopItem->geoMechCase())
|
||||
{
|
||||
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
|
||||
if (timeHistResultAccessor)
|
||||
{
|
||||
std::vector<double> values = timeHistResultAccessor->timeHistoryValues();
|
||||
|
||||
QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings();
|
||||
std::vector<QDateTime> dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames);
|
||||
if (dates.size() == values.size())
|
||||
{
|
||||
for (QDateTime dt : dates)
|
||||
{
|
||||
dateTimes.push_back(dt.toTime_t());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
dateTimes.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dateTimes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
|
||||
uiOrdering.add(&m_topologyText);
|
||||
|
||||
// Fields declared in RimResultDefinition
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
if (eclipseTopologyItem())
|
||||
{
|
||||
CVF_ASSERT(m_eclipseResultDefinition());
|
||||
m_eclipseResultDefinition->uiOrdering(uiConfigName, *group1);
|
||||
}
|
||||
|
||||
if (geoMechTopologyItem())
|
||||
{
|
||||
CVF_ASSERT(m_geoMechResultDefinition());
|
||||
m_geoMechResultDefinition->uiOrdering(uiConfigName, *group1);
|
||||
}
|
||||
|
||||
uiOrdering.add(&m_plotAxis);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::initAfterRead()
|
||||
{
|
||||
updateResultDefinitionFromCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_plotAxis)
|
||||
{
|
||||
updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted(plot);
|
||||
|
||||
plot->updateAxes();
|
||||
}
|
||||
else
|
||||
{
|
||||
RimPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RimGridTimeHistoryCurve::mainGrid()
|
||||
{
|
||||
if (eclipseTopologyItem() && eclipseTopologyItem()->eclipseCase() && eclipseTopologyItem()->eclipseCase()->eclipseCaseData())
|
||||
{
|
||||
return eclipseTopologyItem()->eclipseCase()->eclipseCaseData()->mainGrid();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseTopologyItem* RimGridTimeHistoryCurve::eclipseTopologyItem() const
|
||||
{
|
||||
RimPickingTopologyItem* pickItem = m_pickingTopologyItem();
|
||||
|
||||
return dynamic_cast<RimEclipseTopologyItem*>(pickItem);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechTopologyItem* RimGridTimeHistoryCurve::geoMechTopologyItem() const
|
||||
{
|
||||
RimPickingTopologyItem* pickItem = m_pickingTopologyItem();
|
||||
|
||||
return dynamic_cast<RimGeoMechTopologyItem*>(pickItem);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::updateResultDefinitionFromCase()
|
||||
{
|
||||
if (eclipseTopologyItem())
|
||||
{
|
||||
CVF_ASSERT(m_eclipseResultDefinition());
|
||||
|
||||
m_eclipseResultDefinition->setEclipseCase(eclipseTopologyItem()->eclipseCase());
|
||||
}
|
||||
|
||||
if (geoMechTopologyItem())
|
||||
{
|
||||
CVF_ASSERT(m_geoMechResultDefinition());
|
||||
|
||||
m_geoMechResultDefinition->setGeoMechCase(geoMechTopologyItem()->geoMechCase());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridTimeHistoryCurve::topologyText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
if (eclipseTopologyItem() && m_pickingTopologyItem())
|
||||
{
|
||||
text = m_pickingTopologyItem->topologyText();
|
||||
}
|
||||
else if (geoMechTopologyItem())
|
||||
{
|
||||
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
|
||||
if (timeHistResultAccessor)
|
||||
{
|
||||
text = timeHistResultAccessor->topologyText();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "No topology";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridTimeHistoryCurve::updateQwtPlotAxis()
|
||||
{
|
||||
if (m_qwtPlotCurve)
|
||||
{
|
||||
if (this->yAxis() == RimDefines::PLOT_AXIS_LEFT)
|
||||
{
|
||||
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setYAxis(QwtPlot::yRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<RiuFemTimeHistoryResultAccessor> RimGridTimeHistoryCurve::femTimeHistoryResultAccessor() const
|
||||
{
|
||||
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor;
|
||||
|
||||
if ( geoMechTopologyItem()
|
||||
&& geoMechTopologyItem()->geoMechCase()
|
||||
&& geoMechTopologyItem()->geoMechCase()->geoMechData())
|
||||
{
|
||||
RimGeoMechTopologyItem* geoMechTopItem = geoMechTopologyItem();
|
||||
if (geoMechTopItem->m_hasIntersectionTriangle)
|
||||
{
|
||||
std::array<cvf::Vec3f, 3> intersectionTriangle;
|
||||
intersectionTriangle[0] = cvf::Vec3f(geoMechTopItem->m_intersectionTriangle_0());
|
||||
intersectionTriangle[1] = cvf::Vec3f(geoMechTopItem->m_intersectionTriangle_1());
|
||||
intersectionTriangle[2] = cvf::Vec3f(geoMechTopItem->m_intersectionTriangle_2());
|
||||
|
||||
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
|
||||
new RiuFemTimeHistoryResultAccessor(geoMechTopItem->geoMechCase()->geoMechData(),
|
||||
m_geoMechResultDefinition()->resultAddress(),
|
||||
geoMechTopItem->m_gridIndex,
|
||||
static_cast<int>(geoMechTopItem->m_cellIndex),
|
||||
geoMechTopItem->m_elementFace,
|
||||
geoMechTopItem->m_localIntersectionPoint,
|
||||
intersectionTriangle));
|
||||
}
|
||||
else
|
||||
{
|
||||
timeHistResultAccessor = std::unique_ptr<RiuFemTimeHistoryResultAccessor>(
|
||||
new RiuFemTimeHistoryResultAccessor(geoMechTopItem->geoMechCase()->geoMechData(),
|
||||
m_geoMechResultDefinition()->resultAddress(),
|
||||
geoMechTopItem->m_gridIndex,
|
||||
static_cast<int>(geoMechTopItem->m_cellIndex),
|
||||
geoMechTopItem->m_elementFace,
|
||||
geoMechTopItem->m_localIntersectionPoint));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return timeHistResultAccessor;
|
||||
}
|
92
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h
Normal file
92
ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.h
Normal file
@ -0,0 +1,92 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimPlotCurve.h"
|
||||
|
||||
#include "RimDefines.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RigMainGrid;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultDefinition;
|
||||
class RimEclipseTopologyItem;
|
||||
class RimGeoMechResultDefinition;
|
||||
class RimGeoMechTopologyItem;
|
||||
class RimPickingTopologyItem;
|
||||
class RiuFemTimeHistoryResultAccessor;
|
||||
class RiuSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridTimeHistoryCurve : public RimPlotCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
|
||||
public:
|
||||
RimGridTimeHistoryCurve();
|
||||
virtual ~RimGridTimeHistoryCurve();
|
||||
|
||||
void setFromSelectionItem(const RiuSelectionItem* selectionItem);
|
||||
RimDefines::PlotAxis yAxis() const;
|
||||
void setYAxis(RimDefines::PlotAxis plotAxis);
|
||||
|
||||
std::vector<double> yValues() const;
|
||||
std::vector<time_t> timeStepValues() const;
|
||||
|
||||
QString quantityName() const;
|
||||
QString caseName() const;
|
||||
|
||||
protected:
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void updateZoomInParentPlot() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void initAfterRead() override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
RigMainGrid* mainGrid();
|
||||
RimEclipseTopologyItem* eclipseTopologyItem() const;
|
||||
RimGeoMechTopologyItem* geoMechTopologyItem() const;
|
||||
void updateResultDefinitionFromCase();
|
||||
QString topologyText() const;
|
||||
void updateQwtPlotAxis();
|
||||
|
||||
std::unique_ptr<RiuFemTimeHistoryResultAccessor> femTimeHistoryResultAccessor() const;
|
||||
|
||||
private:
|
||||
caf::PdmProxyValueField<QString> m_topologyText;
|
||||
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
|
||||
caf::PdmChildField<RimGeoMechResultDefinition*> m_geoMechResultDefinition;
|
||||
|
||||
caf::PdmChildField<RimPickingTopologyItem*> m_pickingTopologyItem;
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PlotAxis > > m_plotAxis;
|
||||
};
|
||||
|
@ -228,7 +228,7 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
updateWellExtentDefaultValue();
|
||||
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -628,20 +628,22 @@ void RimLegendConfig::setCategoryItems(const std::vector< std::tuple<QString, in
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimLegendConfig::categoryNameFromCategoryValue(int categoryValue) const
|
||||
QString RimLegendConfig::categoryNameFromCategoryValue(double categoryResultValue) const
|
||||
{
|
||||
if (categoryResultValue == HUGE_VAL) return "Undefined";
|
||||
|
||||
if (m_categoryNames.size() > 0)
|
||||
{
|
||||
for (size_t categoryIndex = 0; categoryIndex < m_categories.size(); categoryIndex++)
|
||||
{
|
||||
if (categoryValue == m_categories[categoryIndex])
|
||||
if (categoryResultValue == m_categories[categoryIndex])
|
||||
{
|
||||
return cvfqt::Utils::toQString(m_categoryNames[categoryIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QString("%1").arg(categoryValue);
|
||||
return QString("%1").arg(categoryResultValue);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
void setIntegerCategories(const std::vector<int>& categories);
|
||||
void setNamedCategoriesInverse(const std::vector<QString>& categoryNames);
|
||||
void setCategoryItems(const std::vector<std::tuple<QString, int, cvf::Color3ub>>& categories);
|
||||
QString categoryNameFromCategoryValue(int categoryValue) const;
|
||||
QString categoryNameFromCategoryValue(double categoryResultValue) const;
|
||||
|
||||
void setTitle(const cvf::String& title);
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuProjectPropertyView.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimMainPlotCollection, "MainPlotCollection");
|
||||
|
||||
@ -52,8 +53,6 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
m_summaryPlotCollection = new RimSummaryPlotCollection();
|
||||
m_flowPlotCollection = new RimFlowPlotCollection();
|
||||
|
||||
//m_plotMainWindow = NULL;
|
||||
//m_plotManagerMainWindow = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -65,8 +64,6 @@ RimMainPlotCollection::~RimMainPlotCollection()
|
||||
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
|
||||
if (m_flowPlotCollection()) delete m_flowPlotCollection();
|
||||
|
||||
//m_plotManagerMainWindow->close();
|
||||
//m_plotManagerMainWindow->deleteLater();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -74,62 +71,9 @@ RimMainPlotCollection::~RimMainPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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->firstAncestorOrThisOfType(proj);
|
||||
|
||||
projPropView->setPdmItem(this);
|
||||
|
||||
m_plotManagerMainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||
}
|
||||
}
|
||||
|
||||
m_plotMainWindow->show();
|
||||
|
||||
m_plotManagerMainWindow->showNormal();
|
||||
m_plotManagerMainWindow->raise();
|
||||
}
|
||||
|
||||
#endif
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -173,115 +117,12 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||
}
|
||||
|
||||
#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)
|
||||
void RimMainPlotCollection::updateCurrentTimeStepInPlots()
|
||||
{
|
||||
foreach(QDockWidget* dockW, m_plotViewDockWidgets)
|
||||
{
|
||||
if (dockW && dockW->widget() == graphPlot->widget())
|
||||
{
|
||||
return dockW;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
m_flowPlotCollection()->defaultFlowCharacteristicsPlot()->updateCurrentTimeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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
|
@ -50,39 +50,18 @@ public:
|
||||
RimSummaryPlotCollection* summaryPlotCollection();
|
||||
RimFlowPlotCollection* flowPlotCollection();
|
||||
|
||||
void deleteAllContainedObjects();
|
||||
void deleteAllContainedObjects();
|
||||
void updateCurrentTimeStepInPlots();
|
||||
|
||||
#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:
|
||||
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
//virtual void initAfterRead();
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
||||
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
|
||||
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
|
||||
|
||||
caf::PdmField<bool> show;
|
||||
caf::PdmField<bool> show;
|
||||
};
|
||||
|
38
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.cpp
Normal file
38
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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 "RimPickingTopologyItem.h"
|
||||
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimPickingTopologyItem, "RimPickingTopologyItem");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPickingTopologyItem::RimPickingTopologyItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPickingTopologyItem::~RimPickingTopologyItem()
|
||||
{
|
||||
|
||||
}
|
32
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.h
Normal file
32
ApplicationCode/ProjectDataModel/RimPickingTopologyItem.h
Normal file
@ -0,0 +1,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 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"
|
||||
|
||||
class RimPickingTopologyItem : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimPickingTopologyItem();
|
||||
virtual ~RimPickingTopologyItem();
|
||||
|
||||
virtual QString topologyText() const = 0;
|
||||
};
|
||||
|
@ -137,7 +137,6 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
|
||||
m_customCurveName = createCurveAutoName();
|
||||
}
|
||||
|
||||
updateOptionSensitivity();
|
||||
updateCurveName();
|
||||
}
|
||||
|
||||
@ -241,15 +240,6 @@ bool RimPlotCurve::isCurveVisible() const
|
||||
return m_showCurve;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::initAfterRead()
|
||||
{
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -96,7 +96,6 @@ protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual void initAfterRead();
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||
|
||||
protected:
|
||||
|
@ -840,6 +840,6 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
||||
uiTreeOrdering.add(scriptCollection());
|
||||
}
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,20 @@ void RimPropertyFilter::setCategoryNames(const std::vector<QString>& categoryNam
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilter::setCategoryNamesAndValues(const std::vector<std::pair<QString, int>>& categoryNamesAndValues)
|
||||
{
|
||||
clearCategories();
|
||||
|
||||
for (auto it : categoryNamesAndValues)
|
||||
{
|
||||
m_categoryNames.push_back(it.first);
|
||||
m_categoryValues.push_back(it.second);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
protected:
|
||||
void setCategoryValues(const std::vector<int>& categoryValues);
|
||||
void setCategoryNames(const std::vector<QString>& categoryNames);
|
||||
void setCategoryNamesAndValues(const std::vector<std::pair<QString, int>>& categoryNamesAndValues);
|
||||
void clearCategories();
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
@ -300,7 +300,7 @@ void RimStimPlanColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrder
|
||||
uiTreeOrdering.add(activeLegend());
|
||||
}
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -311,7 +311,7 @@ void RimStimPlanColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
uiOrdering.add(&m_resultNameAndUnit);
|
||||
uiOrdering.add(&m_defaultColor);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -88,6 +88,6 @@ void RimStimPlanLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiO
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStimPlanLegendConfig::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ void RimTernaryLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
group->add(&ternaryRangeSummary);
|
||||
}
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGridCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimPropertyFilterCollection.h"
|
||||
@ -301,6 +302,10 @@ void RimView::setCurrentTimeStepAndUpdate(int frameIndex)
|
||||
setCurrentTimeStep(frameIndex);
|
||||
|
||||
this->updateCurrentTimeStep();
|
||||
|
||||
RimProject* project;
|
||||
firstAncestorOrThisOfTypeAsserted(project);
|
||||
project->mainPlotCollection()->updateCurrentTimeStepInPlots();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -324,7 +329,11 @@ void RimView::setCurrentTimeStep(int frameIndex)
|
||||
void RimView::updateCurrentTimeStepAndRedraw()
|
||||
{
|
||||
this->updateCurrentTimeStep();
|
||||
|
||||
|
||||
RimProject* project;
|
||||
firstAncestorOrThisOfTypeAsserted(project);
|
||||
project->mainPlotCollection()->updateCurrentTimeStepInPlots();
|
||||
|
||||
if (m_viewer) m_viewer->update();
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ QList<caf::PdmOptionItemInfo> RimViewController::calculateValueOptions(const caf
|
||||
void RimViewController::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
updateDisplayNameAndIcon();
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -62,7 +62,7 @@ void RimViewLinkerCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTre
|
||||
childObject->addViewControllers(uiTreeOrdering);
|
||||
}
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -160,11 +160,14 @@ void RimViewWindow::updateMdiWindowTitle()
|
||||
{
|
||||
if ( viewWidget() )
|
||||
{
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = this->userDescriptionField()->uiCapability();
|
||||
if ( uiFieldHandle )
|
||||
if ( this->userDescriptionField() )
|
||||
{
|
||||
QVariant v = uiFieldHandle->uiValue();
|
||||
viewWidget()->setWindowTitle(v.toString());
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = this->userDescriptionField()->uiCapability();
|
||||
if ( uiFieldHandle )
|
||||
{
|
||||
QVariant v = uiFieldHandle->uiValue();
|
||||
viewWidget()->setWindowTitle(v.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +95,6 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
|
||||
CAF_PDM_InitField(&m_addWellNameToCurveName, "AddWellNameToCurveName", true, " Well Name", "", "", "");
|
||||
CAF_PDM_InitField(&m_addTimestepToCurveName, "AddTimestepToCurveName", false, " Timestep", "", "", "");
|
||||
CAF_PDM_InitField(&m_addDateToCurveName, "AddDateToCurveName", true, " Date", "", "", "");
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -375,6 +373,8 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
|
||||
|
||||
curveDataGroup->add(&m_wellPath);
|
||||
@ -420,7 +420,7 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
|
||||
}
|
||||
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -442,7 +442,7 @@ void RimWellLogExtractionCurve::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -56,8 +56,6 @@ RimWellLogFileCurve::RimWellLogFileCurve()
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellLogChannnelName, "CurveWellLogChannel", "Well Log Channel", "", "", "");
|
||||
|
||||
m_wellPath = NULL;
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -171,6 +169,8 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
RimPlotCurve::updateOptionSensitivity();
|
||||
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
|
||||
curveDataGroup->add(&m_wellPath);
|
||||
curveDataGroup->add(&m_wellLogChannnelName);
|
||||
@ -190,7 +190,7 @@ void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -422,9 +422,9 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
|
||||
}
|
||||
|
||||
|
||||
for (int i = static_cast<int>( curveDepths.size()) - 1; i >= 0; i--)
|
||||
for (int i = static_cast<int>(curveDepths.size()) - 1; i >= 0; i--)
|
||||
{
|
||||
if (i == curveDepths.size() - 1)
|
||||
if (i == static_cast<int>(curveDepths.size()) - 1)
|
||||
{
|
||||
if (depthType() == CONNECTION_NUMBER) out += "Connection";
|
||||
else if (depthType() == MEASURED_DEPTH) out += "MD ";
|
||||
@ -483,7 +483,7 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
uiOrdering.add(&m_showTrackLegends);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user