mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2209 Use correct view in cmd "Export Visible Cells as FLUXNUM/MULTNUM"
This commit is contained in:
parent
f11df61ff2
commit
5a03783328
@ -43,23 +43,15 @@
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicSaveEclipseInputActiveVisibleCellsFeature, "RicSaveEclipseInputActiveVisibleCellsFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicSaveEclipseInputVisibleCellsFeature, "RicSaveEclipseInputVisibleCellsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSaveEclipseInputVisibleCellsFeature::isCommandEnabled()
|
||||
{
|
||||
return getSelectedEclipseView() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseInputVisibleCellsFeature::onActionTriggered(bool isChecked)
|
||||
void executeCommand(RimEclipseView* view)
|
||||
{
|
||||
RimEclipseView* view = getEclipseActiveView();
|
||||
|
||||
RicSaveEclipseInputVisibleCellsUi exportSettings;
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export FLUXNUM/MULTNUM", "");
|
||||
RicExportFeatureImpl::configureForExport(&propertyDialog);
|
||||
@ -99,6 +91,23 @@ void RicSaveEclipseInputVisibleCellsFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSaveEclipseInputVisibleCellsFeature::isCommandEnabled()
|
||||
{
|
||||
return selectedView() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseInputVisibleCellsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimEclipseView* view = RicSaveEclipseInputVisibleCellsFeature::selectedView();
|
||||
executeCommand(view);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -110,17 +119,50 @@ void RicSaveEclipseInputVisibleCellsFeature::setupActionLook(QAction* actionToSe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicSaveEclipseInputVisibleCellsFeature::getEclipseActiveView()
|
||||
RimEclipseView* RicSaveEclipseInputVisibleCellsFeature::selectedView()
|
||||
{
|
||||
RimEclipseView* view = dynamic_cast<RimEclipseView*>(caf::SelectionManager::instance()->selectedItem());
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSaveEclipseInputActiveVisibleCellsFeature::isCommandEnabled()
|
||||
{
|
||||
return getEclipseActiveView() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseInputActiveVisibleCellsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimEclipseView* view = RicSaveEclipseInputActiveVisibleCellsFeature::getEclipseActiveView();
|
||||
executeCommand(view);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaveEclipseInputActiveVisibleCellsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Export Visible Cells as FLUXNUM/MULTNUM");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicSaveEclipseInputActiveVisibleCellsFeature::getEclipseActiveView()
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
|
||||
return dynamic_cast<RimEclipseView*>(activeView);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView * RicSaveEclipseInputVisibleCellsFeature::getSelectedEclipseView()
|
||||
{
|
||||
return dynamic_cast<RimEclipseView*>(caf::SelectionManager::instance()->selectedItem());
|
||||
}
|
||||
|
@ -31,12 +31,26 @@ class RicSaveEclipseInputVisibleCellsFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
RimEclipseView* getEclipseActiveView();
|
||||
RimEclipseView* getSelectedEclipseView();
|
||||
RimEclipseView* selectedView();
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSaveEclipseInputActiveVisibleCellsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
static RimEclipseView* getEclipseActiveView();
|
||||
};
|
||||
|
@ -389,7 +389,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicNewGridTimeHistoryCurveFeature";
|
||||
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
|
||||
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
menuBuilder << "RicSaveEclipseInputActiveVisibleCellsFeature";
|
||||
menuBuilder << "RicShowGridStatisticsFeature";
|
||||
|
||||
menuBuilder.appendToMenu(&menu);
|
||||
|
Loading…
Reference in New Issue
Block a user