mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1427 Enable the new Well Log Curve command for Simulation Wells
This commit is contained in:
parent
f40cf3a9b7
commit
6f07a3698b
@ -41,6 +41,8 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "RimEclipseWell.h"
|
||||||
|
#include "RiuSelectionManager.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature");
|
CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature");
|
||||||
@ -51,8 +53,8 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtr
|
|||||||
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
|
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
|
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
|
||||||
|
int branchIndex;
|
||||||
return (selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL) && caseAvailable();
|
return (selectedWellLogPlotTrack() != nullptr || selectedWellPath() != nullptr || selectedSimulationWell(&branchIndex) != nullptr) && caseAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -65,15 +67,17 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
|
|||||||
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
|
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
|
||||||
if (wellLogPlotTrack)
|
if (wellLogPlotTrack)
|
||||||
{
|
{
|
||||||
addCurve(wellLogPlotTrack, NULL, NULL);
|
addCurve(wellLogPlotTrack, NULL, NULL, nullptr, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RimWellPath* wellPath = selectedWellPath();
|
RimWellPath* wellPath = selectedWellPath();
|
||||||
if (wellPath)
|
int branchIndex = -1;
|
||||||
|
RimEclipseWell* simWell = selectedSimulationWell(&branchIndex);
|
||||||
|
if (wellPath || simWell)
|
||||||
{
|
{
|
||||||
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||||
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath);
|
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath, simWell, branchIndex);
|
||||||
|
|
||||||
plotCurve->loadDataAndUpdate();
|
plotCurve->loadDataAndUpdate();
|
||||||
|
|
||||||
@ -118,6 +122,27 @@ RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() const
|
|||||||
return selection.size() > 0 ? selection[0] : NULL;
|
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);
|
CVF_ASSERT(plotTrack);
|
||||||
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
|
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
|
||||||
|
|
||||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
|
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
|
||||||
curve->setColor(curveColor);
|
curve->setColor(curveColor);
|
||||||
curve->setWellPath(wellPath);
|
if (wellPath) curve->setWellPath(wellPath);
|
||||||
|
if (simWell) curve->setFromSimulationWellName(simWell->name(), branchIndex);
|
||||||
|
|
||||||
curve->setPropertiesFromView(view);
|
curve->setPropertiesFromView(view);
|
||||||
|
|
||||||
plotTrack->addCurve(curve);
|
plotTrack->addCurve(curve);
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
class RimEclipseWell;
|
||||||
|
class RimView;
|
||||||
class RimWellLogExtractionCurve;
|
class RimWellLogExtractionCurve;
|
||||||
class RimWellLogTrack;
|
class RimWellLogTrack;
|
||||||
class RimWellPath;
|
class RimWellPath;
|
||||||
class RimView;
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -34,7 +35,7 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
|
|||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
public:
|
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:
|
protected:
|
||||||
@ -46,5 +47,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
RimWellLogTrack* selectedWellLogPlotTrack() const;
|
RimWellLogTrack* selectedWellLogPlotTrack() const;
|
||||||
RimWellPath* selectedWellPath() const;
|
RimWellPath* selectedWellPath() const;
|
||||||
|
RimEclipseWell* selectedSimulationWell(int * branchIndex) const;
|
||||||
bool caseAvailable() const;
|
bool caseAvailable() const;
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
|
|||||||
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
|
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||||
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
|
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -57,7 +57,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
|
|||||||
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
|
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
|
||||||
|
|
||||||
wellLogPlot->updateConnectedEditors();
|
wellLogPlot->updateConnectedEditors();
|
||||||
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
|
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "cafUtils.h"
|
#include "cafUtils.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include "RimEclipseWell.h"
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -147,6 +148,18 @@ RimWellPath* RimWellLogExtractionCurve::wellPath() const
|
|||||||
return m_wellPath;
|
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 )
|
if (m_addWellNameToCurveName )
|
||||||
{
|
{
|
||||||
generatedCurveName += wellName();
|
generatedCurveName += wellName();
|
||||||
|
if (m_trajectoryType == SIMULATION_WELL && m_generatedSimulationWellPathBranches.size() > 1)
|
||||||
// Todo: Branch
|
{
|
||||||
|
generatedCurveName += " Br" + QString::number(m_branchIndex + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_addCaseNameToCurveName && m_case())
|
if (m_addCaseNameToCurveName && m_case())
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
void setWellPath(RimWellPath* wellPath);
|
void setWellPath(RimWellPath* wellPath);
|
||||||
RimWellPath* wellPath() const;
|
RimWellPath* wellPath() const;
|
||||||
|
|
||||||
|
void setFromSimulationWellName(const QString& simWellName, int branchIndex);
|
||||||
|
|
||||||
void setCase(RimCase* rimCase);
|
void setCase(RimCase* rimCase);
|
||||||
RimCase* rimCase() const;
|
RimCase* rimCase() const;
|
||||||
|
|
||||||
|
@ -294,8 +294,9 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
|||||||
{
|
{
|
||||||
caf::SelectionManager::instance()->setSelectedItem(wellPath);
|
caf::SelectionManager::instance()->setSelectedItem(wellPath);
|
||||||
|
|
||||||
commandIds << "RicNewWellLogFileCurveFeature";
|
|
||||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||||
|
commandIds << "RicNewWellLogFileCurveFeature";
|
||||||
|
commandIds << "Separator";
|
||||||
commandIds << "RicNewWellPathIntersectionFeature";
|
commandIds << "RicNewWellPathIntersectionFeature";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,10 +309,16 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
|||||||
{
|
{
|
||||||
caf::SelectionManager::instance()->setSelectedItem(well);
|
caf::SelectionManager::instance()->setSelectedItem(well);
|
||||||
|
|
||||||
commandIds << "RicNewSimWellIntersectionFeature";
|
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||||
commandIds << "RicShowWellAllocationPlotFeature";
|
commandIds << "RicShowWellAllocationPlotFeature";
|
||||||
commandIds << "RicShowContributingWellsFeature";
|
|
||||||
commandIds << "RicPlotProductionRateFeature";
|
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);
|
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||||
|
|
||||||
if (menu.actions().size() > 0)
|
if (!menu.isEmpty())
|
||||||
{
|
{
|
||||||
menu.exec(event->globalPos());
|
menu.exec(event->globalPos());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user