2015-08-28 04:45:18 -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-09-18 02:07:06 -05:00
|
|
|
#include "RicNewWellLogCurveExtractionFeature.h"
|
2015-08-28 04:45:18 -05:00
|
|
|
|
2015-09-15 11:21:38 -05:00
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
|
2015-08-28 04:45:18 -05:00
|
|
|
#include "RimWellLogPlotTrace.h"
|
2015-09-03 03:55:54 -05:00
|
|
|
#include "RimWellLogExtractionCurve.h"
|
|
|
|
|
|
|
|
#include "RiuMainWindow.h"
|
2015-08-28 04:45:18 -05:00
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
#include <vector>
|
2015-09-03 03:55:54 -05:00
|
|
|
|
2015-08-28 04:45:18 -05:00
|
|
|
|
2015-09-18 02:07:06 -05:00
|
|
|
CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature");
|
2015-08-28 04:45:18 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
|
|
|
return selectedWellLogPlotTrace() != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
|
|
|
RimWellLogPlotTrace* wellLogPlotTrace = selectedWellLogPlotTrace();
|
|
|
|
if (wellLogPlotTrace)
|
|
|
|
{
|
2015-09-08 02:17:40 -05:00
|
|
|
addCurve(wellLogPlotTrace);
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
void RicNewWellLogCurveExtractionFeature::setupActionLook(QAction* actionToSetup)
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2015-09-18 02:07:06 -05:00
|
|
|
actionToSetup->setText("New Well Log Extraction Curve");
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
RimWellLogPlotTrace* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrace()
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
|
|
|
std::vector<RimWellLogPlotTrace*> selection;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
|
|
|
return selection.size() > 0 ? selection[0] : NULL;
|
|
|
|
}
|
2015-09-08 02:17:40 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-18 02:07:06 -05:00
|
|
|
void RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrace* plotTrace)
|
2015-09-08 02:17:40 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(plotTrace);
|
|
|
|
|
|
|
|
size_t curveIndex = plotTrace->curveCount();
|
|
|
|
|
|
|
|
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
|
|
|
|
plotTrace->addCurve(curve);
|
|
|
|
|
2015-09-15 11:21:38 -05:00
|
|
|
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
|
2015-09-08 02:17:40 -05:00
|
|
|
curve->setColor(curveColor);
|
|
|
|
|
|
|
|
curve->setDescription(QString("Curve %1").arg(plotTrace->curveCount()));
|
|
|
|
|
|
|
|
plotTrace->updateConnectedEditors();
|
|
|
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
|
|
|
|
}
|