(#657) Improved 3D view commands and context menu creation

This commit is contained in:
Magne Sjaastad
2015-11-19 18:57:32 +01:00
parent f3a1f21e87
commit 115e0cb660
6 changed files with 51 additions and 72 deletions

View File

@@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -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;
};