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

View File

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

View File

@ -22,8 +22,10 @@
#include "RicEclipsePropertyFilterNewExec.h"
#include "RicGeoMechPropertyFilterNewExec.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 "RigFemPartCollection.h"
@ -238,6 +240,14 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
menu.addAction(newExtractionCurveFeature->action());
}
RicNewWellPathCrossSectionFeature* newWellPathCrossSectionFeature = dynamic_cast<RicNewWellPathCrossSectionFeature*>(commandManager->getCommandFeature("RicNewWellPathCrossSectionFeature"));
if (newWellPathCrossSectionFeature)
{
newWellPathCrossSectionFeature->setView(m_reservoirView);
menu.addAction(newWellPathCrossSectionFeature->action());
}
}
}
}