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