mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#657) Improved 3D view commands and context menu creation
This commit is contained in:
@@ -19,9 +19,12 @@
|
||||
|
||||
#include "RicNewWellPathCrossSectionFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -36,7 +39,6 @@ CAF_CMD_SOURCE_INIT(RicNewWellPathCrossSectionFeature, "RicNewWellPathCrossSecti
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewWellPathCrossSectionFeature::RicNewWellPathCrossSectionFeature()
|
||||
: m_view(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,7 +56,8 @@ bool RicNewWellPathCrossSectionFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
if (!m_view) return;
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
std::vector<RimWellPath*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType(&collection);
|
||||
@@ -62,7 +65,7 @@ void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RimWellPath* wellPath = collection[0];
|
||||
|
||||
RicNewWellPathCrossSectionFeatureCmd* cmd = new RicNewWellPathCrossSectionFeatureCmd(m_view->crossSectionCollection, wellPath);
|
||||
RicNewWellPathCrossSectionFeatureCmd* cmd = new RicNewWellPathCrossSectionFeatureCmd(activeView->crossSectionCollection, wellPath);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
|
||||
}
|
||||
|
||||
@@ -75,14 +78,6 @@ void RicNewWellPathCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
actionToSetup->setText("New Cross Section");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathCrossSectionFeature::setView(RimView* view)
|
||||
{
|
||||
m_view = view;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimView.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
@@ -59,16 +57,11 @@ class RicNewWellPathCrossSectionFeature : public caf::CmdFeature
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user