#2589 intersections. Show extrusion line fix

This commit is contained in:
Bjørn Erik Jensen
2018-03-12 15:14:22 +01:00
parent e13702a88a
commit 1e8f1bb95e
6 changed files with 58 additions and 22 deletions
@@ -23,11 +23,13 @@
#include "RigResultAccessor.h"
#include "RimIntersection.h"
#include "Rim3dView.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionPartMgr.h"
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
#include "cafDisplayCoordTransform.h"
#include "cvfDrawableGeo.h"
#include "cvfGeometryTools.h"
@@ -40,6 +42,16 @@
#include "RivSectionFlattner.h"
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform(const RimIntersection* intersection)
{
Rim3dView* rimView = nullptr;
intersection->firstAncestorOrThisOfType(rimView);
CVF_ASSERT(rimView);
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
return transForm;
}
//--------------------------------------------------------------------------------------------------
/// isFlattened means to transform each flat section of the intersection onto the XZ plane
/// placed adjacent to each other as if they were rotated around the common extrusion line like a hinge
@@ -399,6 +411,22 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPoly
return createLineAlongPolylineDrawable(m_flattenedOrOffsettedPolyLines);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongExtrusionLineDrawable(const std::vector<cvf::Vec3d>& extrusionLine)
{
cvf::ref<caf::DisplayCoordTransform> transform = displayCoordTransform(crossSection());
std::vector<cvf::Vec3d> displayCoords;
for (const auto& pt : extrusionLine)
{
displayCoords.push_back(transform->translateToDisplayCoord(pt));
}
return createLineAlongPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({ displayCoords }));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -407,8 +435,6 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPoly
std::vector<cvf::uint> lineIndices;
std::vector<cvf::Vec3f> vertices;
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
for (size_t pLineIdx = 0; pLineIdx < polyLines.size(); ++pLineIdx)
{
const std::vector<cvf::Vec3d>& polyLine = polyLines[pLineIdx];
@@ -450,6 +476,21 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromPol
return createPointsFromPolylineDrawable(m_flattenedOrOffsettedPolyLines);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromExtrusionLineDrawable(const std::vector<cvf::Vec3d>& extrusionLine)
{
cvf::ref<caf::DisplayCoordTransform> transform = displayCoordTransform(crossSection());
std::vector<cvf::Vec3d> displayCoords;
for (const auto& pt : extrusionLine)
{
displayCoords.push_back(transform->translateToDisplayCoord(pt));
}
return createPointsFromPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({displayCoords}));
}
//--------------------------------------------------------------------------------------------------
///
@@ -458,8 +499,6 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromPol
{
std::vector<cvf::Vec3f> vertices;
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
for (size_t pLineIdx = 0; pLineIdx < polyLines.size(); ++pLineIdx)
{
const std::vector<cvf::Vec3d>& polyLine = polyLines[pLineIdx];