#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 "cvfAssert.h"
#include "cvfBoundingBox.h"
#include <QAction>
@ -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);
}

View File

@ -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<size_t> 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<caf::HexGridIntersectionTools::ClipVx> hexPlaneCutTriangleVxes;
hexPlaneCutTriangleVxes.reserve(5*3);

View File

@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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<double> m_extentLength;
caf::PdmField<double> m_azimuthAngle;
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_customExtrusionPoints;