mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1078 Added context menu for well cells and well cell fence
This commit is contained in:
parent
8f4fa4592a
commit
ccc7345706
@ -267,3 +267,122 @@ bool RicEclipseWellShowSpheresFeature::isCommandChecked()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowWellCellsFeature, "RicEclipseWellShowWellCellsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellCells.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Cells");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellsFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
|
||||
if (wellColl && !wellColl->showWellCells())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellsFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellCells();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowWellCellFenceFeature, "RicEclipseWellShowWellCellFenceFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellFenceFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellCellFence.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellFenceFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Cell Fence");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellFenceFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
|
||||
if (wellColl && !(wellColl->showWellCells() || wellColl->showWellCellFence()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellFenceFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellCellFence();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -77,3 +77,31 @@ protected:
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellShowWellCellsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellShowWellCellFenceFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
|
@ -409,6 +409,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicEclipseWellShowHeadFeature";
|
||||
commandIds << "RicEclipseWellShowPipeFeature";
|
||||
commandIds << "RicEclipseWellShowSpheresFeature";
|
||||
commandIds << "RicEclipseWellShowWellCellsFeature";
|
||||
commandIds << "RicEclipseWellShowWellCellFenceFeature";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user