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 "RicAddWellLogToPlotFeature.h"
|
|
|
|
|
2015-09-15 11:21:38 -05:00
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
#include "RicNewWellLogPlotFeatureImpl.h"
|
|
|
|
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RimMainPlotCollection.h"
|
|
|
|
#include "RimProject.h"
|
2015-09-16 09:06:06 -05:00
|
|
|
#include "RimWellLogFile.h"
|
2015-09-18 02:16:59 -05:00
|
|
|
#include "RimWellLogFileChannel.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
#include "RimWellLogFileCurve.h"
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
#include "RimWellLogPlotCollection.h"
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RimWellLogTrack.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
2016-06-27 04:07:01 -05:00
|
|
|
#include "RiuMainPlotWindow.h"
|
2015-09-16 08:31:04 -05:00
|
|
|
|
2015-09-15 11:07:53 -05:00
|
|
|
#include "RigWellLogFile.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
2015-11-04 09:14:42 -06:00
|
|
|
#include "RiuWellLogTrack.h"
|
2015-09-15 08:23:25 -05:00
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
CAF_CMD_SOURCE_INIT(RicAddWellLogToPlotFeature, "RicAddWellLogToPlotFeature");
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicAddWellLogToPlotFeature::isCommandEnabled()
|
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
|
2015-09-15 08:23:25 -05:00
|
|
|
return selection.size() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
|
2015-09-15 08:23:25 -05:00
|
|
|
if (selection.size() < 1) return;
|
2015-09-16 08:31:04 -05:00
|
|
|
|
2015-09-15 11:21:38 -05:00
|
|
|
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
|
2015-09-15 08:23:25 -05:00
|
|
|
|
2015-11-04 08:57:06 -06:00
|
|
|
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
2015-09-18 05:29:23 -05:00
|
|
|
plot->addTrack(plotTrack);
|
2015-09-18 07:50:08 -05:00
|
|
|
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount()));
|
2015-09-15 08:23:25 -05:00
|
|
|
|
|
|
|
plot->loadDataAndUpdate();
|
|
|
|
|
|
|
|
for (size_t wlIdx = 0; wlIdx < selection.size(); wlIdx++)
|
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
RimWellLogFileChannel* wellLog = selection[wlIdx];
|
2015-09-15 08:23:25 -05:00
|
|
|
|
2015-10-26 04:14:45 -05:00
|
|
|
RimWellPath* wellPath = NULL;
|
2016-09-21 06:59:41 -05:00
|
|
|
wellLog->firstAncestorOrThisOfType(wellPath);
|
2015-09-16 08:31:04 -05:00
|
|
|
|
2015-10-26 04:14:45 -05:00
|
|
|
RimWellLogFile* wellLogFile = NULL;
|
2016-09-21 06:59:41 -05:00
|
|
|
wellLog->firstAncestorOrThisOfType(wellLogFile);
|
2015-09-16 09:06:06 -05:00
|
|
|
if (wellLogFile)
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
|
|
|
RimWellLogFileCurve* curve = new RimWellLogFileCurve;
|
2015-09-18 05:29:23 -05:00
|
|
|
plotTrack->addCurve(curve);
|
2015-09-15 08:23:25 -05:00
|
|
|
|
2015-09-21 03:10:25 -05:00
|
|
|
RigWellLogFile* wellLogDataFile = wellLogFile->wellLogFile();
|
|
|
|
CVF_ASSERT(wellLogDataFile);
|
|
|
|
|
2015-12-02 08:07:12 -06:00
|
|
|
if (wlIdx == 0)
|
|
|
|
{
|
|
|
|
// Initialize plot with depth unit from the first log file
|
|
|
|
plot->setDepthUnit(wellLogDataFile->depthUnit());
|
|
|
|
}
|
|
|
|
|
2015-10-31 17:35:18 -05:00
|
|
|
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
2015-09-15 08:58:22 -05:00
|
|
|
curve->setColor(curveColor);
|
2015-09-16 08:31:04 -05:00
|
|
|
curve->setWellPath(wellPath);
|
|
|
|
curve->setWellLogChannelName(wellLog->name());
|
2015-09-15 08:58:22 -05:00
|
|
|
|
2016-05-23 10:13:03 -05:00
|
|
|
curve->loadDataAndUpdate();
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-27 08:44:53 -05:00
|
|
|
plot->calculateAvailableDepthRange();
|
2015-12-07 05:03:33 -06:00
|
|
|
plot->updateDepthZoom();
|
2015-09-18 05:29:23 -05:00
|
|
|
plotTrack->viewer()->replot();
|
2015-09-15 11:07:53 -05:00
|
|
|
|
2016-06-27 04:07:01 -05:00
|
|
|
// Make sure the summary plot window is created and visible
|
2016-06-27 07:00:19 -05:00
|
|
|
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
2016-06-27 04:07:01 -05:00
|
|
|
|
2015-09-15 08:23:25 -05:00
|
|
|
RiaApplication::instance()->project()->updateConnectedEditors();
|
2015-09-16 08:31:04 -05:00
|
|
|
|
2016-06-27 04:07:01 -05:00
|
|
|
plotwindow->selectAsCurrentItem(selection.back());
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicAddWellLogToPlotFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
2015-10-19 08:25:16 -05:00
|
|
|
actionToSetup->setText("Add To New Plot");
|
2015-09-15 08:23:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> RicAddWellLogToPlotFeature::selectedWellLogs()
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
2015-09-18 02:16:59 -05:00
|
|
|
std::vector<RimWellLogFileChannel*> selection;
|
2015-09-15 08:23:25 -05:00
|
|
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
|
|
|
return selection;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace caf
|