mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
1352 lines
61 KiB
C++
1352 lines
61 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2016 Statoil ASA
|
|
//
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "RicSummaryCurveCreator.h"
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RicSelectSummaryPlotUI.h"
|
|
#include "RicSummaryCurveCreatorUiKeywords.h"
|
|
|
|
#include "RifReaderEclipseSummary.h"
|
|
|
|
#include "RimMainPlotCollection.h"
|
|
#include "RimObservedData.h"
|
|
#include "RimObservedDataCollection.h"
|
|
#include "RimOilField.h"
|
|
#include "RimProject.h"
|
|
#include "RimSummaryCase.h"
|
|
#include "RimSummaryCaseCollection.h"
|
|
#include "RimSummaryCaseMainCollection.h"
|
|
#include "RimSummaryCurve.h"
|
|
#include "RimSummaryCurveAutoName.h"
|
|
#include "RimSummaryCurveCollection.h"
|
|
#include "RimSummaryPlot.h"
|
|
#include "RimSummaryPlotCollection.h"
|
|
|
|
#include "RiuMainPlotWindow.h"
|
|
#include "RiuSummaryQwtPlot.h"
|
|
|
|
#include "cafPdmUiComboBoxEditor.h"
|
|
#include "cafPdmUiListEditor.h"
|
|
#include "cafPdmUiPushButtonEditor.h"
|
|
#include "cafPdmUiTreeSelectionEditor.h"
|
|
|
|
#include <QInputDialog>
|
|
|
|
#include <algorithm>
|
|
#include <sstream>
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RicSummaryCurveCreator, "RicSummaryCurveCreator");
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
|
{
|
|
{ RifEclipseSummaryAddress::SUMMARY_FIELD, {
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_AQUIFER, {
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_NETWORK, {
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_MISC, {
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_REGION,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_REGION_NUMBER) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_REGION_2_REGION) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_WELL_GROUP,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_WELL_GROUP_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_WELL,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_WELL_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_WELL_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_LGR_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_WELL_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_WELL_LGR,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_LGR_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_WELL_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_WELL_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_SEGMENT_NUMBER) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_BLOCK,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} },
|
|
{ RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR,{
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_LGR_NAME) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_CELL_IJK) },
|
|
{ new SummaryIdentifierAndField(RifEclipseSummaryAddress::INPUT_VECTOR_NAME) }
|
|
} }
|
|
})
|
|
{
|
|
CAF_PDM_InitFieldNoDefault(&m_selectedCases, "SummaryCases", "Cases", "", "", "");
|
|
|
|
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", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_AQUIFER][0]->pdmField(), "AquiferVectors", "Aquifer Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_NETWORK][0]->pdmField(), "NetworkVectors", "Network Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_MISC][0]->pdmField(), "MiscVectors", "Misc Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION][0]->pdmField(), "Regions", "Regions", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION][1]->pdmField(), "RegionsVectors", "Regions Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION][0]->pdmField(), "Region2RegionRegions", "Regions", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION][1]->pdmField(), "Region2RegionVectors", "Region2s Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][0]->pdmField(), "WellGroupWellGroupNames", "Well groups", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][1]->pdmField(), "WellGroupVectors", "Well Group Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL][0]->pdmField(), "WellWellName", "Wells", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL][1]->pdmField(), "WellVectors", "Well Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][0]->pdmField(), "WellCompletionWellName", "Wells", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][1]->pdmField(), "WellCompletionIjk", "Cell IJK", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][2]->pdmField(), "WellCompletionVectors", "Well Completion Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][0]->pdmField(), "WellCompletionLgrLgrName", "LGR Names", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][1]->pdmField(), "WellCompletionLgrWellName", "Wells", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][2]->pdmField(), "WellCompletionLgrIjk", "Cell IJK", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][3]->pdmField(), "WellCompletionLgrVectors", "Well Completion Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][0]->pdmField(), "WellLgrLgrName", "LGR Names", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][1]->pdmField(), "WellLgrWellName", "Wells", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][2]->pdmField(), "WellLgrVectors", "Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][0]->pdmField(), "WellSegmentWellName", "Wells", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][1]->pdmField(), "WellSegmentNumber", "Segments", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][2]->pdmField(), "WellSegmentVectors", "Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK][0]->pdmField(), "BlockIjk", "Cell IJK", "", "", "");
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK][1]->pdmField(), "BlockVectors", "Block Vectors", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][0]->pdmField(), "BlockLgrLgrName", "LGR Names", "", "", "");
|
|
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_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", "", "", "");
|
|
|
|
m_previewPlot = new RimSummaryPlot();
|
|
m_previewPlot->setShowDescription(false);
|
|
|
|
for (const auto& itemTypes : m_identifierFieldsMap)
|
|
{
|
|
for (const auto& itemInputType : itemTypes.second)
|
|
{
|
|
itemInputType->pdmField()->uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
|
|
|
itemInputType->pdmField()->uiCapability()->setUiLabelPosition(itemTypes.second.size() > 2 ?
|
|
caf::PdmUiItemInfo::TOP : caf::PdmUiItemInfo::HIDDEN);
|
|
|
|
itemInputType->pdmField()->uiCapability()->setAutoAddingOptionFromValue(false);
|
|
}
|
|
itemTypes.second.back()->pdmField()->uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
|
}
|
|
|
|
m_selectedCases.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
|
m_selectedCases.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
|
m_selectedCases.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
|
|
|
m_selectedSummaryCategories.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
|
m_selectedSummaryCategories.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
|
|
|
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_InitFieldNoDefault(&m_okButtonField, "OK", "", "", "", "");
|
|
m_okButtonField = false;
|
|
m_okButtonField.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
|
m_okButtonField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
|
|
|
m_appearanceApplyButton = false;
|
|
m_appearanceApplyButton.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
|
m_appearanceApplyButton.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LEFT);
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig", "", "", "");
|
|
m_curveNameConfig = new RimSummaryCurveAutoName();
|
|
m_curveNameConfig.uiCapability()->setUiHidden(true);
|
|
m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden(true);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RicSummaryCurveCreator::~RicSummaryCurveCreator()
|
|
{
|
|
for (const auto& identifierAndFieldList : m_identifierFieldsMap)
|
|
{
|
|
for (const auto& identifierAndField : identifierAndFieldList.second)
|
|
{
|
|
delete identifierAndField->pdmField();
|
|
}
|
|
}
|
|
|
|
delete m_previewPlot;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot)
|
|
{
|
|
if (m_targetPlot != targetPlot)
|
|
{
|
|
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;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
{
|
|
if (changedField == &m_applyButtonField || changedField == &m_okButtonField)
|
|
{
|
|
m_applyButtonField = false;
|
|
m_okButtonField = false;
|
|
|
|
if (m_targetPlot == nullptr)
|
|
{
|
|
createNewPlot();
|
|
}
|
|
|
|
updateTargetPlot();
|
|
|
|
if (changedField == &m_okButtonField)
|
|
{
|
|
m_closeButtonField = true;
|
|
}
|
|
|
|
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(m_targetPlot);
|
|
caf::PdmField<bool>* field = dynamic_cast<caf::PdmField<bool>*>(m_targetPlot->uiCapability()->objectToggleField());
|
|
field->setValueWithFieldChanged(true);
|
|
}
|
|
else if (changedField == &m_useAutoAppearanceAssignment && m_useAutoAppearanceAssignment)
|
|
{
|
|
updateAppearanceEditor();
|
|
}
|
|
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 ||
|
|
changedField == &m_selectedSummaryCategories ||
|
|
identifierAndField != nullptr)
|
|
{
|
|
loadDataAndUpdatePlot();
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QList<caf::PdmOptionItemInfo> RicSummaryCurveCreator::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
|
{
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
if (fieldNeedingOptions == &m_selectedCases)
|
|
{
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
std::vector<RimSummaryCase*> topLevelCases;
|
|
std::vector<RimOilField*> oilFields;
|
|
|
|
proj->allOilFields(oilFields);
|
|
for (RimOilField* oilField : oilFields)
|
|
{
|
|
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();
|
|
|
|
// Create New Plot item
|
|
QString displayName = "( New Plot )";
|
|
options.push_back(caf::PdmOptionItemInfo(displayName, nullptr));
|
|
|
|
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 = lookupIdentifierAndFieldFromFieldHandle(fieldNeedingOptions);
|
|
if (identifierAndField != nullptr)
|
|
{
|
|
enum {SUM_CASES, OBS_DATA};
|
|
std::set<RifEclipseSummaryAddress> addrUnion[2];
|
|
addrUnion[SUM_CASES] = findPossibleSummaryAddressesFromSelectedCases(identifierAndField);
|
|
addrUnion[OBS_DATA] = findPossibleSummaryAddressesFromSelectedObservedData(identifierAndField);
|
|
|
|
std::set<QString> itemNames[2];
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
for (const auto& address : addrUnion[i])
|
|
{
|
|
auto name = QString::fromStdString(address.uiText(identifierAndField->summaryIdentifier()));
|
|
if (!name.isEmpty())
|
|
itemNames[i].insert(name);
|
|
}
|
|
}
|
|
|
|
bool isVectorField = identifierAndField->summaryIdentifier() == RifEclipseSummaryAddress::INPUT_VECTOR_NAME;
|
|
|
|
// Merge sets for all other fields than vector fields
|
|
if (!isVectorField)
|
|
{
|
|
itemNames[SUM_CASES].insert(itemNames[OBS_DATA].begin(), itemNames[OBS_DATA].end());
|
|
itemNames[OBS_DATA].clear();
|
|
}
|
|
|
|
auto pdmField = identifierAndField->pdmField();
|
|
for(int i = 0; i < 2; i++)
|
|
{
|
|
// Create headers only for vector fields when observed data is selected
|
|
bool hasObservedData = itemNames[OBS_DATA].size() > 0;
|
|
bool groupItems = isVectorField && hasObservedData;
|
|
if (groupItems)
|
|
{
|
|
auto headerText = i == SUM_CASES ? QString("Simulated Data") : QString("Observed Data");
|
|
options.push_back(caf::PdmOptionItemInfo::createHeader(headerText, true));
|
|
}
|
|
|
|
auto itemPostfix = (isVectorField && i == OBS_DATA) ? QString(OBSERVED_DATA_AVALUE_POSTFIX) : QString("");
|
|
for (const auto& iName : itemNames[i])
|
|
{
|
|
auto optionItem = caf::PdmOptionItemInfo(iName, iName + itemPostfix);
|
|
if (groupItems)
|
|
optionItem.setLevel(1);
|
|
options.push_back(optionItem);
|
|
}
|
|
|
|
if (itemNames[OBS_DATA].size() == 0) break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return options;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
{
|
|
caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", RicSummaryCurveCreatorUiKeywords::sources());
|
|
sourcesGroup->add(&m_selectedCases);
|
|
|
|
caf::PdmUiGroup* itemTypesGroup = uiOrdering.addNewGroupWithKeyword("Summary Types", RicSummaryCurveCreatorUiKeywords::summaryTypes());
|
|
itemTypesGroup->add(&m_selectedSummaryCategories);
|
|
|
|
caf::PdmField<std::vector<QString>>* summaryiesField = nullptr;
|
|
|
|
RifEclipseSummaryAddress::SummaryVarCategory sumCategory = m_currentSummaryCategory();
|
|
if (sumCategory == RifEclipseSummaryAddress::SUMMARY_FIELD)
|
|
{
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_FIELD][0]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_AQUIFER)
|
|
{
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_AQUIFER][0]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_NETWORK)
|
|
{
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_NETWORK][0]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_MISC)
|
|
{
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_MISC][0]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_REGION)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Regions");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION][0]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION][1]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Regions");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION][0]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION][1]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Well Groups");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][0]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][1]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Wells");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL][0]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL][1]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Completions");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][0]->pdmField());
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][1]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][2]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("LGR Completions");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][0]->pdmField());
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][1]->pdmField());
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][2]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][3]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL_LGR)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("LGR Wells");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][0]->pdmField());
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][1]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][2]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Well Segments");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][0]->pdmField());
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][1]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][2]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_BLOCK)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("Blocks");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK][0]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK][1]->pdmField();
|
|
}
|
|
else if (sumCategory == RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR)
|
|
{
|
|
{
|
|
caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup("LGR Blocks");
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][0]->pdmField());
|
|
myGroup->add(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField());
|
|
}
|
|
|
|
summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField();
|
|
}
|
|
|
|
CAF_ASSERT(summaryiesField);
|
|
caf::PdmUiGroup* summariesGroup = uiOrdering.addNewGroupWithKeyword("Summaries", RicSummaryCurveCreatorUiKeywords::summaries());
|
|
summariesGroup->add(summaryiesField);
|
|
|
|
|
|
// Appearance settings
|
|
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroupWithKeyword("Curve Appearance Assignment", RicSummaryCurveCreatorUiKeywords::appearance());
|
|
caf::PdmUiGroup* appearanceSubGroup = appearanceGroup->addNewGroup("Appearance Type Assignment");
|
|
appearanceGroup->setCollapsedByDefault(true);
|
|
appearanceSubGroup->add(&m_useAutoAppearanceAssignment);
|
|
appearanceSubGroup->add(&m_caseAppearanceType);
|
|
appearanceSubGroup->add(&m_variableAppearanceType);
|
|
appearanceSubGroup->add(&m_wellAppearanceType);
|
|
appearanceSubGroup->add(&m_groupAppearanceType);
|
|
appearanceSubGroup->add(&m_regionAppearanceType);
|
|
appearanceGroup->add(&m_appearanceApplyButton);
|
|
|
|
// Appearance option sensitivity
|
|
{
|
|
m_caseAppearanceType.uiCapability()->setUiReadOnly(m_useAutoAppearanceAssignment);
|
|
m_variableAppearanceType.uiCapability()->setUiReadOnly(m_useAutoAppearanceAssignment);
|
|
m_wellAppearanceType.uiCapability()->setUiReadOnly(m_useAutoAppearanceAssignment);
|
|
m_groupAppearanceType.uiCapability()->setUiReadOnly(m_useAutoAppearanceAssignment);
|
|
m_regionAppearanceType.uiCapability()->setUiReadOnly(m_useAutoAppearanceAssignment);
|
|
}
|
|
|
|
// Name config
|
|
caf::PdmUiGroup* autoNameGroup = uiOrdering.addNewGroupWithKeyword("Curve Name Configuration", RicSummaryCurveCreatorUiKeywords::nameConfig());
|
|
autoNameGroup->setCollapsedByDefault(true);
|
|
m_curveNameConfig->uiOrdering(uiConfigName, *autoNameGroup);
|
|
|
|
// Fields to be displayed directly in UI
|
|
uiOrdering.add(&m_targetPlot);
|
|
uiOrdering.add(&m_okButtonField);
|
|
uiOrdering.add(&m_applyButtonField);
|
|
uiOrdering.add(&m_closeButtonField);
|
|
|
|
uiOrdering.skipRemainingFields(true);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAddressesFromSelectedCases(const SummaryIdentifierAndField *identifierAndField)
|
|
{
|
|
std::vector<RimSummaryCase*> cases;
|
|
for (const auto& sumCase: m_selectedCases)
|
|
{
|
|
if(isObservedData(sumCase)) continue;
|
|
cases.push_back(sumCase);
|
|
}
|
|
return findPossibleSummaryAddresses(cases, identifierAndField);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAddressesFromSelectedObservedData(const SummaryIdentifierAndField *identifierAndField)
|
|
{
|
|
std::vector<RimSummaryCase*> obsData;
|
|
for (const auto& sumCase : m_selectedCases)
|
|
{
|
|
if (isObservedData(sumCase))
|
|
{
|
|
obsData.push_back(sumCase);
|
|
}
|
|
}
|
|
return findPossibleSummaryAddresses(obsData, identifierAndField);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
/// Returns the summary addresses that match the selected item type and input selections made in GUI
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAddresses(const std::vector<RimSummaryCase*> &selectedCases,
|
|
const SummaryIdentifierAndField *identifierAndField)
|
|
{
|
|
std::set<RifEclipseSummaryAddress> addrUnion;
|
|
|
|
auto isVectorField = identifierAndField != nullptr && identifierAndField->summaryIdentifier() == RifEclipseSummaryAddress::INPUT_VECTOR_NAME;
|
|
auto controllingIdentifierAndField = identifierAndField != nullptr ? lookupControllingField(identifierAndField) : nullptr;
|
|
if (!isVectorField && controllingIdentifierAndField != nullptr && controllingIdentifierAndField->pdmField()->v().size() == 0)
|
|
{
|
|
return addrUnion;
|
|
}
|
|
|
|
for (RimSummaryCase* currCase : selectedCases)
|
|
{
|
|
RifSummaryReaderInterface* reader = nullptr;
|
|
if (currCase) reader = currCase->summaryReader();
|
|
if (reader)
|
|
{
|
|
const std::vector<RifEclipseSummaryAddress>& allAddresses = reader->allResultAddresses();
|
|
int addressCount = static_cast<int>(allAddresses.size());
|
|
|
|
bool applySelections = identifierAndField == nullptr || (!isVectorField && controllingIdentifierAndField != nullptr);
|
|
std::vector<SummaryIdentifierAndField*> controllingFields;
|
|
if (applySelections)
|
|
{
|
|
// Build selections vector
|
|
controllingFields = buildControllingFieldList(identifierAndField);
|
|
}
|
|
|
|
for (int i = 0; i < addressCount; i++)
|
|
{
|
|
if (allAddresses[i].category() == m_currentSummaryCategory())
|
|
{
|
|
bool addressSelected = applySelections ? isAddressCompatibleWithControllingFieldSelection(allAddresses[i], controllingFields) : true;
|
|
if (addressSelected)
|
|
{
|
|
addrUnion.insert(allAddresses[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return addrUnion;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
/// Build a list of relevant selections
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::vector<RicSummaryCurveCreator::SummaryIdentifierAndField*> RicSummaryCurveCreator::buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField)
|
|
{
|
|
std::vector<RicSummaryCurveCreator::SummaryIdentifierAndField*> controllingFields;
|
|
auto identifierAndFieldList = m_identifierFieldsMap[m_currentSummaryCategory()];
|
|
for (const auto& identifierAndFieldItem : identifierAndFieldList)
|
|
{
|
|
if (identifierAndFieldItem == identifierAndField)
|
|
{
|
|
break;
|
|
}
|
|
controllingFields.push_back(identifierAndFieldItem);
|
|
}
|
|
return controllingFields;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RicSummaryCurveCreator::SummaryIdentifierAndField* RicSummaryCurveCreator::lookupIdentifierAndFieldFromFieldHandle(const caf::PdmFieldHandle* pdmFieldHandle)
|
|
{
|
|
for (const auto& itemTypes : m_identifierFieldsMap)
|
|
{
|
|
for (const auto& itemTypeInput : itemTypes.second)
|
|
{
|
|
if (pdmFieldHandle == itemTypeInput->pdmField())
|
|
{
|
|
return itemTypeInput;
|
|
}
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
/// 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 *dependentField)
|
|
{
|
|
for (const auto& identifierAndFieldList : m_identifierFieldsMap)
|
|
{
|
|
int index = 0;
|
|
for (const auto& iaf : identifierAndFieldList.second)
|
|
{
|
|
if (iaf == dependentField)
|
|
{
|
|
return index > 0 ? identifierAndFieldList.second[index - 1] : nullptr;
|
|
}
|
|
index++;
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RicSummaryCurveCreator::isAddressCompatibleWithControllingFieldSelection(const RifEclipseSummaryAddress &address, const std::vector<SummaryIdentifierAndField*>& identifierAndFieldList)
|
|
{
|
|
for (const auto& identifierAndField : identifierAndFieldList)
|
|
{
|
|
bool match = false;
|
|
for (const auto& selectedText : identifierAndField->pdmField()->v())
|
|
{
|
|
if (QString::compare(QString::fromStdString(address.uiText(identifierAndField->summaryIdentifier())), selectedText) == 0)
|
|
{
|
|
match = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!match)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::buildAddressListFromSelections()
|
|
{
|
|
std::set<RifEclipseSummaryAddress> addressSet;
|
|
for (const auto& category : m_selectedSummaryCategories())
|
|
{
|
|
auto identifierAndFieldList = m_identifierFieldsMap[category];
|
|
std::vector<std::pair<RifEclipseSummaryAddress::SummaryIdentifierType, QString>> selectionStack;
|
|
buildAddressListForCategoryRecursively(category, identifierAndFieldList.begin(), selectionStack, addressSet);
|
|
}
|
|
return addressSet;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::buildAddressListForCategoryRecursively(RifEclipseSummaryAddress::SummaryVarCategory category,
|
|
std::vector<SummaryIdentifierAndField*>::const_iterator identifierAndFieldItr,
|
|
std::vector<std::pair<RifEclipseSummaryAddress::SummaryIdentifierType, QString>>& identifierPath,
|
|
std::set<RifEclipseSummaryAddress>& addressSet)
|
|
|
|
{
|
|
for (const auto& identifierText : (*identifierAndFieldItr)->pdmField()->v())
|
|
{
|
|
auto idText = identifierText;
|
|
idText.remove(OBSERVED_DATA_AVALUE_POSTFIX);
|
|
identifierPath.push_back(std::make_pair((*identifierAndFieldItr)->summaryIdentifier(), idText));
|
|
if ((*identifierAndFieldItr)->summaryIdentifier() != RifEclipseSummaryAddress::INPUT_VECTOR_NAME)
|
|
{
|
|
buildAddressListForCategoryRecursively(category, std::next(identifierAndFieldItr, 1), identifierPath, addressSet);
|
|
}
|
|
else
|
|
{
|
|
std::map<RifEclipseSummaryAddress::SummaryIdentifierType, std::string> selectedIdentifiers;
|
|
for (const auto& identifier : identifierPath)
|
|
{
|
|
selectedIdentifiers.insert(std::make_pair(identifier.first, identifier.second.toStdString()));
|
|
}
|
|
auto address = RifEclipseSummaryAddress(category, selectedIdentifiers);
|
|
addressSet.insert(address);
|
|
}
|
|
identifierPath.pop_back();
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::loadDataAndUpdatePlot()
|
|
{
|
|
syncPreviewCurvesFromUiSelection();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::syncPreviewCurvesFromUiSelection()
|
|
{
|
|
// Create a search map containing whats supposed to be curves
|
|
|
|
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> > allCurveDefinitions;
|
|
|
|
// Populate the newCurveDefinitions from the Gui
|
|
|
|
std::set<RifEclipseSummaryAddress> selectedAddresses = buildAddressListFromSelections();
|
|
|
|
// Find the addresses to display
|
|
std::set<RifEclipseSummaryAddress> addrUnion;
|
|
for (RimSummaryCase* currCase : m_selectedCases)
|
|
{
|
|
RifSummaryReaderInterface* reader = nullptr;
|
|
if (currCase) reader = currCase->summaryReader();
|
|
if (reader)
|
|
{
|
|
const std::vector<RifEclipseSummaryAddress>& allAddresses = reader->allResultAddresses();
|
|
int addressCount = static_cast<int>(allAddresses.size());
|
|
|
|
for (int i = 0; i < addressCount; i++)
|
|
{
|
|
if (selectedAddresses.count(allAddresses[i]) > 0)
|
|
{
|
|
addrUnion.insert(allAddresses[i]);
|
|
allCurveDefinitions.insert(std::make_pair(currCase, allAddresses[i]));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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*> curvesToDelete;
|
|
|
|
for (const auto& curve : currentCurvesInPreviewPlot)
|
|
{
|
|
currentCurveDefs.insert(std::make_pair(curve->summaryCase(), curve->summaryAddress()));
|
|
}
|
|
|
|
if (allCurveDefinitions.size() < currentCurvesInPreviewPlot.size())
|
|
{
|
|
// Determine which curves to delete from plot
|
|
std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress>> deleteCurveDefs;
|
|
std::set_difference(currentCurveDefs.begin(), currentCurveDefs.end(),
|
|
allCurveDefinitions.begin(), allCurveDefinitions.end(),
|
|
std::inserter(deleteCurveDefs, deleteCurveDefs.end()));
|
|
|
|
for (const auto& curve : currentCurvesInPreviewPlot)
|
|
{
|
|
std::pair<RimSummaryCase*, RifEclipseSummaryAddress> curveDef = std::make_pair(curve->summaryCase(), curve->summaryAddress());
|
|
if (deleteCurveDefs.count(curveDef) > 0)
|
|
curvesToDelete.insert(curve);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Determine which curves are new since last time
|
|
std::set_difference(allCurveDefinitions.begin(), allCurveDefinitions.end(),
|
|
currentCurveDefs.begin(), currentCurveDefs.end(),
|
|
std::inserter(newCurveDefs, newCurveDefs.end()));
|
|
}
|
|
|
|
updatePreviewCurvesFromCurveDefinitions(allCurveDefinitions, newCurveDefs, 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;
|
|
RimSummaryCurveAppearanceCalculator curveLookCalc(allCurveDefsToDisplay, getAllSummaryCaseNames(), getAllSummaryWellNames());
|
|
|
|
initCurveAppearanceCalculator(curveLookCalc);
|
|
|
|
// Delete curves
|
|
for (const auto& curve : curvesToDelete)
|
|
{
|
|
m_previewPlot->deleteCurve(curve);
|
|
}
|
|
|
|
// Add new curves
|
|
for (const auto& curveDef : curveDefsToAdd)
|
|
{
|
|
RimSummaryCase* currentCase = curveDef.first;
|
|
RimSummaryCurve* curve = new RimSummaryCurve();
|
|
curve->setSummaryCase(currentCase);
|
|
curve->setSummaryAddress(curveDef.second);
|
|
curve->applyCurveAutoNameSettings(*m_curveNameConfig());
|
|
m_previewPlot->addCurveNoUpdate(curve);
|
|
curveLookCalc.setupCurveLook(curve);
|
|
//if(isObservedData(currentCase))
|
|
// curve->setLineStyle(RimPlotCurve::STYLE_NONE);
|
|
}
|
|
|
|
m_previewPlot->loadDataAndUpdate();
|
|
m_previewPlot->zoomAll();
|
|
updateEditorsConnectedToPreviewPlot();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::set<std::string> RicSummaryCurveCreator::getAllSummaryCaseNames()
|
|
{
|
|
std::set<std::string> summaryCaseHashes;
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
std::vector<RimSummaryCase*> cases;
|
|
|
|
proj->allSummaryCases(cases);
|
|
|
|
for (RimSummaryCase* rimCase : cases)
|
|
{
|
|
summaryCaseHashes.insert(rimCase->summaryHeaderFilename().toUtf8().constData());
|
|
}
|
|
|
|
return summaryCaseHashes;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::set<std::string> RicSummaryCurveCreator::getAllSummaryWellNames()
|
|
{
|
|
std::set<std::string> summaryWellNames;
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
std::vector<RimSummaryCase*> cases;
|
|
|
|
proj->allSummaryCases(cases);
|
|
for (RimSummaryCase* rimCase : cases)
|
|
{
|
|
RifSummaryReaderInterface* reader = nullptr;
|
|
if (rimCase)
|
|
{
|
|
reader = rimCase->summaryReader();
|
|
}
|
|
|
|
if (reader)
|
|
{
|
|
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
|
|
|
for (size_t i = 0; i < allAddresses.size(); i++)
|
|
{
|
|
if (allAddresses[i].category() == RifEclipseSummaryAddress::SUMMARY_WELL)
|
|
{
|
|
summaryWellNames.insert(allAddresses[i].wellName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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_okButtonField == field)
|
|
{
|
|
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
|
|
if (attrib)
|
|
{
|
|
attrib->m_buttonText = "OK";
|
|
}
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
else if (&m_targetPlot == field)
|
|
{
|
|
caf::PdmUiComboBoxEditorAttribute* attrib = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*> (attribute);
|
|
if (attrib)
|
|
{
|
|
attrib->adjustWidthToContents = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
/// Populate curve creator from the given curve collection
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot)
|
|
{
|
|
m_previewPlot->deleteAllSummaryCurves();
|
|
m_selectedSummaryCategories.v().clear();
|
|
for (const auto& curve : sourceSummaryPlot.summaryCurves())
|
|
{
|
|
// Select summary category if not already selected
|
|
auto& selectedCategories = m_selectedSummaryCategories();
|
|
if (std::find(selectedCategories.begin(), selectedCategories.end(),
|
|
curve->summaryAddress().category()) == selectedCategories.end())
|
|
{
|
|
m_selectedSummaryCategories.v().push_back(curve->summaryAddress().category());
|
|
}
|
|
|
|
// Select case if not already selected
|
|
if (std::find(m_selectedCases.begin(), m_selectedCases.end(), curve->summaryCase()) == m_selectedCases.end())
|
|
{
|
|
m_selectedCases.push_back(curve->summaryCase());
|
|
}
|
|
|
|
auto identifierAndFieldList = m_identifierFieldsMap[curve->summaryAddress().category()];
|
|
for (const auto& identifierAndField : identifierAndFieldList)
|
|
{
|
|
QString uiText = QString::fromStdString(curve->summaryAddress().uiText(identifierAndField->summaryIdentifier()));
|
|
const auto& currentSelectionVector = identifierAndField->pdmField()->v();
|
|
if (std::find(currentSelectionVector.begin(), currentSelectionVector.end(), uiText) == currentSelectionVector.end())
|
|
{
|
|
std::vector<QString> newSelectionVector(currentSelectionVector.begin(), currentSelectionVector.end());
|
|
newSelectionVector.push_back(uiText);
|
|
(*identifierAndField->pdmField()) = newSelectionVector;
|
|
}
|
|
}
|
|
|
|
// Copy curve object to the preview plot
|
|
copyCurveAndAddToPlot(curve, m_previewPlot, true);
|
|
}
|
|
|
|
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 preview plot to target plot
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::updateTargetPlot()
|
|
{
|
|
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->loadDataAndUpdate();
|
|
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->addCurveNoUpdate(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(false);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::resetAllFields()
|
|
{
|
|
m_selectedCases.clear();
|
|
m_selectedSummaryCategories = std::vector<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>>();
|
|
|
|
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);
|
|
// if (isObservedData(curve->summaryCase()))
|
|
// curve->setLineStyle(RimPlotCurve::STYLE_NONE);
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
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())
|
|
{
|
|
allCurveDefs.insert(std::make_pair(curve->summaryCase(), curve->summaryAddress()));
|
|
}
|
|
return allCurveDefs;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::createNewPlot()
|
|
{
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
|
|
RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection();
|
|
if (summaryPlotColl)
|
|
{
|
|
QString summaryPlotName = QString("Summary Plot %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_targetPlot = plot;
|
|
updateTargetPlot();
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicSummaryCurveCreator::updateCurveNames()
|
|
{
|
|
for (RimSummaryCurve* curve : m_previewPlot->summaryCurves())
|
|
{
|
|
curve->applyCurveAutoNameSettings(*m_curveNameConfig());
|
|
curve->updateCurveNameNoLegendUpdate();
|
|
}
|
|
|
|
if (m_previewPlot && m_previewPlot->qwtPlot()) m_previewPlot->qwtPlot()->updateLegend();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RicSummaryCurveCreator::isObservedData(RimSummaryCase *sumCase) const
|
|
{
|
|
return dynamic_cast<RimObservedData*>(sumCase) != nullptr;
|
|
}
|