mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 07:26:03 -06:00
#2589 intersections. Show extrusion line fix
This commit is contained in:
parent
e13702a88a
commit
1e8f1bb95e
@ -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];
|
||||
|
@ -61,10 +61,9 @@ public:
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongExtrusionLineDrawable(const std::vector<cvf::Vec3d>& extrusionLine);
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable();
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromExtrusionLineDrawable(const std::vector<cvf::Vec3d>& extrusionLine);
|
||||
|
||||
const std::vector<std::vector<cvf::Vec3d> >& flattenedOrOffsettedPolyLines() { return m_flattenedOrOffsettedPolyLines; }
|
||||
|
||||
@ -78,13 +77,16 @@ public:
|
||||
cvf::Mat4d unflattenTransformMatrix(const cvf::Vec3d& intersectionPointFlat);
|
||||
|
||||
private:
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
|
||||
void calculateArrays();
|
||||
void calculateSegementTransformPrLinePoint();
|
||||
void calculateFlattenedOrOffsetedPolyline();
|
||||
|
||||
static size_t indexToNextValidPoint(const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d extrDir,
|
||||
size_t idxToStartOfLineSegment);
|
||||
//static size_t indexToNextValidPoint(const std::vector<cvf::Vec3d>& polyLine,
|
||||
// const cvf::Vec3d extrDir,
|
||||
// size_t idxToStartOfLineSegment);
|
||||
|
||||
RimIntersection* m_crossSection;
|
||||
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;
|
||||
|
@ -647,7 +647,7 @@ void RivIntersectionPartMgr::createExtrusionDirParts(bool useBufferObjects)
|
||||
if (m_rimCrossSection->direction() == RimIntersection::CS_TWO_POINTS)
|
||||
{
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> polylineGeo = m_crossSectionGenerator->createLineAlongPolylineDrawable(m_rimCrossSection->polyLinesForExtrusionDirection());
|
||||
cvf::ref<cvf::DrawableGeo> polylineGeo = m_crossSectionGenerator->createLineAlongExtrusionLineDrawable(m_rimCrossSection->polyLinesForExtrusionDirection());
|
||||
if (polylineGeo.notNull())
|
||||
{
|
||||
if (useBufferObjects)
|
||||
@ -679,7 +679,7 @@ void RivIntersectionPartMgr::createExtrusionDirParts(bool useBufferObjects)
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> polylinePointsGeo = m_crossSectionGenerator->createPointsFromPolylineDrawable(m_rimCrossSection->polyLinesForExtrusionDirection());
|
||||
cvf::ref<cvf::DrawableGeo> polylinePointsGeo = m_crossSectionGenerator->createPointsFromExtrusionLineDrawable(m_rimCrossSection->polyLinesForExtrusionDirection());
|
||||
if (polylinePointsGeo.notNull())
|
||||
{
|
||||
if (useBufferObjects)
|
||||
|
@ -477,13 +477,9 @@ RivIntersectionPartMgr* RimIntersection::intersectionPartMgr()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLinesForExtrusionDirection() const
|
||||
std::vector <cvf::Vec3d> RimIntersection::polyLinesForExtrusionDirection() const
|
||||
{
|
||||
std::vector< std::vector <cvf::Vec3d> > lines;
|
||||
|
||||
lines.push_back(m_customExtrusionPoints);
|
||||
|
||||
return lines;
|
||||
return m_customExtrusionPoints;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
Rim2dIntersectionView* correspondingIntersectionView();
|
||||
RivIntersectionPartMgr* intersectionPartMgr();
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLinesForExtrusionDirection() const;
|
||||
std::vector <cvf::Vec3d> polyLinesForExtrusionDirection() const;
|
||||
void appendPointToExtrusionDirection(const cvf::Vec3d& point);
|
||||
|
||||
void appendPointToAzimuthLine(const cvf::Vec3d& point);
|
||||
|
@ -20,15 +20,14 @@ public:
|
||||
void setTranslation(const cvf::Vec3d& translation);
|
||||
|
||||
cvf::Vec3d transformToDisplayCoord(const cvf::Vec3d& domainCoord) const;
|
||||
cvf::Vec3d translateToDisplayCoord(const cvf::Vec3d& domainCoord) const;
|
||||
|
||||
cvf::Vec3d scaleToDisplaySize(const cvf::Vec3d& domainSize) const;
|
||||
|
||||
cvf::Vec3d translateToDomainCoord(const cvf::Vec3d& displayCoord) const;
|
||||
cvf::Vec3d transformToDomainCoord(const cvf::Vec3d& displayCoord) const;
|
||||
cvf::Vec3d scaleToDomainSize(const cvf::Vec3d& displaySize) const;
|
||||
|
||||
private:
|
||||
cvf::Vec3d translateToDisplayCoord(const cvf::Vec3d& domainCoord) const;
|
||||
|
||||
private:
|
||||
cvf::Vec3d m_scale;
|
||||
cvf::Vec3d m_translation;
|
||||
|
Loading…
Reference in New Issue
Block a user