diff --git a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp index 8a3c899866..1e4ba8f8a8 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.cpp @@ -17,9 +17,11 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RicDeleteWellPathAttributeFeature.h" +#include "RimProject.h" #include "RimWellPath.h" #include "RimWellPathAttribute.h" #include "RimWellPathAttributeCollection.h" +#include "Riu3DMainWindowTools.h" #include "cafSelectionManager.h" #include @@ -60,6 +62,14 @@ void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked) wellPathAttributeCollection->deleteAttribute(attributeToDelete); } wellPathAttributeCollection->updateAllRequiredEditors(); + + if (wellPathAttributeCollection->attributes().empty()) + { + RimWellPath* wellPath = nullptr; + wellPathAttributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath); + wellPath->updateConnectedEditors(); + Riu3DMainWindowTools::selectAsCurrentItem(wellPath); + } } } diff --git a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp index 6fa77a9a77..5fc205dbe9 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.cpp @@ -17,9 +17,11 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RicNewWellPathAttributeFeature.h" +#include "RimProject.h" #include "RimWellPath.h" #include "RimWellPathAttribute.h" #include "RimWellPathAttributeCollection.h" +#include "Riu3DMainWindowTools.h" #include "cafSelectionManager.h" @@ -86,6 +88,10 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked) attributeCollections[0]->insertAttribute(nullptr, attribute); attributeCollections[0]->updateAllRequiredEditors(); + + wellPath->updateConnectedEditors(); + Riu3DMainWindowTools::selectAsCurrentItem(attributeCollections[0]); + } } } @@ -101,12 +107,17 @@ void RicNewWellPathAttributeFeature::setupActionLook(QAction* actionToSetup) { actionToSetup->setText(QString("Insert New Attribute before %1").arg(attributes[0]->componentTypeLabel())); actionToSetup->setIcon(QIcon(":/Well.png")); - } - else + } + else if (caf::SelectionManager::instance()->selectedItemOfType()) { actionToSetup->setText("Append New Attribute"); actionToSetup->setIcon(QIcon(":/Well.png")); } + else if(caf::SelectionManager::instance()->selectedItemOfType()) + { + actionToSetup->setText("Create Casing Design"); + actionToSetup->setIcon(QIcon(":/Well.png")); + } } diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 21a19138fd..4aeda18a8f 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -289,13 +289,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewWellPathIntersectionFeature"; menuBuilder.addSeparator(); - menuBuilder.subMenuStart("Completions", QIcon(":/FishBoneGroup16x16.png")); menuBuilder << "RicNewWellPathFractureFeature"; menuBuilder << "RicNewFishbonesSubsFeature"; menuBuilder << "RicNewPerforationIntervalFeature"; menuBuilder << "RicNewValveFeature"; - menuBuilder << "RicEditPerforationCollectionFeature"; menuBuilder.subMenuEnd(); @@ -309,6 +307,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicShowWellPlanFeature"; } menuBuilder << "RicCreateMultipleFracturesFeature"; + menuBuilder << "RicNewWellPathAttributeFeature"; menuBuilder << "Separator"; diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index 103a83477d..5654bc04fb 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -118,10 +118,9 @@ RimWellPath::RimWellPath() m_wellLogFile_OBSOLETE.uiCapability()->setUiHidden(true); m_wellLogFile_OBSOLETE.xmlCapability()->setIOWritable(false); - CAF_PDM_InitFieldNoDefault(&m_wellPathAttributes, "WellPathAttributes", "", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_wellPathAttributes, "WellPathAttributes", "Casing Design Rubbish", "", "", ""); m_wellPathAttributes = new RimWellPathAttributeCollection; m_wellPathAttributes->uiCapability()->setUiTreeHidden(true); - m_wellPathAttributes->uiCapability()->setUiTreeChildrenHidden(true); m_wellPath = nullptr; } @@ -564,8 +563,6 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO formationFileInfoGroup->add(&m_wellPathFormationFilePath); formationFileInfoGroup->add(&m_formationKeyInFile); - m_wellPathAttributes->uiOrdering(uiConfigName, uiOrdering); - uiOrdering.skipRemainingFields(true); } @@ -578,12 +575,17 @@ void RimWellPath::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, Q if (m_completions->hasCompletions()) { - uiTreeOrdering.add(&m_completions); + uiTreeOrdering.add(m_completions()); } if (m_3dWellLogCurves->has3dWellLogCurves()) { - uiTreeOrdering.add(&m_3dWellLogCurves); + uiTreeOrdering.add(m_3dWellLogCurves()); + } + + if (!m_wellPathAttributes->attributes().empty()) + { + uiTreeOrdering.add(m_wellPathAttributes()); } uiTreeOrdering.skipRemainingChildren(true); diff --git a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp index dc2ddaf457..5aff64f6f8 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp @@ -22,6 +22,7 @@ #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmUiTableViewEditor.h" +#include "cafPdmUiTreeOrdering.h" CAF_PDM_SOURCE_INIT(RimWellPathAttributeCollection, "WellPathAttributes"); @@ -30,12 +31,11 @@ CAF_PDM_SOURCE_INIT(RimWellPathAttributeCollection, "WellPathAttributes"); //-------------------------------------------------------------------------------------------------- RimWellPathAttributeCollection::RimWellPathAttributeCollection() { - CAF_PDM_InitObject("WellPathAttributes", ":/Well.png", "", ""); + CAF_PDM_InitObject("Casing Design", ":/CompletionsSymbol16x16", "", ""); - CAF_PDM_InitFieldNoDefault(&m_attributes, "Attributes", "", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_attributes, "Attributes", "Casing Design Attributes", "", "", ""); m_attributes.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName()); - m_attributes.uiCapability()->setUiTreeChildrenHidden(true); - m_attributes.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + m_attributes.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_attributes.uiCapability()->setCustomContextMenuEnabled(true); } @@ -137,6 +137,13 @@ void RimWellPathAttributeCollection::defineEditorAttribute(const caf::PdmFieldHa //-------------------------------------------------------------------------------------------------- void RimWellPathAttributeCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { - caf::PdmUiGroup* attrGroup = uiOrdering.addNewGroup("Well Path Attributes"); - attrGroup->add(&m_attributes); + uiOrdering.add(&m_attributes); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathAttributeCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) +{ + uiTreeOrdering.skipRemainingChildren(true); } diff --git a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h index 2d95a711d1..0f3d02e9a0 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h @@ -39,8 +39,10 @@ public: protected: void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget) override; - void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; + void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; + private: caf::PdmChildArrayField m_attributes; }; \ No newline at end of file diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index c3b2cdcef8..0045a28baa 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -405,9 +405,9 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event) menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); - + menuBuilder << "RicNewWellPathAttributeFeature"; menuBuilder.subMenuStart("Completions", QIcon(":/FishBoneGroup16x16.png")); - + menuBuilder << "RicNewWellPathFractureAtPosFeature"; menuBuilder << "RicNewFishbonesSubsAtMeasuredDepthFeature"; menuBuilder << "RicNewPerforationIntervalAtMeasuredDepthFeature";