mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
parent
e9bab1c94b
commit
8c8a2a6492
@ -58,6 +58,15 @@ void caf::AppEnum< RimPlotCurve::PointSymbolEnum >::setUp()
|
||||
|
||||
setDefault(RimPlotCurve::SYMBOL_NONE);
|
||||
}
|
||||
|
||||
template<>
|
||||
void RimPlotCurve::CurveInterpolation::setUp()
|
||||
{
|
||||
addItem(RimPlotCurve::INTERPOLATION_POINT_TO_POINT, "INTERPOLATION_POINT_TO_POINT", "Point to Point");
|
||||
addItem(RimPlotCurve::INTERPOLATION_STEP_LEFT, "INTERPOLATION_STEP_LEFT", "Step Left");
|
||||
|
||||
setDefault(RimPlotCurve::INTERPOLATION_POINT_TO_POINT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -85,6 +94,8 @@ RimPlotCurve::RimPlotCurve()
|
||||
caf::AppEnum< RimPlotCurve::LineStyleEnum > lineStyle = STYLE_SOLID;
|
||||
CAF_PDM_InitField(&m_lineStyle, "LineStyle", lineStyle, "Line Style", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_curveInterpolation, "CurveInterpolation", "Interpolation", "", "", "");
|
||||
|
||||
caf::AppEnum< RimPlotCurve::PointSymbolEnum > pointSymbol = SYMBOL_NONE;
|
||||
CAF_PDM_InitField(&m_pointSymbol, "PointSymbol", pointSymbol, "Symbol", "", "", "");
|
||||
|
||||
@ -128,7 +139,8 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
|
||||
|| &m_curveThickness == changedField
|
||||
|| &m_pointSymbol == changedField
|
||||
|| &m_lineStyle == changedField
|
||||
|| &m_symbolSkipPixelDistance == changedField)
|
||||
|| &m_symbolSkipPixelDistance == changedField
|
||||
|| &m_curveInterpolation == changedField)
|
||||
{
|
||||
updateCurveAppearance();
|
||||
}
|
||||
@ -283,6 +295,7 @@ void RimPlotCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
uiOrdering.add(&m_symbolSkipPixelDistance);
|
||||
uiOrdering.add(&m_curveThickness);
|
||||
uiOrdering.add(&m_lineStyle);
|
||||
uiOrdering.add(&m_curveInterpolation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -346,7 +359,17 @@ void RimPlotCurve::updateCurveAppearance()
|
||||
|
||||
if (m_lineStyle() != STYLE_NONE)
|
||||
{
|
||||
curveStyle = QwtPlotCurve::Lines;
|
||||
switch (m_curveInterpolation())
|
||||
{
|
||||
case INTERPOLATION_STEP_LEFT:
|
||||
curveStyle = QwtPlotCurve::Steps;
|
||||
m_qwtPlotCurve->setCurveAttribute(QwtPlotCurve::Inverted, false);
|
||||
break;
|
||||
case INTERPOLATION_POINT_TO_POINT: // Fall through
|
||||
default:
|
||||
curveStyle = QwtPlotCurve::Lines;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_lineStyle())
|
||||
{
|
||||
|
@ -56,6 +56,14 @@ public:
|
||||
SYMBOL_XCROSS
|
||||
};
|
||||
|
||||
enum CurveInterpolationEnum
|
||||
{
|
||||
INTERPOLATION_POINT_TO_POINT,
|
||||
INTERPOLATION_STEP_LEFT,
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<CurveInterpolationEnum> CurveInterpolation;
|
||||
|
||||
public:
|
||||
RimPlotCurve();
|
||||
virtual ~RimPlotCurve();
|
||||
@ -121,6 +129,7 @@ protected:
|
||||
|
||||
caf::PdmField< caf::AppEnum< PointSymbolEnum > > m_pointSymbol;
|
||||
caf::PdmField< caf::AppEnum< LineStyleEnum > > m_lineStyle;
|
||||
caf::PdmField< CurveInterpolation > m_curveInterpolation;
|
||||
};
|
||||
|
||||
|
||||
|
@ -222,6 +222,8 @@ void RimSummaryCurve::setSummaryAddress(const RifEclipseSummaryAddress& address)
|
||||
m_curveVariable->setAddress(address);
|
||||
|
||||
m_summaryFilter->updateFromAddress(address);
|
||||
|
||||
calculateCurveInterpolationFromAddress();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -511,6 +513,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
m_curveVariable->setAddress(RifEclipseSummaryAddress());
|
||||
}
|
||||
|
||||
this->calculateCurveInterpolationFromAddress();
|
||||
this->loadDataAndUpdate();
|
||||
|
||||
plot->updateAxes();
|
||||
@ -567,3 +570,22 @@ bool RimSummaryCurve::curveData(std::vector<QDateTime>* timeSteps, std::vector<d
|
||||
return reader->values(addr, values);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::calculateCurveInterpolationFromAddress()
|
||||
{
|
||||
if (m_curveVariable())
|
||||
{
|
||||
QString quantityName = QString::fromUtf8(m_curveVariable()->address().quantityName().c_str());
|
||||
if (quantityName.endsWith("T"))
|
||||
{
|
||||
m_curveInterpolation = INTERPOLATION_POINT_TO_POINT;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_curveInterpolation = INTERPOLATION_STEP_LEFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,8 @@ private:
|
||||
RifReaderEclipseSummary* summaryReader() const;
|
||||
bool curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values) const;
|
||||
|
||||
void calculateCurveInterpolationFromAddress();
|
||||
|
||||
// Overridden PDM methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||
|
Loading…
Reference in New Issue
Block a user