mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 07:26:03 -06:00
#1597 Hide completions for well paths that have none, and enable commands to add new ones on well path directly
This commit is contained in:
parent
95ef92a9af
commit
d5d7625864
@ -57,7 +57,14 @@ void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(fishbonesCollection);
|
||||
|
||||
fishbonesCollection->updateConnectedEditors();
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
fishbonesCollection->firstAncestorOrThisOfType(wellPathCollection);
|
||||
if (wellPathCollection)
|
||||
{
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(obj);
|
||||
|
||||
RimProject* proj;
|
||||
@ -80,6 +87,16 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
}
|
||||
|
||||
if (objToFind == nullptr)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPaths);
|
||||
if (!wellPaths.empty())
|
||||
{
|
||||
return wellPaths[0]->fishbonesCollection();
|
||||
}
|
||||
}
|
||||
|
||||
return objToFind;
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPerforationIntervalFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/PerforationInterval16x16.png"));
|
||||
actionToSetup->setText("New Perforation Interval");
|
||||
}
|
||||
|
||||
@ -92,5 +93,15 @@ RimPerforationCollection* RicNewPerforationIntervalFeature::selectedPerforationC
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
}
|
||||
|
||||
if (objToFind == nullptr)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPaths);
|
||||
if (!wellPaths.empty())
|
||||
{
|
||||
return wellPaths[0]->perforationIntervalCollection();
|
||||
}
|
||||
}
|
||||
|
||||
return objToFind;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCompletions.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@ -53,8 +54,8 @@ bool RicWellPathImportCompletionsFileFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimFishboneWellPathCollection* wellPathCollection = RicWellPathImportCompletionsFileFeature::selectedWellPathCollection();
|
||||
CVF_ASSERT(wellPathCollection);
|
||||
RimFishboneWellPathCollection* fishbonesWellPathCollection = RicWellPathImportCompletionsFileFeature::selectedWellPathCollection();
|
||||
CVF_ASSERT(fishbonesWellPathCollection);
|
||||
|
||||
// Open dialog box to select well path files
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
@ -66,7 +67,14 @@ void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
|
||||
|
||||
wellPathCollection->importCompletionsFromFile(wellPathFilePaths);
|
||||
fishbonesWellPathCollection->importCompletionsFromFile(wellPathFilePaths);
|
||||
|
||||
RimWellPathCollection* wellPathCollection;
|
||||
fishbonesWellPathCollection->firstAncestorOrThisOfType(wellPathCollection);
|
||||
if (wellPathCollection)
|
||||
{
|
||||
wellPathCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
if (app->project())
|
||||
{
|
||||
@ -88,15 +96,26 @@ void RicWellPathImportCompletionsFileFeature::setupActionLook(QAction* actionToS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFishboneWellPathCollection* RicWellPathImportCompletionsFileFeature::selectedWellPathCollection()
|
||||
{
|
||||
std::vector<caf::PdmObject*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
if (objects.size() > 0)
|
||||
RimFishbonesCollection* objToFind = nullptr;
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (objHandle)
|
||||
{
|
||||
RimFishboneWellPathCollection* fbWellColl = nullptr;
|
||||
objects[0]->firstAncestorOrThisOfType(fbWellColl);
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
}
|
||||
|
||||
return fbWellColl;
|
||||
if (objToFind == nullptr)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPaths);
|
||||
if (!wellPaths.empty())
|
||||
{
|
||||
return wellPaths[0]->fishbonesCollection()->wellPathCollection();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return objToFind->wellPathCollection();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -19,10 +19,13 @@
|
||||
#include "RimWellPathCompletions.h"
|
||||
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimFishboneWellPathCollection.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellPathCompletions, "WellPathCompletions");
|
||||
|
||||
@ -80,3 +83,31 @@ QString RimWellPathCompletions::wellNameForExport() const
|
||||
return m_wellNameForExport();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPathCompletions::hasCompletions() const
|
||||
{
|
||||
return !fishbonesCollection()->fishbonesSubs().empty() ||
|
||||
!fishbonesCollection()->wellPathCollection()->wellPaths().empty() ||
|
||||
!perforationCollection()->perforations().empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCompletions::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
|
||||
{
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
|
||||
if (!perforationCollection()->perforations().empty())
|
||||
{
|
||||
uiTreeOrdering.add(&m_perforationCollection);
|
||||
}
|
||||
|
||||
if (!fishbonesCollection()->fishbonesSubs().empty() ||
|
||||
!fishbonesCollection()->wellPathCollection()->wellPaths().empty())
|
||||
{
|
||||
uiTreeOrdering.add(&m_fishbonesCollection);
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,10 @@ public:
|
||||
|
||||
void setWellNameForExport(const QString& name);
|
||||
QString wellNameForExport() const;
|
||||
bool hasCompletions() const;
|
||||
|
||||
protected:
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimFishbonesCollection*> m_fishbonesCollection;
|
||||
|
@ -366,7 +366,11 @@ void RimWellPath::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
{
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
uiTreeOrdering.add(&m_wellLogFile);
|
||||
uiTreeOrdering.add(&m_completions);
|
||||
|
||||
if (m_completions->hasCompletions())
|
||||
{
|
||||
uiTreeOrdering.add(&m_completions);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user