From 650fc2147d8948a5a7284aa85e4f7d6b29c08dad Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 24 Jan 2018 10:48:23 +0100 Subject: [PATCH] #2404 Intersection: Update 3d view when creating new Intersection Box --- .../RicAppendIntersectionFeature.cpp | 2 +- .../RicNewAzimuthDipIntersectionFeature.cpp | 2 +- .../RicNewPolylineIntersectionFeature.cpp | 2 +- .../RicNewSimWellIntersectionFeature.cpp | 2 +- .../RicNewWellPathIntersectionFeature.cpp | 2 +- .../RicAppendIntersectionBoxFeature.cpp | 2 +- .../RicIntersectionBoxAtPosFeature.cpp | 2 +- .../RicIntersectionBoxXSliceFeature.cpp | 2 +- .../RicIntersectionBoxYSliceFeature.cpp | 2 +- .../RicIntersectionBoxZSliceFeature.cpp | 2 +- .../ProjectDataModel/RimIntersectionCollection.cpp | 14 ++++++++++++-- .../ProjectDataModel/RimIntersectionCollection.h | 5 +++-- 12 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp index 71acc20341..0b463e7793 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.cpp @@ -100,7 +100,7 @@ void RicAppendIntersectionFeatureCmd::redo() RimIntersection* intersection = new RimIntersection(); intersection->name = QString("Intersection"); - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); RimView* view = nullptr; m_intersectionCollection->firstAncestorOrThisOfTypeAsserted(view); diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp index 049500112a..6205e3d840 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp @@ -122,7 +122,7 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo() intersection->setLengthDown(cvf::Math::floor(bBox.extent()[2] / 2)); } - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); RiuSelectionManager::instance()->deleteAllItems(); RiuMainWindow::instance()->selectAsCurrentItem(intersection); diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp index 7d7ea02d34..ac7f045f5b 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.cpp @@ -112,7 +112,7 @@ void RicNewPolylineIntersectionFeatureCmd::redo() intersection->type = RimIntersection::CS_POLYLINE; intersection->inputPolyLineFromViewerEnabled = true; - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); RiuSelectionManager::instance()->deleteAllItems(); diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp index 2d20fd4ba3..d20238f06b 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp @@ -107,7 +107,7 @@ void RicNewSimWellIntersectionCmd::redo() intersection->type = RimIntersection::CS_SIMULATION_WELL; intersection->simulationWell = m_simWell; - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp index fcb0a3b455..a778aa82c6 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.cpp @@ -116,7 +116,7 @@ void RicNewWellPathIntersectionFeatureCmd::redo() intersection->type = RimIntersection::CS_WELL_PATH; intersection->wellPath = m_wellPath; - m_intersectionCollection->appendIntersection(intersection); + m_intersectionCollection->appendIntersectionAndUpdate(intersection); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp index 226292ed97..b5449d3dc7 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.cpp @@ -56,7 +56,7 @@ void RicAppendIntersectionBoxFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Intersection Box"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); intersectionBox->setToDefaultSizeBox(); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp index 3ad0570eb5..d8b9cb928c 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxAtPosFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Intersection box"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_NONE, domainCoord); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp index fbf17a62e8..102971ae8b 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxXSliceFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("X-slice (Intersection box)"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_X, domainCoord); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp index aea7a5d115..abe6bff899 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxYSliceFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Y-slice (Intersection box)"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Y, domainCoord); diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp index 68d65a23e0..0a73ce33b1 100644 --- a/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp +++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.cpp @@ -59,7 +59,7 @@ void RicIntersectionBoxZSliceFeature::onActionTriggered(bool isChecked) RimIntersectionBox* intersectionBox = new RimIntersectionBox(); intersectionBox->name = QString("Z-slice (Intersection box)"); - coll->appendIntersectionBox(intersectionBox); + coll->appendIntersectionBoxAndUpdate(intersectionBox); cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Z, domainCoord); diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp index eaebab0d58..ae205a7e32 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp @@ -149,7 +149,7 @@ void RimIntersectionCollection::appendPartsToModel(cvf::ModelBasicList* model, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimIntersectionCollection::appendIntersection(RimIntersection* intersection) +void RimIntersectionCollection::appendIntersectionAndUpdate(RimIntersection* intersection) { m_intersections.push_back(intersection); @@ -167,9 +167,19 @@ void RimIntersectionCollection::appendIntersection(RimIntersection* intersection //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimIntersectionCollection::appendIntersectionBox(RimIntersectionBox* intersectionBox) +void RimIntersectionCollection::appendIntersectionBoxAndUpdate(RimIntersectionBox* intersectionBox) { m_intersectionBoxes.push_back(intersectionBox); + + updateConnectedEditors(); + RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox); + + RimView* rimView = NULL; + firstAncestorOrThisOfType(rimView); + if (rimView) + { + rimView->scheduleCreateDisplayModelAndRedraw(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h index 2575250b64..631107f5e7 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h @@ -48,8 +48,9 @@ public: caf::PdmField isActive; - void appendIntersection(RimIntersection* intersection); - void appendIntersectionBox(RimIntersectionBox* intersectionBox); + void appendIntersectionAndUpdate(RimIntersection* intersection); + + void appendIntersectionBoxAndUpdate(RimIntersectionBox* intersectionBox); bool hasActiveIntersectionForSimulationWell(const RimSimWellInView* simWell) const;