(#468) Added context menu item in 3D view for plotting of well log extraction curves

This commit is contained in:
Pål Hagen
2015-09-21 14:24:29 +02:00
parent 903b692e8e
commit 5e58cb141e
5 changed files with 51 additions and 6 deletions

View File

@@ -20,9 +20,12 @@
#include "RicNewWellLogCurveExtractionFeature.h" #include "RicNewWellLogCurveExtractionFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h" #include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimWellLogPlotTrack.h" #include "RimWellLogPlotTrack.h"
#include "RimWellLogExtractionCurve.h" #include "RimWellLogExtractionCurve.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
@@ -40,7 +43,7 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtr
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled() bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
{ {
return selectedWellLogPlotTrack() != NULL; return selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -53,6 +56,17 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
{ {
addCurve(wellLogPlotTrack); addCurve(wellLogPlotTrack);
} }
else
{
RimWellPath* wellPath = selectedWellPath();
if (wellPath)
{
RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack);
plotCurve->setWellPath(wellPath);
plotCurve->updateConnectedEditors();
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -76,13 +90,23 @@ RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTra
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrack) RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath()
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrack)
{ {
CVF_ASSERT(plotTrack); CVF_ASSERT(plotTrack);
size_t curveIndex = plotTrack->curveCount(); size_t curveIndex = plotTrack->curveCount();
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve(); RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
plotTrack->addCurve(curve); plotTrack->addCurve(curve);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
@@ -91,4 +115,6 @@ void RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrac
plotTrack->updateConnectedEditors(); plotTrack->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve); RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
return curve;
} }

View File

@@ -21,7 +21,9 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
class RimWellLogExtractionCurve;
class RimWellLogPlotTrack; class RimWellLogPlotTrack;
class RimWellPath;
//================================================================================================== //==================================================================================================
/// ///
@@ -31,7 +33,7 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public: public:
static void addCurve(RimWellLogPlotTrack* plotTrack); static RimWellLogExtractionCurve* addCurve(RimWellLogPlotTrack* plotTrack);
protected: protected:
@@ -41,5 +43,6 @@ protected:
virtual void setupActionLook( QAction* actionToSetup ); virtual void setupActionLook( QAction* actionToSetup );
private: private:
RimWellLogPlotTrack* selectedWellLogPlotTrack(); RimWellLogPlotTrack* selectedWellLogPlotTrack();
RimWellPath* selectedWellPath();
}; };

View File

@@ -94,6 +94,15 @@ RimWellLogExtractionCurve::~RimWellLogExtractionCurve()
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setWellPath(RimWellPath* wellPath)
{
m_wellPath = wellPath;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -547,4 +556,3 @@ QString RimWellLogExtractionCurve::createCurveName()
return generatedCurveName; return generatedCurveName;
} }

View File

@@ -41,6 +41,8 @@ public:
virtual ~RimWellLogExtractionCurve(); virtual ~RimWellLogExtractionCurve();
virtual void updatePlotData(); virtual void updatePlotData();
void setWellPath(RimWellPath* wellPath);
protected: protected:
virtual QString createCurveName(); virtual QString createCurveName();

View File

@@ -25,6 +25,7 @@
#include "RicGeoMechPropertyFilterNewExec.h" #include "RicGeoMechPropertyFilterNewExec.h"
#include "RicRangeFilterNewExec.h" #include "RicRangeFilterNewExec.h"
#include "Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h" #include "Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h"
#include "Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h"
#include "RigCaseData.h" #include "RigCaseData.h"
#include "RigFemPartCollection.h" #include "RigFemPartCollection.h"
@@ -219,6 +220,11 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
CVF_ASSERT(newWellLogFileCurveFeature); CVF_ASSERT(newWellLogFileCurveFeature);
menu.addAction(newWellLogFileCurveFeature->action()); menu.addAction(newWellLogFileCurveFeature->action());
RicNewWellLogCurveExtractionFeature* newExtractionCurveFeature = dynamic_cast<RicNewWellLogCurveExtractionFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogCurveExtractionFeature"));
CVF_ASSERT(newExtractionCurveFeature);
menu.addAction(newExtractionCurveFeature->action());
} }
} }
} }