#1815 Curve Creator. Display observed data in summaries editor

This commit is contained in:
Bjørn Erik Jensen 2017-09-20 11:20:32 +02:00
parent 9fee4d0511
commit dd8549d3d1
2 changed files with 63 additions and 12 deletions

View File

@ -418,19 +418,41 @@ QList<caf::PdmOptionItemInfo> RicSummaryCurveCreator::calculateValueOptions(cons
auto identifierAndField = lookupIdentifierAndFieldFromFieldHandle(fieldNeedingOptions);
if (identifierAndField != nullptr)
{
enum {SUM_CASES, OBS_DATA};
bool includeObservedData = identifierAndField->summaryIdentifier() == RifEclipseSummaryAddress::INPUT_VECTOR_NAME;
std::set<RifEclipseSummaryAddress> addrUnion[2];
addrUnion[SUM_CASES] = findPossibleSummaryAddressesFromSelectedCases(identifierAndField);
addrUnion[OBS_DATA] = includeObservedData ?
findPossibleSummaryAddressesFromSelectedObservedData(identifierAndField) : std::set<RifEclipseSummaryAddress>();
auto pdmField = identifierAndField->pdmField();
std::set<RifEclipseSummaryAddress> addrUnion = findPossibleSummaryAddresses(identifierAndField);
std::set<QString> itemNames;
for (const auto& address : addrUnion)
for(int i = 0; i < 2; i++)
{
auto name = QString::fromStdString(address.uiText(identifierAndField->summaryIdentifier()));
if (!name.isEmpty())
itemNames.insert(name);
}
for (const auto& iName : itemNames)
{
options.push_back(caf::PdmOptionItemInfo(iName, iName));
for (const auto& address : addrUnion[i])
{
auto name = QString::fromStdString(address.uiText(identifierAndField->summaryIdentifier()));
if (!name.isEmpty())
itemNames.insert(name);
}
// Create headers only when observed data is selected
bool createHeaders = addrUnion[OBS_DATA].size() > 0;
if (createHeaders)
{
auto headerText = i == SUM_CASES ? QString("Simulated Data") : QString("Observed Data");
options.push_back(caf::PdmOptionItemInfo::createHeader(headerText, true));
}
for (const auto& iName : itemNames)
{
auto optionItem = caf::PdmOptionItemInfo(iName, iName);
if (createHeaders)
optionItem.setLevel(1);
options.push_back(optionItem);
}
if (!includeObservedData) break;
}
}
}
@ -601,10 +623,35 @@ void RicSummaryCurveCreator::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
uiOrdering.skipRemainingFields(true);
}
std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAddressesFromSelectedCases(const SummaryIdentifierAndField *identifierAndField)
{
std::vector<RimSummaryCase*> cases;
for (const auto& sumCase: m_selectedCases)
{
if(typeid(sumCase) == typeid(RimObservedData)) 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 (typeid(sumCase) == typeid(RimObservedData))
{
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 SummaryIdentifierAndField *identifierAndField)
std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAddresses(const std::vector<RimSummaryCase*> &selectedCases,
const SummaryIdentifierAndField *identifierAndField)
{
std::set<RifEclipseSummaryAddress> addrUnion;
@ -615,7 +662,7 @@ std::set<RifEclipseSummaryAddress> RicSummaryCurveCreator::findPossibleSummaryAd
return addrUnion;
}
for (RimSummaryCase* currCase : m_selectedCases)
for (RimSummaryCase* currCase : selectedCases)
{
RifReaderEclipseSummary* reader = nullptr;
if (currCase && currCase->caseData()) reader = currCase->caseData()->summaryReader();

View File

@ -90,7 +90,11 @@ private:
caf::PdmUiEditorAttribute* attribute) override;
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddresses(const SummaryIdentifierAndField *identifierAndField);
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddresses(const std::vector<RimSummaryCase*> &selectedCases,
const SummaryIdentifierAndField *identifierAndField);
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddressesFromSelectedCases(const SummaryIdentifierAndField *identifierAndField);
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddressesFromSelectedObservedData(const SummaryIdentifierAndField *identifierAndField);
std::vector<SummaryIdentifierAndField*> buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField);
SummaryIdentifierAndField* lookupIdentifierAndFieldFromFieldHandle(const caf::PdmFieldHandle* pdmFieldHandle);
SummaryIdentifierAndField* lookupControllingField(const SummaryIdentifierAndField *dependentField);