2015-08-27 09:13:49 -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 "RimWellLogPlot.h"
|
|
|
|
|
2015-08-27 09:43:54 -05:00
|
|
|
#include "RimWellLogPlotTrace.h"
|
|
|
|
|
2015-08-27 09:13:49 -05:00
|
|
|
#include "RiuWellLogPlot.h"
|
2015-08-30 19:06:37 -05:00
|
|
|
#include "RiuWellLogTracePlot.h"
|
2015-08-27 09:13:49 -05:00
|
|
|
#include "RiuMainWindow.h"
|
|
|
|
|
2015-08-28 04:32:25 -05:00
|
|
|
#include "cafPdmUiTreeView.h"
|
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
#include "cvfAssert.h"
|
2015-08-28 04:32:25 -05:00
|
|
|
|
2015-08-27 09:13:49 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RimWellLogPlot, "WellLogPlot");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogPlot::RimWellLogPlot()
|
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("Well Log Plot", ":/WellCollection.png", "", "");
|
|
|
|
|
|
|
|
m_viewer = NULL;
|
|
|
|
|
|
|
|
CAF_PDM_InitField(&showWindow, "ShowWindow", true, "Show well log plot", "", "", "");
|
|
|
|
showWindow.uiCapability()->setUiHidden(true);
|
2015-08-31 10:21:21 -05:00
|
|
|
|
2015-09-01 07:50:26 -05:00
|
|
|
CAF_PDM_InitField(&m_minimumVisibleDepth, "MinimumDepth", 0.0, "Set minimum depth", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_maximumVisibleDepth, "MaximumDepth", 1000.0, "Set maximum depth", "", "", "");
|
2015-08-27 09:13:49 -05:00
|
|
|
|
2015-08-27 09:43:54 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&traces, "Traces", "", "", "", "");
|
|
|
|
traces.uiCapability()->setUiHidden(true);
|
|
|
|
|
2015-08-27 09:13:49 -05:00
|
|
|
updateViewerWidget();
|
2015-09-01 07:50:26 -05:00
|
|
|
updateAvailableDepthRange();
|
2015-08-27 09:13:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellLogPlot::~RimWellLogPlot()
|
|
|
|
{
|
2015-08-31 04:05:55 -05:00
|
|
|
RiuMainWindow::instance()->removeWellLogViewer(m_viewer);
|
|
|
|
delete m_viewer;
|
2015-08-27 09:13:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlot::updateViewerWidget()
|
|
|
|
{
|
|
|
|
if (showWindow())
|
|
|
|
{
|
|
|
|
bool isViewerCreated = false;
|
|
|
|
if (!m_viewer)
|
|
|
|
{
|
2015-09-01 04:14:58 -05:00
|
|
|
m_viewer = new RiuWellLogPlot(this, RiuMainWindow::instance());
|
2015-08-27 09:13:49 -05:00
|
|
|
|
|
|
|
RiuMainWindow::instance()->addWellLogViewer(m_viewer);
|
|
|
|
isViewerCreated = true;
|
|
|
|
}
|
2015-08-31 03:12:45 -05:00
|
|
|
|
|
|
|
if (m_viewer->parentWidget())
|
|
|
|
{
|
|
|
|
m_viewer->parentWidget()->showMaximized();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_viewer->showMaximized();
|
|
|
|
}
|
2015-08-27 09:13:49 -05:00
|
|
|
|
|
|
|
RiuMainWindow::instance()->setActiveWellLogViewer(m_viewer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
{
|
|
|
|
if (changedField == &showWindow)
|
|
|
|
{
|
|
|
|
if (newValue == true)
|
|
|
|
{
|
|
|
|
updateViewerWidget();
|
|
|
|
}
|
2015-08-31 03:12:45 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
if (m_viewer->parentWidget())
|
|
|
|
{
|
|
|
|
m_viewer->parentWidget()->hide();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_viewer->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-27 09:13:49 -05:00
|
|
|
}
|
2015-09-01 07:50:26 -05:00
|
|
|
else if (changedField == &m_minimumVisibleDepth || changedField == &m_maximumVisibleDepth)
|
2015-08-31 10:21:21 -05:00
|
|
|
{
|
2015-09-01 07:50:26 -05:00
|
|
|
m_viewer->setDepthRange(m_minimumVisibleDepth, m_maximumVisibleDepth);
|
2015-08-31 10:21:21 -05:00
|
|
|
}
|
2015-08-27 09:13:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimWellLogPlot::objectToggleField()
|
|
|
|
{
|
|
|
|
return &showWindow;
|
|
|
|
}
|
2015-08-28 04:32:25 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlot::addTrace()
|
|
|
|
{
|
|
|
|
RimWellLogPlotTrace* trace = new RimWellLogPlotTrace();
|
|
|
|
traces.push_back(trace);
|
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
trace->setUiName(QString("Trace %1").arg(traces.size()));
|
|
|
|
|
|
|
|
RiuWellLogTracePlot* viewer = m_viewer->createTracePlot();
|
|
|
|
trace->setViewer(viewer);
|
|
|
|
|
2015-08-28 04:32:25 -05:00
|
|
|
updateConnectedEditors();
|
2015-08-31 04:25:22 -05:00
|
|
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(trace);
|
2015-08-30 19:06:37 -05:00
|
|
|
}
|
2015-08-28 07:25:14 -05:00
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RiuWellLogPlot* RimWellLogPlot::viewer()
|
|
|
|
{
|
|
|
|
return m_viewer;
|
2015-08-28 04:32:25 -05:00
|
|
|
}
|
2015-09-01 04:14:58 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlot::zoomDepth(double zoomFactor)
|
|
|
|
{
|
2015-09-01 07:50:26 -05:00
|
|
|
double center = (m_maximumVisibleDepth + m_minimumVisibleDepth)/2;
|
|
|
|
double newHalfDepth = zoomFactor*(m_maximumVisibleDepth - m_minimumVisibleDepth)/2;
|
2015-09-01 04:14:58 -05:00
|
|
|
|
|
|
|
double newMinimum = center - newHalfDepth;
|
|
|
|
double newMaximum = center + newHalfDepth;
|
|
|
|
|
2015-09-01 07:50:26 -05:00
|
|
|
setDepthRange(newMinimum, newMaximum);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlot::setDepthRange(double minimumDepth, double maximumDepth)
|
|
|
|
{
|
|
|
|
m_minimumVisibleDepth = minimumDepth;
|
|
|
|
m_maximumVisibleDepth = maximumDepth;
|
|
|
|
|
|
|
|
m_minimumVisibleDepth.uiCapability()->updateConnectedEditors();
|
|
|
|
m_maximumVisibleDepth.uiCapability()->updateConnectedEditors();
|
|
|
|
|
|
|
|
m_viewer->setDepthRange(m_minimumVisibleDepth, m_maximumVisibleDepth);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlot::updateAvailableDepthRange()
|
|
|
|
{
|
|
|
|
double minDepth = DBL_MAX;
|
|
|
|
double maxDepth = DBL_MIN;
|
|
|
|
|
|
|
|
for (size_t tIdx = 0; tIdx < traces.size(); tIdx++)
|
|
|
|
{
|
|
|
|
double minTraceDepth = DBL_MAX;
|
|
|
|
double maxTraceDepth = DBL_MIN;
|
|
|
|
|
|
|
|
if (traces[tIdx]->availableDepthRange(&minTraceDepth, &maxTraceDepth))
|
|
|
|
{
|
|
|
|
if (minTraceDepth < minDepth)
|
|
|
|
{
|
|
|
|
minDepth = minTraceDepth;
|
|
|
|
}
|
2015-09-01 04:14:58 -05:00
|
|
|
|
2015-09-01 07:50:26 -05:00
|
|
|
if (maxTraceDepth > maxDepth)
|
|
|
|
{
|
|
|
|
maxDepth = maxTraceDepth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_depthRangeMinimum = minDepth;
|
|
|
|
m_depthRangeMaximum = maxDepth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimWellLogPlot::availableDepthRange(double* minimumDepth, double* maximumDepth)
|
|
|
|
{
|
|
|
|
if (m_maximumVisibleDepth > m_minimumVisibleDepth)
|
|
|
|
{
|
|
|
|
*minimumDepth = m_depthRangeMinimum;
|
|
|
|
*maximumDepth = m_depthRangeMaximum;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2015-09-01 04:14:58 -05:00
|
|
|
|
2015-09-01 07:50:26 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogPlot::visibleDepthRange(double* minimumDepth, double* maximumDepth)
|
|
|
|
{
|
|
|
|
*minimumDepth = m_minimumVisibleDepth;
|
|
|
|
*maximumDepth = m_maximumVisibleDepth;
|
2015-09-01 04:14:58 -05:00
|
|
|
}
|