diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp index 1523ee7575..b47a27d309 100644 --- a/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp +++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewAzimuthDipIntersectionFeature.cpp @@ -34,6 +34,7 @@ #include "cafSelectionManager.h" #include "cvfAssert.h" +#include "cvfBoundingBox.h" #include @@ -111,11 +112,18 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo() intersection->name = "Azimuth and Dip"; intersection->type = RimIntersection::CS_AZIMUTHLINE; intersection->inputTwoAzimuthPointsFromViewerEnabled = true; - + + RimCase* rimCase; + m_intersectionCollection->firstAncestorOrThisOfTypeAsserted(rimCase); + cvf::BoundingBox bBox = rimCase->allCellsBoundingBox(); + if (bBox.isValid()) + { + intersection->setHeight(cvf::Math::floor(bBox.extent()[2])); + } + m_intersectionCollection->appendIntersection(intersection); RiuSelectionManager::instance()->deleteAllItems(); - RiuMainWindow::instance()->selectAsCurrentItem(intersection); } diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp index c950c7f8bb..fb2cdc9ae1 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp @@ -91,23 +91,36 @@ void RivIntersectionGeometryGenerator::calculateArrays() cvf::BoundingBox sectionBBox; sectionBBox.add(p1); sectionBBox.add(p2); - double maxSectionHeight = gridBBox.radius(); - sectionBBox.add(p1 + m_extrusionDirection*maxSectionHeight); - sectionBBox.add(p1 - m_extrusionDirection*maxSectionHeight); - sectionBBox.add(p2 + m_extrusionDirection*maxSectionHeight); - sectionBBox.add(p2 - m_extrusionDirection*maxSectionHeight); + + double maxSectionHeight; + if (m_crossSection->type == RimIntersection::CS_AZIMUTHLINE) + { + maxSectionHeight = m_crossSection->height(); + } + else + { + maxSectionHeight = sectionBBox.radius(); + } + + if (maxSectionHeight == 0) return; + + cvf::Vec3d maxHeightVec = m_extrusionDirection*maxSectionHeight; + + sectionBBox.add(p1 + maxHeightVec); + sectionBBox.add(p1 - maxHeightVec); + sectionBBox.add(p2 + maxHeightVec); + sectionBBox.add(p2 - maxHeightVec); std::vector columnCellCandidates; m_hexGrid->findIntersectingCells(sectionBBox, &columnCellCandidates); cvf::Plane plane; - plane.setFromPoints(p1, p2, p2 + m_extrusionDirection*maxSectionHeight); + plane.setFromPoints(p1, p2, p2 + maxHeightVec); cvf::Plane p1Plane; - p1Plane.setFromPoints(p1, p1 + m_extrusionDirection*maxSectionHeight, p1 + plane.normal()); + p1Plane.setFromPoints(p1, p1 + maxHeightVec, p1 + plane.normal()); cvf::Plane p2Plane; - p2Plane.setFromPoints(p2, p2 + m_extrusionDirection*maxSectionHeight, p2 - plane.normal()); - + p2Plane.setFromPoints(p2, p2 + maxHeightVec, p2 - plane.normal()); std::vector hexPlaneCutTriangleVxes; hexPlaneCutTriangleVxes.reserve(5*3); diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.cpp b/ApplicationCode/ProjectDataModel/RimIntersection.cpp index 4f54a64f0b..3db54db277 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersection.cpp @@ -100,8 +100,10 @@ RimIntersection::RimIntersection() CAF_PDM_InitFieldNoDefault(&m_customExtrusionPoints, "CustomExtrusionPoints", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_twoAzimuthPoints, "TwoAzimuthPoints", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", ""); - CAF_PDM_InitField (&m_branchIndex, "Branch", -1, "Branch", "", "", ""); - CAF_PDM_InitField (&m_extentLength, "ExtentLength", 200.0, "Extent length", "", "", ""); + CAF_PDM_InitField (&m_branchIndex, "Branch", -1, "Branch", "", "", ""); + CAF_PDM_InitField (&m_extentLength, "ExtentLength", 200.0, "Extent Length", "", "", ""); + CAF_PDM_InitField (&m_height, "Height", 2000.0, "Height", "", "", ""); + CAF_PDM_InitField (&showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", ""); CAF_PDM_InitFieldNoDefault(&inputPolyLineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", ""); @@ -139,6 +141,7 @@ void RimIntersection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, changedField == &simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength || + changedField == &m_height || changedField == &showInactiveCells) { rebuildGeometryAndScheduleCreateDisplayModel(); @@ -245,7 +248,11 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup("Options"); - if (!(type == CS_AZIMUTHLINE)) + if (type == CS_AZIMUTHLINE) + { + optionsGroup->add(&m_height); + } + else { optionsGroup->add(&direction); optionsGroup->add(&m_extentLength); @@ -783,6 +790,22 @@ cvf::Vec3d RimIntersection::extrusionDirection() const return dir; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimIntersection::height() const +{ + return m_height; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersection::setHeight(double height) +{ + m_height = height; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.h b/ApplicationCode/ProjectDataModel/RimIntersection.h index a05edc8781..16577aba7e 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersection.h @@ -94,7 +94,8 @@ public: void appendPointToAzimuthLine(const cvf::Vec3d& point); cvf::Vec3d extrusionDirection() const; - + double height() const; + void setHeight(double height); protected: virtual caf::PdmFieldHandle* userDescriptionField(); @@ -113,6 +114,7 @@ private: caf::PdmField m_extentLength; caf::PdmField m_azimuthAngle; caf::PdmField m_dipAngle; + caf::PdmField m_height; caf::PdmField< std::vector< cvf::Vec3d> > m_userPolyline; caf::PdmField< std::vector< cvf::Vec3d> > m_customExtrusionPoints;