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-22 04:17:24 -05:00
|
|
|
#include "RimWellLogPlotTrack.h"
|
|
|
|
|
2015-09-17 11:42:35 -05:00
|
|
|
#include "RiuWellLogPlotCurve.h"
|
2015-09-22 04:17:24 -05:00
|
|
|
#include "RiuWellLogTrackPlot.h"
|
2015-09-17 11:42:35 -05:00
|
|
|
|
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()
|
|
|
|
{
|
2015-10-15 03:18:59 -05:00
|
|
|
CAF_PDM_InitObject("Curve", ":/WellLogCurve16x16.png", "", "");
|
2015-08-27 09:13:49 -05:00
|
|
|
|
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
|
|
|
|
2015-09-22 08:23:52 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_curveName, "CurveName", "Curve Name", "", "", "");
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");
|
|
|
|
m_customCurveName.uiCapability()->setUiHidden(true);
|
|
|
|
|
|
|
|
CAF_PDM_InitField(&m_autoName, "AutoName", true, "Auto 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-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve = new RiuWellLogPlotCurve;
|
|
|
|
m_qwtPlotCurve->setXAxis(QwtPlot::xTop);
|
|
|
|
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
|
2015-09-22 08:23:52 -05:00
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
m_ownerQwtTrack = NULL;
|
2015-08-27 09:13:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogPlotCurve::~RimWellLogPlotCurve()
|
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->detach();
|
|
|
|
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
|
2015-08-30 19:06:37 -05:00
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
delete m_qwtPlotCurve;
|
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-22 08:23:52 -05:00
|
|
|
else if (changedField == &m_curveName)
|
2015-09-18 06:02:33 -05:00
|
|
|
{
|
2015-09-22 08:23:52 -05:00
|
|
|
m_customCurveName = m_curveName;
|
2015-09-18 06:02:33 -05:00
|
|
|
updatePlotTitle();
|
|
|
|
}
|
2015-09-22 08:23:52 -05:00
|
|
|
else if (&m_curveColor == changedField)
|
2015-09-03 02:49:36 -05:00
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->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-22 08:23:52 -05:00
|
|
|
else if (changedField == &m_autoName)
|
2015-09-18 06:02:33 -05:00
|
|
|
{
|
2015-09-22 08:23:52 -05:00
|
|
|
if (!m_autoName)
|
|
|
|
{
|
|
|
|
m_customCurveName = createCurveName();
|
|
|
|
}
|
|
|
|
|
2015-09-18 06:43:09 -05:00
|
|
|
updateOptionSensitivity();
|
2015-09-22 08:23:52 -05:00
|
|
|
updateCurveName();
|
|
|
|
updatePlotTitle();
|
2015-09-18 06:02:33 -05:00
|
|
|
}
|
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
if (m_ownerQwtTrack) m_ownerQwtTrack->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-10-27 08:44:53 -05:00
|
|
|
if (m_showCurve() && m_ownerQwtTrack)
|
2015-09-03 02:49:36 -05:00
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->attach(m_ownerQwtTrack);
|
2015-09-03 02:49:36 -05:00
|
|
|
}
|
|
|
|
else
|
2015-09-01 07:50:26 -05:00
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->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();
|
2015-09-22 08:23:52 -05:00
|
|
|
this->updateCurveName();
|
2015-09-18 06:43:09 -05:00
|
|
|
this->updatePlotTitle();
|
2015-09-03 02:49:36 -05:00
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
|
2015-09-03 02:49:36 -05:00
|
|
|
// 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-10-27 08:44:53 -05:00
|
|
|
void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrackPlot* plot)
|
2015-09-01 02:32:44 -05:00
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_ownerQwtTrack = plot;
|
2015-09-03 02:49:36 -05:00
|
|
|
if (m_showCurve)
|
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->attach(m_ownerQwtTrack);
|
|
|
|
m_ownerQwtTrack->replot();
|
2015-09-03 02:49:36 -05:00
|
|
|
}
|
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-22 08:23:52 -05:00
|
|
|
return &m_curveName;
|
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);
|
2015-10-27 08:44:53 -05:00
|
|
|
CVF_ASSERT(m_qwtPlotCurve);
|
2015-09-01 07:50:26 -05:00
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
if (m_qwtPlotCurve->data()->size() < 1)
|
2015-09-01 07:50:26 -05:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
*minimumDepth = m_qwtPlotCurve->minYValue();
|
|
|
|
*maximumDepth = m_qwtPlotCurve->maxYValue();
|
2015-09-01 07:50:26 -05:00
|
|
|
|
|
|
|
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);
|
2015-10-27 08:44:53 -05:00
|
|
|
CVF_ASSERT(m_qwtPlotCurve);
|
2015-09-18 03:50:01 -05:00
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
if (m_qwtPlotCurve->data()->size() < 1)
|
2015-09-18 03:50:01 -05:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
*minimumValue = m_qwtPlotCurve->minXValue();
|
|
|
|
*maximumValue = m_qwtPlotCurve->maxXValue();
|
2015-09-18 03:50:01 -05:00
|
|
|
|
|
|
|
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
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-10-27 08:44:53 -05:00
|
|
|
void RimWellLogPlotCurve::detachQwtCurve()
|
2015-09-03 08:10:02 -05:00
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->detach();
|
2015-09-03 08:10:02 -05:00
|
|
|
}
|
|
|
|
|
2015-09-17 11:42:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
|
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
return m_qwtPlotCurve;
|
2015-09-17 11:42:35 -05:00
|
|
|
}
|
2015-09-18 06:02:33 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::updatePlotTitle()
|
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
m_qwtPlotCurve->setTitle(m_curveName);
|
2015-09-18 06:02:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-10-27 08:44:53 -05:00
|
|
|
bool RimWellLogPlotCurve::isCurveVisible()
|
2015-09-18 06:02:33 -05:00
|
|
|
{
|
|
|
|
return m_showCurve;
|
|
|
|
}
|
2015-09-18 06:43:09 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::initAfterRead()
|
|
|
|
{
|
|
|
|
updateOptionSensitivity();
|
|
|
|
}
|
|
|
|
|
2015-09-22 04:17:24 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::updateTrackAndPlotFromCurveData()
|
|
|
|
{
|
|
|
|
RimWellLogPlot* wellLogPlot;
|
|
|
|
firstAnchestorOrThisOfType(wellLogPlot);
|
2015-09-22 04:54:58 -05:00
|
|
|
if (wellLogPlot)
|
2015-09-22 04:17:24 -05:00
|
|
|
{
|
2015-10-27 08:44:53 -05:00
|
|
|
wellLogPlot->calculateAvailableDepthRange();
|
2015-10-28 04:06:35 -05:00
|
|
|
wellLogPlot->zoomAllDepth();
|
2015-09-22 04:54:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
RimWellLogPlotTrack* plotTrack;
|
|
|
|
firstAnchestorOrThisOfType(plotTrack);
|
|
|
|
if (plotTrack)
|
|
|
|
{
|
2015-10-28 04:06:35 -05:00
|
|
|
plotTrack->alignDepthZoomToPlotAndZoomAllX();
|
2015-09-22 04:17:24 -05:00
|
|
|
}
|
|
|
|
}
|
2015-09-22 08:23:52 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::updateCurveName()
|
|
|
|
{
|
|
|
|
if (m_autoName)
|
|
|
|
{
|
|
|
|
m_curveName = this->createCurveName();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_curveName = m_customCurveName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlotCurve::updateOptionSensitivity()
|
|
|
|
{
|
|
|
|
m_curveName.uiCapability()->setUiReadOnly(m_autoName);
|
|
|
|
}
|
2015-10-15 04:27:12 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const RigWellLogCurveData* RimWellLogPlotCurve::curveData() const
|
|
|
|
{
|
|
|
|
return m_curveData.p();
|
|
|
|
}
|