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