mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3526 Support picking of Valve objects and well path attributes
This commit is contained in:
@@ -60,12 +60,14 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
|||||||
{
|
{
|
||||||
std::vector<RimWellPathAttribute*> attributes;
|
std::vector<RimWellPathAttribute*> attributes;
|
||||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
|
RimWellPathAttribute* attribute = nullptr;
|
||||||
if (attributes.size() == 1u)
|
if (attributes.size() == 1u)
|
||||||
{
|
{
|
||||||
RimWellPathAttributeCollection* attributeCollection = nullptr;
|
RimWellPathAttributeCollection* attributeCollection = nullptr;
|
||||||
attributes[0]->firstAncestorOrThisOfTypeAsserted(attributeCollection);
|
attributes[0]->firstAncestorOrThisOfTypeAsserted(attributeCollection);
|
||||||
|
|
||||||
RimWellPathAttribute* attribute = new RimWellPathAttribute;
|
attribute = new RimWellPathAttribute;
|
||||||
RimWellPath* wellPath = nullptr;
|
RimWellPath* wellPath = nullptr;
|
||||||
attributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
attributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||||
|
|
||||||
@@ -73,26 +75,33 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
|||||||
attributeCollection->insertAttribute(attributes[0], attribute);
|
attributeCollection->insertAttribute(attributes[0], attribute);
|
||||||
|
|
||||||
attributeCollection->updateAllRequiredEditors();
|
attributeCollection->updateAllRequiredEditors();
|
||||||
return;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
|
||||||
|
if (wellPath)
|
||||||
|
{
|
||||||
|
std::vector<RimWellPathAttributeCollection*> attributeCollections;
|
||||||
|
wellPath->descendantsIncludingThisOfType(attributeCollections);
|
||||||
|
if (!attributeCollections.empty())
|
||||||
|
{
|
||||||
|
attribute = new RimWellPathAttribute;
|
||||||
|
attribute->setDepthsFromWellPath(wellPath);
|
||||||
|
|
||||||
|
attributeCollections[0]->insertAttribute(nullptr, attribute);
|
||||||
|
attributeCollections[0]->updateAllRequiredEditors();
|
||||||
|
|
||||||
|
wellPath->updateConnectedEditors();
|
||||||
|
Riu3DMainWindowTools::selectAsCurrentItem(attributeCollections[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
|
if (attribute)
|
||||||
if (wellPath)
|
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathAttributeCollection*> attributeCollections;
|
RimProject* project = nullptr;
|
||||||
wellPath->descendantsIncludingThisOfType(attributeCollections);
|
attribute->firstAncestorOrThisOfTypeAsserted(project);
|
||||||
if (!attributeCollections.empty())
|
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||||
{
|
|
||||||
RimWellPathAttribute* attribute = new RimWellPathAttribute;
|
|
||||||
attribute->setDepthsFromWellPath(wellPath);
|
|
||||||
|
|
||||||
attributeCollections[0]->insertAttribute(nullptr, attribute);
|
|
||||||
attributeCollections[0]->updateAllRequiredEditors();
|
|
||||||
|
|
||||||
wellPath->updateConnectedEditors();
|
|
||||||
Riu3DMainWindowTools::selectAsCurrentItem(attributeCollections[0]);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user