mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 07:56:08 -06:00
#1495 Move features from well path to sub objects
This commit is contained in:
parent
ecddaffeb4
commit
123b404809
@ -20,7 +20,6 @@
|
||||
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@ -36,33 +35,33 @@ CAF_CMD_SOURCE_INIT(RicNewFishbonesSubsFeature, "RicNewFishbonesSubsFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellPath* wellPath = selectedWellPath();
|
||||
CVF_ASSERT(wellPath);
|
||||
RimFishbonesCollection* fishbonesCollection = selectedFishbonesCollection();
|
||||
CVF_ASSERT(fishbonesCollection);
|
||||
|
||||
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
|
||||
obj->setName(QString("Fishbones Subs (%1)").arg(wellPath->fishbonesCollection()->fishbonesSubs.size()));
|
||||
wellPath->fishbonesCollection()->fishbonesSubs.push_back(obj);
|
||||
obj->setName(QString("Fishbones Subs (%1)").arg(fishbonesCollection->fishbonesSubs.size()));
|
||||
fishbonesCollection->fishbonesSubs.push_back(obj);
|
||||
|
||||
wellPath->updateConnectedEditors();
|
||||
fishbonesCollection->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(obj);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RicNewFishbonesSubsFeature::selectedWellPath()
|
||||
RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection()
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
RimFishbonesCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (objHandle)
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType(wellPath);
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
}
|
||||
|
||||
return wellPath;
|
||||
return objToFind;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -79,7 +78,7 @@ void RicNewFishbonesSubsFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewFishbonesSubsFeature::isCommandEnabled()
|
||||
{
|
||||
if (selectedWellPath())
|
||||
if (selectedFishbonesCollection())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimWellPath;
|
||||
class RimFishbonesCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -35,5 +35,5 @@ protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
private:
|
||||
static RimWellPath* selectedWellPath();
|
||||
static RimFishbonesCollection* selectedFishbonesCollection();
|
||||
};
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "RiuEditPerforationCollectionWidget.h"
|
||||
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -36,7 +35,7 @@ CAF_CMD_SOURCE_INIT(RicEditPerforationCollectionFeature, "RicEditPerforationColl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEditPerforationCollectionFeature::isCommandEnabled()
|
||||
{
|
||||
return selectedWellPath() != nullptr;
|
||||
return selectedPerforationCollection() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -46,13 +45,14 @@ void RicEditPerforationCollectionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RimWellPath* wellPath = selectedWellPath();
|
||||
RimPerforationCollection* perforationCollection = selectedPerforationCollection();
|
||||
|
||||
if (wellPath == nullptr) return;
|
||||
if (perforationCollection == nullptr) return;
|
||||
|
||||
RiuEditPerforationCollectionWidget dlg(nullptr, wellPath->perforationIntervalCollection());
|
||||
RiuEditPerforationCollectionWidget dlg(nullptr, perforationCollection);
|
||||
dlg.exec();
|
||||
wellPath->updateConnectedEditors();
|
||||
|
||||
perforationCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -66,17 +66,17 @@ void RicEditPerforationCollectionFeature::setupActionLook(QAction* actionToSetup
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RicEditPerforationCollectionFeature::selectedWellPath() const
|
||||
RimPerforationCollection* RicEditPerforationCollectionFeature::selectedPerforationCollection()
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
RimPerforationCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (objHandle)
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType(wellPath);
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
}
|
||||
|
||||
return wellPath;
|
||||
return objToFind;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimWellPath;
|
||||
class RimPerforationCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -35,6 +35,6 @@ protected:
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
RimWellPath* selectedWellPath() const;
|
||||
static RimPerforationCollection* selectedPerforationCollection();
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
@ -39,7 +38,7 @@ CAF_CMD_SOURCE_INIT(RicNewPerforationIntervalFeature, "RicNewPerforationInterval
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPerforationIntervalFeature::isCommandEnabled()
|
||||
{
|
||||
return selectedWellPath() != nullptr;
|
||||
return selectedPerforationCollection() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -47,15 +46,15 @@ bool RicNewPerforationIntervalFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPerforationIntervalFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellPath* wellPath = selectedWellPath();
|
||||
if (wellPath == nullptr) return;
|
||||
RimPerforationCollection* perforationCollection = selectedPerforationCollection();
|
||||
if (perforationCollection == nullptr) return;
|
||||
|
||||
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
|
||||
|
||||
wellPath->perforationIntervalCollection()->appendPerforation(perforationInterval);
|
||||
perforationCollection->appendPerforation(perforationInterval);
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
wellPath->firstAncestorOrThisOfType(wellPathCollection);
|
||||
perforationCollection->firstAncestorOrThisOfType(wellPathCollection);
|
||||
if (!wellPathCollection) return;
|
||||
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
@ -75,17 +74,17 @@ void RicNewPerforationIntervalFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath * RicNewPerforationIntervalFeature::selectedWellPath()
|
||||
RimPerforationCollection* RicNewPerforationIntervalFeature::selectedPerforationCollection()
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
RimPerforationCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (objHandle)
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType(wellPath);
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
}
|
||||
|
||||
return wellPath;
|
||||
return objToFind;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimWellPath;
|
||||
class RimPerforationCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -37,5 +37,5 @@ protected:
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
RimWellPath* selectedWellPath();
|
||||
RimPerforationCollection* selectedPerforationCollection();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user