2015-08-26 05:27:29 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-08-27 09:13:49 -05:00
|
|
|
#include "RimWellLogPlotCurve.h"
|
2015-08-26 05:27:29 -05:00
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
#include "RiuWellLogTracePlot.h"
|
|
|
|
|
|
|
|
#include "qwt_plot_curve.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
2015-08-27 09:13:49 -05:00
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimWellLogPlotCurve, "WellLogPlotCurve");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogPlotCurve::RimWellLogPlotCurve()
|
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("Curve", "", "", "");
|
|
|
|
|
|
|
|
CAF_PDM_InitField(&show, "Show", true, "Show curve", "", "", "");
|
|
|
|
show.uiCapability()->setUiHidden(true);
|
2015-08-30 19:06:37 -05:00
|
|
|
|
|
|
|
m_plotCurve = new QwtPlotCurve;
|
2015-08-27 09:13:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogPlotCurve::~RimWellLogPlotCurve()
|
|
|
|
{
|
2015-08-30 19:06:37 -05:00
|
|
|
m_plotCurve->detach();
|
|
|
|
m_plot->replot();
|
|
|
|
|
|
|
|
delete m_plotCurve;
|
2015-08-27 09:13:49 -05:00
|
|
|
}
|
2015-08-26 05:27:29 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-27 09:13:49 -05:00
|
|
|
void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
2015-08-26 05:27:29 -05:00
|
|
|
{
|
2015-08-31 02:50:40 -05:00
|
|
|
if (changedField == &show)
|
|
|
|
{
|
|
|
|
if (newValue == true)
|
|
|
|
{
|
|
|
|
m_plotCurve->attach(m_plot);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_plotCurve->detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_plot->replot();
|
|
|
|
}
|
2015-08-26 05:27:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-27 09:13:49 -05:00
|
|
|
caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField()
|
2015-08-26 05:27:29 -05:00
|
|
|
{
|
2015-08-27 09:13:49 -05:00
|
|
|
return &show;
|
2015-08-26 05:27:29 -05:00
|
|
|
}
|
2015-08-30 19:06:37 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::plot(std::vector<double> depthValues, std::vector<double> values)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(m_plot);
|
|
|
|
|
|
|
|
m_depthValues = depthValues;
|
|
|
|
m_values = values;
|
|
|
|
|
|
|
|
m_plotCurve->setTitle(this->uiName());
|
|
|
|
m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
|
|
|
|
m_plotCurve->attach(m_plot);
|
|
|
|
m_plot->replot();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
size_t RimWellLogPlotCurve::pointCount() const
|
|
|
|
{
|
|
|
|
return m_depthValues.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const double* RimWellLogPlotCurve::depthValues() const
|
|
|
|
{
|
|
|
|
return m_depthValues.data();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const double* RimWellLogPlotCurve::values() const
|
|
|
|
{
|
|
|
|
return m_values.data();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::setPlot(RiuWellLogTracePlot* plot)
|
|
|
|
{
|
|
|
|
m_plot = plot;
|
|
|
|
}
|