2015-09-15 08:23:25 -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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimWellLogFileCurve.h"
|
|
|
|
|
2015-09-16 08:31:04 -05:00
|
|
|
#include "RimProject.h"
|
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
|
|
|
#include "RimWellPath.h"
|
2015-09-18 02:16:59 -05:00
|
|
|
#include "RimWellLogFileChannel.h"
|
2015-09-16 09:06:06 -05:00
|
|
|
#include "RimWellLogFile.h"
|
2015-11-04 09:14:42 -06:00
|
|
|
#include "RimWellLogTrack.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
|
|
|
|
2015-11-04 09:14:42 -06:00
|
|
|
#include "RiuWellLogTrack.h"
|
2015-11-06 01:32:58 -06:00
|
|
|
#include "RiuLineSegmentQwtPlotCurve.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
2015-10-30 05:42:11 -05:00
|
|
|
#include "RiaPreferences.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
|
|
|
|
2015-10-30 05:42:11 -05:00
|
|
|
#include <QMessageBox>
|
|
|
|
|
2015-09-15 08:23:25 -05:00
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimWellLogFileCurve, "WellLogFileCurve");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogFileCurve::RimWellLogFileCurve()
|
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("Well Log File Curve", "", "", "");
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", "Well Path", "", "", "");
|
2016-10-10 08:38:31 -05:00
|
|
|
m_wellPath.uiCapability()->setUiTreeChildrenHidden(true);
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_wellLogChannnelName, "CurveWellLogChannel", "Well Log Channel", "", "", "");
|
|
|
|
|
|
|
|
m_wellPath = NULL;
|
2015-09-22 08:23:52 -05:00
|
|
|
|
|
|
|
updateOptionSensitivity();
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogFileCurve::~RimWellLogFileCurve()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-05-23 10:13:03 -05:00
|
|
|
void RimWellLogFileCurve::onLoadDataAndUpdate()
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2016-05-23 10:13:03 -05:00
|
|
|
RimWellLogCurve::updateCurvePresentation();
|
2015-09-16 08:31:04 -05:00
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
if (isCurveVisible())
|
2015-09-16 08:31:04 -05:00
|
|
|
{
|
2015-10-15 04:27:12 -05:00
|
|
|
m_curveData = new RigWellLogCurveData;
|
|
|
|
|
2015-10-30 05:42:11 -05:00
|
|
|
RimWellLogPlot* wellLogPlot;
|
2016-09-21 06:59:41 -05:00
|
|
|
firstAncestorOrThisOfType(wellLogPlot);
|
2015-10-30 05:42:11 -05:00
|
|
|
CVF_ASSERT(wellLogPlot);
|
|
|
|
|
|
|
|
if (wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
|
|
|
{
|
|
|
|
if (RiaApplication::instance()->preferences()->showLasCurveWithoutTvdWarning())
|
|
|
|
{
|
|
|
|
QString tmp = QString("Display of True Vertical Depth (TVD) for LAS curves in not yet supported, and no LAS curve will be displayed in this mode.\n\n");
|
|
|
|
tmp += "Control display of this warning from \"Preferences->Show LAS curve without TVD warning\"";
|
|
|
|
|
|
|
|
QMessageBox::warning(NULL, "LAS curve without TVD", tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (m_wellPath)
|
2015-09-16 08:31:04 -05:00
|
|
|
{
|
2015-09-16 09:06:06 -05:00
|
|
|
RimWellLogFile* logFileInfo = m_wellPath->m_wellLogFile;
|
2015-09-16 08:31:04 -05:00
|
|
|
if (logFileInfo)
|
|
|
|
{
|
|
|
|
RigWellLogFile* wellLogFile = logFileInfo->wellLogFile();
|
2015-10-12 05:40:10 -05:00
|
|
|
if (wellLogFile)
|
2015-09-18 02:05:15 -05:00
|
|
|
{
|
2015-10-12 05:40:10 -05:00
|
|
|
std::vector<double> values = wellLogFile->values(m_wellLogChannnelName);
|
|
|
|
std::vector<double> depthValues = wellLogFile->depthValues();
|
|
|
|
|
2015-10-15 04:27:12 -05:00
|
|
|
if (values.size() == depthValues.size())
|
2015-10-12 05:40:10 -05:00
|
|
|
{
|
2015-12-02 05:19:35 -06:00
|
|
|
m_curveData->setValuesAndMD(values, depthValues, wellLogFile->depthUnit(), false);
|
2015-10-12 05:40:10 -05:00
|
|
|
}
|
2015-09-18 02:05:15 -05:00
|
|
|
}
|
2015-09-22 08:12:33 -05:00
|
|
|
|
2016-05-23 10:13:03 -05:00
|
|
|
if (m_isUsingAutoName)
|
2015-09-22 08:45:58 -05:00
|
|
|
{
|
2016-05-23 10:13:03 -05:00
|
|
|
m_qwtPlotCurve->setTitle(createCurveAutoName());
|
2015-09-22 08:45:58 -05:00
|
|
|
}
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
}
|
2015-10-15 04:27:12 -05:00
|
|
|
|
2015-12-02 06:39:16 -06:00
|
|
|
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
|
|
|
|
if (wellLogPlot)
|
|
|
|
{
|
|
|
|
displayUnit = wellLogPlot->depthUnit();
|
|
|
|
}
|
|
|
|
|
2016-09-12 09:43:31 -05:00
|
|
|
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
2015-11-06 03:08:35 -06:00
|
|
|
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
2015-09-22 04:17:24 -05:00
|
|
|
|
2016-09-13 02:59:34 -05:00
|
|
|
updateZoomInParentPlot();
|
2015-09-22 04:17:24 -05:00
|
|
|
|
2016-05-23 10:13:03 -05:00
|
|
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogFileCurve::setWellPath(RimWellPath* wellPath)
|
|
|
|
{
|
|
|
|
m_wellPath = wellPath;
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-16 08:31:04 -05:00
|
|
|
void RimWellLogFileCurve::setWellLogChannelName(const QString& name)
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2015-09-16 08:31:04 -05:00
|
|
|
m_wellLogChannnelName = name;
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
{
|
2015-11-04 09:19:38 -06:00
|
|
|
RimWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
if (changedField == &m_wellPath)
|
|
|
|
{
|
2016-05-23 10:13:03 -05:00
|
|
|
this->loadDataAndUpdate();
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
else if (changedField == &m_wellLogChannnelName)
|
|
|
|
{
|
2016-05-23 10:13:03 -05:00
|
|
|
this->loadDataAndUpdate();
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
|
2016-05-23 10:13:03 -05:00
|
|
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
2015-09-22 08:23:52 -05:00
|
|
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
|
|
|
|
curveDataGroup->add(&m_wellPath);
|
|
|
|
curveDataGroup->add(&m_wellLogChannnelName);
|
|
|
|
|
|
|
|
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
2015-10-23 04:31:16 -05:00
|
|
|
appearanceGroup->add(&m_curveColor);
|
2015-12-01 09:22:18 -06:00
|
|
|
appearanceGroup->add(&m_curveThickness);
|
2015-12-09 05:21:57 -06:00
|
|
|
appearanceGroup->add(&m_pointSymbol);
|
2016-06-22 03:42:45 -05:00
|
|
|
appearanceGroup->add(&m_symbolSkipPixelDistance);
|
2015-12-09 05:21:57 -06:00
|
|
|
appearanceGroup->add(&m_lineStyle);
|
2015-09-22 08:23:52 -05:00
|
|
|
appearanceGroup->add(&m_curveName);
|
2016-05-23 10:13:03 -05:00
|
|
|
appearanceGroup->add(&m_isUsingAutoName);
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogFileCurve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
|
|
|
{
|
|
|
|
uiTreeOrdering.setForgetRemainingFields(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
|
|
|
{
|
|
|
|
QList<caf::PdmOptionItemInfo> optionList;
|
|
|
|
|
2015-12-01 09:22:18 -06:00
|
|
|
optionList = RimWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
|
|
|
|
if (optionList.size() > 0) return optionList;
|
|
|
|
|
2015-09-16 08:31:04 -05:00
|
|
|
if (fieldNeedingOptions == &m_wellPath)
|
|
|
|
{
|
|
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
|
|
if (proj->activeOilField()->wellPathCollection())
|
|
|
|
{
|
|
|
|
caf::PdmChildArrayField<RimWellPath*>& wellPaths = proj->activeOilField()->wellPathCollection()->wellPaths;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < wellPaths.size(); i++)
|
|
|
|
{
|
2015-09-25 11:04:10 -05:00
|
|
|
if (wellPaths[i]->m_wellLogFile())
|
|
|
|
{
|
|
|
|
optionList.push_back(caf::PdmOptionItemInfo(wellPaths[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(wellPaths[i]))));
|
|
|
|
}
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (optionList.size() > 0)
|
|
|
|
{
|
|
|
|
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldNeedingOptions == &m_wellLogChannnelName)
|
|
|
|
{
|
|
|
|
if (m_wellPath())
|
|
|
|
{
|
2015-09-16 09:06:06 -05:00
|
|
|
RimWellLogFile* wellLogFile = m_wellPath->m_wellLogFile();
|
|
|
|
if (wellLogFile)
|
2015-09-16 08:31:04 -05:00
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
const caf::PdmChildArrayField<RimWellLogFileChannel*>* fileLogs = wellLogFile->wellLogChannelNames();
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
for (size_t i = 0; i < fileLogs->size(); i++)
|
|
|
|
{
|
|
|
|
QString wellLogChannelName = (*fileLogs)[i]->name();
|
|
|
|
optionList.push_back(caf::PdmOptionItemInfo(wellLogChannelName, wellLogChannelName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-09-18 02:05:15 -05:00
|
|
|
|
|
|
|
if (optionList.size() == 0)
|
|
|
|
{
|
|
|
|
optionList.push_back(caf::PdmOptionItemInfo("None", "None"));
|
|
|
|
}
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return optionList;
|
|
|
|
}
|
|
|
|
|
2015-09-18 06:02:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-05-23 10:13:03 -05:00
|
|
|
QString RimWellLogFileCurve::createCurveAutoName()
|
2015-09-18 06:02:33 -05:00
|
|
|
{
|
2015-09-22 08:12:33 -05:00
|
|
|
if (m_wellPath)
|
2015-09-18 06:43:09 -05:00
|
|
|
{
|
|
|
|
QString txt;
|
|
|
|
|
2015-10-16 04:15:04 -05:00
|
|
|
txt += wellName();
|
2015-09-18 06:43:09 -05:00
|
|
|
txt += " : ";
|
|
|
|
txt += m_wellLogChannnelName;
|
|
|
|
|
2015-09-22 08:12:33 -05:00
|
|
|
RimWellLogFile* logFileInfo = m_wellPath->m_wellLogFile;
|
|
|
|
RigWellLogFile* wellLogFile = logFileInfo ? logFileInfo->wellLogFile() : NULL;
|
|
|
|
if (wellLogFile)
|
2015-09-21 03:10:25 -05:00
|
|
|
{
|
2015-12-02 07:21:22 -06:00
|
|
|
RimWellLogPlot* wellLogPlot;
|
2016-09-21 06:59:41 -05:00
|
|
|
firstAncestorOrThisOfType(wellLogPlot);
|
2015-12-02 07:21:22 -06:00
|
|
|
CVF_ASSERT(wellLogPlot);
|
|
|
|
|
|
|
|
QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannnelName, wellLogPlot->depthUnit());
|
2015-09-22 08:12:33 -05:00
|
|
|
if (!unitName.isEmpty())
|
|
|
|
{
|
2015-09-22 08:45:58 -05:00
|
|
|
txt += QString(" [%1]").arg(unitName);
|
2015-09-22 08:12:33 -05:00
|
|
|
}
|
2015-09-21 03:10:25 -05:00
|
|
|
}
|
|
|
|
|
2015-09-18 06:43:09 -05:00
|
|
|
return txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Empty curve";
|
2015-09-18 06:02:33 -05:00
|
|
|
}
|
|
|
|
|
2015-10-15 07:37:57 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimWellLogFileCurve::wellLogChannelName() const
|
|
|
|
{
|
|
|
|
return m_wellLogChannnelName;
|
|
|
|
}
|
|
|
|
|
2015-10-16 04:15:04 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimWellLogFileCurve::wellName() const
|
|
|
|
{
|
|
|
|
return m_wellPath->name();
|
|
|
|
}
|