mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2449 2d intersection view. Show UTM intersection point in result info window
This commit is contained in:
parent
917cae9e2d
commit
772ba788ad
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -75,6 +75,8 @@ public:
|
||||
|
||||
RimIntersection* crossSection() const;
|
||||
|
||||
cvf::Mat4d unflattenTransformMatrix(const cvf::Vec3d& intersectionPointUtm);
|
||||
|
||||
private:
|
||||
void calculateArrays();
|
||||
void calculateSegementTransformPrLinePoint();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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,
|
||||
|
@ -19,10 +19,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimIntersection;
|
||||
class RivIntersectionPartMgr;
|
||||
class RimLegendConfig;
|
||||
class RimTernaryLegendConfig;
|
||||
|
||||
@ -58,6 +58,8 @@ public:
|
||||
|
||||
void update3dInfo();
|
||||
|
||||
cvf::ref<RivIntersectionPartMgr> flatIntersectionPartMgr() const { return m_flatIntersectionPartMgr; }
|
||||
|
||||
protected:
|
||||
void updateLegends();
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RiuGeoMechXfTensorResultAccessor.h"
|
||||
|
||||
|
||||
@ -70,6 +71,14 @@ void RiuFemResultTextBuilder::setIntersectionTriangle(const std::array<cvf::Vec3
|
||||
m_isIntersectionTriangleSet = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuFemResultTextBuilder::set2dIntersectionView(Rim2dIntersectionView* intersectionView)
|
||||
{
|
||||
m_2dIntersectionView = intersectionView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -142,9 +151,24 @@ QString RiuFemResultTextBuilder::geometrySelectionText(QString itemSeparator)
|
||||
text += QString(", ijk[%1, %2, %3]").arg(i).arg(j).arg(k) + itemSeparator;
|
||||
|
||||
QString formattedText;
|
||||
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
||||
if (m_2dIntersectionView)
|
||||
{
|
||||
formattedText.sprintf("Horizontal length from well start: %.2f", domainCoord.x());
|
||||
text += formattedText + itemSeparator;
|
||||
|
||||
text += formattedText;
|
||||
cvf::Mat4d t = m_2dIntersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix(m_intersectionPoint);
|
||||
if (!t.isZero())
|
||||
{
|
||||
cvf::Vec3d intPt = m_intersectionPoint.getTransformedPoint(t);
|
||||
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", intPt.x(), intPt.y(), -intPt.z());
|
||||
text += formattedText;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
||||
text += formattedText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ class RigGeoMechCaseData;
|
||||
class RimEclipseCellColors;
|
||||
class RimGeoMechResultDefinition;
|
||||
class RimGeoMechView;
|
||||
class Rim2dIntersectionView;
|
||||
|
||||
namespace cvf {
|
||||
class Part;
|
||||
@ -46,6 +47,7 @@ public:
|
||||
void setFace(int face);
|
||||
void setIntersectionPoint(cvf::Vec3d intersectionPoint);
|
||||
void setIntersectionTriangle(const std::array<cvf::Vec3f, 3>& triangle);
|
||||
void set2dIntersectionView(Rim2dIntersectionView* intersectionView);
|
||||
|
||||
QString mainResultText();
|
||||
|
||||
@ -63,6 +65,7 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimGeoMechView> m_reservoirView;
|
||||
caf::PdmPointer<Rim2dIntersectionView> m_2dIntersectionView;
|
||||
|
||||
int m_gridIndex;
|
||||
int m_cellIndex;
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "RigResultAccessorFactory.h"
|
||||
#include "RigSimWellData.h"
|
||||
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
@ -36,6 +38,8 @@
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
|
||||
@ -73,6 +77,14 @@ void RiuResultTextBuilder::setIntersectionPoint(cvf::Vec3d intersectionPoint)
|
||||
m_intersectionPoint = intersectionPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuResultTextBuilder::set2dIntersectionView(Rim2dIntersectionView* intersectionView)
|
||||
{
|
||||
m_2dIntersectionView = intersectionView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -177,9 +189,24 @@ QString RiuResultTextBuilder::geometrySelectionText(QString itemSeparator)
|
||||
cvf::Vec3d domainCoord = transForm->translateToDomainCoord(m_intersectionPoint);
|
||||
|
||||
QString formattedText;
|
||||
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
||||
if (m_2dIntersectionView)
|
||||
{
|
||||
formattedText.sprintf("Horizontal length from well start: %.2f", domainCoord.x());
|
||||
text += formattedText + itemSeparator;
|
||||
|
||||
text += formattedText;
|
||||
cvf::Mat4d t = m_2dIntersectionView->flatIntersectionPartMgr()->unflattenTransformMatrix(m_intersectionPoint);
|
||||
if (!t.isZero())
|
||||
{
|
||||
cvf::Vec3d intPt = m_intersectionPoint.getTransformedPoint(t);
|
||||
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", intPt.x(), intPt.y(), -intPt.z());
|
||||
text += formattedText;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
||||
text += formattedText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
class RimEclipseView;
|
||||
class RimEclipseCellColors;
|
||||
class Rim2dIntersectionView;
|
||||
class QString;
|
||||
class RigEclipseCaseData;
|
||||
|
||||
@ -44,6 +45,7 @@ public:
|
||||
void setFace(cvf::StructGridInterface::FaceType face);
|
||||
void setNncIndex(size_t nncIndex);
|
||||
void setIntersectionPoint(cvf::Vec3d intersectionPoint);
|
||||
void set2dIntersectionView(Rim2dIntersectionView* intersectionView);
|
||||
|
||||
QString mainResultText();
|
||||
|
||||
@ -69,6 +71,7 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
caf::PdmPointer<Rim2dIntersectionView> m_2dIntersectionView;
|
||||
|
||||
size_t m_gridIndex;
|
||||
size_t m_cellIndex;
|
||||
|
@ -310,9 +310,12 @@ void RiuSelectionChangedHandler::updateResultInfo(const RiuSelectionItem* itemAd
|
||||
RiuSelectionItem* selItem = const_cast<RiuSelectionItem*>(itemAdded);
|
||||
if (selItem != NULL)
|
||||
{
|
||||
Rim2dIntersectionView* intersectionView = nullptr;
|
||||
|
||||
if (selItem->type() == RiuSelectionItem::INTERSECTION_SELECTION_OBJECT)
|
||||
{
|
||||
const Riu2dIntersectionSelectionItem* wrapperSelItem = dynamic_cast<Riu2dIntersectionSelectionItem*>(selItem);
|
||||
intersectionView = wrapperSelItem->view();
|
||||
if (wrapperSelItem && wrapperSelItem->eclipseSelectionItem()) selItem = wrapperSelItem->eclipseSelectionItem();
|
||||
else if (wrapperSelItem && wrapperSelItem->geoMechSelectionItem()) selItem = wrapperSelItem->geoMechSelectionItem();
|
||||
}
|
||||
@ -327,6 +330,7 @@ void RiuSelectionChangedHandler::updateResultInfo(const RiuSelectionItem* itemAd
|
||||
textBuilder.setFace(eclipseSelectionItem->m_face);
|
||||
textBuilder.setNncIndex(eclipseSelectionItem->m_nncIndex);
|
||||
textBuilder.setIntersectionPoint(eclipseSelectionItem->m_localIntersectionPoint);
|
||||
textBuilder.set2dIntersectionView(intersectionView);
|
||||
|
||||
resultInfo = textBuilder.mainResultText();
|
||||
|
||||
@ -340,6 +344,7 @@ void RiuSelectionChangedHandler::updateResultInfo(const RiuSelectionItem* itemAd
|
||||
RiuFemResultTextBuilder textBuilder(geomView, (int)geomSelectionItem->m_gridIndex, (int)geomSelectionItem->m_cellIndex, geomView->currentTimeStep());
|
||||
textBuilder.setIntersectionPoint(geomSelectionItem->m_localIntersectionPoint);
|
||||
textBuilder.setFace(geomSelectionItem->m_elementFace);
|
||||
textBuilder.set2dIntersectionView(intersectionView);
|
||||
if (geomSelectionItem->m_hasIntersectionTriangle) textBuilder.setIntersectionTriangle(geomSelectionItem->m_intersectionTriangle);
|
||||
|
||||
resultInfo = textBuilder.mainResultText();
|
||||
|
@ -218,8 +218,9 @@ RiuGeoMechSelectionItem::RiuGeoMechSelectionItem(RimGeoMechView* view,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Riu2dIntersectionSelectionItem::Riu2dIntersectionSelectionItem(RiuSelectionItem *selItem)
|
||||
Riu2dIntersectionSelectionItem::Riu2dIntersectionSelectionItem(Rim2dIntersectionView* view, RiuSelectionItem *selItem)
|
||||
{
|
||||
m_view = view;
|
||||
m_eclipseSelItem = dynamic_cast<RiuEclipseSelectionItem*>(selItem);
|
||||
m_geoMechSelItem = dynamic_cast<RiuGeoMechSelectionItem*>(selItem);
|
||||
}
|
||||
@ -233,6 +234,14 @@ Riu2dIntersectionSelectionItem::~Riu2dIntersectionSelectionItem()
|
||||
if (m_geoMechSelItem) delete m_geoMechSelItem;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmPointer<Rim2dIntersectionView> Riu2dIntersectionSelectionItem::view() const
|
||||
{
|
||||
return m_view;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -206,7 +206,7 @@ public:
|
||||
class Riu2dIntersectionSelectionItem : public RiuSelectionItem
|
||||
{
|
||||
public:
|
||||
explicit Riu2dIntersectionSelectionItem(RiuSelectionItem *selItem);
|
||||
explicit Riu2dIntersectionSelectionItem(Rim2dIntersectionView* view, RiuSelectionItem *selItem);
|
||||
|
||||
virtual ~Riu2dIntersectionSelectionItem();
|
||||
|
||||
@ -216,10 +216,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
caf::PdmPointer<Rim2dIntersectionView> view() const;
|
||||
RiuEclipseSelectionItem* eclipseSelectionItem() const;
|
||||
RiuGeoMechSelectionItem* geoMechSelectionItem() const;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<Rim2dIntersectionView> m_view;
|
||||
RiuEclipseSelectionItem* m_eclipseSelItem;
|
||||
RiuGeoMechSelectionItem* m_geoMechSelItem;
|
||||
};
|
||||
|
@ -654,7 +654,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
else selItem = new RiuGeoMechSelectionItem(geomView, gridIndex, cellIndex, curveColor, gmFace, localIntersectionPoint);
|
||||
}
|
||||
|
||||
if (intersectionView) selItem = new Riu2dIntersectionSelectionItem(selItem);
|
||||
if (intersectionView) selItem = new Riu2dIntersectionSelectionItem(intersectionView, selItem);
|
||||
}
|
||||
|
||||
if (appendToSelection)
|
||||
|
Loading…
Reference in New Issue
Block a user