2018-10-10 04:10:56 -05:00
|
|
|
#include "RicNewValveFeature.h"
|
|
|
|
#include "Riu3DMainWindowTools.h"
|
|
|
|
|
2018-11-20 08:38:43 -06:00
|
|
|
#include "RiaApplication.h"
|
2018-10-10 04:10:56 -05:00
|
|
|
#include "RimPerforationInterval.h"
|
|
|
|
#include "RimWellPathValve.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT(RicNewValveFeature, "RicNewValveFeature");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicNewValveFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
const RimPerforationInterval* perfInterval = caf::SelectionManager::instance()->selectedItemOfType<RimPerforationInterval>();
|
2018-11-20 08:38:43 -06:00
|
|
|
return perfInterval != nullptr && RiaApplication::enableDevelopmentFeatures();
|
2018-10-10 04:10:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewValveFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
|
|
|
RimPerforationInterval* perfInterval = caf::SelectionManager::instance()->selectedItemOfType<RimPerforationInterval>();
|
|
|
|
if (perfInterval)
|
|
|
|
{
|
|
|
|
RimWellPathValve* valve = new RimWellPathValve;
|
|
|
|
perfInterval->addValve(valve);
|
2018-10-19 07:44:17 -05:00
|
|
|
valve->setMeasuredDepthAndCount(perfInterval->startMD(), perfInterval->endMD() - perfInterval->startMD(), 1);
|
2018-10-10 04:10:56 -05:00
|
|
|
|
|
|
|
RimWellPathCollection* wellPathCollection = nullptr;
|
|
|
|
perfInterval->firstAncestorOrThisOfType(wellPathCollection);
|
|
|
|
if (!wellPathCollection) return;
|
|
|
|
|
|
|
|
wellPathCollection->uiCapability()->updateConnectedEditors();
|
|
|
|
wellPathCollection->scheduleRedrawAffectedViews();
|
|
|
|
|
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem(valve);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewValveFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
2018-10-31 03:37:47 -05:00
|
|
|
actionToSetup->setIcon(QIcon(":/ICDValve16x16.png"));
|
2018-10-10 04:10:56 -05:00
|
|
|
actionToSetup->setText("New Valve");
|
|
|
|
}
|