#1113, #1112 Made stacked curves. Now the accumulated well flow by connection graphs is up to speed.

This commit is contained in:
Jacob Støren
2017-02-01 19:17:56 +01:00
parent a4ce5f532d
commit 8e4e7f098f
7 changed files with 104 additions and 19 deletions

View File

@@ -24,6 +24,8 @@
#include "qwt_plot.h"
#include "RimWellLogPlot.h"
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
#include "RimWellLogTrack.h"
@@ -40,6 +42,7 @@ CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "RimWellFlowRateCurve");
RimWellFlowRateCurve::RimWellFlowRateCurve()
{
CAF_PDM_InitObject("Flow Rate Curve", "", "", "");
m_curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
}
//--------------------------------------------------------------------------------------------------
@@ -96,15 +99,9 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate()
if (isCurveVisible())
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot);
CVF_ASSERT(wellLogPlot);
m_qwtPlotCurve->setTitle(createCurveAutoName());
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
updateStackedPlotData();
updateZoomInParentPlot();
@@ -112,6 +109,64 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::updateCurveAppearance()
{
RimWellLogCurve::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));
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);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::updateStackedPlotData()
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType(wellLogTrack);
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
std::vector<double> depthValues = m_curveData->measuredDepthPlotValues(displayUnit);
if (depthValues.size()) depthValues.insert(depthValues.begin(), depthValues[0]); // Insert the first depth position again, to make room for a real 0 value
std::vector<double> stackedValues(depthValues.size(), 0.0);
std::vector<RimWellFlowRateCurve*> stackedCurves = wellLogTrack->visibleStackedCurves();
double zPos = -0.1;
for ( RimWellFlowRateCurve * stCurve: stackedCurves )
{
std::vector<double> values = stCurve->curveData()->xPlotValues();
for ( size_t i = 0; i < values.size(); ++i )
{
stackedValues[i+1] += values[i];
}
if ( stCurve == this ) break;
zPos -= 1.0;
}
m_qwtPlotCurve->setSamples(stackedValues.data(), depthValues.data(), static_cast<int>(depthValues.size()));
std::vector< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices();
polyLineStartStopIndices.front().second += 1;
m_qwtPlotCurve->setLineSegmentStartStopIndices(polyLineStartStopIndices);
m_qwtPlotCurve->setZ(zPos);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------