mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2331 Add 2d Intersection View collection with automatic views. The create command is adjusted into a "Show" command.
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user