#1427 Enable the new Well Log Curve command for Simulation Wells

This commit is contained in:
Jacob Støren
2017-04-25 16:12:22 +02:00
parent f40cf3a9b7
commit 6f07a3698b
7 changed files with 70 additions and 17 deletions

View File

@@ -41,6 +41,8 @@
#include <QAction>
#include <vector>
#include "RimEclipseWell.h"
#include "RiuSelectionManager.h"
CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature");
@@ -51,8 +53,8 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtr
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
{
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
return (selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL) && caseAvailable();
int branchIndex;
return (selectedWellLogPlotTrack() != nullptr || selectedWellPath() != nullptr || selectedSimulationWell(&branchIndex) != nullptr) && caseAvailable();
}
//--------------------------------------------------------------------------------------------------
@@ -65,15 +67,17 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
if (wellLogPlotTrack)
{
addCurve(wellLogPlotTrack, NULL, NULL);
addCurve(wellLogPlotTrack, NULL, NULL, nullptr, -1);
}
else
{
RimWellPath* wellPath = selectedWellPath();
if (wellPath)
int branchIndex = -1;
RimEclipseWell* simWell = selectedSimulationWell(&branchIndex);
if (wellPath || simWell)
{
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath);
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath, simWell, branchIndex);
plotCurve->loadDataAndUpdate();
@@ -118,6 +122,27 @@ RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() const
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;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -132,14 +157,16 @@ bool RicNewWellLogCurveExtractionFeature::caseAvailable() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath)
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);
curve->setWellPath(wellPath);
if (wellPath) curve->setWellPath(wellPath);
if (simWell) curve->setFromSimulationWellName(simWell->name(), branchIndex);
curve->setPropertiesFromView(view);
plotTrack->addCurve(curve);

View File

@@ -21,10 +21,11 @@
#include "cafCmdFeature.h"
class RimEclipseWell;
class RimView;
class RimWellLogExtractionCurve;
class RimWellLogTrack;
class RimWellPath;
class RimView;
//==================================================================================================
///
@@ -34,7 +35,7 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
public:
static RimWellLogExtractionCurve* addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath);
static RimWellLogExtractionCurve* addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath, const RimEclipseWell* simWell, int branchIndex);
protected:
@@ -46,5 +47,6 @@ protected:
private:
RimWellLogTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPath() const;
RimEclipseWell* selectedSimulationWell(int * branchIndex) const;
bool caseAvailable() const;
};

View File

@@ -51,7 +51,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -57,7 +57,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
wellLogPlot->updateConnectedEditors();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
}
}