Add wellLog Tools class and move static methods from newCurve-commands

This commit is contained in:
Rebecca Cox
2017-10-09 14:30:27 +02:00
parent da118ac1da
commit 634108de8c
12 changed files with 338 additions and 324 deletions

View File

@@ -5,6 +5,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicWellLogTools.h
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseInCollectionFeature.h
@@ -75,6 +76,7 @@ endif()
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicWellLogTools.cpp
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseInCollectionFeature.cpp

View File

@@ -0,0 +1,238 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// 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 "RicWellLogTools.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseWell.h"
#include "RimProject.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogRftCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RifReaderEclipseRft.h"
#include "RiuMainPlotWindow.h"
#include "RiuSelectionManager.h"
#include "WellLogCommands\RicWellLogPlotCurveFeatureImpl.h"
#include "cafSelectionManager.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicWellLogTools::selectedWellLogPlotTrack()
{
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWell* RicWellLogTools::selectedSimulationWell(int *branchIndex)
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimEclipseWell*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::selectedWellPath()
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellLogTools::wellHasRftData(const QString& wellName)
{
RimEclipseResultCase* resultCase;
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
for (RimCase* rimCase : cases)
{
if (resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase))
{
return resultCase->rftReader()->wellHasRftData(wellName);
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogTools::addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels)
{
for (size_t cIdx = 0; cIdx < wellLogFileChannels.size(); cIdx++)
{
RimWellLogFileCurve* plotCurve = RicWellLogTools::addFileCurve(plotTrack);
RimWellPath* wellPath;
wellLogFileChannels[cIdx]->firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
plotCurve->setWellPath(wellPath);
plotCurve->setWellLogChannelName(wellLogFileChannels[cIdx]->name());
plotCurve->loadDataAndUpdate(true);
plotCurve->updateConnectedEditors();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::selectedWellPathWithLogFile()
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() > 0)
{
RimWellPath* wellPath = selection[0];
if (wellPath->wellLogFile())
{
return wellPath;
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath, const RimEclipseWell* simWell, int branchIndex)
{
CVF_ASSERT(plotTrack);
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
curve->setColor(curveColor);
if (wellPath) curve->setWellPath(wellPath);
if (simWell) curve->setFromSimulationWellName(simWell->name(), branchIndex);
curve->setPropertiesFromView(view);
plotTrack->addCurve(curve);
plotTrack->updateConnectedEditors();
// Make sure the summary plot window is created and visible
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
RiaApplication::instance()->project()->updateConnectedEditors();
plotwindow->selectAsCurrentItem(curve);
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, const RimEclipseWell* simWell)
{
CVF_ASSERT(plotTrack);
RimWellLogRftCurve* curve = new RimWellLogRftCurve();
RimEclipseResultCase* resultCase;
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
for (RimCase* rimCase : cases)
{
if (resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase))
{
break;
}
}
if (simWell && resultCase)
{
curve->setEclipseResultCase(resultCase);
curve->setDefaultAddress(simWell->name());
}
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
curve->setColor(curveColor);
plotTrack->addCurve(curve);
plotTrack->updateConnectedEditors();
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
RiaApplication::instance()->project()->updateConnectedEditors();
plotwindow->selectAsCurrentItem(curve);
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack)
{
CVF_ASSERT(plotTrack);
RimWellLogFileCurve* curve = new RimWellLogFileCurve();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
curve->setColor(curveColor);
plotTrack->addCurve(curve);
plotTrack->updateConnectedEditors();
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
plotwindow->selectAsCurrentItem(curve);
return curve;
}

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
class RimEclipseWell;
class RimView;
class RimWellLogExtractionCurve;
class RimWellLogFileChannel;
class RimWellLogFileCurve;
class RimWellLogRftCurve;
class RimWellLogTrack;
class RimWellPath;
#include <QString>
#include <vector>
class RicWellLogTools
{
public:
static RimWellLogTrack* selectedWellLogPlotTrack();
static RimEclipseWell* selectedSimulationWell(int *branchIndex);
static RimWellPath* selectedWellPath();
static bool wellHasRftData(const QString& wellName);
static void addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels);
static RimWellPath* selectedWellPathWithLogFile();
static RimWellLogExtractionCurve* addExtractionCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath, const RimEclipseWell* simWell, int branchIndex);
static RimWellLogRftCurve* addRftCurve(RimWellLogTrack* plotTrack, const RimEclipseWell* simWell);
static RimWellLogFileCurve* addFileCurve(RimWellLogTrack* plotTrack);
};

View File

@@ -19,13 +19,15 @@
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RiaApplication.h"
#include "RigWellLogCurveData.h"
#include "RimEclipseWell.h"
#include "RimProject.h"
#include "RimView.h"
#include "RimWellLogExtractionCurve.h"
@@ -35,14 +37,13 @@
#include "RimWellPathCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuSelectionManager.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <vector>
#include "RimEclipseWell.h"
#include "RiuSelectionManager.h"
CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature");
@@ -54,7 +55,7 @@ bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
{
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
int branchIndex;
return (selectedWellLogPlotTrack() != nullptr || selectedWellPath() != nullptr || selectedSimulationWell(&branchIndex) != nullptr) && caseAvailable();
return (RicWellLogTools::selectedWellLogPlotTrack() != nullptr || RicWellLogTools::selectedWellPath() != nullptr || RicWellLogTools::selectedSimulationWell(&branchIndex) != nullptr) && caseAvailable();
}
//--------------------------------------------------------------------------------------------------
@@ -64,24 +65,24 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
{
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
RimWellLogTrack* wellLogPlotTrack = RicWellLogTools::selectedWellLogPlotTrack();
if (wellLogPlotTrack)
{
addCurve(wellLogPlotTrack, NULL, NULL, nullptr, -1);
RicWellLogTools::addExtractionCurve(wellLogPlotTrack, nullptr, nullptr, nullptr, -1);
}
else
{
RimWellPath* wellPath = selectedWellPath();
RimWellPath* wellPath = RicWellLogTools::selectedWellPath();
int branchIndex = -1;
RimEclipseWell* simWell = selectedSimulationWell(&branchIndex);
RimEclipseWell* simWell = RicWellLogTools::selectedSimulationWell(&branchIndex);
if (wellPath || simWell)
{
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath, simWell, branchIndex);
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addExtractionCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath, simWell, branchIndex);
plotCurve->loadDataAndUpdate(true);
RimWellLogPlot* plot = NULL;
RimWellLogPlot* plot = nullptr;
wellLogPlotTrack->firstAncestorOrThisOfType(plot);
if (plot && plotCurve->curveData())
{
@@ -105,80 +106,10 @@ void RicNewWellLogCurveExtractionFeature::setupActionLook(QAction* actionToSetup
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() const
{
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() const
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWell* RicNewWellLogCurveExtractionFeature::selectedSimulationWell(int * branchIndex) const
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimEclipseWell*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : NULL;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogCurveExtractionFeature::caseAvailable() const
bool RicNewWellLogCurveExtractionFeature::caseAvailable()
{
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
return cases.size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath, const RimEclipseWell* simWell, int branchIndex)
{
CVF_ASSERT(plotTrack);
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
curve->setColor(curveColor);
if (wellPath) curve->setWellPath(wellPath);
if (simWell) curve->setFromSimulationWellName(simWell->name(), branchIndex);
curve->setPropertiesFromView(view);
plotTrack->addCurve(curve);
plotTrack->updateConnectedEditors();
// Make sure the summary plot window is created and visible
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
RiaApplication::instance()->project()->updateConnectedEditors();
plotwindow->selectAsCurrentItem(curve);
return curve;
}

View File

@@ -21,12 +21,6 @@
#include "cafCmdFeature.h"
class RimEclipseWell;
class RimView;
class RimWellLogExtractionCurve;
class RimWellLogTrack;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
@@ -34,19 +28,10 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static RimWellLogExtractionCurve* addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath, const RimEclipseWell* simWell, int branchIndex);
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellLogTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPath() const;
RimEclipseWell* selectedSimulationWell(int * branchIndex) const;
bool caseAvailable() const;
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
static bool caseAvailable();
};

View File

@@ -34,6 +34,8 @@
#include "RimWellPathCollection.h"
#include "RiuMainPlotWindow.h"
#include "RicWellLogTools.h"
#include "cafSelectionManager.h"
#include <QAction>
@@ -48,7 +50,7 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogFileCurveFeature, "RicNewWellLogFileCurveFeatur
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogFileCurveFeature::isCommandEnabled()
{
return (selectedWellLogPlotTrack() != NULL && wellLogFilesAvailable()) || selectedWellPathWithLogFile() != NULL;
return (RicWellLogTools::selectedWellLogPlotTrack() != nullptr && wellLogFilesAvailable()) || RicWellLogTools::selectedWellPathWithLogFile() != nullptr;
}
//--------------------------------------------------------------------------------------------------
@@ -56,18 +58,18 @@ bool RicNewWellLogFileCurveFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::onActionTriggered(bool isChecked)
{
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
RimWellLogTrack* wellLogPlotTrack = RicWellLogTools::selectedWellLogPlotTrack();
if (wellLogPlotTrack)
{
addCurve(wellLogPlotTrack);
RicWellLogTools::addFileCurve(wellLogPlotTrack);
}
else
{
RimWellPath* wellPath = selectedWellPathWithLogFile();
RimWellPath* wellPath = RicWellLogTools::selectedWellPathWithLogFile();
if (wellPath)
{
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogFileCurve* plotCurve = addCurve(wellLogPlotTrack);
RimWellLogFileCurve* plotCurve = RicWellLogTools::addFileCurve(wellLogPlotTrack);
plotCurve->setWellPath(wellPath);
plotCurve->updateConnectedEditors();
}
@@ -82,35 +84,6 @@ void RicNewWellLogFileCurveFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setText("New Well Log LAS Curve");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogFileCurveFeature::selectedWellLogPlotTrack() const
{
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewWellLogFileCurveFeature::selectedWellPathWithLogFile() const
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() > 0)
{
RimWellPath* wellPath = selection[0];
if (wellPath->wellLogFile())
{
return wellPath;
}
}
return NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -135,47 +108,3 @@ bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable() const
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogTrack* plotTrack)
{
CVF_ASSERT(plotTrack);
RimWellLogFileCurve* curve = new RimWellLogFileCurve();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
curve->setColor(curveColor);
plotTrack->addCurve(curve);
plotTrack->updateConnectedEditors();
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
plotwindow->selectAsCurrentItem(curve);
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels)
{
for (size_t cIdx = 0; cIdx < wellLogFileChannels.size(); cIdx++)
{
RimWellLogFileCurve* plotCurve = addCurve(plotTrack);
RimWellPath* wellPath;
wellLogFileChannels[cIdx]->firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
plotCurve->setWellPath(wellPath);
plotCurve->setWellLogChannelName(wellLogFileChannels[cIdx]->name());
plotCurve->loadDataAndUpdate(true);
plotCurve->updateConnectedEditors();
}
}
}

View File

@@ -23,12 +23,6 @@
#include <vector>
class RimWellLogTrack;
class RimWellLogFileCurve;
class RimWellPath;
class RimWellLogFileChannel;
//==================================================================================================
///
//==================================================================================================
@@ -36,19 +30,11 @@ class RicNewWellLogFileCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static RimWellLogFileCurve* addCurve(RimWellLogTrack* plotTrack);
static void addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels);
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
private:
RimWellLogTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPathWithLogFile() const;
bool wellLogFilesAvailable() const;
bool wellLogFilesAvailable() const;
};

View File

@@ -28,6 +28,8 @@
#include "RimWellLogTrack.h"
#include "RimWellLogCurve.h"
#include "RicWellLogTools.h"
#include "RiaApplication.h"
#include <QAction>
@@ -51,7 +53,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
RicWellLogTools::addExtractionCurve(plotTrack, nullptr, nullptr, nullptr, -1);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -21,6 +21,7 @@
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
@@ -57,7 +58,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
wellLogPlot->updateConnectedEditors();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
RicWellLogTools::addExtractionCurve(plotTrack, nullptr, nullptr, nullptr, -1);
}
}

