3D Well Log Curve (#2747): Add "Add new curve" command to 3D track and other curves.

This commit is contained in:
Gaute Lindkvist 2018-04-19 11:26:03 +02:00
parent 32fb519073
commit 4dc9d1ba8a
6 changed files with 71 additions and 18 deletions

View File

@ -84,6 +84,26 @@ RimWellPath* RicWellLogTools::selectedWellPath()
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::findWellPathFromSelection()
{
std::vector<caf::PdmObject*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() > 0)
{
caf::PdmObject* firstSelection = selection[0];
RimWellPath* wellPath;
firstSelection->firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
return wellPath;
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -170,6 +190,19 @@ RimWellPath* RicWellLogTools::selectedWellPathWithLogFile()
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicWellLogTools::findWellPathWithLogFileFromSelection()
{
RimWellPath* wellPath = findWellPathFromSelection();
if (wellPath->wellLogFiles().size() > 0)
{
return wellPath;
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -24,6 +24,7 @@
class RimSimWellInView;
class Rim3dView;
class Rim3dWellLogCurveCollection;
class RimWellLogExtractionCurve;
class RimWellLogFileChannel;
class RimWellLogFileCurve;
@ -37,17 +38,19 @@ class RimWellPath;
class RicWellLogTools
{
public:
static RimWellLogTrack* selectedWellLogPlotTrack();
static RimSimWellInView* selectedSimulationWell(int* branchIndex);
static RimWellPath* selectedWellPath();
static bool wellHasRftData(const QString& wellName);
static bool isWellPathOrSimWellSelectedInView();
static void addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack,
static RimWellLogTrack* selectedWellLogPlotTrack();
static RimSimWellInView* selectedSimulationWell(int* branchIndex);
static RimWellPath* selectedWellPath();
static RimWellPath* findWellPathFromSelection();
static bool wellHasRftData(const QString& wellName);
static bool isWellPathOrSimWellSelectedInView();
static void addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack,
const std::vector<RimWellLogFileChannel*>& wellLogFileChannels);
static RimWellPath* selectedWellPathWithLogFile();
static RimWellLogExtractionCurve* addExtractionCurve(RimWellLogTrack* plotTrack, Rim3dView* view, RimWellPath* wellPath,
static RimWellPath* selectedWellPathWithLogFile();
static RimWellPath* findWellPathWithLogFileFromSelection();
static RimWellLogExtractionCurve* addExtractionCurve(RimWellLogTrack* plotTrack, Rim3dView* view, RimWellPath* wellPath,
const RimSimWellInView* simWell, int branchIndex,
bool useBranchDetection);
static RimWellLogRftCurve* addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell);
static RimWellLogFileCurve* addFileCurve(RimWellLogTrack* plotTrack);
static RimWellLogRftCurve* addRftCurve(RimWellLogTrack* plotTrack, const RimSimWellInView* simWell);
static RimWellLogFileCurve* addFileCurve(RimWellLogTrack* plotTrack);
};

View File

@ -42,7 +42,7 @@ bool RicAdd3dWellLogCurveFeature::isCommandEnabled()
RiaApplication::instance()->project()->allCases(cases);
if (cases.empty()) return false;
return (RicWellLogTools::selectedWellPath() != nullptr);
return RicWellLogTools::findWellPathFromSelection() != nullptr;
}
//--------------------------------------------------------------------------------------------------
@ -50,7 +50,8 @@ bool RicAdd3dWellLogCurveFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogCurveFeature::onActionTriggered(bool isChecked)
{
RimWellPath* selectedWellPath = RicWellLogTools::selectedWellPath();
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathFromSelection();
if (!selectedWellPath) return;
Rim3dWellLogExtractionCurve* rim3dWellLogExtractionCurve = new Rim3dWellLogExtractionCurve();

View File

@ -41,7 +41,7 @@ bool RicAdd3dWellLogFileCurveFeature::isCommandEnabled()
RiaApplication::instance()->project()->allCases(cases);
if (cases.empty()) return false;
return (RicWellLogTools::selectedWellPathWithLogFile() != nullptr);
return (RicWellLogTools::findWellPathWithLogFileFromSelection() != nullptr);
}
//--------------------------------------------------------------------------------------------------
@ -49,7 +49,7 @@ bool RicAdd3dWellLogFileCurveFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogFileCurveFeature::onActionTriggered(bool isChecked)
{
RimWellPath* selectedWellPath = RicWellLogTools::selectedWellPathWithLogFile();
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathWithLogFileFromSelection();
if (!selectedWellPath) return;
Rim3dWellLogFileCurve* rim3dWellLogFileCurve = new Rim3dWellLogFileCurve();

View File

@ -41,9 +41,12 @@ bool RicAdd3dWellLogRftCurveFeature::isCommandEnabled()
RiaApplication::instance()->project()->allCases(cases);
if (cases.empty()) return false;
RimWellPath* wellPath = RicWellLogTools::selectedWellPath();
return RicWellLogTools::wellHasRftData(wellPath->name());
RimWellPath* wellPath = RicWellLogTools::findWellPathFromSelection();
if (wellPath)
{
return RicWellLogTools::wellHasRftData(wellPath->name());
}
return false;
}
//--------------------------------------------------------------------------------------------------
@ -51,7 +54,7 @@ bool RicAdd3dWellLogRftCurveFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogRftCurveFeature::onActionTriggered(bool isChecked)
{
RimWellPath* selectedWellPath = RicWellLogTools::selectedWellPath();
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathFromSelection();
if (!selectedWellPath) return;
Rim3dWellLogRftCurve* rim3dWellLogRftCurve = new Rim3dWellLogRftCurve();

View File

@ -22,6 +22,10 @@
#include "RiaApplication.h"
#include "Rim3dOverlayInfoConfig.h"
#include "Rim3dWellLogCurveCollection.h"
#include "Rim3dWellLogExtractionCurve.h"
#include "Rim3dWellLogFileCurve.h"
#include "Rim3dWellLogRftCurve.h"
#include "RimCalcScript.h"
#include "RimCaseCollection.h"
#include "RimCellRangeFilter.h"
@ -291,6 +295,15 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "Separator";
}
else if (dynamic_cast<Rim3dWellLogCurveCollection*>(uiItem) ||
dynamic_cast<Rim3dWellLogExtractionCurve*>(uiItem) ||
dynamic_cast<Rim3dWellLogFileCurve*>(uiItem) ||
dynamic_cast<Rim3dWellLogRftCurve*>(uiItem))
{
menuBuilder << "RicAdd3dWellLogCurveFeature";
menuBuilder << "RicAdd3dWellLogFileCurveFeature";
menuBuilder << "RicAdd3dWellLogRftCurveFeature";
}
else if (dynamic_cast<RimWellLogFile*>(uiItem))
{
menuBuilder << "RicWellPathsImportFileFeature";