mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#739 Aligned more to the way of the RimPlotCurve
This commit is contained in:
parent
e469eb1483
commit
cb8f2e47f5
@ -30,6 +30,7 @@
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryCurve, "SummaryCurve");
|
||||
|
||||
@ -63,6 +64,8 @@ RimSummaryCurve::~RimSummaryCurve()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
{
|
||||
this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
|
||||
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
if (fieldNeedingOptions == &m_variableName)
|
||||
{
|
||||
@ -111,19 +114,59 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryCurve::createCurveAutoName()
|
||||
{
|
||||
return m_variableName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::zoomAllParentPlot()
|
||||
{
|
||||
// Todo
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::onLoadDataAndUpdate()
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation();
|
||||
|
||||
if (isCurveVisible())
|
||||
{
|
||||
std::vector<QDateTime> dateTimes;
|
||||
std::vector<double> values;
|
||||
|
||||
this->curveData(&dateTimes, &values);
|
||||
|
||||
m_qwtPlotCurve->setSamplesFromDateAndValues(dateTimes, values);
|
||||
|
||||
zoomAllParentPlot();
|
||||
|
||||
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
this->RimPlotCurve::fieldChangedByUi(changedField,oldValue,newValue);
|
||||
|
||||
if (changedField == &m_variableName)
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = NULL;
|
||||
this->firstAnchestorOrThisOfType(summaryPlot);
|
||||
if (summaryPlot)
|
||||
{
|
||||
//summaryPlot->redrawAllCurves();
|
||||
}
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
else if (changedField = &m_eclipseCase)
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "RimPlotCurve.h"
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RifReaderEclipseSummary;
|
||||
@ -33,7 +34,7 @@ class RiuLineSegmentQwtPlotCurve;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryCurve : public caf::PdmObject
|
||||
class RimSummaryCurve : public RimPlotCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
@ -44,17 +45,20 @@ public:
|
||||
|
||||
caf::PdmField<QString> m_variableName;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||
|
||||
void curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values);
|
||||
|
||||
protected:
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void zoomAllParentPlot() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
RifReaderEclipseSummary* summaryReader();
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||
|
||||
private:
|
||||
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
|
||||
|
||||
};
|
||||
|
@ -101,14 +101,7 @@ void RimSummaryPlot::loadDataAndUpdate()
|
||||
{
|
||||
RimSummaryCurve* curve = curves[i];
|
||||
|
||||
std::vector<QDateTime> dateTimes;
|
||||
std::vector<double> values;
|
||||
|
||||
curve->curveData(&dateTimes, &values);
|
||||
|
||||
cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable();
|
||||
|
||||
m_viewer->addCurve(curve->m_variableName(), curveColor, dateTimes, values);
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,6 +154,6 @@ void RimSummaryPlot::detachAllCurves()
|
||||
{
|
||||
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
||||
{
|
||||
//curves[cIdx]->detachQwtCurve();
|
||||
curves[cIdx]->detachQwtCurve();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user