mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge fixes related to #1901 Perforation COMPDAT export errors
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
@@ -484,6 +485,11 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
oilField->summaryCaseMainCollection()->createSummaryCasesFromRelevantEclipseResultCases();
|
||||
oilField->summaryCaseMainCollection()->loadAllSummaryCaseData();
|
||||
|
||||
if (!oilField->observedDataCollection())
|
||||
{
|
||||
oilField->observedDataCollection = new RimObservedDataCollection();
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
oilField->fractureDefinitionCollection()->loadAndUpdateData();
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ ${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportObservedDataInMenuFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.h
|
||||
@@ -97,6 +99,8 @@ ${CEE_CURRENT_LIST_DIR}RicReloadFormationNamesFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportObservedDataInMenuFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.cpp
|
||||
|
||||
@@ -110,9 +110,12 @@ bool RicCutReferencesToClipboardFeature::isAnyCuttableObjectSelected()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCutReferencesToClipboardFeature::isCuttingOfObjectSupported(caf::PdmObject* pdmObject)
|
||||
{
|
||||
if (dynamic_cast<RimSummaryCase*>(pdmObject))
|
||||
if (RimSummaryCase* summaryCase = dynamic_cast<RimSummaryCase*>(pdmObject))
|
||||
{
|
||||
return true;
|
||||
if (!summaryCase->isObservedData())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -77,7 +77,19 @@ bool RicCloseSummaryCaseFeature::isCommandEnabled()
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return (selection.size() > 0);
|
||||
if (selection.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (RimSummaryCase* summaryCase : selection)
|
||||
{
|
||||
if (summaryCase->isObservedData())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -35,9 +35,21 @@ CAF_CMD_SOURCE_INIT(RicCreateSummaryCaseCollectionFeature, "RicCreateSummaryCase
|
||||
bool RicCreateSummaryCaseCollectionFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return (selection.size() > 0);
|
||||
if (selection.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (RimSummaryCase* summaryCase : selection)
|
||||
{
|
||||
if (summaryCase->isObservedData())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
115
ApplicationCode/Commands/RicImportObservedDataFeature.cpp
Normal file
115
ApplicationCode/Commands/RicImportObservedDataFeature.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicImportObservedDataFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimObservedData.h"
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryObservedDataFile.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportObservedDataFeature, "RicImportObservedDataFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicImportObservedDataFeature::RicImportObservedDataFeature()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedDataFeature::selectObservedDataFileInDialog()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Import Observed Data", defaultDir, "All Files (*.*)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
RimProject* proj = app->project();
|
||||
RimObservedDataCollection* observedDataCollection = proj->activeOilField() ? proj->activeOilField()->observedDataCollection() : nullptr;
|
||||
if (!observedDataCollection) return;
|
||||
|
||||
for (auto fileName : fileNames)
|
||||
{
|
||||
RicImportObservedDataFeature::createAndAddObservedDataFromFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportObservedDataFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimObservedDataCollection*> selectionObservedDataCollection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectionObservedDataCollection);
|
||||
|
||||
std::vector<RimObservedData*> selectionObservedData;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectionObservedData);
|
||||
|
||||
return (selectionObservedDataCollection.size() > 0 || selectionObservedData.size() > 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RicImportObservedDataFeature::selectObservedDataFileInDialog();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedDataFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Default.png"));
|
||||
actionToSetup->setText("Import Observed Data");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportObservedDataFeature::createAndAddObservedDataFromFile(const QString& fileName)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
|
||||
RimObservedDataCollection* observedDataCollection = proj->activeOilField() ? proj->activeOilField()->observedDataCollection() : nullptr;
|
||||
if (!observedDataCollection) return false;
|
||||
|
||||
RimSummaryObservedDataFile* newObservedData = observedDataCollection->createAndAddObservedDataFromFileName(fileName);
|
||||
newObservedData->loadCase();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
44
ApplicationCode/Commands/RicImportObservedDataFeature.h
Normal file
44
ApplicationCode/Commands/RicImportObservedDataFeature.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicImportObservedDataFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicImportObservedDataFeature();
|
||||
static void selectObservedDataFileInDialog();
|
||||
|
||||
private:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
static bool createAndAddObservedDataFromFile(const QString& fileName);
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicImportObservedDataInMenuFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicImportObservedDataFeature.h"
|
||||
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryObservedDataFile.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportObservedDataInMenuFeature, "RicImportObservedDataInMenuFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicImportObservedDataInMenuFeature::RicImportObservedDataInMenuFeature()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportObservedDataInMenuFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedDataInMenuFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RicImportObservedDataFeature::selectObservedDataFileInDialog();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportObservedDataInMenuFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Default.png"));
|
||||
actionToSetup->setText("Import Observed Data");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicImportObservedDataInMenuFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicImportObservedDataInMenuFeature();
|
||||
|
||||
private:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
@@ -43,7 +43,20 @@ bool RicReloadSummaryCaseFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimSummaryCase*> caseSelection = selectedSummaryCases();
|
||||
|
||||
return (caseSelection.size() > 0);
|
||||
if (caseSelection.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (RimSummaryCase* summaryCase : caseSelection)
|
||||
{
|
||||
if (summaryCase->isObservedData())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -34,6 +34,22 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEditSummaryCurves, "RicEditSummaryCurves");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEditSummaryCurves::closeDialogAndResetTargetPlot()
|
||||
{
|
||||
if (m_dialogWithSplitter && m_dialogWithSplitter->isVisible())
|
||||
{
|
||||
m_dialogWithSplitter->hide();
|
||||
}
|
||||
|
||||
if (m_curveCreator)
|
||||
{
|
||||
m_curveCreator->updateFromSummaryPlot(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -64,7 +80,7 @@ void RicEditSummaryCurves::onActionTriggered(bool isChecked)
|
||||
caf::SelectionManager::instance()->objectsByType(&plots);
|
||||
if (plots.size() == 1)
|
||||
{
|
||||
m_curveCreator->setTargetPlot(plots.front());
|
||||
m_curveCreator->updateFromSummaryPlot(plots.front());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@ class RicEditSummaryCurves : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
void closeDialogAndResetTargetPlot();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
|
||||
@@ -55,7 +55,21 @@ bool RicPasteSummaryCaseFeature::isCommandEnabled()
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicPasteSummaryCaseFeature::summaryCases().size() > 0;
|
||||
std::vector<caf::PdmPointer<RimSummaryCase> > summaryCases = RicPasteSummaryCaseFeature::summaryCases();
|
||||
|
||||
if (summaryCases.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (RimSummaryCase* summaryCase : summaryCases)
|
||||
{
|
||||
if (summaryCase->isObservedData())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -91,13 +91,9 @@ QList<caf::PdmOptionItemInfo> RicSelectSummaryPlotUI::calculateValueOptions(cons
|
||||
|
||||
if (fieldNeedingOptions == &m_selectedSummaryPlot)
|
||||
{
|
||||
for (RimSummaryPlot* plot : RicSelectSummaryPlotUI::summaryPlots())
|
||||
{
|
||||
QIcon icon = plot->uiCapability()->uiIcon();
|
||||
QString displayName = plot->description();
|
||||
RimSummaryPlotCollection* summaryPlotColl = summaryPlotCollection();
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(displayName, plot, false, icon));
|
||||
}
|
||||
summaryPlotColl->summaryPlotItemInfos(&options);
|
||||
}
|
||||
|
||||
return options;
|
||||
@@ -108,7 +104,7 @@ QList<caf::PdmOptionItemInfo> RicSelectSummaryPlotUI::calculateValueOptions(cons
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSelectSummaryPlotUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
if (RicSelectSummaryPlotUI::summaryPlots().size() == 0)
|
||||
if (summaryPlotCollection()->summaryPlots().size() == 0)
|
||||
{
|
||||
m_createNewPlot = true;
|
||||
}
|
||||
@@ -128,20 +124,11 @@ void RicSelectSummaryPlotUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RicSelectSummaryPlotUI::summaryPlots()
|
||||
RimSummaryPlotCollection* RicSelectSummaryPlotUI::summaryPlotCollection()
|
||||
{
|
||||
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;
|
||||
|
||||
return project->mainPlotCollection()->summaryPlotCollection();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryPlotCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -47,7 +48,7 @@ protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
static std::vector<RimSummaryPlot*> summaryPlots();
|
||||
static RimSummaryPlotCollection* summaryPlotCollection();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryPlot*> m_selectedSummaryPlot;
|
||||
|
||||
@@ -21,22 +21,35 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicSummaryCurveCreatorUiKeywords.h"
|
||||
#include "RicSelectSummaryPlotUI.h"
|
||||
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
|
||||
#include "RigSummaryCaseData.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimObservedData.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicSummaryCurveCreator, "RicSummaryCurveCreator");
|
||||
@@ -107,10 +120,10 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
||||
} }
|
||||
})
|
||||
{
|
||||
//CAF_PDM_InitObject("Curve Filter", ":/SummaryCurveFilter16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedCases, "SummaryCases", "Cases", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedSummaryCategory, "IdentifierTypes", "Identifier types", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_currentSummaryCategory, "CurrentSummaryCategory", "Current Summary Category", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedSummaryCategories, "SelectedSummaryCategories", "Summary Categories", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_FIELD][0]->pdmField(), "FieldVectors", "Field vectors", "", "", "");
|
||||
|
||||
@@ -157,19 +170,16 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
||||
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField(), "BlockLgrIjk", "Cell IJK", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(), "BlockLgrVectors", "Block Vectors", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_previewPlot, "PreviewPlot", "PreviewPlot", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetPlot, "TargetPlot", "TargetPlot", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetPlot, "TargetPlot", "Target Plot", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto", "", "", "");
|
||||
CAF_PDM_InitField(&m_appearanceApplyButton, "AppearanceApplyButton", false, "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_caseAppearanceType, "CaseAppearanceType", "Case", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_variableAppearanceType, "VariableAppearanceType", "Vector", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellAppearanceType, "WellAppearanceType", "Well", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_groupAppearanceType, "GroupAppearanceType", "Group", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_regionAppearanceType, "RegionAppearanceType", "Region", "", "", "");
|
||||
|
||||
//CAF_PDM_InitFieldNoDefault(&m_selectedCurveTexts, "CurveTexts", "Selected Curves", "", "", "");
|
||||
//m_selectedCurveTexts.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
m_previewPlot = new RimSummaryPlot();
|
||||
|
||||
for (const auto& itemTypes : m_identifierFieldsMap)
|
||||
@@ -186,11 +196,28 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
||||
m_selectedCases.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
||||
m_selectedCases.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
m_selectedSummaryCategory.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
m_selectedSummaryCategory.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
m_selectedSummaryCategories.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
||||
m_selectedSummaryCategories.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
m_previewPlot.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
//m_previewPlot.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
||||
m_currentSummaryCategory.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_applyButtonField, "ApplySelection", "", "", "", "");
|
||||
m_applyButtonField = false;
|
||||
m_applyButtonField.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||
m_applyButtonField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_closeButtonField, "Close", "", "", "", "");
|
||||
m_closeButtonField = false;
|
||||
m_closeButtonField.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||
m_closeButtonField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
CAF_PDM_InitField(&m_createNewPlot, "CreateNewPlot", false, "Create New Plot", "", "", "");
|
||||
m_createNewPlot.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||
m_createNewPlot.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
m_appearanceApplyButton = false;
|
||||
m_appearanceApplyButton.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||
m_appearanceApplyButton.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LEFT);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -205,19 +232,46 @@ RicSummaryCurveCreator::~RicSummaryCurveCreator()
|
||||
delete identifierAndField->pdmField();
|
||||
}
|
||||
}
|
||||
|
||||
delete m_previewPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::setTargetPlot(RimSummaryPlot* targetPlot)
|
||||
void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot)
|
||||
{
|
||||
m_targetPlot = targetPlot;
|
||||
if (targetPlot != nullptr)
|
||||
if (m_targetPlot != targetPlot)
|
||||
{
|
||||
populateCurveCreator(*targetPlot);
|
||||
updateConnectedEditors();
|
||||
resetAllFields();
|
||||
}
|
||||
|
||||
m_targetPlot = targetPlot;
|
||||
m_useAutoAppearanceAssignment = true;
|
||||
|
||||
if (m_targetPlot)
|
||||
{
|
||||
populateCurveCreator(*m_targetPlot);
|
||||
loadDataAndUpdatePlot();
|
||||
}
|
||||
|
||||
caf::PdmUiItem::updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSummaryCurveCreator::isCloseButtonPressed() const
|
||||
{
|
||||
return m_closeButtonField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::clearCloseButton()
|
||||
{
|
||||
m_closeButtonField = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -225,18 +279,64 @@ void RicSummaryCurveCreator::setTargetPlot(RimSummaryPlot* targetPlot)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
// Lookup item type input field
|
||||
auto identifierAndField = findIdentifierAndField(changedField);
|
||||
if (changedField == &m_selectedCases ||
|
||||
changedField == &m_useAutoAppearanceAssignment ||
|
||||
changedField == &m_caseAppearanceType ||
|
||||
changedField == &m_variableAppearanceType ||
|
||||
changedField == &m_wellAppearanceType ||
|
||||
changedField == &m_groupAppearanceType ||
|
||||
changedField == &m_regionAppearanceType ||
|
||||
identifierAndField != nullptr)
|
||||
if (changedField == &m_applyButtonField)
|
||||
{
|
||||
loadDataAndUpdatePlot();
|
||||
m_applyButtonField = false;
|
||||
|
||||
updateTargetPlot();
|
||||
}
|
||||
else if (changedField == &m_createNewPlot)
|
||||
{
|
||||
m_createNewPlot = false;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection();
|
||||
if (summaryPlotColl)
|
||||
{
|
||||
QString summaryPlotName = QString("SummaryPlot %1").arg(summaryPlotColl->summaryPlots().size() + 1);
|
||||
|
||||
bool ok = false;
|
||||
summaryPlotName = QInputDialog::getText(NULL, "New Summary Plot Name", "New Summary Plot Name", QLineEdit::Normal, summaryPlotName, &ok);
|
||||
if (ok)
|
||||
{
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
summaryPlotColl->summaryPlots().push_back(plot);
|
||||
|
||||
plot->setDescription(summaryPlotName);
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
summaryPlotColl->updateConnectedEditors();
|
||||
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (mainPlotWindow)
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem(plot);
|
||||
mainPlotWindow->setExpanded(plot, true);
|
||||
}
|
||||
|
||||
m_createNewPlot = false;
|
||||
m_targetPlot = plot;
|
||||
|
||||
updateTargetPlot();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_appearanceApplyButton)
|
||||
{
|
||||
applyAppearanceToAllPreviewCurves();
|
||||
m_previewPlot->loadDataAndUpdate();
|
||||
m_appearanceApplyButton = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lookup item type input field
|
||||
auto identifierAndField = lookupIdentifierAndFieldFromFieldHandle(changedField);
|
||||
if (changedField == &m_selectedCases ||
|
||||
identifierAndField != nullptr)
|
||||
{
|
||||
loadDataAndUpdatePlot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,24 +350,76 @@ QList<caf::PdmOptionItemInfo> RicSummaryCurveCreator::calculateValueOptions(cons
|
||||
if (fieldNeedingOptions == &m_selectedCases)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
std::vector<RimSummaryCase*> cases;
|
||||
std::vector<RimSummaryCase*> topLevelCases;
|
||||
std::vector<RimOilField*> oilFields;
|
||||
|
||||
proj->allSummaryCases(cases);
|
||||
|
||||
for (RimSummaryCase* rimCase : cases)
|
||||
proj->allOilFields(oilFields);
|
||||
for (RimOilField* oilField : oilFields)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), rimCase));
|
||||
RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection();
|
||||
if (sumCaseMainColl)
|
||||
{
|
||||
// Top level cases
|
||||
for (const auto& sumCase : sumCaseMainColl->topLevelSummaryCases())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(sumCase->caseName(), sumCase));
|
||||
}
|
||||
|
||||
// Grouped cases
|
||||
for (const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader(sumCaseColl->name(), true));
|
||||
|
||||
for (const auto& sumCase : sumCaseColl->allSummaryCases())
|
||||
{
|
||||
auto optionItem = caf::PdmOptionItemInfo(sumCase->caseName(), sumCase);
|
||||
optionItem.setLevel(1);
|
||||
options.push_back(optionItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Observed data
|
||||
auto observedDataColl = oilField->observedDataCollection();
|
||||
if (observedDataColl->allObservedData().size() > 0)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo::createHeader("Observed Data", true));
|
||||
|
||||
for (const auto& obsData : observedDataColl->allObservedData())
|
||||
{
|
||||
auto optionItem = caf::PdmOptionItemInfo(obsData->caseName(), obsData);
|
||||
optionItem.setLevel(1);
|
||||
options.push_back(optionItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_targetPlot)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection();
|
||||
if (summaryPlotColl)
|
||||
{
|
||||
summaryPlotColl->summaryPlotItemInfos(&options);
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_selectedSummaryCategories)
|
||||
{
|
||||
for (size_t i = 0; i < caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::size(); ++i)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::uiTextFromIndex(i),
|
||||
caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::fromIndex(i)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lookup item type input field
|
||||
auto identifierAndField = findIdentifierAndField(fieldNeedingOptions);
|
||||
auto identifierAndField = lookupIdentifierAndFieldFromFieldHandle(fieldNeedingOptions);
|
||||
if (identifierAndField != nullptr)
|
||||
{
|
||||
auto pdmField = identifierAndField->pdmField();
|
||||
std::set<RifEclipseSummaryAddress> addrUnion =
|
||||
findPossibleSummaryAddresses(identifierAndField);
|
||||
std::set<RifEclipseSummaryAddress> addrUnion = findPossibleSummaryAddresses(identifierAndField);
|
||||
std::set<QString> itemNames;
|
||||
|
||||
for (const auto& address : addrUnion)
|
||||
@@ -293,12 +445,12 @@ void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", RicSummaryCurveCreatorUiKeywords::sources());
|
||||
sourcesGroup->add(&m_selectedCases);
|
||||
|
||||
caf::PdmUiGroup* itemTypesGroup = uiOrdering.addNewGroupWithKeyword("Identifier Types", RicSummaryCurveCreatorUiKeywords::summaryTypes());
|
||||
itemTypesGroup->add(&m_selectedSummaryCategory);
|
||||
caf::PdmUiGroup* itemTypesGroup = uiOrdering.addNewGroupWithKeyword("Summary Types", RicSummaryCurveCreatorUiKeywords::summaryTypes());
|
||||
itemTypesGroup->add(&m_selectedSummaryCategories);
|
||||
|
||||
caf::PdmField<std::vector<QString>>* summaryiesField = nullptr;
|
||||
|
||||
RifEclipseSummaryAddress::SummaryVarCategory sumCategory = m_selectedSummaryCategory();
|
||||
RifEclipseSummaryAddress::SummaryVarCategory sumCategory = m_currentSummaryCategory();
|
||||
if (sumCategory == RifEclipseSummaryAddress::SUMMARY_FIELD)
|
||||
{
|
||||
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_FIELD][0]->pdmField();
|
||||
@@ -318,7 +470,7 @@ void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||
{
|
||||
{
|
||||
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroupWithKeyword("Regions", "RegionsKeyword");
|
||||
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Regions");
|
||||
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION][0]->pdmField());
|
||||
}
|
||||
|
||||
@@ -420,13 +572,15 @@ void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
|
||||
// Appearance settings
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroupWithKeyword("Appearance Settings", RicSummaryCurveCreatorUiKeywords::appearance());
|
||||
//appearanceGroup->setCollapsedByDefault(true);
|
||||
appearanceGroup->setCollapsedByDefault(true);
|
||||
appearanceGroup->add(&m_useAutoAppearanceAssignment);
|
||||
appearanceGroup->add(&m_caseAppearanceType);
|
||||
appearanceGroup->add(&m_variableAppearanceType);
|
||||
appearanceGroup->add(&m_wellAppearanceType);
|
||||
appearanceGroup->add(&m_groupAppearanceType);
|
||||
appearanceGroup->add(&m_regionAppearanceType);
|
||||
appearanceGroup->add(&m_appearanceApplyButton);
|
||||
|
||||
// Appearance option sensitivity
|
||||
{
|
||||
m_caseAppearanceType.uiCapability()->setUiReadOnly(m_useAutoAppearanceAssignment);
|
||||
@@ -436,18 +590,13 @@ void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
m_regionAppearanceType.uiCapability()->setUiReadOnly(m_useAutoAppearanceAssignment);
|
||||
}
|
||||
|
||||
// Fields to be displayed directly in UI
|
||||
uiOrdering.add(&m_createNewPlot);
|
||||
uiOrdering.add(&m_targetPlot);
|
||||
uiOrdering.add(&m_applyButtonField);
|
||||
uiOrdering.add(&m_closeButtonField);
|
||||
|
||||
// Dynamic item input editors
|
||||
/*
|
||||
auto pdmFields = m_selectedIdentifiers[m_selectedSummaryCategory()];
|
||||
if (pdmFields.size() > 0)
|
||||
{
|
||||
auto groupLabel = QString("%1 input").arg(m_selectedSummaryCategory().uiText());
|
||||
caf::PdmUiGroup* itemInputGroup = uiOrdering.addNewGroup(groupLabel);
|
||||
for (const auto& pdmField : pdmFields)
|
||||
itemInputGroup->add(pdmField->pdmField());
|
||||
}
|
||||
*/
|
||||
m_targetPlot.uiCapability()->setUiReadOnly(m_createNewPlot);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
@@ -476,22 +625,18 @@ std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAd
|
||||
int addressCount = static_cast<int>(allAddresses.size());
|
||||
|
||||
bool applySelections = identifierAndField == nullptr || (!isVectorField && controllingIdentifierAndField != nullptr);
|
||||
std::vector<SummaryIdentifierAndField*> selections;
|
||||
std::vector<SummaryIdentifierAndField*> controllingFields;
|
||||
if (applySelections)
|
||||
{
|
||||
// Build selections vector
|
||||
selections = buildControllingFieldList(identifierAndField);
|
||||
controllingFields = buildControllingFieldList(identifierAndField);
|
||||
}
|
||||
|
||||
for (int i = 0; i < addressCount; i++)
|
||||
{
|
||||
if (allAddresses[i].category() == m_selectedSummaryCategory())
|
||||
if (allAddresses[i].category() == m_currentSummaryCategory())
|
||||
{
|
||||
bool addressSelected = applySelections ? isAddressSelected(allAddresses[i], selections) : true;
|
||||
|
||||
// Todo: Add text filter
|
||||
//if (!m_summaryFilter->isIncludedByFilter(allAddresses[i])) continue;
|
||||
|
||||
bool addressSelected = applySelections ? isAddressCompatibleWithControllingFieldSelection(allAddresses[i], controllingFields) : true;
|
||||
if (addressSelected)
|
||||
{
|
||||
addrUnion.insert(allAddresses[i]);
|
||||
@@ -508,23 +653,23 @@ std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAd
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RicSummaryCurveCreator::SummaryIdentifierAndField*> RicSummaryCurveCreator::buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField)
|
||||
{
|
||||
std::vector<RicSummaryCurveCreator::SummaryIdentifierAndField*> selections;
|
||||
auto identifierAndFieldList = m_identifierFieldsMap[m_selectedSummaryCategory()];
|
||||
std::vector<RicSummaryCurveCreator::SummaryIdentifierAndField*> controllingFields;
|
||||
auto identifierAndFieldList = m_identifierFieldsMap[m_currentSummaryCategory()];
|
||||
for (const auto& identifierAndFieldItem : identifierAndFieldList)
|
||||
{
|
||||
if (identifierAndFieldItem == identifierAndField)
|
||||
{
|
||||
break;
|
||||
}
|
||||
selections.push_back(identifierAndFieldItem);
|
||||
controllingFields.push_back(identifierAndFieldItem);
|
||||
}
|
||||
return selections;
|
||||
return controllingFields;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns pdm field info from the specified pdm field
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSummaryCurveCreator::SummaryIdentifierAndField* RicSummaryCurveCreator::findIdentifierAndField(const caf::PdmFieldHandle* pdmFieldHandle)
|
||||
RicSummaryCurveCreator::SummaryIdentifierAndField* RicSummaryCurveCreator::lookupIdentifierAndFieldFromFieldHandle(const caf::PdmFieldHandle* pdmFieldHandle)
|
||||
{
|
||||
for (const auto& itemTypes : m_identifierFieldsMap)
|
||||
{
|
||||
@@ -540,17 +685,18 @@ RicSummaryCurveCreator::SummaryIdentifierAndField* RicSummaryCurveCreator::findI
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns the parent pdm field info for the specified pdm field info.
|
||||
/// Returns the Controlling pdm field info for the specified pdm field info.
|
||||
/// Controlling means the field controlling the dependent field
|
||||
/// If the specified pdm field info is the topmost (i.e. index is 0), null pointer is returned
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSummaryCurveCreator::SummaryIdentifierAndField* RicSummaryCurveCreator::lookupControllingField(const RicSummaryCurveCreator::SummaryIdentifierAndField *identifierAndField)
|
||||
RicSummaryCurveCreator::SummaryIdentifierAndField* RicSummaryCurveCreator::lookupControllingField(const RicSummaryCurveCreator::SummaryIdentifierAndField *dependentField)
|
||||
{
|
||||
for (const auto& identifierAndFieldList : m_identifierFieldsMap)
|
||||
{
|
||||
int index = 0;
|
||||
for (const auto& iaf : identifierAndFieldList.second)
|
||||
{
|
||||
if (iaf == identifierAndField)
|
||||
if (iaf == dependentField)
|
||||
{
|
||||
return index > 0 ? identifierAndFieldList.second[index - 1] : nullptr;
|
||||
}
|
||||
@@ -561,9 +707,9 @@ RicSummaryCurveCreator::SummaryIdentifierAndField* RicSummaryCurveCreator::looku
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns true if the specified address object matches the selections
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSummaryCurveCreator::isAddressSelected(const RifEclipseSummaryAddress &address, const std::vector<SummaryIdentifierAndField*>& identifierAndFieldList)
|
||||
bool RicSummaryCurveCreator::isAddressCompatibleWithControllingFieldSelection(const RifEclipseSummaryAddress &address, const std::vector<SummaryIdentifierAndField*>& identifierAndFieldList)
|
||||
{
|
||||
for (const auto& identifierAndField : identifierAndFieldList)
|
||||
{
|
||||
@@ -576,26 +722,34 @@ bool RicSummaryCurveCreator::isAddressSelected(const RifEclipseSummaryAddress &a
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!match)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::buildAddressListFromSelections()
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> addressSet;
|
||||
for (const auto& identifierAndFieldList : m_identifierFieldsMap)
|
||||
{
|
||||
std::vector<std::pair<RifEclipseSummaryAddress::SummaryIdentifierType, QString>> selectionStack;
|
||||
addSelectionAddress(identifierAndFieldList.first, identifierAndFieldList.second.begin(), addressSet, selectionStack);
|
||||
buildAddressListForCategoryRecursively(identifierAndFieldList.first, identifierAndFieldList.second.begin(), addressSet, selectionStack);
|
||||
}
|
||||
return addressSet;
|
||||
}
|
||||
|
||||
void RicSummaryCurveCreator::addSelectionAddress(RifEclipseSummaryAddress::SummaryVarCategory category,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::buildAddressListForCategoryRecursively(RifEclipseSummaryAddress::SummaryVarCategory category,
|
||||
std::vector<SummaryIdentifierAndField*>::const_iterator identifierAndFieldItr,
|
||||
std::set<RifEclipseSummaryAddress>& addressSet,
|
||||
std::vector<std::pair<RifEclipseSummaryAddress::SummaryIdentifierType, QString>>& identifierPath)
|
||||
@@ -605,7 +759,7 @@ void RicSummaryCurveCreator::addSelectionAddress(RifEclipseSummaryAddress::Summa
|
||||
identifierPath.push_back(std::make_pair((*identifierAndFieldItr)->summaryIdentifier(), identifierText));
|
||||
if ((*identifierAndFieldItr)->summaryIdentifier() != RifEclipseSummaryAddress::INPUT_VECTOR_NAME)
|
||||
{
|
||||
addSelectionAddress(category, std::next(identifierAndFieldItr, 1), addressSet, identifierPath);
|
||||
buildAddressListForCategoryRecursively(category, std::next(identifierAndFieldItr, 1), addressSet, identifierPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -626,18 +780,13 @@ void RicSummaryCurveCreator::addSelectionAddress(RifEclipseSummaryAddress::Summa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::loadDataAndUpdatePlot()
|
||||
{
|
||||
syncCurvesFromUiSelection();
|
||||
//loadDataAndUpdate();
|
||||
|
||||
//RimSummaryPlot* plot = nullptr;
|
||||
//firstAncestorOrThisOfType(plot);
|
||||
//plot->updateAxes();
|
||||
syncPreviewCurvesFromUiSelection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::syncCurvesFromUiSelection()
|
||||
void RicSummaryCurveCreator::syncPreviewCurvesFromUiSelection()
|
||||
{
|
||||
// Create a search map containing whats supposed to be curves
|
||||
|
||||
@@ -647,7 +796,7 @@ void RicSummaryCurveCreator::syncCurvesFromUiSelection()
|
||||
|
||||
std::set<RifEclipseSummaryAddress> selectedAddresses = buildAddressListFromSelections();
|
||||
|
||||
// Todo: Move to separate method
|
||||
// Find the addresses to display
|
||||
std::set<RifEclipseSummaryAddress> addrUnion;
|
||||
for (RimSummaryCase* currCase : m_selectedCases)
|
||||
{
|
||||
@@ -665,26 +814,23 @@ void RicSummaryCurveCreator::syncCurvesFromUiSelection()
|
||||
addrUnion.insert(allAddresses[i]);
|
||||
allCurveDefinitions.insert(std::make_pair(currCase, allAddresses[i]));
|
||||
}
|
||||
|
||||
// Todo: Add text filter
|
||||
//if (!m_summaryFilter->isIncludedByFilter(allAddresses[i])) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimSummaryCurve*> currentCurvesInPlot = m_previewPlot->summaryCurves();
|
||||
if (allCurveDefinitions.size() != currentCurvesInPlot.size())
|
||||
std::vector<RimSummaryCurve*> currentCurvesInPreviewPlot = m_previewPlot->summaryCurves();
|
||||
if (allCurveDefinitions.size() != currentCurvesInPreviewPlot.size())
|
||||
{
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> currentCurveDefs;
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> newCurveDefs;
|
||||
std::set<RimSummaryCurve*> deleteCurves;
|
||||
std::set<RimSummaryCurve*> curvesToDelete;
|
||||
|
||||
for (const auto& curve : currentCurvesInPlot)
|
||||
for (const auto& curve : currentCurvesInPreviewPlot)
|
||||
{
|
||||
currentCurveDefs.insert(std::make_pair(curve->summaryCase(), curve->summaryAddress()));
|
||||
}
|
||||
|
||||
if (allCurveDefinitions.size() < currentCurvesInPlot.size())
|
||||
if (allCurveDefinitions.size() < currentCurvesInPreviewPlot.size())
|
||||
{
|
||||
// Determine which curves to delete from plot
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> deleteCurveDefs;
|
||||
@@ -692,11 +838,11 @@ void RicSummaryCurveCreator::syncCurvesFromUiSelection()
|
||||
allCurveDefinitions.begin(), allCurveDefinitions.end(),
|
||||
std::inserter(deleteCurveDefs, deleteCurveDefs.end()));
|
||||
|
||||
for (const auto& curve : currentCurvesInPlot)
|
||||
for (const auto& curve : currentCurvesInPreviewPlot)
|
||||
{
|
||||
std::pair<RimSummaryCase*, RifEclipseSummaryAddress> curveDef = std::make_pair(curve->summaryCase(), curve->summaryAddress());
|
||||
if (deleteCurveDefs.count(curveDef))
|
||||
deleteCurves.insert(curve);
|
||||
if (deleteCurveDefs.count(curveDef) > 0)
|
||||
curvesToDelete.insert(curve);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -706,48 +852,23 @@ void RicSummaryCurveCreator::syncCurvesFromUiSelection()
|
||||
currentCurveDefs.begin(), currentCurveDefs.end(),
|
||||
std::inserter(newCurveDefs, newCurveDefs.end()));
|
||||
}
|
||||
updateCurvesFromCurveDefinitions(newCurveDefs, deleteCurves);
|
||||
|
||||
updatePreviewCurvesFromCurveDefinitions(allCurveDefinitions, newCurveDefs, curvesToDelete);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::updateCurvesFromCurveDefinitions(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefsToAdd,
|
||||
const std::set<RimSummaryCurve*>& curvesToDelete)
|
||||
void RicSummaryCurveCreator::updatePreviewCurvesFromCurveDefinitions(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& allCurveDefsToDisplay,
|
||||
const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefsToAdd,
|
||||
const std::set<RimSummaryCurve*>& curvesToDelete)
|
||||
{
|
||||
RimSummaryCase* prevCase = nullptr;
|
||||
RimPlotCurve::LineStyleEnum lineStyle = RimPlotCurve::STYLE_SOLID;
|
||||
RimSummaryCurveAppearanceCalculator curveLookCalc(curveDefsToAdd, getAllSummaryCaseNames(), getAllSummaryWellNames());
|
||||
RimSummaryCurveAppearanceCalculator curveLookCalc(allCurveDefsToDisplay, getAllSummaryCaseNames(), getAllSummaryWellNames());
|
||||
|
||||
if (!m_useAutoAppearanceAssignment())
|
||||
{
|
||||
curveLookCalc.assignDimensions(m_caseAppearanceType(),
|
||||
m_variableAppearanceType(),
|
||||
m_wellAppearanceType(),
|
||||
m_groupAppearanceType(),
|
||||
m_regionAppearanceType());
|
||||
}
|
||||
else
|
||||
{
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType caseAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType variAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType wellAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType gropAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType regiAppearance;
|
||||
|
||||
curveLookCalc.getDimensions(&caseAppearance,
|
||||
&variAppearance,
|
||||
&wellAppearance,
|
||||
&gropAppearance,
|
||||
®iAppearance);
|
||||
|
||||
m_caseAppearanceType = caseAppearance;
|
||||
m_variableAppearanceType = variAppearance;
|
||||
m_wellAppearanceType = wellAppearance;
|
||||
m_groupAppearanceType = gropAppearance;
|
||||
m_regionAppearanceType = regiAppearance;
|
||||
}
|
||||
initCurveAppearanceCalculator(curveLookCalc);
|
||||
|
||||
// Delete curves
|
||||
for (const auto& curve : curvesToDelete)
|
||||
@@ -756,7 +877,6 @@ void RicSummaryCurveCreator::updateCurvesFromCurveDefinitions(const std::set<std
|
||||
}
|
||||
|
||||
// Add new curves
|
||||
//m_previewPlot->deleteAllTopLevelCurves();
|
||||
for (const auto& curveDef : curveDefsToAdd)
|
||||
{
|
||||
RimSummaryCase* currentCase = curveDef.first;
|
||||
@@ -765,30 +885,11 @@ void RicSummaryCurveCreator::updateCurvesFromCurveDefinitions(const std::set<std
|
||||
curve->setSummaryAddress(curveDef.second);
|
||||
m_previewPlot->addCurve(curve);
|
||||
curveLookCalc.setupCurveLook(curve);
|
||||
//m_currentCurvesInPlot.insert(std::make_pair(curveDef, curve));
|
||||
//curveTexts.push_back(QString::fromStdString( curveDef.second.uiText()));
|
||||
}
|
||||
|
||||
//m_selectedCurveTexts = curveTexts;
|
||||
m_previewPlot->loadDataAndUpdate();
|
||||
m_previewPlot->updateConnectedEditors();
|
||||
m_previewPlot->zoomAll();
|
||||
|
||||
//for (auto& caseAddrPair : curveDefinitions)
|
||||
//{
|
||||
// RimSummaryCase* currentCase = caseAddrPair.first;
|
||||
|
||||
// RimSummaryCurve* curve = new RimSummaryCurve();
|
||||
// curve->setParentQwtPlot(m_parentQwtPlot);
|
||||
// curve->setSummaryCase(currentCase);
|
||||
// curve->setSummaryAddress(caseAddrPair.second);
|
||||
// curve->setYAxis(m_plotAxis());
|
||||
// curve->applyCurveAutoNameSettings(*m_curveNameConfig());
|
||||
|
||||
// m_curves.push_back(curve);
|
||||
|
||||
// curveLookCalc.setupCurveLook(curve);
|
||||
//}
|
||||
updateEditorsConnectedToPreviewPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -844,11 +945,67 @@ std::set<std::string> RicSummaryCurveCreator::getAllSummaryWellNames()
|
||||
return summaryWellNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (&m_applyButtonField == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Apply";
|
||||
}
|
||||
}
|
||||
else if (&m_closeButtonField == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Cancel";
|
||||
}
|
||||
}
|
||||
else if (&m_createNewPlot == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "New Plot";
|
||||
}
|
||||
}
|
||||
else if (&m_appearanceApplyButton == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->m_buttonText = "Apply";
|
||||
}
|
||||
}
|
||||
else if (&m_selectedSummaryCategories == field)
|
||||
{
|
||||
caf::PdmUiTreeSelectionEditorAttribute* attrib = dynamic_cast<caf::PdmUiTreeSelectionEditorAttribute*> (attribute);
|
||||
if (attrib)
|
||||
{
|
||||
attrib->fieldToReceiveCurrentItemValue = &m_currentSummaryCategory;
|
||||
attrib->showTextFilter = false;
|
||||
attrib->showToggleAllCheckbox = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Populate curve creator from the given curve collection
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot)
|
||||
{
|
||||
m_selectedSummaryCategories.v().clear();
|
||||
for (size_t i = 0; i < caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::size(); ++i)
|
||||
{
|
||||
m_selectedSummaryCategories.v().push_back(caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::fromIndex(i));
|
||||
}
|
||||
|
||||
m_previewPlot->deleteAllSummaryCurves();
|
||||
for (const auto& curve : sourceSummaryPlot.summaryCurves())
|
||||
{
|
||||
// Select case if not already selected
|
||||
@@ -871,36 +1028,172 @@ void RicSummaryCurveCreator::populateCurveCreator(const RimSummaryPlot& sourceSu
|
||||
}
|
||||
|
||||
// Copy curve object to the preview plot
|
||||
RimSummaryCurve* curveCopy = dynamic_cast<RimSummaryCurve*>(curve->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(curveCopy);
|
||||
|
||||
m_previewPlot->addCurve(curveCopy);
|
||||
|
||||
// Resolve references after object has been inserted into the project data model
|
||||
curveCopy->resolveReferencesRecursively();
|
||||
|
||||
// The curve creator is not a descendant of the project, and need to be set manually
|
||||
curveCopy->setSummaryCase(curve->summaryCase());
|
||||
curveCopy->initAfterReadRecursively();
|
||||
curveCopy->loadDataAndUpdate();
|
||||
copyCurveAndAddToPlot(curve, m_previewPlot, true);
|
||||
}
|
||||
m_previewPlot->updateConnectedEditors();
|
||||
|
||||
syncPreviewCurvesFromUiSelection();
|
||||
|
||||
// Set visibility for imported curves which were not checked in source plot
|
||||
std::set <std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> sourceCurveDefs;
|
||||
for (const auto& curve : sourceSummaryPlot.summaryCurves())
|
||||
{
|
||||
sourceCurveDefs.insert(std::make_pair(curve->summaryCase(), curve->summaryAddress()));
|
||||
}
|
||||
for (const auto& curve : m_previewPlot->summaryCurves())
|
||||
{
|
||||
auto curveDef = std::make_pair(curve->summaryCase(), curve->summaryAddress());
|
||||
if (sourceCurveDefs.count(curveDef) == 0)
|
||||
curve->setCurveVisiblity(false);
|
||||
}
|
||||
updateEditorsConnectedToPreviewPlot();
|
||||
updateAppearanceEditor();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Copy curves from
|
||||
/// Copy curves from preview plot to target plot
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::updateTargetPlot()
|
||||
{
|
||||
// Q: What about hidden curves?
|
||||
|
||||
if (m_targetPlot == nullptr)
|
||||
m_targetPlot = new RimSummaryPlot();
|
||||
|
||||
m_targetPlot->deleteAllSummaryCurves();
|
||||
|
||||
// Add edited curves to target plot
|
||||
for (const auto& editedCurve : m_previewPlot->summaryCurves())
|
||||
{
|
||||
if (!editedCurve->isCurveVisible())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
copyCurveAndAddToPlot(editedCurve, m_targetPlot);
|
||||
}
|
||||
m_targetPlot->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve *curve, RimSummaryPlot *plot, bool forceVisible)
|
||||
{
|
||||
RimSummaryCurve* curveCopy = dynamic_cast<RimSummaryCurve*>(curve->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(curveCopy);
|
||||
|
||||
if (forceVisible)
|
||||
curveCopy->setCurveVisiblity(true);
|
||||
plot->addCurve(curveCopy);
|
||||
|
||||
// Resolve references after object has been inserted into the project data model
|
||||
curveCopy->resolveReferencesRecursively();
|
||||
|
||||
// The curve creator is not a descendant of the project, and need to be set manually
|
||||
curveCopy->setSummaryCase(curve->summaryCase());
|
||||
curveCopy->initAfterReadRecursively();
|
||||
curveCopy->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::resetAllFields()
|
||||
{
|
||||
m_selectedCases.clear();
|
||||
|
||||
m_previewPlot->deleteAllSummaryCurves();
|
||||
m_targetPlot = nullptr;
|
||||
|
||||
// clear all state in fields
|
||||
for (auto& identifierAndFieldList : m_identifierFieldsMap)
|
||||
{
|
||||
for (auto a : identifierAndFieldList.second)
|
||||
{
|
||||
a->pdmField()->v().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::updateEditorsConnectedToPreviewPlot()
|
||||
{
|
||||
m_previewPlot->updateConnectedEditors();
|
||||
m_previewPlot->summaryCurveCollection()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::initCurveAppearanceCalculator(RimSummaryCurveAppearanceCalculator& curveAppearanceCalc)
|
||||
{
|
||||
if (!m_useAutoAppearanceAssignment())
|
||||
{
|
||||
curveAppearanceCalc.assignDimensions(m_caseAppearanceType(),
|
||||
m_variableAppearanceType(),
|
||||
m_wellAppearanceType(),
|
||||
m_groupAppearanceType(),
|
||||
m_regionAppearanceType());
|
||||
}
|
||||
else
|
||||
{
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType caseAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType variAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType wellAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType gropAppearance;
|
||||
RimSummaryCurveAppearanceCalculator::CurveAppearanceType regiAppearance;
|
||||
|
||||
curveAppearanceCalc.getDimensions(&caseAppearance,
|
||||
&variAppearance,
|
||||
&wellAppearance,
|
||||
&gropAppearance,
|
||||
®iAppearance);
|
||||
|
||||
m_caseAppearanceType = caseAppearance;
|
||||
m_variableAppearanceType = variAppearance;
|
||||
m_wellAppearanceType = wellAppearance;
|
||||
m_groupAppearanceType = gropAppearance;
|
||||
m_regionAppearanceType = regiAppearance;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::applyAppearanceToAllPreviewCurves()
|
||||
{
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> allCurveDefs = allPreviewCurveDefs();
|
||||
|
||||
RimSummaryCurveAppearanceCalculator curveLookCalc(allCurveDefs, getAllSummaryCaseNames(), getAllSummaryWellNames());
|
||||
initCurveAppearanceCalculator(curveLookCalc);
|
||||
|
||||
for (auto& curve : m_previewPlot->summaryCurves())
|
||||
{
|
||||
curve->resetAppearance();
|
||||
curveLookCalc.setupCurveLook(curve);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::updateAppearanceEditor()
|
||||
{
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> allCurveDefs = allPreviewCurveDefs();
|
||||
|
||||
RimSummaryCurveAppearanceCalculator curveLookCalc(allCurveDefs, getAllSummaryCaseNames(), getAllSummaryWellNames());
|
||||
initCurveAppearanceCalculator(curveLookCalc);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> RicSummaryCurveCreator::allPreviewCurveDefs() const
|
||||
{
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> allCurveDefs;
|
||||
|
||||
for (const auto& curve : m_previewPlot->summaryCurves())
|
||||
{
|
||||
m_targetPlot->addCurve(curve);
|
||||
allCurveDefs.insert(std::make_pair(curve->summaryCase(), curve->summaryAddress()));
|
||||
}
|
||||
m_targetPlot->loadDataAndUpdate();
|
||||
}
|
||||
return allCurveDefs;
|
||||
}
|
||||
@@ -75,7 +75,10 @@ public:
|
||||
virtual ~RicSummaryCurveCreator();
|
||||
|
||||
RimSummaryPlot* previewPlot() { return m_previewPlot;}
|
||||
void setTargetPlot(RimSummaryPlot* targetPlot);
|
||||
void updateFromSummaryPlot(RimSummaryPlot* targetPlot);
|
||||
|
||||
bool isCloseButtonPressed() const;
|
||||
void clearCloseButton();
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
@@ -83,42 +86,62 @@ private:
|
||||
const QVariant& newValue);
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
|
||||
|
||||
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddresses(const SummaryIdentifierAndField *identifierAndField);
|
||||
std::vector<SummaryIdentifierAndField*> buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField);
|
||||
SummaryIdentifierAndField* findIdentifierAndField(const caf::PdmFieldHandle* pdmFieldHandle);
|
||||
SummaryIdentifierAndField* lookupControllingField(const SummaryIdentifierAndField *identifierAndField);
|
||||
bool isAddressSelected(const RifEclipseSummaryAddress &address,
|
||||
SummaryIdentifierAndField* lookupIdentifierAndFieldFromFieldHandle(const caf::PdmFieldHandle* pdmFieldHandle);
|
||||
SummaryIdentifierAndField* lookupControllingField(const SummaryIdentifierAndField *dependentField);
|
||||
bool isAddressCompatibleWithControllingFieldSelection(const RifEclipseSummaryAddress &address,
|
||||
const std::vector<SummaryIdentifierAndField*>& identifierAndFieldList);
|
||||
std::set<RifEclipseSummaryAddress> buildAddressListFromSelections();
|
||||
void addSelectionAddress(RifEclipseSummaryAddress::SummaryVarCategory category,
|
||||
void buildAddressListForCategoryRecursively(RifEclipseSummaryAddress::SummaryVarCategory category,
|
||||
std::vector<SummaryIdentifierAndField*>::const_iterator identifierAndFieldItr,
|
||||
std::set<RifEclipseSummaryAddress>& addressSet,
|
||||
std::vector<std::pair<RifEclipseSummaryAddress::SummaryIdentifierType, QString>>& identifierPath);
|
||||
|
||||
void loadDataAndUpdatePlot();
|
||||
void syncCurvesFromUiSelection();
|
||||
void updateCurvesFromCurveDefinitions(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefsToAdd,
|
||||
const std::set<RimSummaryCurve*>& curvesToDelete);
|
||||
void syncPreviewCurvesFromUiSelection();
|
||||
void updatePreviewCurvesFromCurveDefinitions(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& allCurveDefsToDisplay,
|
||||
const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefsToAdd,
|
||||
const std::set<RimSummaryCurve*>& curvesToDelete);
|
||||
std::set<std::string> getAllSummaryCaseNames();
|
||||
std::set<std::string> getAllSummaryWellNames();
|
||||
|
||||
void populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot);
|
||||
void updateTargetPlot();
|
||||
static void copyCurveAndAddToPlot(const RimSummaryCurve *curve, RimSummaryPlot *plot, bool forceVisible = false);
|
||||
|
||||
void resetAllFields();
|
||||
void updateEditorsConnectedToPreviewPlot();
|
||||
void initCurveAppearanceCalculator(RimSummaryCurveAppearanceCalculator& curveAppearanceCalc);
|
||||
void applyAppearanceToAllPreviewCurves();
|
||||
void updateAppearanceEditor();
|
||||
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>>
|
||||
allPreviewCurveDefs() const;
|
||||
private:
|
||||
caf::PdmPtrArrayField<RimSummaryCase*> m_selectedCases;
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_selectedSummaryCategory;
|
||||
|
||||
caf::PdmField<std::vector<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>>> m_selectedSummaryCategories;
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_currentSummaryCategory;
|
||||
|
||||
std::map<RifEclipseSummaryAddress::SummaryVarCategory, std::vector<SummaryIdentifierAndField*>> m_identifierFieldsMap;
|
||||
|
||||
caf::PdmPtrField<RimSummaryPlot*> m_targetPlot;
|
||||
caf::PdmChildField<RimSummaryPlot*> m_previewPlot;
|
||||
|
||||
RimSummaryPlot* m_previewPlot;
|
||||
|
||||
caf::PdmField<bool> m_useAutoAppearanceAssignment;
|
||||
caf::PdmField<bool> m_appearanceApplyButton;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_caseAppearanceType;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_variableAppearanceType;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_wellAppearanceType;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_groupAppearanceType;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_regionAppearanceType;
|
||||
|
||||
caf::PdmField<bool> m_createNewPlot;
|
||||
caf::PdmField<bool> m_applyButtonField;
|
||||
caf::PdmField<bool> m_closeButtonField;
|
||||
};
|
||||
|
||||
@@ -39,6 +39,8 @@ RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog(QWidget* parent, RicS
|
||||
|
||||
m_curveCreatorSplitterUi->setPdmObject(summaryCurveCreator);
|
||||
m_curveCreatorSplitterUi->updateUi();
|
||||
|
||||
connect(m_curveCreatorSplitterUi, SIGNAL(signalCloseButtonPressed()), this, SLOT(accept()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
class RicSummaryCurveCreatorSplitterUi;
|
||||
class RicSummaryCurveCreator;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSummaryCurveCreatorDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
#include "RicSummaryCurveCreator.h"
|
||||
#include "RicSummaryCurveCreatorUiKeywords.h"
|
||||
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiFieldHandle.h"
|
||||
#include "cafPdmUiGroup.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
@@ -29,7 +32,8 @@
|
||||
#include <QSplitter>
|
||||
#include <QFrame>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -51,6 +55,17 @@ RicSummaryCurveCreatorSplitterUi::~RicSummaryCurveCreatorSplitterUi()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreatorSplitterUi::recursivelyConfigureAndUpdateTopLevelUiItems(const std::vector<caf::PdmUiItem *>& topLevelUiItems, const QString& uiConfigName)
|
||||
{
|
||||
RicSummaryCurveCreator* sumCurveCreator = dynamic_cast<RicSummaryCurveCreator*>(this->pdmItem());
|
||||
if (sumCurveCreator)
|
||||
{
|
||||
if (sumCurveCreator->isCloseButtonPressed())
|
||||
{
|
||||
sumCurveCreator->clearCloseButton();
|
||||
|
||||
emit signalCloseButtonPressed();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_layout) return;
|
||||
|
||||
int splitterPositionIndex = 0;
|
||||
@@ -77,24 +92,26 @@ void RicSummaryCurveCreatorSplitterUi::recursivelyConfigureAndUpdateTopLevelUiIt
|
||||
}
|
||||
|
||||
|
||||
m_lowerLeftLayout->insertWidget(0, getOrCreateCurveTreeWidget(), 1);
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = findGroupByKeyword(topLevelUiItems, RicSummaryCurveCreatorUiKeywords::appearance(), uiConfigName);
|
||||
|
||||
QMinimizePanel* groupBox = findOrCreateGroupBox(this->widget(), group, uiConfigName);
|
||||
|
||||
m_lowerLeftLayout->insertWidget(0, groupBox);
|
||||
m_lowerLeftLayout->insertWidget(1, groupBox);
|
||||
|
||||
const std::vector<caf::PdmUiItem*>& groupChildren = group->uiItems();
|
||||
recursivelyConfigureAndUpdateUiItemsInGridLayoutColumn(groupChildren, groupBox->contentFrame(), uiConfigName);
|
||||
}
|
||||
|
||||
|
||||
m_lowerLeftLayout->insertWidget(1, getOrCreateCurveTreeWidget());
|
||||
|
||||
m_secondRowLayout->insertWidget(1, getOrCreatePlotWidget());
|
||||
|
||||
// NB! Only groups at top level are handled, fields at top level are not added to layout
|
||||
|
||||
// Fields at bottom of dialog
|
||||
|
||||
configureAndUpdateFields(1, m_bottomFieldLayout, topLevelUiItems, uiConfigName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -125,6 +142,10 @@ QWidget* RicSummaryCurveCreatorSplitterUi::createWidget(QWidget* parent)
|
||||
|
||||
m_layout->addWidget(m_firstColumnSplitter);
|
||||
|
||||
m_bottomFieldLayout = new QHBoxLayout;
|
||||
m_layout->addLayout(m_bottomFieldLayout);
|
||||
m_bottomFieldLayout->insertStretch(0, 1);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
@@ -167,7 +188,8 @@ QWidget* RicSummaryCurveCreatorSplitterUi::getOrCreateCurveTreeWidget()
|
||||
RicSummaryCurveCreator* sumCurveCreator = dynamic_cast<RicSummaryCurveCreator*>(this->pdmItem());
|
||||
if (sumCurveCreator)
|
||||
{
|
||||
curveTreeView->setPdmItem(sumCurveCreator->previewPlot());
|
||||
RimSummaryCurveCollection* sumColl = sumCurveCreator->previewPlot()->summaryCurveCollection();
|
||||
curveTreeView->setPdmItem(sumColl);
|
||||
}
|
||||
|
||||
curveTreeView->treeView()->setHeaderHidden(true);
|
||||
@@ -192,3 +214,72 @@ QWidget* RicSummaryCurveCreatorSplitterUi::getOrCreatePlotWidget()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreatorSplitterUi::configureAndUpdateFields(int widgetStartIndex,
|
||||
QBoxLayout* layout,
|
||||
const std::vector<caf::PdmUiItem *>& uiItems,
|
||||
const QString& uiConfigName)
|
||||
{
|
||||
int currentWidgetIndex = widgetStartIndex;
|
||||
|
||||
for (size_t i = 0; i < uiItems.size(); ++i)
|
||||
{
|
||||
if (uiItems[i]->isUiHidden(uiConfigName)) continue;
|
||||
if (uiItems[i]->isUiGroup()) continue;
|
||||
|
||||
{
|
||||
caf::PdmUiFieldHandle* field = dynamic_cast<caf::PdmUiFieldHandle*>(uiItems[i]);
|
||||
|
||||
caf::PdmUiFieldEditorHandle* fieldEditor = findOrCreateFieldEditor(this->widget(), field, uiConfigName);
|
||||
|
||||
if (fieldEditor)
|
||||
{
|
||||
fieldEditor->setField(field);
|
||||
|
||||
// Place the widget(s) into the correct parent and layout
|
||||
QWidget* fieldCombinedWidget = fieldEditor->combinedWidget();
|
||||
|
||||
if (fieldCombinedWidget)
|
||||
{
|
||||
fieldCombinedWidget->setParent(this->widget());
|
||||
layout->insertWidget(currentWidgetIndex++, fieldCombinedWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::PdmUiItemInfo::LabelPosType labelPos = field->uiLabelPosition(uiConfigName);
|
||||
|
||||
QWidget* fieldEditorWidget = fieldEditor->editorWidget();
|
||||
|
||||
if (labelPos != caf::PdmUiItemInfo::HIDDEN)
|
||||
{
|
||||
QWidget* fieldLabelWidget = fieldEditor->labelWidget();
|
||||
if (fieldLabelWidget)
|
||||
{
|
||||
fieldLabelWidget->setParent(this->widget());
|
||||
|
||||
layout->insertWidget(currentWidgetIndex++, fieldLabelWidget);
|
||||
|
||||
fieldLabelWidget->show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QWidget* fieldLabelWidget = fieldEditor->labelWidget();
|
||||
if (fieldLabelWidget) fieldLabelWidget->hide();
|
||||
}
|
||||
|
||||
if (fieldEditorWidget)
|
||||
{
|
||||
fieldEditorWidget->setParent(this->widget()); // To make sure this widget has the current group box as parent.
|
||||
|
||||
layout->insertWidget(currentWidgetIndex++, fieldEditorWidget);
|
||||
}
|
||||
}
|
||||
|
||||
fieldEditor->updateUi(uiConfigName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,19 +24,26 @@
|
||||
|
||||
class RicSummaryCurveCreator;
|
||||
|
||||
class QHBoxLayout;
|
||||
class QMinimizePanel;
|
||||
class QSplitter;
|
||||
class QString;
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QBoxLayout;
|
||||
|
||||
namespace caf {
|
||||
class PdmUiItem;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSummaryCurveCreatorSplitterUi : public caf::PdmUiWidgetBasedObjectEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RicSummaryCurveCreatorSplitterUi(QWidget* parent);
|
||||
~RicSummaryCurveCreatorSplitterUi();
|
||||
@@ -54,6 +61,15 @@ private:
|
||||
const QString& keyword,
|
||||
const QString& uiConfigName);
|
||||
|
||||
void configureAndUpdateFields(int widgetStartIndex,
|
||||
QBoxLayout* layout,
|
||||
const std::vector<caf::PdmUiItem *>& topLevelUiItems,
|
||||
const QString& uiConfigName);
|
||||
|
||||
signals:
|
||||
void signalCloseButtonPressed();
|
||||
|
||||
|
||||
private:
|
||||
QPointer<QVBoxLayout> m_layout;
|
||||
QPointer<QSplitter> m_firstColumnSplitter;
|
||||
@@ -63,4 +79,6 @@ private:
|
||||
QPointer<QHBoxLayout> m_firstRowLayout;
|
||||
QPointer<QHBoxLayout> m_secondRowLayout;
|
||||
QPointer<QVBoxLayout> m_lowerLeftLayout;
|
||||
|
||||
QPointer<QHBoxLayout> m_bottomFieldLayout;
|
||||
};
|
||||
|
||||
@@ -15,6 +15,8 @@ ${CEE_CURRENT_LIST_DIR}RifEclipseUnifiedRestartFileAccess.h
|
||||
${CEE_CURRENT_LIST_DIR}RifPerforationIntervalReader.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderEclipseInput.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput.h
|
||||
${CEE_CURRENT_LIST_DIR}RifSummaryReaderInterface.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderObservedData.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderEclipseSummary.h
|
||||
${CEE_CURRENT_LIST_DIR}RifJsonEncodeDecode.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderInterface.h
|
||||
@@ -45,6 +47,8 @@ ${CEE_CURRENT_LIST_DIR}RifEclipseSummaryTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifPerforationIntervalReader.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderEclipseInput.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifSummaryReaderInterface.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderObservedData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderEclipseSummary.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifJsonEncodeDecode.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderInterface.cpp
|
||||
|
||||
@@ -191,6 +191,9 @@ std::string RifEclipseSummaryAddress::uiText(RifEclipseSummaryAddress::SummaryId
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEclipseSummaryAddress::formatUiTextIJK() const
|
||||
{
|
||||
return std::to_string(this->cellI()) + ", "
|
||||
@@ -198,7 +201,9 @@ std::string RifEclipseSummaryAddress::formatUiTextIJK() const
|
||||
+ std::to_string(this->cellK());
|
||||
}
|
||||
|
||||
// todo: Make class member
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::tuple<int, int, int> RifEclipseSummaryAddress::ijkTupleFromUiText(const std::string &s)
|
||||
{
|
||||
auto firstSep = s.find(',');
|
||||
|
||||
@@ -231,16 +231,6 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSu
|
||||
cellI, cellJ, cellK);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RifEclipseSummaryAddress>& RifReaderEclipseSummary::allResultAddresses()
|
||||
{
|
||||
buildMetaData();
|
||||
|
||||
return m_allResultAddresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -293,38 +283,6 @@ const std::vector<time_t>& RifReaderEclipseSummary::timeSteps() const
|
||||
return m_timeSteps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QDateTime> RifReaderEclipseSummary::fromTimeT(const std::vector<time_t>& timeSteps)
|
||||
{
|
||||
std::vector<QDateTime> a;
|
||||
|
||||
for (size_t i = 0; i < timeSteps.size(); i++)
|
||||
{
|
||||
QDateTime dt = QDateTime::fromTime_t(timeSteps[i]);
|
||||
a.push_back(dt);
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RifReaderEclipseSummary::indexFromAddress(const RifEclipseSummaryAddress& resultAddress)
|
||||
{
|
||||
this->buildMetaData();
|
||||
|
||||
auto it = m_resultAddressToErtNodeIdx.find(resultAddress);
|
||||
if (it != m_resultAddressToErtNodeIdx.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -343,17 +301,6 @@ void RifReaderEclipseSummary::buildMetaData()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderEclipseSummary::hasAddress(const RifEclipseSummaryAddress& resultAddress)
|
||||
{
|
||||
this->buildMetaData();
|
||||
|
||||
auto it = m_resultAddressToErtNodeIdx.find(resultAddress);
|
||||
|
||||
return (it != m_resultAddressToErtNodeIdx.end());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -34,30 +35,23 @@ class QDateTime;
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifReaderEclipseSummary : public cvf::Object
|
||||
class RifReaderEclipseSummary : public RifSummaryReaderInterface
|
||||
{
|
||||
public:
|
||||
RifReaderEclipseSummary();
|
||||
~RifReaderEclipseSummary();
|
||||
|
||||
bool open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames);
|
||||
virtual bool open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames) override;
|
||||
|
||||
bool hasAddress(const RifEclipseSummaryAddress& resultAddress);
|
||||
const std::vector<RifEclipseSummaryAddress>& allResultAddresses();
|
||||
const std::vector<time_t>& timeSteps() const;
|
||||
virtual const std::vector<time_t>& timeSteps() const override;
|
||||
|
||||
bool values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values);
|
||||
std::string unitName(const RifEclipseSummaryAddress& resultAddress);
|
||||
virtual bool values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) override;
|
||||
std::string unitName(const RifEclipseSummaryAddress& resultAddress) override;
|
||||
|
||||
// TODO: Move this to a tools class with static members
|
||||
static std::vector<QDateTime> fromTimeT(const std::vector<time_t>& timeSteps);
|
||||
|
||||
private:
|
||||
virtual int timeStepCount() const override;
|
||||
|
||||
int timeStepCount() const;
|
||||
int indexFromAddress(const RifEclipseSummaryAddress& resultAddress);
|
||||
|
||||
void buildMetaData();
|
||||
virtual void buildMetaData() override;
|
||||
private:
|
||||
// Taken from ecl_sum.h
|
||||
typedef struct ecl_sum_struct ecl_sum_type;
|
||||
@@ -66,9 +60,5 @@ private:
|
||||
ecl_sum_type* m_ecl_sum;
|
||||
const ecl_smspec_type * m_ecl_SmSpec;
|
||||
std::vector<time_t> m_timeSteps;
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> m_allResultAddresses;
|
||||
std::map<RifEclipseSummaryAddress, int> m_resultAddressToErtNodeIdx;
|
||||
|
||||
};
|
||||
|
||||
|
||||
94
ApplicationCode/FileInterface/RifReaderObservedData.cpp
Normal file
94
ApplicationCode/FileInterface/RifReaderObservedData.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RifReaderObservedData.h"
|
||||
|
||||
#include "ert/ecl/ecl_sum.h"
|
||||
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include "ert/ecl/smspec_node.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderObservedData::RifReaderObservedData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderObservedData::~RifReaderObservedData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderObservedData::open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderObservedData::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RifReaderObservedData::timeStepCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<time_t>& RifReaderObservedData::timeSteps() const
|
||||
{
|
||||
std::vector<time_t> steps;
|
||||
return steps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderObservedData::buildMetaData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifReaderObservedData::unitName(const RifEclipseSummaryAddress& resultAddress)
|
||||
{
|
||||
std::string str = "";
|
||||
return str;
|
||||
}
|
||||
59
ApplicationCode/FileInterface/RifReaderObservedData.h
Normal file
59
ApplicationCode/FileInterface/RifReaderObservedData.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RifEclipseSummaryAddress.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
|
||||
class QDateTime;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifReaderObservedData : public RifSummaryReaderInterface
|
||||
{
|
||||
public:
|
||||
RifReaderObservedData();
|
||||
~RifReaderObservedData();
|
||||
|
||||
virtual bool open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames) override;
|
||||
|
||||
virtual const std::vector<time_t>& timeSteps() const override;
|
||||
|
||||
virtual bool values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) override;
|
||||
std::string unitName(const RifEclipseSummaryAddress& resultAddress) override;
|
||||
|
||||
private:
|
||||
virtual int timeStepCount() const override;
|
||||
|
||||
virtual void buildMetaData() override;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
78
ApplicationCode/FileInterface/RifSummaryReaderInterface.cpp
Normal file
78
ApplicationCode/FileInterface/RifSummaryReaderInterface.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RifSummaryReaderInterface.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RifEclipseSummaryAddress>& RifSummaryReaderInterface::allResultAddresses()
|
||||
{
|
||||
this->buildMetaData();
|
||||
|
||||
return m_allResultAddresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QDateTime> RifSummaryReaderInterface::fromTimeT(const std::vector<time_t>& timeSteps)
|
||||
{
|
||||
std::vector<QDateTime> a;
|
||||
|
||||
for (size_t i = 0; i < timeSteps.size(); i++)
|
||||
{
|
||||
QDateTime dt = QDateTime::fromTime_t(timeSteps[i]);
|
||||
a.push_back(dt);
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RifSummaryReaderInterface::indexFromAddress(const RifEclipseSummaryAddress& resultAddress)
|
||||
{
|
||||
this->buildMetaData();
|
||||
|
||||
auto it = m_resultAddressToErtNodeIdx.find(resultAddress);
|
||||
if (it != m_resultAddressToErtNodeIdx.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifSummaryReaderInterface::hasAddress(const RifEclipseSummaryAddress& resultAddress)
|
||||
{
|
||||
this->buildMetaData();
|
||||
|
||||
auto it = m_resultAddressToErtNodeIdx.find(resultAddress);
|
||||
|
||||
return (it != m_resultAddressToErtNodeIdx.end());
|
||||
}
|
||||
63
ApplicationCode/FileInterface/RifSummaryReaderInterface.h
Normal file
63
ApplicationCode/FileInterface/RifSummaryReaderInterface.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
|
||||
class QDateTime;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RifSummaryReaderInterface : public cvf::Object
|
||||
{
|
||||
public:
|
||||
virtual bool open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames) = 0;
|
||||
|
||||
bool hasAddress(const RifEclipseSummaryAddress& resultAddress);
|
||||
const std::vector<RifEclipseSummaryAddress>& allResultAddresses();
|
||||
virtual const std::vector<time_t>& timeSteps() const = 0;
|
||||
|
||||
virtual bool values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) = 0;
|
||||
virtual std::string unitName(const RifEclipseSummaryAddress& resultAddress) = 0;
|
||||
|
||||
// TODO: Move this to a tools class with static members
|
||||
static std::vector<QDateTime> fromTimeT(const std::vector<time_t>& timeSteps);
|
||||
|
||||
protected:
|
||||
|
||||
virtual int timeStepCount() const = 0;
|
||||
int indexFromAddress(const RifEclipseSummaryAddress& resultAddress);
|
||||
|
||||
virtual void buildMetaData() = 0;
|
||||
|
||||
protected:
|
||||
std::vector<RifEclipseSummaryAddress> m_allResultAddresses;
|
||||
std::map<RifEclipseSummaryAddress, int> m_resultAddressToErtNodeIdx;
|
||||
};
|
||||
|
||||
@@ -90,6 +90,9 @@ ${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimDialogData.h
|
||||
${CEE_CURRENT_LIST_DIR}RimTimeStepFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimObservedData.h
|
||||
${CEE_CURRENT_LIST_DIR}RimObservedDataCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryObservedDataFile.h
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
@@ -185,6 +188,9 @@ ${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimDialogData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimTimeStepFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimObservedData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimObservedDataCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryObservedDataFile.cpp
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimFault.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimObservedData.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
@@ -322,7 +323,10 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSummaryPlotFeature";
|
||||
if (!dynamic_cast<RimObservedData*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSummaryPlotFeature";
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
||||
{
|
||||
@@ -445,14 +449,16 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicFlyToObjectFeature";
|
||||
commandIds << "RicExportCarfin";
|
||||
|
||||
commandIds << "RicImportObservedDataFeature";
|
||||
commandIds << "RicPasteSummaryCaseFeature";
|
||||
commandIds << "RicReloadSummaryCaseFeature";
|
||||
commandIds << "RicCreateSummaryCaseCollectionFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCutReferencesToClipboardFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCloseSummaryCaseFeature";
|
||||
commandIds << "RicCloseSummaryCaseInCollectionFeature";
|
||||
commandIds << "RicDeleteSummaryCaseCollectionFeature";
|
||||
commandIds << "RicCutReferencesToClipboardFeature";
|
||||
|
||||
// Fracture commands
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
61
ApplicationCode/ProjectDataModel/RimObservedData.cpp
Normal file
61
ApplicationCode/ProjectDataModel/RimObservedData.cpp
Normal file
@@ -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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimObservedData.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimObservedData, "ObservedData");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimObservedData::RimObservedData()
|
||||
{
|
||||
m_isObservedData = true;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_summaryCategory, "SummaryType", "Summary Type", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_identifierName, "IdentifierName", "Identifier Name", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimObservedData::summaryHeaderFilename() const
|
||||
{
|
||||
return m_summaryHeaderFilename();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimObservedData::caseName()
|
||||
{
|
||||
QFileInfo caseFileName(this->summaryHeaderFilename());
|
||||
|
||||
return caseFileName.completeBaseName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimObservedData::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
|
||||
{
|
||||
m_summaryHeaderFilename = RimTools::relocateFile(m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr);
|
||||
}
|
||||
46
ApplicationCode/ProjectDataModel/RimObservedData.h
Normal file
46
ApplicationCode/ProjectDataModel/RimObservedData.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSummaryCase.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimObservedData : public RimSummaryCase
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimObservedData();
|
||||
|
||||
virtual QString summaryHeaderFilename() const override;
|
||||
virtual QString caseName() override;
|
||||
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory> > m_summaryCategory;
|
||||
caf::PdmField<QString> m_identifierName;
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimObservedDataCollection.h"
|
||||
#include "RimObservedData.h"
|
||||
#include "RimSummaryObservedDataFile.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimObservedDataCollection, "ObservedDataCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimObservedDataCollection::RimObservedDataCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Observed Data", ":/Folder.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_observedDataArray, "ObservedDataArray", "", "", "", "");
|
||||
|
||||
m_observedDataArray.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimObservedDataCollection::~RimObservedDataCollection()
|
||||
{
|
||||
m_observedDataArray.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimObservedDataCollection::removeObservedData(RimObservedData* observedData)
|
||||
{
|
||||
m_observedDataArray.removeChildObject(observedData);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimObservedDataCollection::addObservedData(RimObservedData* observedData)
|
||||
{
|
||||
m_observedDataArray.push_back(observedData);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryObservedDataFile* RimObservedDataCollection::createAndAddObservedDataFromFileName(const QString& fileName)
|
||||
{
|
||||
RimSummaryObservedDataFile* newObservedData = new RimSummaryObservedDataFile();
|
||||
|
||||
this->m_observedDataArray.push_back(newObservedData);
|
||||
newObservedData->setSummaryHeaderFilename(fileName);
|
||||
newObservedData->updateOptionSensitivity();
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
return newObservedData;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimObservedData*> RimObservedDataCollection::allObservedData()
|
||||
{
|
||||
std::vector<RimObservedData*> allObservedData;
|
||||
|
||||
allObservedData.insert(allObservedData.begin(), m_observedDataArray.begin(), m_observedDataArray.end());
|
||||
|
||||
return allObservedData;
|
||||
}
|
||||
45
ApplicationCode/ProjectDataModel/RimObservedDataCollection.h
Normal file
45
ApplicationCode/ProjectDataModel/RimObservedDataCollection.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
class RimObservedData;
|
||||
class RimSummaryObservedDataFile;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimObservedDataCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimObservedDataCollection();
|
||||
virtual ~RimObservedDataCollection();
|
||||
|
||||
void removeObservedData(RimObservedData* observedData);
|
||||
void addObservedData(RimObservedData* observedData);
|
||||
RimSummaryObservedDataFile* createAndAddObservedDataFromFileName(const QString& fileName);
|
||||
std::vector<RimObservedData*> allObservedData();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimObservedData*> m_observedDataArray;
|
||||
};
|
||||
@@ -28,6 +28,9 @@
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
#include "RimGeoMechModels.h"
|
||||
#include "RimObservedData.h"
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
@@ -50,6 +53,7 @@ RimOilField::RimOilField(void)
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&summaryCaseMainCollection,"SummaryCaseCollection","Summary Cases",":/GridModels.png","","");
|
||||
CAF_PDM_InitFieldNoDefault(&formationNamesCollection,"FormationNamesCollection","Formations","","","");
|
||||
CAF_PDM_InitFieldNoDefault(&observedDataCollection, "ObservedDataCollection", "Observed data", ":/Cases16x16.png", "", "");
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
fractureDefinitionCollection = new RimFractureTemplateCollection();
|
||||
@@ -58,6 +62,7 @@ RimOilField::RimOilField(void)
|
||||
analysisModels = new RimEclipseCaseCollection();
|
||||
wellPathCollection = new RimWellPathCollection();
|
||||
summaryCaseMainCollection = new RimSummaryCaseMainCollection();
|
||||
observedDataCollection = new RimObservedDataCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -75,5 +80,74 @@ RimOilField::~RimOilField(void)
|
||||
if (analysisModels()) delete analysisModels();
|
||||
if (summaryCaseMainCollection()) delete summaryCaseMainCollection();
|
||||
if (formationNamesCollection()) delete formationNamesCollection();
|
||||
if (observedDataCollection()) delete observedDataCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimOilField::uniqueShortNameForCase(RimSummaryCase* summaryCase)
|
||||
{
|
||||
std::set<QString> allAutoShortNames;
|
||||
|
||||
std::vector<RimSummaryCase*> allCases = summaryCaseMainCollection->allSummaryCases();
|
||||
std::vector<RimObservedData*> observedDataCases = observedDataCollection->allObservedData();
|
||||
|
||||
for (RimObservedData* observedData : observedDataCases)
|
||||
{
|
||||
allCases.push_back(dynamic_cast<RimSummaryCase*>(observedData));
|
||||
}
|
||||
|
||||
for (RimSummaryCase* sumCase : allCases)
|
||||
{
|
||||
if (sumCase && sumCase != summaryCase)
|
||||
{
|
||||
allAutoShortNames.insert(sumCase->shortName());
|
||||
}
|
||||
}
|
||||
|
||||
bool foundUnique = false;
|
||||
|
||||
QString caseName = summaryCase->caseName();
|
||||
QString shortName;
|
||||
|
||||
if (caseName.size() > 2)
|
||||
{
|
||||
QString candidate;
|
||||
candidate += caseName[0];
|
||||
|
||||
for (int i = 1; i < caseName.size(); ++i)
|
||||
{
|
||||
if (allAutoShortNames.count(candidate + caseName[i]) == 0)
|
||||
{
|
||||
shortName = candidate + caseName[i];
|
||||
foundUnique = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shortName = caseName.left(2);
|
||||
if (allAutoShortNames.count(shortName) == 0)
|
||||
{
|
||||
foundUnique = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString candidate = shortName;
|
||||
int autoNumber = 0;
|
||||
|
||||
while (!foundUnique)
|
||||
{
|
||||
candidate = shortName + QString::number(autoNumber++);
|
||||
if (allAutoShortNames.count(candidate) == 0)
|
||||
{
|
||||
shortName = candidate;
|
||||
foundUnique = true;
|
||||
}
|
||||
}
|
||||
|
||||
return shortName;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimEclipseCaseCollection;
|
||||
class RimGeoMechModels;
|
||||
class RimWellPathCollection;
|
||||
class RimFractureTemplateCollection;
|
||||
class RimSummaryCaseMainCollection;
|
||||
class RimFormationNamesCollection;
|
||||
class RimFractureTemplateCollection;
|
||||
class RimGeoMechModels;
|
||||
class RimObservedDataCollection;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseMainCollection;
|
||||
class RimWellPathCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -44,11 +46,14 @@ public:
|
||||
RimOilField(void);
|
||||
virtual ~RimOilField(void);
|
||||
|
||||
QString uniqueShortNameForCase(RimSummaryCase* summaryCase);
|
||||
|
||||
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
|
||||
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
|
||||
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
|
||||
caf::PdmChildField<RimFractureTemplateCollection*> fractureDefinitionCollection;
|
||||
caf::PdmChildField<RimSummaryCaseMainCollection*> summaryCaseMainCollection;
|
||||
caf::PdmChildField<RimObservedDataCollection*> observedDataCollection;
|
||||
caf::PdmChildField<RimFormationNamesCollection*> formationNamesCollection;
|
||||
|
||||
};
|
||||
|
||||
@@ -272,6 +272,14 @@ bool RimPlotCurve::isCurveVisible() const
|
||||
return m_showCurve;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setCurveVisiblity(bool visible)
|
||||
{
|
||||
m_showCurve = visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -472,6 +480,18 @@ void RimPlotCurve::setLineThickness(int thickness)
|
||||
m_curveThickness = thickness;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::resetAppearance()
|
||||
{
|
||||
setColor(cvf::Color3f(cvf::Color3::BLACK));
|
||||
setLineThickness(2);
|
||||
setLineStyle(STYLE_SOLID);
|
||||
setSymbol(SYMBOL_NONE);
|
||||
setSymbolSkipDinstance(10);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -80,9 +80,10 @@ public:
|
||||
void setSymbol(PointSymbolEnum symbolStyle);
|
||||
void setSymbolSkipDinstance(float distance);
|
||||
void setLineThickness(int thickness);
|
||||
|
||||
void resetAppearance();
|
||||
bool isCurveVisible() const;
|
||||
|
||||
void setCurveVisiblity(bool visible);
|
||||
|
||||
void updateCurveName();
|
||||
QString curveName() const { return m_curveName; }
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimMultiSnapshotDefinition.h"
|
||||
#include "RimObservedDataCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
@@ -548,6 +549,24 @@ void RimProject::allSummaryCases(std::vector<RimSummaryCase*>& sumCases)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::allObservedData(std::vector<RimObservedData*>& observedData)
|
||||
{
|
||||
for (RimOilField* oilField : oilFields)
|
||||
{
|
||||
if (!oilField) continue;
|
||||
RimObservedDataCollection* observedDataCollection = oilField->observedDataCollection();
|
||||
if (observedDataCollection)
|
||||
{
|
||||
observedData.clear();
|
||||
std::vector<RimObservedData*> allObservedData = observedDataCollection->allObservedData();
|
||||
observedData.insert(observedData.end(), allObservedData.begin(), allObservedData.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -630,6 +649,18 @@ void RimProject::createDisplayModelAndRedrawAllViews()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::allOilFields(std::vector<RimOilField*>& oilFields)
|
||||
{
|
||||
oilFields.clear();
|
||||
for (const auto& oilField : this->oilFields)
|
||||
{
|
||||
oilFields.push_back(oilField);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Currently there will be only one oil field in Resinsight, so return hardcoded first oil field
|
||||
/// from the RimOilField collection.
|
||||
@@ -855,7 +886,14 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
||||
RimOilField* oilField = activeOilField();
|
||||
if (oilField)
|
||||
{
|
||||
if (oilField->summaryCaseMainCollection()) uiTreeOrdering.add(oilField->summaryCaseMainCollection());
|
||||
if (oilField->summaryCaseMainCollection())
|
||||
{
|
||||
uiTreeOrdering.add( oilField->summaryCaseMainCollection() );
|
||||
}
|
||||
if (oilField->observedDataCollection())
|
||||
{
|
||||
uiTreeOrdering.add( oilField->observedDataCollection() );
|
||||
}
|
||||
}
|
||||
|
||||
if (mainPlotCollection)
|
||||
|
||||
@@ -38,7 +38,8 @@ class RimDialogData;
|
||||
class RimEclipseCase;
|
||||
class RimIdenticalGridCaseGroup;
|
||||
class RimMainPlotCollection;
|
||||
class RimMultiSnapshotDefinition;
|
||||
class RimMultiSnapshotDefinition;
|
||||
class RimObservedData;
|
||||
class RimOilField;
|
||||
class RimScriptCollection;
|
||||
class RimSummaryCase;
|
||||
@@ -94,6 +95,7 @@ public:
|
||||
|
||||
void allCases(std::vector<RimCase*>& cases);
|
||||
void allSummaryCases(std::vector<RimSummaryCase*>& sumCases);
|
||||
void allObservedData(std::vector<RimObservedData*>& observedData);
|
||||
void allNotLinkedViews(std::vector<RimView*>& views);
|
||||
void allVisibleViews(std::vector<RimView*>& views);
|
||||
|
||||
@@ -101,8 +103,9 @@ public:
|
||||
|
||||
void computeUtmAreaOfInterest();
|
||||
|
||||
RimOilField* activeOilField();
|
||||
const RimOilField* activeOilField() const;
|
||||
void allOilFields(std::vector<RimOilField*>& oilFields);
|
||||
RimOilField* activeOilField();
|
||||
const RimOilField* activeOilField() const;
|
||||
|
||||
void actionsBasedOnSelection(QMenu& contextMenu);
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSummaryObservedDataFile.h"
|
||||
|
||||
#include "RigObservedData.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryObservedDataFile, "SummaryObservedDataFile");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryObservedDataFile::RimSummaryObservedDataFile()
|
||||
{
|
||||
CAF_PDM_InitObject("Observed data file", ":/Default.png", "", "");
|
||||
m_summaryHeaderFilename.uiCapability()->setUiName("File");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryObservedDataFile::~RimSummaryObservedDataFile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryObservedDataFile::setSummaryHeaderFilename(const QString& fileName)
|
||||
{
|
||||
m_summaryHeaderFilename = fileName;
|
||||
|
||||
this->updateAutoShortName();
|
||||
this->updateTreeItemName();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimObservedData.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimSummaryObservedDataFile : public RimObservedData
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimSummaryObservedDataFile();
|
||||
virtual ~RimSummaryObservedDataFile();
|
||||
|
||||
void setSummaryHeaderFilename(const QString& fileName);
|
||||
};
|
||||
@@ -19,13 +19,15 @@
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include "RigSummaryCaseData.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT(RimSummaryCase,"SummaryCase");
|
||||
|
||||
@@ -41,6 +43,8 @@ RimSummaryCase::RimSummaryCase()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_summaryHeaderFilename, "SummaryHeaderFilename", "Summary Header File", "", "", "");
|
||||
m_summaryHeaderFilename.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
m_isObservedData = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -78,6 +82,14 @@ RigSummaryCaseData* RimSummaryCase::caseData()
|
||||
return m_summaryCaseData.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCase::isObservedData()
|
||||
{
|
||||
return m_isObservedData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -147,16 +159,16 @@ void RimSummaryCase::updateAutoShortName()
|
||||
{
|
||||
if(m_useAutoShortName)
|
||||
{
|
||||
RimSummaryCaseMainCollection* summaryCaseMainCollection = NULL;
|
||||
this->firstAncestorOrThisOfType(summaryCaseMainCollection);
|
||||
CVF_ASSERT(summaryCaseMainCollection);
|
||||
RimOilField* oilField = NULL;
|
||||
this->firstAncestorOrThisOfType(oilField);
|
||||
CVF_ASSERT(oilField);
|
||||
|
||||
m_shortName = summaryCaseMainCollection->uniqueShortNameForCase(this);
|
||||
updateTreeItemName();
|
||||
m_shortName = oilField->uniqueShortNameForCase(this);
|
||||
}
|
||||
else if (m_shortName() == QString("Display Name"))
|
||||
{
|
||||
m_shortName = caseName();
|
||||
updateTreeItemName();
|
||||
}
|
||||
|
||||
updateTreeItemName();
|
||||
}
|
||||
|
||||
@@ -51,14 +51,16 @@ public:
|
||||
|
||||
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) = 0;
|
||||
|
||||
bool isObservedData();
|
||||
|
||||
protected:
|
||||
void updateTreeItemName();
|
||||
|
||||
caf::PdmField<QString> m_shortName;
|
||||
caf::PdmField<bool> m_useAutoShortName;
|
||||
caf::PdmField<QString> m_summaryHeaderFilename;
|
||||
|
||||
cvf::ref<RigSummaryCaseData> m_summaryCaseData;
|
||||
caf::PdmField<QString> m_shortName;
|
||||
caf::PdmField<bool> m_useAutoShortName;
|
||||
caf::PdmField<QString> m_summaryHeaderFilename;
|
||||
cvf::ref<RigSummaryCaseData> m_summaryCaseData;
|
||||
bool m_isObservedData;
|
||||
|
||||
private:
|
||||
// Overridden PDM methods
|
||||
|
||||
@@ -35,7 +35,8 @@ public:
|
||||
void removeCase(RimSummaryCase* summaryCase);
|
||||
void addCase(RimSummaryCase* summaryCase);
|
||||
|
||||
std::vector<RimSummaryCase*> allSummaryCases();
|
||||
std::vector<RimSummaryCase*> allSummaryCases();
|
||||
QString name() const { return m_name; }
|
||||
|
||||
private:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
@@ -225,6 +225,32 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::allSummaryCases()
|
||||
return cases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::topLevelSummaryCases() const
|
||||
{
|
||||
std::vector<RimSummaryCase*> cases;
|
||||
for (const auto& sumCase : m_cases)
|
||||
{
|
||||
cases.push_back(sumCase);
|
||||
}
|
||||
return cases;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCaseCollection*> RimSummaryCaseMainCollection::summaryCaseCollections() const
|
||||
{
|
||||
std::vector<RimSummaryCaseCollection*> summaryCaseCollections;
|
||||
for (const auto& caseColl : m_caseCollections)
|
||||
{
|
||||
summaryCaseCollections.push_back(caseColl);
|
||||
}
|
||||
return summaryCaseCollections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -39,8 +39,10 @@ public:
|
||||
RimSummaryCase* summaryCase(size_t idx);
|
||||
size_t summaryCaseCount() const;
|
||||
|
||||
std::vector<RimSummaryCase*> allSummaryCases();
|
||||
|
||||
std::vector<RimSummaryCase*> allSummaryCases();
|
||||
std::vector<RimSummaryCase*> topLevelSummaryCases() const;
|
||||
std::vector<RimSummaryCaseCollection*> summaryCaseCollections() const;
|
||||
|
||||
void createSummaryCasesFromRelevantEclipseResultCases();
|
||||
RimSummaryCase* createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase);
|
||||
RimSummaryCase* createAndAddSummaryCaseFromFileName(const QString& fileName);
|
||||
|
||||
@@ -201,7 +201,7 @@ void RimSummaryCurve::setSummaryCase(RimSummaryCase* sumCase)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimSummaryCurve::summaryCase()
|
||||
RimSummaryCase* RimSummaryCurve::summaryCase() const
|
||||
{
|
||||
return m_summaryCase();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
virtual ~RimSummaryCurve();
|
||||
|
||||
void setSummaryCase(RimSummaryCase* sumCase);
|
||||
RimSummaryCase* summaryCase();
|
||||
RimSummaryCase* summaryCase() const;
|
||||
|
||||
RifEclipseSummaryAddress summaryAddress();
|
||||
void setSummaryAddress(const RifEclipseSummaryAddress& address);
|
||||
|
||||
@@ -176,6 +176,14 @@ void RimSummaryCurveCollection::deleteCurvesAssosiatedWithCase(RimSummaryCase* s
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::deleteAllCurves()
|
||||
{
|
||||
m_curves.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
std::vector<RimSummaryCurve*> curves();
|
||||
void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase);
|
||||
|
||||
void deleteAllCurves();
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
private:
|
||||
|
||||
@@ -453,21 +453,23 @@ QString RimSummaryPlot::asciiDataForPlotExport() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCurve*> RimSummaryPlot::summaryCurves() const
|
||||
{
|
||||
std::vector<RimSummaryCurve*> curves;
|
||||
curves.reserve(m_summaryCurves.size());
|
||||
for (const auto& curve : m_summaryCurveCollection->curves())
|
||||
{
|
||||
curves.push_back(curve);
|
||||
}
|
||||
return curves;
|
||||
return m_summaryCurveCollection->curves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::deleteAllCurves()
|
||||
void RimSummaryPlot::deleteAllSummaryCurves()
|
||||
{
|
||||
m_summaryCurveCollection->curves().clear();
|
||||
m_summaryCurveCollection->deleteAllCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCurveCollection* RimSummaryPlot::summaryCurveCollection() const
|
||||
{
|
||||
return m_summaryCurveCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -100,8 +100,8 @@ public:
|
||||
QString asciiDataForPlotExport() const;
|
||||
|
||||
std::vector<RimSummaryCurve*> summaryCurves() const;
|
||||
void deleteAllCurves();
|
||||
|
||||
void deleteAllSummaryCurves();
|
||||
RimSummaryCurveCollection* summaryCurveCollection() const;
|
||||
// RimViewWindow overrides
|
||||
public:
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
|
||||
@@ -130,3 +130,17 @@ void RimSummaryPlotCollection::updateSummaryNameHasChanged()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::summaryPlotItemInfos(QList<caf::PdmOptionItemInfo>* optionInfos) const
|
||||
{
|
||||
for (RimSummaryPlot* plot : summaryPlots())
|
||||
{
|
||||
QIcon icon = plot->uiCapability()->uiIcon();
|
||||
QString displayName = plot->description();
|
||||
|
||||
optionInfos->push_back(caf::PdmOptionItemInfo(displayName, plot, false, icon));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ public:
|
||||
caf::PdmChildArrayField<RimSummaryPlot*> summaryPlots;
|
||||
|
||||
void updateSummaryNameHasChanged();
|
||||
|
||||
void summaryPlotItemInfos(QList<caf::PdmOptionItemInfo>* optionInfos) const;
|
||||
|
||||
private:
|
||||
RifReaderEclipseSummary* createSummaryFileReader(const QString& eclipseCaseFilePathBasename);
|
||||
RifReaderEclipseSummary* getOrCreateSummaryFileReader(const QString& eclipseCaseFilePathBasename);
|
||||
|
||||
@@ -53,6 +53,7 @@ ${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h
|
||||
${CEE_CURRENT_LIST_DIR}RigObservedData.h
|
||||
${CEE_CURRENT_LIST_DIR}RigLasFileExporter.h
|
||||
${CEE_CURRENT_LIST_DIR}RigSimulationWellCoordsAndMD.h
|
||||
${CEE_CURRENT_LIST_DIR}RigFishbonesGeometry.h
|
||||
@@ -123,6 +124,7 @@ ${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigObservedData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigLasFileExporter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigSimulationWellCoordsAndMD.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigFishbonesGeometry.cpp
|
||||
|
||||
46
ApplicationCode/ReservoirDataModel/RigObservedData.cpp
Normal file
46
ApplicationCode/ReservoirDataModel/RigObservedData.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RigObservedData.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigObservedData::RigObservedData(const QString& observedDataFileName)
|
||||
{
|
||||
openOrReloadCase(observedDataFileName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigObservedData::~RigObservedData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigObservedData::openOrReloadCase(const QString& observedDataFileName)
|
||||
{
|
||||
|
||||
}
|
||||
35
ApplicationCode/ReservoirDataModel/RigObservedData.h
Normal file
35
ApplicationCode/ReservoirDataModel/RigObservedData.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
class QString;
|
||||
|
||||
class RigObservedData: public cvf::Object
|
||||
{
|
||||
public:
|
||||
explicit RigObservedData(const QString& observedDataFileName );
|
||||
~RigObservedData();
|
||||
|
||||
void openOrReloadCase(const QString& observedDataFileName);
|
||||
|
||||
private:
|
||||
};
|
||||
@@ -184,6 +184,7 @@ void RiuMainPlotWindow::createMenus()
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicImportEclipseCaseFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicImportInputEclipseCaseFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicImportSummaryCaseFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicImportObservedDataInMenuFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicCreateGridCaseGroupFeature"));
|
||||
importMenu->addSeparator();
|
||||
#ifdef USE_ODB_API
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
#include "SummaryPlotCommands/RicEditSummaryCurves.h"
|
||||
|
||||
#include "cvfTimer.h"
|
||||
|
||||
@@ -183,6 +184,12 @@ void RiuMainWindow::cleanupGuiCaseClose()
|
||||
}
|
||||
}
|
||||
m_processMonitor->startMonitorWorkProcess(NULL);
|
||||
|
||||
RicEditSummaryCurves* editSumCurves = dynamic_cast<RicEditSummaryCurves*>(caf::CmdFeatureManager::instance()->getCommandFeature("RicEditSummaryCurves"));
|
||||
if (editSumCurves)
|
||||
{
|
||||
editSumCurves->closeDialogAndResetTargetPlot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user