#2449 2d intersection view. Show UTM intersection point in result info window

This commit is contained in:
Bjørn Erik Jensen
2018-02-16 14:37:59 +01:00
parent 917cae9e2d
commit 772ba788ad
13 changed files with 132 additions and 8 deletions

View File

@@ -25,6 +25,7 @@
#include "RimIntersection.h"
#include "RivHexGridIntersectionTools.h"
#include "RivIntersectionPartMgr.h"
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
@@ -603,6 +604,41 @@ RimIntersection* RivIntersectionGeometryGenerator::crossSection() const
return m_crossSection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Mat4d RivIntersectionGeometryGenerator::unflattenTransformMatrix(const cvf::Vec3d& intersectionPointUtm)
{
cvf::Vec3d startPt = cvf::Vec3d::ZERO;
int polyLineIdx = -1;
int segIdx = -1;
for (int i = 0; i < m_flattenedOrOffsettedPolyLines.size(); i++)
{
std::vector<cvf::Vec3d> pts = m_flattenedOrOffsettedPolyLines[i];
for(int j = 0; j < pts.size(); j++)
{
// Assumes ascending sorted list
if (j > 0 && intersectionPointUtm.x() < pts[j].x())
{
polyLineIdx = i;
segIdx = j - 1;
startPt = pts[segIdx];
break;
}
}
if (!startPt.isZero()) break;
}
if (polyLineIdx > -1 && segIdx > -1)
{
cvf::Mat4d t = m_segementTransformPrLinePoint[polyLineIdx][segIdx];
return t.getInverted(); // Check for invertible?
}
return cvf::Mat4d::ZERO;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -75,6 +75,8 @@ public:
RimIntersection* crossSection() const;
cvf::Mat4d unflattenTransformMatrix(const cvf::Vec3d& intersectionPointUtm);
private:
void calculateArrays();
void calculateSegementTransformPrLinePoint();

View File

@@ -967,6 +967,14 @@ const RimIntersection* RivIntersectionPartMgr::intersection() const
return m_rimCrossSection.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Mat4d RivIntersectionPartMgr::unflattenTransformMatrix(const cvf::Vec3d& intersectionPointUtm)
{
return m_crossSectionGenerator->unflattenTransformMatrix(intersectionPointUtm);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -24,6 +24,8 @@
#include "cvfColor4.h"
#include "cvfVector3.h"
#include "cvfArray.h"
#include "cvfMatrix4.h"
#include "cafPdmPointer.h"
#include <list>
@@ -74,6 +76,7 @@ public:
const RimIntersection* intersection() const;
cvf::Mat4d unflattenTransformMatrix(const cvf::Vec3d& intersectionPointUtm);
public:
static void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,