#2175 Intersection: Make extrude length option on azimuth, dip plane

This commit is contained in:
Unknown 2017-11-23 15:19:10 +01:00 committed by Rebecca Cox
parent 89f67c053f
commit ef52927795
4 changed files with 61 additions and 15 deletions

View File

@ -34,6 +34,7 @@
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include "cvfAssert.h" #include "cvfAssert.h"
#include "cvfBoundingBox.h"
#include <QAction> #include <QAction>
@ -112,10 +113,17 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo()
intersection->type = RimIntersection::CS_AZIMUTHLINE; intersection->type = RimIntersection::CS_AZIMUTHLINE;
intersection->inputTwoAzimuthPointsFromViewerEnabled = true; 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); m_intersectionCollection->appendIntersection(intersection);
RiuSelectionManager::instance()->deleteAllItems(); RiuSelectionManager::instance()->deleteAllItems();
RiuMainWindow::instance()->selectAsCurrentItem(intersection); RiuMainWindow::instance()->selectAsCurrentItem(intersection);
} }

View File

@ -91,23 +91,36 @@ void RivIntersectionGeometryGenerator::calculateArrays()
cvf::BoundingBox sectionBBox; cvf::BoundingBox sectionBBox;
sectionBBox.add(p1); sectionBBox.add(p1);
sectionBBox.add(p2); sectionBBox.add(p2);
double maxSectionHeight = gridBBox.radius();
sectionBBox.add(p1 + m_extrusionDirection*maxSectionHeight); double maxSectionHeight;
sectionBBox.add(p1 - m_extrusionDirection*maxSectionHeight); if (m_crossSection->type == RimIntersection::CS_AZIMUTHLINE)
sectionBBox.add(p2 + m_extrusionDirection*maxSectionHeight); {
sectionBBox.add(p2 - m_extrusionDirection*maxSectionHeight); 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<size_t> columnCellCandidates; std::vector<size_t> columnCellCandidates;
m_hexGrid->findIntersectingCells(sectionBBox, &columnCellCandidates); m_hexGrid->findIntersectingCells(sectionBBox, &columnCellCandidates);
cvf::Plane plane; cvf::Plane plane;
plane.setFromPoints(p1, p2, p2 + m_extrusionDirection*maxSectionHeight); plane.setFromPoints(p1, p2, p2 + maxHeightVec);
cvf::Plane p1Plane; cvf::Plane p1Plane;
p1Plane.setFromPoints(p1, p1 + m_extrusionDirection*maxSectionHeight, p1 + plane.normal()); p1Plane.setFromPoints(p1, p1 + maxHeightVec, p1 + plane.normal());
cvf::Plane p2Plane; cvf::Plane p2Plane;
p2Plane.setFromPoints(p2, p2 + m_extrusionDirection*maxSectionHeight, p2 - plane.normal()); p2Plane.setFromPoints(p2, p2 + maxHeightVec, p2 - plane.normal());
std::vector<caf::HexGridIntersectionTools::ClipVx> hexPlaneCutTriangleVxes; std::vector<caf::HexGridIntersectionTools::ClipVx> hexPlaneCutTriangleVxes;
hexPlaneCutTriangleVxes.reserve(5*3); hexPlaneCutTriangleVxes.reserve(5*3);

View File

@ -101,7 +101,9 @@ RimIntersection::RimIntersection()
CAF_PDM_InitFieldNoDefault(&m_twoAzimuthPoints, "TwoAzimuthPoints", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", ""); 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_branchIndex, "Branch", -1, "Branch", "", "", "");
CAF_PDM_InitField (&m_extentLength, "ExtentLength", 200.0, "Extent length", "", "", ""); 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_InitField (&showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "");
CAF_PDM_InitFieldNoDefault(&inputPolyLineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&inputPolyLineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", "");
@ -139,6 +141,7 @@ void RimIntersection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
changedField == &simulationWell || changedField == &simulationWell ||
changedField == &m_branchIndex || changedField == &m_branchIndex ||
changedField == &m_extentLength || changedField == &m_extentLength ||
changedField == &m_height ||
changedField == &showInactiveCells) changedField == &showInactiveCells)
{ {
rebuildGeometryAndScheduleCreateDisplayModel(); rebuildGeometryAndScheduleCreateDisplayModel();
@ -245,7 +248,11 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup("Options"); caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup("Options");
if (!(type == CS_AZIMUTHLINE)) if (type == CS_AZIMUTHLINE)
{
optionsGroup->add(&m_height);
}
else
{ {
optionsGroup->add(&direction); optionsGroup->add(&direction);
optionsGroup->add(&m_extentLength); optionsGroup->add(&m_extentLength);
@ -783,6 +790,22 @@ cvf::Vec3d RimIntersection::extrusionDirection() const
return dir; return dir;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimIntersection::height() const
{
return m_height;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersection::setHeight(double height)
{
m_height = height;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -94,7 +94,8 @@ public:
void appendPointToAzimuthLine(const cvf::Vec3d& point); void appendPointToAzimuthLine(const cvf::Vec3d& point);
cvf::Vec3d extrusionDirection() const; cvf::Vec3d extrusionDirection() const;
double height() const;
void setHeight(double height);
protected: protected:
virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* userDescriptionField();
@ -113,6 +114,7 @@ private:
caf::PdmField<double> m_extentLength; caf::PdmField<double> m_extentLength;
caf::PdmField<double> m_azimuthAngle; caf::PdmField<double> m_azimuthAngle;
caf::PdmField<double> m_dipAngle; caf::PdmField<double> m_dipAngle;
caf::PdmField<double> m_height;
caf::PdmField< std::vector< cvf::Vec3d> > m_userPolyline; caf::PdmField< std::vector< cvf::Vec3d> > m_userPolyline;
caf::PdmField< std::vector< cvf::Vec3d> > m_customExtrusionPoints; caf::PdmField< std::vector< cvf::Vec3d> > m_customExtrusionPoints;