Refactored and renamed to RuiLineSegmentQwtPlotCurve

This commit is contained in:
Magne Sjaastad 2015-11-06 08:32:58 +01:00
parent cef31b2c4a
commit 3c00a8394d
6 changed files with 43 additions and 23 deletions

View File

@ -23,7 +23,7 @@
#include "RimWellLogTrack.h"
#include "RiuWellLogCurve.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuWellLogTrack.h"
#include "cvfAssert.h"
@ -49,7 +49,7 @@ RimWellLogCurve::RimWellLogCurve()
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
m_qwtPlotCurve = new RiuWellLogCurve;
m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve;
m_qwtPlotCurve->setXAxis(QwtPlot::xTop);
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);

View File

@ -29,7 +29,7 @@
class RigWellLogCurveData;
class RiuWellLogTrack;
class RiuWellLogCurve;
class RiuLineSegmentQwtPlotCurve;
class QwtPlotCurve;
class QString;
@ -82,7 +82,7 @@ protected:
QPointer<RiuWellLogTrack> m_ownerQwtTrack;
RiuWellLogCurve* m_qwtPlotCurve;
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
cvf::ref<RigWellLogCurveData> m_curveData;
caf::PdmField<bool> m_showCurve;

View File

@ -46,7 +46,7 @@
#include "RimGeoMechView.h"
#include "RimGeoMechCellColors.h"
#include "RiuWellLogCurve.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuWellLogTrack.h"
#include "cafPdmUiTreeOrdering.h"

View File

@ -29,7 +29,7 @@
#include "RimWellLogPlot.h"
#include "RiuWellLogTrack.h"
#include "RiuWellLogCurve.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"

View File

@ -17,7 +17,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuWellLogCurve.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RigWellLogCurveData.h"
@ -25,21 +25,21 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellLogCurve::RiuWellLogCurve()
RiuLineSegmentQwtPlotCurve::RiuLineSegmentQwtPlotCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellLogCurve::~RiuWellLogCurve()
RiuLineSegmentQwtPlotCurve::~RiuLineSegmentQwtPlotCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogCurve::drawCurve(QPainter* p, int style,
void RiuLineSegmentQwtPlotCurve::drawCurve(QPainter* p, int style,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to) const
{
@ -57,13 +57,19 @@ void RiuWellLogCurve::drawCurve(QPainter* p, int style,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogCurve::setCurveData(const RigWellLogCurveData* curveData)
void RiuLineSegmentQwtPlotCurve::setCurveData(const RigWellLogCurveData* curveData)
{
CVF_ASSERT(curveData);
std::vector<double> validXValues = curveData->xPlotValues();
std::vector<double> validYValues = curveData->depthPlotValues();
setSamples(validXValues.data(), validYValues.data(), (int) validXValues.size());
m_polyLineStartStopIndices = curveData->polylineStartStopIndices();
setCurveData(curveData->xPlotValues(), curveData->depthPlotValues(), curveData->polylineStartStopIndices());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuLineSegmentQwtPlotCurve::setCurveData(const std::vector<double>& xValues, const std::vector<double>& yValues, const std::vector< std::pair<size_t, size_t> >& lineSegmentStartStopIndices)
{
setSamples(xValues.data(), yValues.data(), static_cast<int>(xValues.size()));
m_polyLineStartStopIndices = lineSegmentStartStopIndices;
}

View File

@ -26,20 +26,34 @@
class RigWellLogCurveData;
//==================================================================================================
///
///
//
// The PlotCurve class is able to draw a curve using line segments. If inf data is present
// in the curve data, Qwt is not able to draw a nice curve. This class assumes that inf data is removed,
// and segments to be draw are indicated by start/stop indices into curve data.
//
// Here you can see the curve segments visualized. Curve segments are drawn between vector indices.
//
// 0 - 1
// 5 - 7
// 9 -10
//
// * *
// / / \
// Curve * * * *---*
//
// Values 1.0|2.0|inf|inf|inf|1.0|2.0|1.0|inf|1.0|1.0
// Vec index 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
//==================================================================================================
class RiuWellLogCurve : public QwtPlotCurve
class RiuLineSegmentQwtPlotCurve : public QwtPlotCurve
{
public:
RiuWellLogCurve();
virtual ~RiuWellLogCurve();
RiuLineSegmentQwtPlotCurve();
virtual ~RiuLineSegmentQwtPlotCurve();
void setCurveData(const RigWellLogCurveData* curveData);
void setCurveData(const std::vector<double>& xValues, const std::vector<double>& yValues, const std::vector< std::pair<size_t, size_t> >& lineSegmentStartStopIndices);
protected:
virtual void drawCurve(QPainter* p, int style,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to) const;