View File

@@ -18,26 +18,21 @@
#include "RicNewWellLogRftCurveFeature.h"
#include "RiaApplication.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseWell.h"
#include "RimProject.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogRftCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogPlot.h"
#include "RimWellLogCurve.h"
#include "RimEclipseResultCase.h"
#include "RigWellLogCurveData.h"
#include "RifReaderEclipseRft.h"
#include "RiuMainPlotWindow.h"
#include "RiuSelectionManager.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "cafSelectionManager.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include <QAction>
#include <QString>
@@ -45,7 +40,6 @@
#include <vector>
CAF_CMD_SOURCE_INIT(RicNewWellLogRftCurveFeature, "RicNewWellLogRftCurveFeature");
//--------------------------------------------------------------------------------------------------
@@ -53,19 +47,19 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogRftCurveFeature, "RicNewWellLogRftCurveFeature"
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogRftCurveFeature::isCommandEnabled()
{
if (RicNewWellLogRftCurveFeature::selectedWellLogPlotTrack() != nullptr)
if (RicWellLogTools::selectedWellLogPlotTrack() != nullptr)
{
return true;
}
int branchIdx;
RimEclipseWell* simulationWell = RicNewWellLogRftCurveFeature::selectedSimulationWell(&branchIdx);
RimEclipseWell* simulationWell = RicWellLogTools::selectedSimulationWell(&branchIdx);
if (simulationWell != nullptr)
{
return RicNewWellLogRftCurveFeature::wellHasRftData(simulationWell->name());
return RicWellLogTools::wellHasRftData(simulationWell->name());
}
return false;
}
@@ -74,24 +68,24 @@ bool RicNewWellLogRftCurveFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewWellLogRftCurveFeature::onActionTriggered(bool isChecked)
{
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
RimWellLogTrack* wellLogPlotTrack = RicWellLogTools::selectedWellLogPlotTrack();
if (wellLogPlotTrack)
{
int branchIdx;
RicNewWellLogRftCurveFeature::addCurve(wellLogPlotTrack, selectedSimulationWell(&branchIdx));
RicWellLogTools::addRftCurve(wellLogPlotTrack, RicWellLogTools::selectedSimulationWell(&branchIdx));
}
else
{
int branchIndex = -1;
RimEclipseWell* simWell = selectedSimulationWell(&branchIndex);
RimEclipseWell* simWell = RicWellLogTools::selectedSimulationWell(&branchIndex);
if (simWell)
{
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogRftCurve* plotCurve = RicNewWellLogRftCurveFeature::addCurve(wellLogPlotTrack, simWell);
RimWellLogRftCurve* plotCurve = RicWellLogTools::addRftCurve(wellLogPlotTrack, simWell);
plotCurve->loadDataAndUpdate(true);
RimWellLogPlot* plot = NULL;
RimWellLogPlot* plot = nullptr;
wellLogPlotTrack->firstAncestorOrThisOfType(plot);
if (plot && plotCurve->curveData())
{
@@ -111,97 +105,3 @@ void RicNewWellLogRftCurveFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setText("New Well Log RFT Curve");
actionToSetup->setIcon(QIcon(":/WellLogCurve16x16.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurve* RicNewWellLogRftCurveFeature::addCurve(RimWellLogTrack* plotTrack, const RimEclipseWell* simWell)
{
CVF_ASSERT(plotTrack);
RimWellLogRftCurve* curve = new RimWellLogRftCurve();
RimEclipseResultCase* resultCase;
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
for (RimCase* rimCase : cases)
{
if (resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase))
{
break;
}
}
if (simWell && resultCase)
{
curve->setEclipseResultCase(resultCase);
curve->setDefaultAddress(simWell->name());
}
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
curve->setColor(curveColor);
plotTrack->addCurve(curve);
plotTrack->updateConnectedEditors();
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
RiaApplication::instance()->project()->updateConnectedEditors();
plotwindow->selectAsCurrentItem(curve);
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogRftCurveFeature::selectedWellLogPlotTrack()
{
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWell* RicNewWellLogRftCurveFeature::selectedSimulationWell(int *branchIndex)
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimEclipseWell*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : NULL;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogRftCurveFeature::wellHasRftData(const QString& wellName)
{
RimEclipseResultCase* resultCase;
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
for (RimCase* rimCase : cases)
{
if (resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase))
{
return resultCase->rftReader()->wellHasRftData(wellName);
}
}
return false;
}

View File

@@ -20,11 +20,6 @@
#include "cafCmdFeature.h"
class RimWellLogRftCurve;
class RimWellLogTrack;
class RimEclipseWell;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
@@ -36,9 +31,4 @@ private:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
static RimWellLogRftCurve* addCurve(RimWellLogTrack* plotTrack, const RimEclipseWell* simWell);
static RimWellLogTrack* selectedWellLogPlotTrack();
static RimEclipseWell* selectedSimulationWell(int * branchIndex);
static bool wellHasRftData(const QString& wellName);
};

View File

@@ -40,6 +40,8 @@
#include "RimWellLogTrack.h"
#include "RiuMainWindow.h"
#include "RicWellLogTools.h"
#include "cafPdmUiTreeView.h"
#include "cafSelectionManager.h"
#include "cafPdmUiItem.h"
@@ -387,7 +389,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
{
if (action == Qt::CopyAction)
{
RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(trackTarget, wellLogFileChannels);
RicWellLogTools::addWellLogChannelsToPlotTrack(trackTarget, wellLogFileChannels);
return true;
}
}