mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#861) Summary Plot : Add support for autogenerated plot name
This commit is contained in:
parent
20b3de9f7a
commit
5e3467a5f6
@ -20,92 +20,99 @@
|
|||||||
|
|
||||||
#include "RiaSummaryCurveDefinition.h"
|
#include "RiaSummaryCurveDefinition.h"
|
||||||
|
|
||||||
|
#include "RimSummaryCurve.h"
|
||||||
|
#include "RimSummaryCurveCollection.h"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaSummaryCurveDefTools::RiaSummaryCurveDefTools(const std::vector<RiaSummaryCurveDefinition>& curveDefinitions)
|
RiaSummaryCurveDefTools::RiaSummaryCurveDefTools() {}
|
||||||
: m_curveDefinitions(curveDefinitions), m_isEvaluated(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<std::string> RiaSummaryCurveDefTools::uniqueWellNames() const
|
void RiaSummaryCurveDefTools::findIdentifiers(RimSummaryCurveCollection* sumCurveCollection)
|
||||||
{
|
{
|
||||||
computeUniqueValues();
|
if (!sumCurveCollection) return;
|
||||||
|
|
||||||
return std::vector<std::string>(m_wellNames.begin(), m_wellNames.end());
|
for (auto curve : sumCurveCollection->curves())
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::string> RiaSummaryCurveDefTools::uniqueGroupNames() const
|
|
||||||
{
|
|
||||||
computeUniqueValues();
|
|
||||||
|
|
||||||
return std::vector<std::string>(m_groupName.begin(), m_groupName.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<int> RiaSummaryCurveDefTools::uniqueRegions() const
|
|
||||||
{
|
|
||||||
computeUniqueValues();
|
|
||||||
|
|
||||||
return std::vector<int>(m_regionNumbers.begin(), m_regionNumbers.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<RimSummaryCase*> RiaSummaryCurveDefTools::uniqueSummaryCases() const
|
|
||||||
{
|
|
||||||
computeUniqueValues();
|
|
||||||
|
|
||||||
return std::vector<RimSummaryCase*>(m_summaryCases.begin(), m_summaryCases.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiaSummaryCurveDefTools::computeUniqueValues() const
|
|
||||||
{
|
|
||||||
if (m_isEvaluated)
|
|
||||||
{
|
{
|
||||||
return;
|
m_summaryCases.insert(curve->summaryCaseY());
|
||||||
}
|
|
||||||
|
|
||||||
// m_wellNames.clear();
|
auto adr = curve->summaryAddressY();
|
||||||
// m_groupName.clear();
|
|
||||||
// m_summaryCases.clear();
|
|
||||||
|
|
||||||
for (const auto& curveDef : m_curveDefinitions)
|
if (!adr.wellName().empty())
|
||||||
{
|
|
||||||
if (curveDef.summaryCase() != nullptr)
|
|
||||||
{
|
{
|
||||||
m_summaryCases.insert(curveDef.summaryCase());
|
m_wellNames.insert(adr.wellName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!curveDef.summaryAddress().wellName().empty())
|
if (!adr.quantityName().empty())
|
||||||
{
|
{
|
||||||
m_wellNames.insert(curveDef.summaryAddress().wellName());
|
m_quantities.insert(adr.quantityName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!curveDef.summaryAddress().wellGroupName().empty())
|
if (!adr.wellGroupName().empty())
|
||||||
{
|
{
|
||||||
m_groupName.insert(curveDef.summaryAddress().wellGroupName());
|
m_wellGroupNames.insert(adr.wellGroupName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curveDef.summaryAddress().regionNumber() != -1)
|
if (adr.regionNumber() != -1)
|
||||||
{
|
{
|
||||||
m_regionNumbers.insert(curveDef.summaryAddress().regionNumber());
|
m_regionNumbers.insert(adr.regionNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_isEvaluated = true;
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<std::string> RiaSummaryCurveDefTools::quantities() const
|
||||||
|
{
|
||||||
|
return m_quantities;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<std::string> RiaSummaryCurveDefTools::wellNames() const
|
||||||
|
{
|
||||||
|
return m_wellNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<std::string> RiaSummaryCurveDefTools::wellGroupNames() const
|
||||||
|
{
|
||||||
|
return m_wellGroupNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<int> RiaSummaryCurveDefTools::regionNumbers() const
|
||||||
|
{
|
||||||
|
return m_regionNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RimSummaryCase*> RiaSummaryCurveDefTools::summaryCases() const
|
||||||
|
{
|
||||||
|
return m_summaryCases;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaSummaryCurveDefTools::clearAllSets()
|
||||||
|
{
|
||||||
|
m_quantities.clear();
|
||||||
|
m_wellNames.clear();
|
||||||
|
m_wellGroupNames.clear();
|
||||||
|
m_regionNumbers.clear();
|
||||||
|
m_summaryCases.clear();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RiaSummaryCurveDefinition;
|
class RimSummaryCurveCollection;
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -31,22 +31,24 @@ class RimSummaryCase;
|
|||||||
class RiaSummaryCurveDefTools
|
class RiaSummaryCurveDefTools
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RiaSummaryCurveDefTools(const std::vector<RiaSummaryCurveDefinition>& curveDefinitions);
|
RiaSummaryCurveDefTools();
|
||||||
|
|
||||||
std::vector<std::string> uniqueWellNames() const;
|
void findIdentifiers(RimSummaryCurveCollection* sumCurveCollection);
|
||||||
std::vector<std::string> uniqueGroupNames() const;
|
|
||||||
std::vector<int> uniqueRegions() const;
|
std::set<std::string> quantities() const;
|
||||||
std::vector<RimSummaryCase*> uniqueSummaryCases() const;
|
std::set<std::string> wellNames() const;
|
||||||
|
std::set<std::string> wellGroupNames() const;
|
||||||
|
|
||||||
|
std::set<int> regionNumbers() const;
|
||||||
|
std::set<RimSummaryCase*> summaryCases() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void computeUniqueValues() const;
|
void clearAllSets();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::vector<RiaSummaryCurveDefinition>& m_curveDefinitions;
|
std::set<std::string> m_quantities;
|
||||||
|
std::set<std::string> m_wellNames;
|
||||||
mutable bool m_isEvaluated;
|
std::set<std::string> m_wellGroupNames;
|
||||||
mutable std::set<std::string> m_wellNames;
|
std::set<int> m_regionNumbers;
|
||||||
mutable std::set<std::string> m_groupName;
|
std::set<RimSummaryCase*> m_summaryCases;
|
||||||
mutable std::set<int> m_regionNumbers;
|
|
||||||
mutable std::set<RimSummaryCase*> m_summaryCases;
|
|
||||||
};
|
};
|
||||||
|
@ -99,11 +99,8 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
|
|||||||
description = "Well Injection Rates : ";
|
description = "Well Injection Rates : ";
|
||||||
}
|
}
|
||||||
|
|
||||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
|
||||||
summaryPlotColl->summaryPlots().push_back(plot);
|
|
||||||
|
|
||||||
description += well->name();
|
description += well->name();
|
||||||
plot->setDescription(description);
|
RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot(description);
|
||||||
|
|
||||||
if (isInjector(well))
|
if (isInjector(well))
|
||||||
{
|
{
|
||||||
|
@ -119,10 +119,7 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
|||||||
RimSummaryPlot* summaryPlot = nullptr;
|
RimSummaryPlot* summaryPlot = nullptr;
|
||||||
if (featureUi.isCreateNewPlotChecked())
|
if (featureUi.isCreateNewPlotChecked())
|
||||||
{
|
{
|
||||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot(featureUi.newPlotName());
|
||||||
summaryPlotColl->summaryPlots().push_back(plot);
|
|
||||||
|
|
||||||
plot->setDescription(featureUi.newPlotName());
|
|
||||||
|
|
||||||
summaryPlotColl->updateConnectedEditors();
|
summaryPlotColl->updateConnectedEditors();
|
||||||
|
|
||||||
|
@ -246,10 +246,7 @@ RicPasteAsciiDataToSummaryPlotFeature::CurveType RicPasteAsciiDataToSummaryPlotF
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryPlot* RicPasteAsciiDataToSummaryPlotFeature::createSummaryPlotAndAddToPlotCollection(RimSummaryPlotCollection *plotCollection)
|
RimSummaryPlot* RicPasteAsciiDataToSummaryPlotFeature::createSummaryPlotAndAddToPlotCollection(RimSummaryPlotCollection *plotCollection)
|
||||||
{
|
{
|
||||||
auto summaryPlot = new RimSummaryPlot();
|
QString name = QString("Summary Plot %1").arg(plotCollection->summaryPlots.size() + 1);
|
||||||
summaryPlot->setDescription(QString("Summary Plot %1").arg(plotCollection->summaryPlots.size() + 1));
|
|
||||||
plotCollection->summaryPlots().push_back(summaryPlot);
|
return plotCollection->createNamedSummaryPlot(name);
|
||||||
plotCollection->updateConnectedEditors();
|
|
||||||
summaryPlot->loadDataAndUpdate();
|
|
||||||
return summaryPlot;
|
|
||||||
}
|
}
|
||||||
|
@ -649,10 +649,7 @@ void RicSummaryCurveCreator::createNewPlot()
|
|||||||
summaryPlotName = QInputDialog::getText(NULL, "New Summary Plot Name", "New Summary Plot Name", QLineEdit::Normal, summaryPlotName, &ok);
|
summaryPlotName = QInputDialog::getText(NULL, "New Summary Plot Name", "New Summary Plot Name", QLineEdit::Normal, summaryPlotName, &ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot(summaryPlotName);
|
||||||
summaryPlotColl->summaryPlots().push_back(plot);
|
|
||||||
|
|
||||||
plot->setDescription(summaryPlotName);
|
|
||||||
plot->loadDataAndUpdate();
|
plot->loadDataAndUpdate();
|
||||||
|
|
||||||
summaryPlotColl->updateConnectedEditors();
|
summaryPlotColl->updateConnectedEditors();
|
||||||
|
@ -50,6 +50,7 @@ RimSummaryCurvesModifier::RimSummaryCurvesModifier()
|
|||||||
m_wellNameProxy.registerGetMethod(this, &RimSummaryCurvesModifier::wellName);
|
m_wellNameProxy.registerGetMethod(this, &RimSummaryCurvesModifier::wellName);
|
||||||
m_wellNameProxy.registerSetMethod(this, &RimSummaryCurvesModifier::setWellName);
|
m_wellNameProxy.registerSetMethod(this, &RimSummaryCurvesModifier::setWellName);
|
||||||
m_wellNameProxy.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
m_wellNameProxy.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||||
|
m_wellNameProxy.uiCapability()->setUiHidden(false);
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,20 +93,20 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurvesModifier::calculateValueOptions(co
|
|||||||
std::set<QString> identifierTexts;
|
std::set<QString> identifierTexts;
|
||||||
|
|
||||||
RifSummaryReaderInterface* reader = summaryReader();
|
RifSummaryReaderInterface* reader = summaryReader();
|
||||||
|
if (reader)
|
||||||
{
|
{
|
||||||
|
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
||||||
|
|
||||||
if (fieldNeedingOptions == &m_wellName || fieldNeedingOptions == &m_wellNameProxy)
|
if (fieldNeedingOptions == &m_wellName || fieldNeedingOptions == &m_wellNameProxy)
|
||||||
{
|
{
|
||||||
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
|
||||||
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_WELL);
|
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_WELL);
|
||||||
}
|
}
|
||||||
else if (fieldNeedingOptions == &m_region)
|
else if (fieldNeedingOptions == &m_region)
|
||||||
{
|
{
|
||||||
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
|
||||||
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_REGION);
|
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_REGION);
|
||||||
}
|
}
|
||||||
else if (fieldNeedingOptions == &m_groupName)
|
else if (fieldNeedingOptions == &m_groupName)
|
||||||
{
|
{
|
||||||
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
|
||||||
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
identifierTexts = findAvailableIdentifierTexts(allAddresses, RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,9 +194,12 @@ void RimSummaryCurvesModifier::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
for (auto curve : curveCollection->curves())
|
for (auto curve : curveCollection->curves())
|
||||||
{
|
{
|
||||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||||
adr.setWellName(m_wellName().toStdString());
|
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
|
||||||
|
{
|
||||||
|
adr.setWellName(m_wellName().toStdString());
|
||||||
|
|
||||||
curve->setSummaryAddressY(adr);
|
curve->setSummaryAddressY(adr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerLoadDataAndUpdate = true;
|
triggerLoadDataAndUpdate = true;
|
||||||
@ -205,9 +209,12 @@ void RimSummaryCurvesModifier::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
for (auto curve : curveCollection->curves())
|
for (auto curve : curveCollection->curves())
|
||||||
{
|
{
|
||||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||||
adr.setRegion(m_region());
|
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
|
||||||
|
{
|
||||||
|
adr.setRegion(m_region());
|
||||||
|
|
||||||
curve->setSummaryAddressY(adr);
|
curve->setSummaryAddressY(adr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerLoadDataAndUpdate = true;
|
triggerLoadDataAndUpdate = true;
|
||||||
@ -217,9 +224,12 @@ void RimSummaryCurvesModifier::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
for (auto curve : curveCollection->curves())
|
for (auto curve : curveCollection->curves())
|
||||||
{
|
{
|
||||||
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
||||||
adr.setWellGroupName(m_groupName().toStdString());
|
if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
|
||||||
|
{
|
||||||
|
adr.setWellGroupName(m_groupName().toStdString());
|
||||||
|
|
||||||
curve->setSummaryAddressY(adr);
|
curve->setSummaryAddressY(adr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerLoadDataAndUpdate = true;
|
triggerLoadDataAndUpdate = true;
|
||||||
@ -229,6 +239,9 @@ void RimSummaryCurvesModifier::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
{
|
{
|
||||||
RimSummaryPlot* summaryPlot = nullptr;
|
RimSummaryPlot* summaryPlot = nullptr;
|
||||||
this->firstAncestorOrThisOfTypeAsserted(summaryPlot);
|
this->firstAncestorOrThisOfTypeAsserted(summaryPlot);
|
||||||
|
|
||||||
|
summaryPlot->updatePlotTitle();
|
||||||
|
|
||||||
summaryPlot->loadDataAndUpdate();
|
summaryPlot->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,8 +260,6 @@ void RimSummaryCurvesModifier::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
|||||||
curveDefinitions.push_back(RiaSummaryCurveDefinition(curve->summaryCaseY(), curve->summaryAddressY()));
|
curveDefinitions.push_back(RiaSummaryCurveDefinition(curve->summaryCaseY(), curve->summaryAddressY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RiaSummaryCurveDefTools tools(curveDefinitions);
|
|
||||||
|
|
||||||
// m_summaryCase.uiCapability()->setUiReadOnly(true);
|
// m_summaryCase.uiCapability()->setUiReadOnly(true);
|
||||||
// m_wellName.uiCapability()->setUiReadOnly(true);
|
// m_wellName.uiCapability()->setUiReadOnly(true);
|
||||||
// m_groupName.uiCapability()->setUiReadOnly(true);
|
// m_groupName.uiCapability()->setUiReadOnly(true);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
#include "RiaSummaryCurveDefTools.h"
|
||||||
|
|
||||||
#include "RimAsciiDataCurve.h"
|
#include "RimAsciiDataCurve.h"
|
||||||
#include "RimGridTimeHistoryCurve.h"
|
#include "RimGridTimeHistoryCurve.h"
|
||||||
@ -40,16 +41,16 @@
|
|||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafPdmUiCheckBoxEditor.h"
|
#include "cafPdmUiCheckBoxEditor.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QString>
|
|
||||||
#include <QRectF>
|
|
||||||
|
|
||||||
#include "qwt_abstract_legend.h"
|
#include "qwt_abstract_legend.h"
|
||||||
#include "qwt_legend.h"
|
#include "qwt_legend.h"
|
||||||
#include "qwt_plot_curve.h"
|
#include "qwt_plot_curve.h"
|
||||||
#include "qwt_plot_renderer.h"
|
#include "qwt_plot_renderer.h"
|
||||||
|
|
||||||
#include "vector"
|
#include <QDateTime>
|
||||||
|
#include <QString>
|
||||||
|
#include <QRectF>
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
|
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
|
||||||
@ -61,12 +62,15 @@ RimSummaryPlot::RimSummaryPlot()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Summary Plot", ":/SummaryPlotLight16x16.png", "", "");
|
CAF_PDM_InitObject("Summary Plot", ":/SummaryPlotLight16x16.png", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
|
CAF_PDM_InitField(&m_userDefinedPlotTitle, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
|
||||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Plot Title", "", "", "");
|
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Plot Title", "", "", "");
|
||||||
m_showPlotTitle.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
m_showPlotTitle.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||||
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
|
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
|
||||||
m_showLegend.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
m_showLegend.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_isUsingAutoName, "IsUsingAutoName", false, "Auto Name", "", "", "");
|
||||||
|
m_isUsingAutoName.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_curveFilters_OBSOLETE, "SummaryCurveFilters", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_curveFilters_OBSOLETE, "SummaryCurveFilters", "", "", "", "");
|
||||||
m_curveFilters_OBSOLETE.uiCapability()->setUiTreeHidden(true);
|
m_curveFilters_OBSOLETE.uiCapability()->setUiTreeHidden(true);
|
||||||
|
|
||||||
@ -497,6 +501,19 @@ RiuSummaryQwtPlot* RimSummaryPlot::qwtPlot() const
|
|||||||
return m_qwtPlot;
|
return m_qwtPlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::updatePlotTitle()
|
||||||
|
{
|
||||||
|
if (m_isUsingAutoName)
|
||||||
|
{
|
||||||
|
m_userDefinedPlotTitle = extractPlotTitleFromCurves();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateMdiWindowTitle();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1045,6 +1062,14 @@ void RimSummaryPlot::addAsciiDataCruve(RimAsciiDataCurve* curve)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmFieldHandle* RimSummaryPlot::userDescriptionField()
|
||||||
|
{
|
||||||
|
return &m_userDefinedPlotTitle;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1052,11 +1077,12 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
{
|
{
|
||||||
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
|
||||||
if (changedField == &m_userName ||
|
if (changedField == &m_userDefinedPlotTitle ||
|
||||||
changedField == &m_showPlotTitle ||
|
changedField == &m_showPlotTitle ||
|
||||||
changedField == &m_showLegend)
|
changedField == &m_showLegend ||
|
||||||
|
changedField == &m_isUsingAutoName)
|
||||||
{
|
{
|
||||||
updateMdiWindowTitle();
|
updatePlotTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1115,7 +1141,12 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::onLoadDataAndUpdate()
|
void RimSummaryPlot::onLoadDataAndUpdate()
|
||||||
{
|
{
|
||||||
updateMdiWindowVisibility();
|
if (m_isUsingAutoName)
|
||||||
|
{
|
||||||
|
m_userDefinedPlotTitle = extractPlotTitleFromCurves();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateMdiWindowVisibility();
|
||||||
|
|
||||||
for (RimSummaryCurveFilter* curveFilter: m_curveFilters_OBSOLETE)
|
for (RimSummaryCurveFilter* curveFilter: m_curveFilters_OBSOLETE)
|
||||||
{
|
{
|
||||||
@ -1190,6 +1221,42 @@ void RimSummaryPlot::setZoomIntervalsInQwtPlot()
|
|||||||
m_qwtPlot->setZoomWindow(left, right, time);
|
m_qwtPlot->setZoomWindow(left, right, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimSummaryPlot::extractPlotTitleFromCurves() const
|
||||||
|
{
|
||||||
|
RiaSummaryCurveDefTools nameHelper;
|
||||||
|
|
||||||
|
nameHelper.findIdentifiers(m_summaryCurveCollection());
|
||||||
|
|
||||||
|
auto quantities = nameHelper.quantities();
|
||||||
|
auto wellNames = nameHelper.wellNames();
|
||||||
|
auto wellGroupNames = nameHelper.wellGroupNames();
|
||||||
|
auto regions = nameHelper.regionNumbers();
|
||||||
|
|
||||||
|
QString title;
|
||||||
|
|
||||||
|
if (wellNames.size() == 1)
|
||||||
|
{
|
||||||
|
title = "Well : " + QString::fromStdString(*(wellNames.begin()));
|
||||||
|
}
|
||||||
|
else if (wellGroupNames.size() == 1)
|
||||||
|
{
|
||||||
|
title = "Well Group : " + QString::fromStdString(*(wellGroupNames.begin()));
|
||||||
|
}
|
||||||
|
else if (regions.size() == 1)
|
||||||
|
{
|
||||||
|
title = "Region : " + QString::number(*(regions.begin()));
|
||||||
|
}
|
||||||
|
else if (quantities.size() == 1)
|
||||||
|
{
|
||||||
|
title = "Quantity : " + QString::fromStdString(*(quantities.begin()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1216,7 +1283,7 @@ void RimSummaryPlot::disableAutoZoom()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::setDescription(const QString& description)
|
void RimSummaryPlot::setDescription(const QString& description)
|
||||||
{
|
{
|
||||||
m_userName = description;
|
m_userDefinedPlotTitle = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1224,7 +1291,7 @@ void RimSummaryPlot::setDescription(const QString& description)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimSummaryPlot::description() const
|
QString RimSummaryPlot::description() const
|
||||||
{
|
{
|
||||||
return m_userName();
|
return m_userDefinedPlotTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1235,6 +1302,14 @@ void RimSummaryPlot::setShowDescription(bool showDescription)
|
|||||||
m_showPlotTitle = showDescription;
|
m_showPlotTitle = showDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::enableAutoName(bool enable)
|
||||||
|
{
|
||||||
|
m_isUsingAutoName = enable;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1243,6 +1318,24 @@ void RimSummaryPlot::setAsCrossPlot()
|
|||||||
m_isCrossPlot = true;
|
m_isCrossPlot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
uiOrdering.add(&m_isUsingAutoName);
|
||||||
|
uiOrdering.add(&m_userDefinedPlotTitle);
|
||||||
|
uiOrdering.add(&m_showPlotTitle);
|
||||||
|
uiOrdering.add(&m_showLegend);
|
||||||
|
|
||||||
|
m_userDefinedPlotTitle.uiCapability()->setUiReadOnly(m_isUsingAutoName);
|
||||||
|
|
||||||
|
if (m_isUsingAutoName)
|
||||||
|
{
|
||||||
|
m_userDefinedPlotTitle = extractPlotTitleFromCurves();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1327,18 +1420,19 @@ void RimSummaryPlot::updateMdiWindowTitle()
|
|||||||
{
|
{
|
||||||
if (m_qwtPlot)
|
if (m_qwtPlot)
|
||||||
{
|
{
|
||||||
m_qwtPlot->setWindowTitle(m_userName);
|
QString plotTitle = description();
|
||||||
|
|
||||||
|
m_qwtPlot->setWindowTitle(plotTitle);
|
||||||
|
|
||||||
if (m_showPlotTitle)
|
if (m_showPlotTitle)
|
||||||
{
|
{
|
||||||
m_qwtPlot->setTitle(m_userName);
|
m_qwtPlot->setTitle(plotTitle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_qwtPlot->setTitle("");
|
m_qwtPlot->setTitle("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_showLegend)
|
if (m_showLegend)
|
||||||
{
|
{
|
||||||
// Will be released in plot destructor or when a new legend is set
|
// Will be released in plot destructor or when a new legend is set
|
||||||
@ -1446,7 +1540,9 @@ size_t RimSummaryPlot::curveCount() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
void RimSummaryPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
||||||
{
|
{
|
||||||
if (field == &m_showLegend || field == &m_showPlotTitle)
|
if (field == &m_showLegend ||
|
||||||
|
field == &m_showPlotTitle ||
|
||||||
|
field == &m_isUsingAutoName)
|
||||||
{
|
{
|
||||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
|
||||||
if (myAttr)
|
if (myAttr)
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
void setDescription(const QString& description);
|
void setDescription(const QString& description);
|
||||||
QString description() const;
|
QString description() const;
|
||||||
void setShowDescription(bool showDescription);
|
void setShowDescription(bool showDescription);
|
||||||
|
void enableAutoName(bool enable);
|
||||||
|
|
||||||
void addCurveAndUpdate(RimSummaryCurve* curve);
|
void addCurveAndUpdate(RimSummaryCurve* curve);
|
||||||
void addCurveNoUpdate(RimSummaryCurve* curve);
|
void addCurveNoUpdate(RimSummaryCurve* curve);
|
||||||
@ -101,6 +102,8 @@ public:
|
|||||||
RimSummaryCurveCollection* summaryCurveCollection() const;
|
RimSummaryCurveCollection* summaryCurveCollection() const;
|
||||||
RiuSummaryQwtPlot* qwtPlot() const;
|
RiuSummaryQwtPlot* qwtPlot() const;
|
||||||
|
|
||||||
|
void updatePlotTitle();
|
||||||
|
|
||||||
// RimViewWindow overrides
|
// RimViewWindow overrides
|
||||||
public:
|
public:
|
||||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||||
@ -112,16 +115,19 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||||
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
virtual void onLoadDataAndUpdate() override;
|
virtual void onLoadDataAndUpdate() override;
|
||||||
|
|
||||||
virtual QImage snapshotWindowContent() override;
|
virtual QImage snapshotWindowContent() override;
|
||||||
|
|
||||||
void setAsCrossPlot();
|
void setAsCrossPlot();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||||
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||||
@ -136,10 +142,14 @@ private:
|
|||||||
void updateBottomXAxis();
|
void updateBottomXAxis();
|
||||||
void setZoomIntervalsInQwtPlot();
|
void setZoomIntervalsInQwtPlot();
|
||||||
|
|
||||||
|
QString extractPlotTitleFromCurves() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_showPlotTitle;
|
caf::PdmField<bool> m_showPlotTitle;
|
||||||
caf::PdmField<bool> m_showLegend;
|
caf::PdmField<bool> m_showLegend;
|
||||||
caf::PdmField<QString> m_userName;
|
|
||||||
|
caf::PdmField<bool> m_isUsingAutoName;
|
||||||
|
caf::PdmField<QString> m_userDefinedPlotTitle;
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
||||||
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
||||||
|
@ -42,6 +42,30 @@ RimSummaryPlotCollection::~RimSummaryPlotCollection()
|
|||||||
summaryPlots.deleteAllChildObjects();
|
summaryPlots.deleteAllChildObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotAutoName()
|
||||||
|
{
|
||||||
|
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||||
|
plot->enableAutoName(true);
|
||||||
|
summaryPlots.push_back(plot);
|
||||||
|
|
||||||
|
return plot;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot(const QString& name)
|
||||||
|
{
|
||||||
|
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||||
|
summaryPlots.push_back(plot);
|
||||||
|
plot->setDescription(name);
|
||||||
|
|
||||||
|
return plot;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -36,6 +36,9 @@ public:
|
|||||||
|
|
||||||
caf::PdmChildArrayField<RimSummaryPlot*> summaryPlots;
|
caf::PdmChildArrayField<RimSummaryPlot*> summaryPlots;
|
||||||
|
|
||||||
|
RimSummaryPlot* createSummaryPlotAutoName();
|
||||||
|
RimSummaryPlot* createNamedSummaryPlot(const QString& name);
|
||||||
|
|
||||||
void updateSummaryNameHasChanged();
|
void updateSummaryNameHasChanged();
|
||||||
void summaryPlotItemInfos(QList<caf::PdmOptionItemInfo>* optionInfos) const;
|
void summaryPlotItemInfos(QList<caf::PdmOptionItemInfo>* optionInfos) const;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user