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-09-18 05:29:23 -05:00
|
|
|
#include "RimWellLogPlotTrack.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
|
|
|
|
2015-09-18 05:29:23 -05:00
|
|
|
#include "RiuWellLogTrackPlot.h"
|
2015-09-17 11:42:35 -05:00
|
|
|
#include "RiuWellLogPlotCurve.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
|
|
|
|
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", "", "", "");
|
|
|
|
m_wellPath.uiCapability()->setUiChildrenHidden(true);
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_wellLogChannnelName, "CurveWellLogChannel", "Well Log Channel", "", "", "");
|
|
|
|
|
|
|
|
m_wellPath = NULL;
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogFileCurve::~RimWellLogFileCurve()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogFileCurve::updatePlotData()
|
|
|
|
{
|
|
|
|
RimWellLogPlotCurve::updatePlotData();
|
2015-09-16 08:31:04 -05:00
|
|
|
|
|
|
|
if (m_showCurve)
|
|
|
|
{
|
|
|
|
if (m_wellPath)
|
|
|
|
{
|
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-09-18 02:05:15 -05:00
|
|
|
|
|
|
|
std::vector<double> values = wellLogFile->values(m_wellLogChannnelName);
|
|
|
|
std::vector<double> depthValues = wellLogFile->depthValues();
|
|
|
|
|
|
|
|
if (values.size() > 0 && depthValues.size() > 0)
|
|
|
|
{
|
|
|
|
m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_plotCurve->setSamples(NULL, NULL, 0);
|
|
|
|
}
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_plotCurve->setSamples(NULL, NULL, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
|
|
|
|
2015-09-18 03:50:01 -05:00
|
|
|
RimWellLogPlot* wellLoglot;
|
|
|
|
firstAnchestorOrThisOfType(wellLoglot);
|
|
|
|
|
2015-09-18 05:29:23 -05:00
|
|
|
RimWellLogPlotTrack* wellLoglotTrack;
|
|
|
|
firstAnchestorOrThisOfType(wellLoglotTrack);
|
2015-09-18 03:50:01 -05:00
|
|
|
|
2015-09-16 08:31:04 -05:00
|
|
|
if (changedField == &m_wellPath)
|
|
|
|
{
|
|
|
|
this->updatePlotData();
|
|
|
|
|
|
|
|
if (wellLoglot)
|
|
|
|
{
|
|
|
|
wellLoglot->updateAvailableDepthRange();
|
|
|
|
wellLoglot->setVisibleDepthRangeFromContents();
|
|
|
|
}
|
2015-09-18 03:50:01 -05:00
|
|
|
|
2015-09-18 05:29:23 -05:00
|
|
|
if (wellLoglotTrack)
|
2015-09-18 03:50:01 -05:00
|
|
|
{
|
2015-09-18 05:29:23 -05:00
|
|
|
wellLoglotTrack->updateXAxisRangeFromCurves();
|
2015-09-18 03:50:01 -05:00
|
|
|
}
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
else if (changedField == &m_wellLogChannnelName)
|
|
|
|
{
|
2015-09-16 08:43:14 -05:00
|
|
|
if (oldValue.toString() == m_userName)
|
|
|
|
{
|
|
|
|
m_userName = m_wellLogChannnelName;
|
|
|
|
}
|
|
|
|
|
2015-09-16 08:31:04 -05:00
|
|
|
this->updatePlotData();
|
|
|
|
|
|
|
|
if (wellLoglot)
|
|
|
|
{
|
|
|
|
if (!wellLoglot->hasAvailableDepthRange())
|
|
|
|
{
|
|
|
|
wellLoglot->updateAvailableDepthRange();
|
|
|
|
wellLoglot->setVisibleDepthRangeFromContents();
|
|
|
|
}
|
2015-09-18 03:50:01 -05:00
|
|
|
|
2015-09-18 05:29:23 -05:00
|
|
|
if (wellLoglotTrack)
|
2015-09-18 03:50:01 -05:00
|
|
|
{
|
2015-09-18 05:29:23 -05:00
|
|
|
wellLoglotTrack->updateXAxisRangeFromCurves();
|
2015-09-18 03:50:01 -05:00
|
|
|
}
|
2015-09-16 08:31:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_plot->replot();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
2015-09-16 08:43:14 -05:00
|
|
|
uiOrdering.add(&m_userName);
|
2015-09-16 08:31:04 -05:00
|
|
|
uiOrdering.add(&m_wellPath);
|
|
|
|
uiOrdering.add(&m_wellLogChannnelName);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
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;
|
|
|
|
|
|
|
|
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++)
|
|
|
|
{
|
|
|
|
optionList.push_back(caf::PdmOptionItemInfo(wellPaths[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(wellPaths[i]))));
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|