#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);
}
}

View File

@ -59,6 +59,7 @@
#include "cafUtils.h"
#include <cmath>
#include "RimEclipseWell.h"
//==================================================================================================
///
@ -147,6 +148,18 @@ RimWellPath* RimWellLogExtractionCurve::wellPath() const
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setFromSimulationWellName(const QString& simWellName, int branchIndex)
{
m_trajectoryType = SIMULATION_WELL;
m_simWellName = simWellName;
m_branchIndex = branchIndex;
clearGeneratedSimWellPaths();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -675,8 +688,10 @@ QString RimWellLogExtractionCurve::createCurveAutoName()
if (m_addWellNameToCurveName )
{
generatedCurveName += wellName();
// Todo: Branch
if (m_trajectoryType == SIMULATION_WELL && m_generatedSimulationWellPathBranches.size() > 1)
{
generatedCurveName += " Br" + QString::number(m_branchIndex + 1);
}
}
if (m_addCaseNameToCurveName && m_case())

View File

@ -48,6 +48,8 @@ public:
void setWellPath(RimWellPath* wellPath);
RimWellPath* wellPath() const;
void setFromSimulationWellName(const QString& simWellName, int branchIndex);
void setCase(RimCase* rimCase);
RimCase* rimCase() const;

View File

@ -294,8 +294,9 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
caf::SelectionManager::instance()->setSelectedItem(wellPath);
commandIds << "RicNewWellLogFileCurveFeature";
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewWellLogFileCurveFeature";
commandIds << "Separator";
commandIds << "RicNewWellPathIntersectionFeature";
}
}
@ -308,10 +309,16 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
caf::SelectionManager::instance()->setSelectedItem(well);
commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicShowWellAllocationPlotFeature";
commandIds << "RicShowContributingWellsFeature";
commandIds << "RicPlotProductionRateFeature";
commandIds << "Separator";
commandIds << "RicShowContributingWellsFeature";
commandIds << "Separator";
commandIds << "RicNewSimWellIntersectionFeature";
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
}
}
@ -333,7 +340,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
if (menu.actions().size() > 0)
if (!menu.isEmpty())
{
menu.exec(event->globalPos());
}