#3526 Support picking of Valve objects and well path attributes

This commit is contained in:
Gaute Lindkvist committed 2019-01-16 15:46:15 +01:00
1 parent 431ce346ea
commit 3692f66b6d
1 file changed
+14 -5
@@ -60,12 +60,14 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPathAttribute*> attributes;
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
RimWellPathAttribute* attribute = nullptr;
if (attributes.size() == 1u)
{
RimWellPathAttributeCollection* attributeCollection = nullptr;
attributes[0]->firstAncestorOrThisOfTypeAsserted(attributeCollection);
RimWellPathAttribute* attribute = new RimWellPathAttribute;
attribute = new RimWellPathAttribute;
RimWellPath* wellPath = nullptr;
attributeCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
@@ -73,9 +75,9 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
attributeCollection->insertAttribute(attributes[0], attribute);
attributeCollection->updateAllRequiredEditors();
return;
}
else
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if (wellPath)
{
@@ -83,7 +85,7 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
wellPath->descendantsIncludingThisOfType(attributeCollections);
if (!attributeCollections.empty())
{
RimWellPathAttribute* attribute = new RimWellPathAttribute;
attribute = new RimWellPathAttribute;
attribute->setDepthsFromWellPath(wellPath);
attributeCollections[0]->insertAttribute(nullptr, attribute);
@@ -91,11 +93,18 @@ void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
wellPath->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem(attributeCollections[0]);
}
}
}
if (attribute)
{
RimProject* project = nullptr;
attribute->firstAncestorOrThisOfTypeAsserted(project);
project->scheduleCreateDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------