#1948 PLT plot. Support for setting doFillCurve flag

This commit is contained in:
Bjørn Erik Jensen 2017-10-27 15:49:00 +02:00
parent 0c6fd31e07
commit d591177872
4 changed files with 51 additions and 22 deletions

View File

@ -48,6 +48,8 @@ CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "WellFlowRateCurve");
RimWellFlowRateCurve::RimWellFlowRateCurve()
{
CAF_PDM_InitObject("Flow Rate Curve", "", "", "");
m_groupId = 0;
m_doFillCurve = true;
}
//--------------------------------------------------------------------------------------------------
@ -103,6 +105,22 @@ int RimWellFlowRateCurve::groupId() const
return m_groupId;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setDoFillCurve(bool doFill)
{
m_doFillCurve = doFill;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellFlowRateCurve::doFillCurve() const
{
return m_doFillCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -143,26 +161,29 @@ void RimWellFlowRateCurve::updateCurveAppearance()
m_qwtPlotCurve->setStyle(QwtPlotCurve::Steps);
}
QColor curveQColor = QColor (m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
m_qwtPlotCurve->setBrush(QBrush( curveQColor));
if (m_doFillCurve)
{
QColor curveQColor = QColor (m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
m_qwtPlotCurve->setBrush(QBrush( curveQColor));
QLinearGradient gradient;
gradient.setCoordinateMode(QGradient::StretchToDeviceMode);
gradient.setColorAt(0,curveQColor.darker(110));
gradient.setColorAt(0.15,curveQColor);
gradient.setColorAt(0.25,curveQColor);
gradient.setColorAt(0.4,curveQColor.darker(110));
gradient.setColorAt(0.6,curveQColor);
gradient.setColorAt(0.8,curveQColor.darker(110));
gradient.setColorAt(1,curveQColor);
m_qwtPlotCurve->setBrush(gradient);
QLinearGradient gradient;
gradient.setCoordinateMode(QGradient::StretchToDeviceMode);
gradient.setColorAt(0, curveQColor.darker(110));
gradient.setColorAt(0.15, curveQColor);
gradient.setColorAt(0.25, curveQColor);
gradient.setColorAt(0.4, curveQColor.darker(110));
gradient.setColorAt(0.6, curveQColor);
gradient.setColorAt(0.8, curveQColor.darker(110));
gradient.setColorAt(1, curveQColor);
m_qwtPlotCurve->setBrush(gradient);
QPen curvePen = m_qwtPlotCurve->pen();
curvePen.setColor(curveQColor.darker());
m_qwtPlotCurve->setPen(curvePen);
m_qwtPlotCurve->setOrientation(Qt::Horizontal);
m_qwtPlotCurve->setBaseline(0.0);
m_qwtPlotCurve->setCurveAttribute(QwtPlotCurve::Inverted, true);
QPen curvePen = m_qwtPlotCurve->pen();
curvePen.setColor(curveQColor.darker());
m_qwtPlotCurve->setPen(curvePen);
m_qwtPlotCurve->setOrientation(Qt::Horizontal);
m_qwtPlotCurve->setBaseline(0.0);
m_qwtPlotCurve->setCurveAttribute(QwtPlotCurve::Inverted, true);
}
}
//--------------------------------------------------------------------------------------------------
@ -262,7 +283,7 @@ void RimWellFlowRateCurve::updateStackedPlotData()
m_qwtPlotCurve->setSamples(stackedValues.data(), depthValues.data(), static_cast<int>(depthValues.size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(polyLineStartStopIndices);
m_qwtPlotCurve->setZ(zPos);
m_qwtPlotCurve->setZ(doFillCurve() ? zPos : zPos + 10 /*?*/);
}
//--------------------------------------------------------------------------------------------------

View File

@ -47,6 +47,9 @@ public:
void setGroupId(int groupId);
int groupId() const;
void setDoFillCurve(bool doFill);
bool doFillCurve() const;
protected:
virtual QString createCurveAutoName() override;
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
@ -61,5 +64,6 @@ private:
QString m_tracerName;
int m_groupId;
bool m_doFillCurve;
};

View File

@ -889,7 +889,8 @@ void RimWellPltPlot::updateCurvesInPlot(const std::set<std::pair<RifWellRftAddre
const auto& channelName = channel->name();
if (selectedPhases.count(flowPhaseFromChannelName(channelName)) > 0)
{
addStackedCurve(channelName, rigWellLogFile->depthValues(), rigWellLogFile->values(channelName), plotTrack, curveGroupId);
addStackedCurve(channelName, rigWellLogFile->depthValues(), rigWellLogFile->values(channelName),
plotTrack, curveGroupId, true);
}
}
}
@ -906,7 +907,8 @@ void RimWellPltPlot::addStackedCurve(const QString& channelName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack,
int curveGroupId)
int curveGroupId,
bool doFillCurve)
{
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValuesPrDepthValue(channelName, depthValues, accFlow);
@ -917,6 +919,7 @@ void RimWellPltPlot::addStackedCurve(const QString& channelName,
cvf::Color3f::DARK_GRAY;
curve->setColor(color);
curve->setGroupId(curveGroupId);
curve->setDoFillCurve(doFillCurve);
plotTrack->addCurve(curve);
curve->loadDataAndUpdate(true);

View File

@ -154,7 +154,8 @@ private:
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack,
int curveGroupId);
int curveGroupId,
bool doFillCurve);
bool isOnlyGridSourcesSelected() const;
bool isAnySourceAddressSelected(const std::set<RifWellRftAddress>& addresses) const;