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-09-18 03:50:01 -05:00
|
|
|
|
2015-09-01 07:50:26 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
2015-09-18 03:50:01 -05:00
|
|
|
|
2015-09-18 05:29:23 -05:00
|
|
|
#include "RiuWellLogTrackPlot.h"
|
2015-09-17 11:42:35 -05:00
|
|
|
#include "RiuWellLogPlotCurve.h"
|
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
#include "cvfAssert.h"
|
2015-08-27 09:13:49 -05:00
|
|
|
|
2015-09-18 06:02:33 -05:00
|
|
|
// NB! Special macro for pure virtual class
|
|
|
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogPlotCurve, "WellLogPlotCurve");
|
2015-08-27 09:13:49 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogPlotCurve::RimWellLogPlotCurve()
|
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("Curve", "", "", "");
|
|
|
|
|
2015-09-01 02:32:44 -05:00
|
|
|
CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
|
|
|
|
m_showCurve.uiCapability()->setUiHidden(true);
|
2015-09-18 06:02:33 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Name", "", "", "");
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_generatedCurveName, "GeneratedCurveName", "Generated Curve Name", "", "", "");
|
|
|
|
m_generatedCurveName.uiCapability()->setUiReadOnly(true);
|
|
|
|
m_generatedCurveName.xmlCapability()->setIOReadable(false);
|
|
|
|
m_generatedCurveName.xmlCapability()->setIOWritable(false);
|
|
|
|
|
|
|
|
CAF_PDM_InitField(&m_useCustomCurveName, "UseCustomCurveName", false, "Custom Curve Name", "", "", "");
|
2015-08-30 19:06:37 -05:00
|
|
|
|
2015-09-03 03:55:54 -05:00
|
|
|
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
|
|
|
|
|
2015-09-17 11:42:35 -05:00
|
|
|
m_plotCurve = new RiuWellLogPlotCurve;
|
2015-09-01 08:38:26 -05:00
|
|
|
m_plotCurve->setXAxis(QwtPlot::xTop);
|
|
|
|
m_plotCurve->setYAxis(QwtPlot::yLeft);
|
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-09-01 02:32:44 -05:00
|
|
|
if (changedField == &m_showCurve)
|
2015-08-31 02:50:40 -05:00
|
|
|
{
|
2015-09-03 02:49:36 -05:00
|
|
|
this->updateCurveVisibility();
|
|
|
|
}
|
|
|
|
|
2015-09-18 06:02:33 -05:00
|
|
|
if (changedField == &m_customCurveName)
|
|
|
|
{
|
|
|
|
updatePlotTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (&m_curveColor == changedField)
|
2015-09-03 02:49:36 -05:00
|
|
|
{
|
2015-09-18 06:02:33 -05:00
|
|
|
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
|
2015-08-31 02:50:40 -05:00
|
|
|
}
|
2015-09-18 06:02:33 -05:00
|
|
|
|
|
|
|
if (changedField == &m_useCustomCurveName)
|
|
|
|
{
|
|
|
|
updatePlotTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
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-09-01 02:32:44 -05:00
|
|
|
return &m_showCurve;
|
2015-08-26 05:27:29 -05:00
|
|
|
}
|
2015-08-30 19:06:37 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-03 02:49:36 -05:00
|
|
|
void RimWellLogPlotCurve::updateCurveVisibility()
|
2015-08-30 19:06:37 -05:00
|
|
|
{
|
2015-09-03 02:49:36 -05:00
|
|
|
if (m_showCurve())
|
|
|
|
{
|
|
|
|
m_plotCurve->attach(m_plot);
|
|
|
|
}
|
|
|
|
else
|
2015-09-01 07:50:26 -05:00
|
|
|
{
|
2015-09-03 02:49:36 -05:00
|
|
|
m_plotCurve->detach();
|
2015-09-01 07:50:26 -05:00
|
|
|
}
|
2015-09-03 02:49:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 06:02:33 -05:00
|
|
|
void RimWellLogPlotCurve::updatePlotConfiguration()
|
2015-09-03 02:49:36 -05:00
|
|
|
{
|
|
|
|
this->updateCurveVisibility();
|
|
|
|
|
|
|
|
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
|
|
|
|
// Todo: Rest of the curve setup controlled from this class
|
2015-09-01 02:32:44 -05:00
|
|
|
}
|
2015-08-30 19:06:37 -05:00
|
|
|
|
2015-09-01 02:32:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 05:29:23 -05:00
|
|
|
void RimWellLogPlotCurve::setPlot(RiuWellLogTrackPlot* plot)
|
2015-09-01 02:32:44 -05:00
|
|
|
{
|
|
|
|
m_plot = plot;
|
2015-09-03 02:49:36 -05:00
|
|
|
if (m_showCurve)
|
|
|
|
{
|
|
|
|
m_plotCurve->attach(m_plot);
|
|
|
|
m_plot->replot();
|
|
|
|
}
|
2015-08-30 19:06:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-01 02:32:44 -05:00
|
|
|
caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField()
|
2015-08-30 19:06:37 -05:00
|
|
|
{
|
2015-09-18 06:02:33 -05:00
|
|
|
if (m_useCustomCurveName)
|
|
|
|
{
|
|
|
|
return &m_customCurveName;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return &m_generatedCurveName;
|
|
|
|
}
|
2015-08-30 19:06:37 -05:00
|
|
|
}
|
2015-09-01 07:50:26 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-03 08:10:02 -05:00
|
|
|
bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth) const
|
2015-09-01 07:50:26 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(minimumDepth && maximumDepth);
|
|
|
|
CVF_ASSERT(m_plotCurve);
|
|
|
|
|
|
|
|
if (m_plotCurve->data()->size() < 1)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*minimumDepth = m_plotCurve->minYValue();
|
|
|
|
*maximumDepth = m_plotCurve->maxYValue();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-09-01 04:25:09 -05:00
|
|
|
|
2015-09-18 03:50:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue) const
|
|
|
|
{
|
|
|
|
CVF_ASSERT(minimumValue && maximumValue);
|
|
|
|
CVF_ASSERT(m_plotCurve);
|
|
|
|
|
|
|
|
if (m_plotCurve->data()->size() < 1)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*minimumValue = m_plotCurve->minXValue();
|
|
|
|
*maximumValue = m_plotCurve->maxXValue();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-09-03 03:55:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::setColor(const cvf::Color3f& color)
|
|
|
|
{
|
|
|
|
m_curveColor = color;
|
|
|
|
}
|
|
|
|
|
2015-09-03 08:10:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::detachCurve()
|
|
|
|
{
|
|
|
|
m_plotCurve->detach();
|
|
|
|
}
|
|
|
|
|
2015-09-17 11:42:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
|
|
|
|
{
|
|
|
|
return m_plotCurve;
|
|
|
|
}
|
2015-09-18 06:02:33 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::updatePlotTitle()
|
|
|
|
{
|
|
|
|
if (m_useCustomCurveName)
|
|
|
|
{
|
|
|
|
m_plotCurve->setTitle(m_customCurveName);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_generatedCurveName = this->createCurveName();
|
|
|
|
m_plotCurve->setTitle(m_generatedCurveName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
|
|
|
uiOrdering.add(&m_customCurveName);
|
|
|
|
uiOrdering.add(&m_generatedCurveName);
|
|
|
|
uiOrdering.add(&m_useCustomCurveName);
|
|
|
|
uiOrdering.add(&m_curveColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimWellLogPlotCurve::isCurveVisibile()
|
|
|
|
{
|
|
|
|
return m_showCurve;
|
|
|
|
}
|