(#657) Added support for creating a cross section from well path context menu in 3D viewer

This commit is contained in:
Magne Sjaastad 2015-11-18 17:55:05 +01:00
parent 91e159810c
commit dc894928b5
3 changed files with 44 additions and 11 deletions

View File

@ -34,6 +34,15 @@
CAF_CMD_SOURCE_INIT(RicNewWellPathCrossSectionFeature, "RicNewWellPathCrossSectionFeature"); CAF_CMD_SOURCE_INIT(RicNewWellPathCrossSectionFeature, "RicNewWellPathCrossSectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathCrossSectionFeature::RicNewWellPathCrossSectionFeature()
: m_view(NULL)
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -47,20 +56,16 @@ bool RicNewWellPathCrossSectionFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked) void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked)
{ {
/* if (!m_view) return;
std::vector<RimEclipseWell*> collection;
std::vector<RimWellPath*> collection;
caf::SelectionManager::instance()->objectsByType(&collection); caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1); CVF_ASSERT(collection.size() == 1);
RimEclipseWell* eclWell = collection[0]; RimWellPath* wellPath = collection[0];
RimEclipseView* eclView = NULL; RicNewWellPathCrossSectionFeatureCmd* cmd = new RicNewWellPathCrossSectionFeatureCmd(m_view->crossSectionCollection, wellPath);
eclWell->firstAnchestorOrThisOfType(eclView);
CVF_ASSERT(eclView);
RicNewWellPathCrossSectionFeatureCmd* cmd = new RicNewWellPathCrossSectionFeatureCmd(eclView->crossSectionCollection, eclWell);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd); caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
*/
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -72,6 +77,14 @@ void RicNewWellPathCrossSectionFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setText("New Cross Section"); actionToSetup->setText("New Cross Section");
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathCrossSectionFeature::setView(RimView* view)
{
m_view = view;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -19,6 +19,8 @@
#pragma once #pragma once
#include "RimView.h"
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include "cafCmdExecuteCommand.h" #include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
@ -54,11 +56,19 @@ class RicNewWellPathCrossSectionFeature : public caf::CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public:
RicNewWellPathCrossSectionFeature();
void setView(RimView* view);
protected: protected:
// Overrides // Overrides
virtual bool isCommandEnabled(); virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked ); virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup ); virtual void setupActionLook( QAction* actionToSetup );
private:
caf::PdmPointer<RimView> m_view;
}; };

View File

@ -22,8 +22,10 @@
#include "RicEclipsePropertyFilterNewExec.h" #include "RicEclipsePropertyFilterNewExec.h"
#include "RicGeoMechPropertyFilterNewExec.h" #include "RicGeoMechPropertyFilterNewExec.h"
#include "RicRangeFilterNewExec.h" #include "RicRangeFilterNewExec.h"
#include "Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h"
#include "Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h" #include "CrossSectionCommands/RicNewWellPathCrossSectionFeature.h"
#include "WellLogCommands/RicNewWellLogCurveExtractionFeature.h"
#include "WellLogCommands/RicNewWellLogFileCurveFeature.h"
#include "RigCaseData.h" #include "RigCaseData.h"
#include "RigFemPartCollection.h" #include "RigFemPartCollection.h"
@ -238,6 +240,14 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{ {
menu.addAction(newExtractionCurveFeature->action()); menu.addAction(newExtractionCurveFeature->action());
} }
RicNewWellPathCrossSectionFeature* newWellPathCrossSectionFeature = dynamic_cast<RicNewWellPathCrossSectionFeature*>(commandManager->getCommandFeature("RicNewWellPathCrossSectionFeature"));
if (newWellPathCrossSectionFeature)
{
newWellPathCrossSectionFeature->setView(m_reservoirView);
menu.addAction(newWellPathCrossSectionFeature->action());
}
} }
} }
} }