mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5068 Add "Input Property" command to menu of Cell Result and 3D view.
This commit is contained in:
parent
860e6641e5
commit
5dc883f1ca
@ -19,9 +19,11 @@
|
||||
|
||||
#include "RicAddEclipseInputPropertyFeature.h"
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
@ -41,7 +43,9 @@ CAF_CMD_SOURCE_INIT( RicAddEclipseInputPropertyFeature, "RicAddEclipseInputPrope
|
||||
bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
|
||||
{
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputCase>() ||
|
||||
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseResultCase>();
|
||||
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseResultCase>() ||
|
||||
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCellColors>() ||
|
||||
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -49,8 +53,11 @@ bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
|
||||
if ( !eclipseCase ) return;
|
||||
RimEclipseCase* eclipseCase = getEclipseCase();
|
||||
if ( !eclipseCase )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection = eclipseCase->inputPropertyCollection();
|
||||
if ( !inputPropertyCollection ) return;
|
||||
@ -83,3 +90,37 @@ void RicAddEclipseInputPropertyFeature::setupActionLook( QAction* actionToSetup
|
||||
actionToSetup->setText( "Add Input Property" );
|
||||
actionToSetup->setIcon( QIcon( ":/EclipseInput48x48.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicAddEclipseInputPropertyFeature::getEclipseCase() const
|
||||
{
|
||||
RimEclipseCase* eclipseCase = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
return eclipseCase;
|
||||
}
|
||||
|
||||
RimEclipseCellColors* cellColors = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCellColors>();
|
||||
if ( cellColors )
|
||||
{
|
||||
cellColors->firstAncestorOrThisOfType( eclipseCase );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
return eclipseCase;
|
||||
}
|
||||
}
|
||||
|
||||
RimEclipseView* eclipseView = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
if ( eclipseView )
|
||||
{
|
||||
eclipseView->firstAncestorOrThisOfType( eclipseCase );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
return eclipseCase;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -21,8 +21,7 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimEclipseInputPropertyCollection;
|
||||
class QStringList;
|
||||
class RimEclipseCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -38,7 +37,5 @@ protected:
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
RimEclipseInputPropertyCollection* selectedInputPropertyCollection() const;
|
||||
static void addEclipseInputProperty( const QStringList& fileNames,
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection );
|
||||
RimEclipseCase* getEclipseCase() const;
|
||||
};
|
||||
|
@ -207,6 +207,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicSaveEclipseResultAsInputPropertyFeature";
|
||||
menuBuilder << "RicExportContourMapToTextFeature";
|
||||
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
menuBuilder << "RicAddEclipseInputPropertyFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipseContourMapViewCollection*>( firstUiItem ) )
|
||||
{
|
||||
@ -269,6 +270,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicExportEclipseInputGridFeature";
|
||||
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
menuBuilder << "RicCreateGridCrossPlotFeature";
|
||||
menuBuilder << "RicAddEclipseInputPropertyFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipseInputProperty*>( firstUiItem ) )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user