diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp index 20b7ffaa8f..8f6395a1e8 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp @@ -505,7 +505,7 @@ void RivIntersectionPartMgr::computeData() std::vector< std::vector > polyLines = m_rimCrossSection->polyLines(); if (polyLines.size() > 0) { - cvf::Vec3d direction = extrusionDirection(polyLines[0]); + cvf::Vec3d direction = m_rimCrossSection->extrusionDirection(); cvf::ref hexGrid = createHexGridInterface(); m_crossSectionGenerator = new RivIntersectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p()); } @@ -516,7 +516,6 @@ void RivIntersectionPartMgr::computeData() //-------------------------------------------------------------------------------------------------- cvf::ref RivIntersectionPartMgr::createHexGridInterface() { - RimEclipseView* eclipseView; m_rimCrossSection->firstAncestorOrThisOfType(eclipseView); if (eclipseView) @@ -537,26 +536,3 @@ cvf::ref RivIntersectionPartMgr::createHexGridI return NULL; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::Vec3d RivIntersectionPartMgr::extrusionDirection(const std::vector& polyline) const -{ - CVF_ASSERT(m_rimCrossSection); - - cvf::Vec3d dir = cvf::Vec3d::Z_AXIS; - - if (m_rimCrossSection->direction == RimIntersection::CS_HORIZONTAL && - polyline.size() > 1) - { - // Use first and last point of polyline to approximate orientation of polyline - // Then cross with Z axis to find extrusion direction - - cvf::Vec3d polyLineDir = polyline[polyline.size() - 1] - polyline[0]; - cvf::Vec3d up = cvf::Vec3d::Z_AXIS; - dir = polyLineDir ^ up; - } - - return dir; -} - diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h index 5c325603bd..bac1b135f3 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.h @@ -62,7 +62,6 @@ private: void generatePartGeometry(); void computeData(); - cvf::Vec3d extrusionDirection(const std::vector& polyline) const; static void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords, const std::vector& triangleToCellIdxMap, const RigResultAccessor* resultAccessor, diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.cpp b/ApplicationCode/ProjectDataModel/RimIntersection.cpp index 0e37b2658e..0518ff319f 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersection.cpp @@ -57,6 +57,7 @@ void caf::AppEnum< RimIntersection::CrossSectionDirEnum >::setUp() { addItem(RimIntersection::CS_VERTICAL, "CS_VERTICAL", "Vertical"); addItem(RimIntersection::CS_HORIZONTAL, "CS_HORIZONTAL", "Horizontal"); + addItem(RimIntersection::CS_CUSTOM, "CS_CUSTOM", "Custom"); setDefault(RimIntersection::CS_VERTICAL); } @@ -81,6 +82,9 @@ RimIntersection::RimIntersection() CAF_PDM_InitFieldNoDefault(&wellPath, "WellPath", "Well Path ", "", "", ""); CAF_PDM_InitFieldNoDefault(&simulationWell, "SimulationWell", "Simulation Well", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_userPolyline, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", ""); + + CAF_PDM_InitFieldNoDefault(&m_customExtrusionPoints, "CustomExtrusionPoints", "Extrusion Points", "", "", ""); + CAF_PDM_InitField (&m_branchIndex, "Branch", -1, "Branch", "", "", ""); CAF_PDM_InitField (&m_extentLength, "ExtentLength", 200.0, "Extent length", "", "", ""); CAF_PDM_InitField (&showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", ""); @@ -543,6 +547,27 @@ void RimIntersection::appendPointToPolyLine(const cvf::Vec3d& point) rebuildGeometryAndScheduleCreateDisplayModel(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RimIntersection::extrusionDirection() const +{ + cvf::Vec3d dir = cvf::Vec3d::Z_AXIS; + + if (direction() == RimIntersection::CS_HORIZONTAL && + m_userPolyline().size() > 1) + { + // Use first and last point of polyline to approximate orientation of polyline + // Then cross with Z axis to find extrusion direction + + cvf::Vec3d polyLineDir = m_userPolyline()[m_userPolyline().size() - 1] - m_userPolyline()[0]; + cvf::Vec3d up = cvf::Vec3d::Z_AXIS; + dir = polyLineDir ^ up; + } + + return dir; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.h b/ApplicationCode/ProjectDataModel/RimIntersection.h index 64c8ea141e..2b5e7d4fe8 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersection.h @@ -54,7 +54,8 @@ public: enum CrossSectionDirEnum { CS_VERTICAL, - CS_HORIZONTAL + CS_HORIZONTAL, + CS_CUSTOM }; public: @@ -78,6 +79,8 @@ public: void appendPointToPolyLine(const cvf::Vec3d& point); + cvf::Vec3d extrusionDirection() const; + protected: virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* objectToggleField(); @@ -95,7 +98,8 @@ private: caf::PdmField m_extentLength; caf::PdmField< std::vector< cvf::Vec3d> > m_userPolyline; - + caf::PdmField< std::vector< cvf::Vec3d> > m_customExtrusionPoints; + RimEclipseWellCollection* simulationWellCollection(); void updateWellCenterline() const; void updateWellExtentDefaultValue();