#2331 Add 2d Intersection View collection with automatic views. The create command is adjusted into a "Show" command.

This commit is contained in:
Jacob Støren
2018-01-23 14:23:28 +01:00
parent 9cfd2ff3cf
commit d34b3a7c74
19 changed files with 321 additions and 36 deletions

View File

@@ -42,6 +42,20 @@ bool RicNewIntersectionViewFeature::isCommandEnabled()
return !objects.empty();
}
Rim2dIntersectionView* correspondingIntersectionView(RimIntersection* intersection)
{
std::vector<caf::PdmObjectHandle*> objects;
intersection->objectsWithReferringPtrFields(objects);
Rim2dIntersectionView* isectView = nullptr;
for (auto obj : objects)
{
isectView = dynamic_cast<Rim2dIntersectionView*>(obj);
if (isectView) break;
}
return isectView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -67,10 +81,11 @@ void RicNewIntersectionViewFeature::onActionTriggered(bool isChecked)
QMessageBox::warning(RiuMainWindow::instance(), "New Intersection View", text);
}
Rim2dIntersectionView* intersectionView = rimCase->createAndAddIntersectionView(intersection);
Rim2dIntersectionView* intersectionView = correspondingIntersectionView(intersection);
intersectionView->setVisible(true);
intersectionView->loadDataAndUpdate();
rimCase->updateConnectedEditors();
intersectionView->updateConnectedEditors();
objectToSelect = intersectionView;
}
@@ -87,7 +102,7 @@ void RicNewIntersectionViewFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicNewIntersectionViewFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New Intersection View");
actionToSetup->setText("Show 2D Intersection View");
// actionToSetup->setIcon(QIcon(":/chain.png"));
}