(#525) New well log extraction curve command feature needs a case

Not available unless there is a case.
This commit is contained in:
Pål Hagen 2015-09-25 14:48:31 +02:00
parent d8acb9d1bc
commit 7b802187d0
2 changed files with 16 additions and 5 deletions

View File

@ -26,6 +26,7 @@
#include "RimWellLogExtractionCurve.h" #include "RimWellLogExtractionCurve.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimWellPathCollection.h" #include "RimWellPathCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiaApplication.h" #include "RiaApplication.h"
@ -44,7 +45,7 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtr
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled() bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
{ {
return selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL; return (selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL) && caseAvailable();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -82,7 +83,7 @@ void RicNewWellLogCurveExtractionFeature::setupActionLook(QAction* actionToSetup
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() const
{ {
std::vector<RimWellLogPlotTrack*> selection; std::vector<RimWellLogPlotTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType(&selection);
@ -92,13 +93,22 @@ RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTra
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() const
{ {
std::vector<RimWellPath*> selection; std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL; return selection.size() > 0 ? selection[0] : NULL;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogCurveExtractionFeature::caseAvailable() const
{
RimView* view = RiaApplication::instance()->activeReservoirView();
return view ? view->ownerCase() != NULL : false;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -44,6 +44,7 @@ protected:
virtual void setupActionLook( QAction* actionToSetup ); virtual void setupActionLook( QAction* actionToSetup );
private: private:
RimWellLogPlotTrack* selectedWellLogPlotTrack(); RimWellLogPlotTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPath(); RimWellPath* selectedWellPath() const;
bool caseAvailable() const;
}; };