mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1886 curve creator. Populate curve creator and copy curves back to target plot
This commit is contained in:
parent
0a824d351c
commit
388dcd3552
@ -197,15 +197,24 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicSummaryCurveCreator::~RicSummaryCurveCreator()
|
RicSummaryCurveCreator::~RicSummaryCurveCreator()
|
||||||
{
|
{
|
||||||
for (const auto& itemTypes : m_identifierFieldsMap)
|
for (const auto& identifierAndFieldList : m_identifierFieldsMap)
|
||||||
{
|
{
|
||||||
for (const auto& itemTypeInput : itemTypes.second)
|
for (const auto& identifierAndField : identifierAndFieldList.second)
|
||||||
{
|
{
|
||||||
delete itemTypeInput->pdmField();
|
delete identifierAndField->pdmField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicSummaryCurveCreator::setTargetPlot(RimSummaryPlot* targetPlot)
|
||||||
|
{
|
||||||
|
m_targetPlot = targetPlot;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -244,10 +253,6 @@ QList<caf::PdmOptionItemInfo> RicSummaryCurveCreator::calculateValueOptions(cons
|
|||||||
{
|
{
|
||||||
options.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), rimCase));
|
options.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), rimCase));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (fieldNeedingOptions == &m_previewPlot)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -262,7 +267,7 @@ QList<caf::PdmOptionItemInfo> RicSummaryCurveCreator::calculateValueOptions(cons
|
|||||||
|
|
||||||
for (const auto& address : addrUnion)
|
for (const auto& address : addrUnion)
|
||||||
{
|
{
|
||||||
auto name = getIdentifierTextFromAddress(identifierAndField->summaryIdentifier(), address);
|
auto name = QString::fromStdString(address.uiText(identifierAndField->summaryIdentifier()));
|
||||||
if (!name.isEmpty())
|
if (!name.isEmpty())
|
||||||
itemNames.insert(name);
|
itemNames.insert(name);
|
||||||
}
|
}
|
||||||
@ -511,27 +516,6 @@ std::vector<RicSummaryCurveCreator::SummaryIdentifierAndField*> RicSummaryCurveC
|
|||||||
return selections;
|
return selections;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
/// Returns the stringified value for the specified value in the specfied address object
|
|
||||||
/// Todo: Move this method to RicElipseSummaryAddress class
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RicSummaryCurveCreator::getIdentifierTextFromAddress(RifEclipseSummaryAddress::SummaryIdentifierType itemTypeInput, const RifEclipseSummaryAddress &address)
|
|
||||||
{
|
|
||||||
switch (itemTypeInput)
|
|
||||||
{
|
|
||||||
case RifEclipseSummaryAddress::INPUT_REGION_NUMBER: return QString("%1").arg(address.regionNumber());
|
|
||||||
case RifEclipseSummaryAddress::INPUT_REGION2_NUMBER: return QString("%1").arg(address.regionNumber2());
|
|
||||||
case RifEclipseSummaryAddress::INPUT_WELL_NAME: return QString::fromStdString(address.wellName());
|
|
||||||
case RifEclipseSummaryAddress::INPUT_WELL_GROUP_NAME: return QString::fromStdString(address.wellGroupName());
|
|
||||||
case RifEclipseSummaryAddress::INPUT_CELL_IJK: return QString("%1,%2,%3").arg(QString::number(address.cellI()),
|
|
||||||
QString::number(address.cellJ()), QString::number(address.cellK()));
|
|
||||||
case RifEclipseSummaryAddress::INPUT_LGR_NAME: return QString::fromStdString(address.lgrName());
|
|
||||||
case RifEclipseSummaryAddress::INPUT_SEGMENT_NUMBER: return QString("%1").arg(address.wellSegmentNumber());
|
|
||||||
case RifEclipseSummaryAddress::INPUT_VECTOR_NAME: return QString::fromStdString(address.quantityName());
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Returns pdm field info from the specified pdm field
|
/// Returns pdm field info from the specified pdm field
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -579,9 +563,9 @@ bool RicSummaryCurveCreator::isAddressSelected(const RifEclipseSummaryAddress &a
|
|||||||
for (const auto& identifierAndField : identifierAndFieldList)
|
for (const auto& identifierAndField : identifierAndFieldList)
|
||||||
{
|
{
|
||||||
bool match = false;
|
bool match = false;
|
||||||
for (const auto& selection : identifierAndField->pdmField()->v())
|
for (const auto& selectedText : identifierAndField->pdmField()->v())
|
||||||
{
|
{
|
||||||
if (QString::compare(getIdentifierTextFromAddress(identifierAndField->summaryIdentifier(), address), selection) == 0)
|
if (QString::compare(QString::fromStdString(address.uiText(identifierAndField->summaryIdentifier())), selectedText) == 0)
|
||||||
{
|
{
|
||||||
match = true;
|
match = true;
|
||||||
break;
|
break;
|
||||||
@ -854,3 +838,44 @@ std::set<std::string> RicSummaryCurveCreator::getAllSummaryWellNames()
|
|||||||
}
|
}
|
||||||
return summaryWellNames;
|
return summaryWellNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Populate curve creator from the given curve collection
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicSummaryCurveCreator::populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot)
|
||||||
|
{
|
||||||
|
for (const auto& curve : sourceSummaryPlot.summaryCurves())
|
||||||
|
{
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
auto& pdmField = *identifierAndField->pdmField();
|
||||||
|
auto currentSelections = pdmField();
|
||||||
|
currentSelections.push_back(QString::fromStdString(curve->summaryAddress().uiText(identifierAndField->summaryIdentifier())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Copy curves from
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicSummaryCurveCreator::updateTargetPlot()
|
||||||
|
{
|
||||||
|
// Q: What about hidden curves?
|
||||||
|
|
||||||
|
if (m_targetPlot == nullptr)
|
||||||
|
m_targetPlot = new RimSummaryPlot();
|
||||||
|
|
||||||
|
for (const auto& curve : m_previewPlot->summaryCurves())
|
||||||
|
{
|
||||||
|
m_targetPlot->addCurve(curve);
|
||||||
|
}
|
||||||
|
m_targetPlot->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
@ -75,6 +75,8 @@ public:
|
|||||||
virtual ~RicSummaryCurveCreator();
|
virtual ~RicSummaryCurveCreator();
|
||||||
|
|
||||||
RimSummaryPlot* previewPlot() { return m_previewPlot;}
|
RimSummaryPlot* previewPlot() { return m_previewPlot;}
|
||||||
|
void setTargetPlot(RimSummaryPlot* targetPlot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||||
const QVariant& oldValue,
|
const QVariant& oldValue,
|
||||||
@ -85,8 +87,6 @@ private:
|
|||||||
|
|
||||||
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddresses(const SummaryIdentifierAndField *identifierAndField);
|
std::set<RifEclipseSummaryAddress> findPossibleSummaryAddresses(const SummaryIdentifierAndField *identifierAndField);
|
||||||
std::vector<SummaryIdentifierAndField*> buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField);
|
std::vector<SummaryIdentifierAndField*> buildControllingFieldList(const SummaryIdentifierAndField *identifierAndField);
|
||||||
QString getIdentifierTextFromAddress(RifEclipseSummaryAddress::SummaryIdentifierType itemTypeInput,
|
|
||||||
const RifEclipseSummaryAddress &address);
|
|
||||||
SummaryIdentifierAndField* findIdentifierAndField(const caf::PdmFieldHandle* pdmFieldHandle);
|
SummaryIdentifierAndField* findIdentifierAndField(const caf::PdmFieldHandle* pdmFieldHandle);
|
||||||
SummaryIdentifierAndField* lookupControllingField(const SummaryIdentifierAndField *identifierAndField);
|
SummaryIdentifierAndField* lookupControllingField(const SummaryIdentifierAndField *identifierAndField);
|
||||||
bool isAddressSelected(const RifEclipseSummaryAddress &address,
|
bool isAddressSelected(const RifEclipseSummaryAddress &address,
|
||||||
@ -104,13 +104,16 @@ private:
|
|||||||
std::set<std::string> getAllSummaryCaseNames();
|
std::set<std::string> getAllSummaryCaseNames();
|
||||||
std::set<std::string> getAllSummaryWellNames();
|
std::set<std::string> getAllSummaryWellNames();
|
||||||
|
|
||||||
|
void populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot);
|
||||||
|
void updateTargetPlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPtrArrayField<RimSummaryCase*> m_selectedCases;
|
caf::PdmPtrArrayField<RimSummaryCase*> m_selectedCases;
|
||||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_selectedSummaryCategory;
|
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_selectedSummaryCategory;
|
||||||
std::map<RifEclipseSummaryAddress::SummaryVarCategory, std::vector<SummaryIdentifierAndField*>> m_identifierFieldsMap;
|
std::map<RifEclipseSummaryAddress::SummaryVarCategory, std::vector<SummaryIdentifierAndField*>> m_identifierFieldsMap;
|
||||||
|
|
||||||
|
caf::PdmPtrField<RimSummaryPlot*> m_targetPlot;
|
||||||
caf::PdmChildField<RimSummaryPlot*> m_previewPlot;
|
caf::PdmChildField<RimSummaryPlot*> m_previewPlot;
|
||||||
//caf::PdmField<std::vector<QString>> m_selectedCurveTexts;
|
|
||||||
|
|
||||||
caf::PdmField<bool> m_useAutoAppearanceAssignment;
|
caf::PdmField<bool> m_useAutoAppearanceAssignment;
|
||||||
caf::PdmField< AppearanceTypeAppEnum > m_caseAppearanceType;
|
caf::PdmField< AppearanceTypeAppEnum > m_caseAppearanceType;
|
||||||
|
@ -462,6 +462,14 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::summaryCurves() const
|
|||||||
return curves;
|
return curves;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::deleteAllCurves()
|
||||||
|
{
|
||||||
|
m_summaryCurveCollection->curves().clear();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -100,6 +100,7 @@ public:
|
|||||||
QString asciiDataForPlotExport() const;
|
QString asciiDataForPlotExport() const;
|
||||||
|
|
||||||
std::vector<RimSummaryCurve*> summaryCurves() const;
|
std::vector<RimSummaryCurve*> summaryCurves() const;
|
||||||
|
void deleteAllCurves();
|
||||||
|
|
||||||
// RimViewWindow overrides
|
// RimViewWindow overrides
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user