#1060 Use DisplayCoordTransform in ResultTextBuilder

This commit is contained in:
Magne Sjaastad 2017-01-09 07:43:17 +01:00
parent c197709e08
commit 785a5e9ff8
3 changed files with 38 additions and 15 deletions

View File

@ -21,18 +21,20 @@
#include "RigCaseCellResultsData.h"
#include "RigCaseData.h"
#include "RigFormationNames.h"
#include "RigMainGrid.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "RimEclipseCase.h"
#include "RimCellEdgeColors.h"
#include "RimEclipseFaultColors.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimEclipseView.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipseView.h"
#include "RimFormationNames.h"
#include "RigFormationNames.h"
#include "RimReservoirCellResultsStorage.h"
#include "cafDisplayCoordTransform.h"
@ -134,7 +136,7 @@ QString RiuResultTextBuilder::topologyText(QString itemSeparator)
{
QString text;
if (m_reservoirView->eclipseCase())
if (m_reservoirView && m_reservoirView->eclipseCase())
{
const RigCaseData* eclipseCase = m_reservoirView->eclipseCase()->reservoirData();
if (eclipseCase)
@ -161,7 +163,9 @@ QString RiuResultTextBuilder::topologyText(QString itemSeparator)
}
}
cvf::Vec3d domainCoord = m_intersectionPoint + eclipseCase->grid(0)->displayModelOffset();
cvf::ref<caf::DisplayCoordTransform> transForm = m_reservoirView->displayCoordTransform();
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());

View File

@ -27,12 +27,21 @@ void caf::DisplayCoordTransform::setTranslation(const cvf::Vec3d& translation)
m_translation = translation;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d caf::DisplayCoordTransform::translateToDisplayCoord(const cvf::Vec3d& domainCoord) const
{
return domainCoord - m_translation;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d caf::DisplayCoordTransform::transformToDisplayCoord(const cvf::Vec3d& domainCoord) const
{
cvf::Vec3d coord = domainCoord - m_translation;
cvf::Vec3d coord = translateToDisplayCoord(domainCoord);
coord.x() *= m_scale.x();
coord.y() *= m_scale.y();
coord.z() *= m_scale.z();
@ -53,19 +62,25 @@ cvf::Vec3d caf::DisplayCoordTransform::scaleToDisplaySize(const cvf::Vec3d& doma
return coord;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d caf::DisplayCoordTransform::translateToDomainCoord(const cvf::Vec3d& displayCoord) const
{
return displayCoord + m_translation;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d caf::DisplayCoordTransform::transformToDomainCoord(const cvf::Vec3d& displayCoord) const
{
cvf::Vec3d coord = displayCoord;
coord.x() /= m_scale.x();
coord.y() /= m_scale.y();
coord.z() /= m_scale.z();
cvf::Vec3d unScaledDisplayCoord = displayCoord;
unScaledDisplayCoord.x() /= m_scale.x();
unScaledDisplayCoord.y() /= m_scale.y();
unScaledDisplayCoord.z() /= m_scale.z();
coord += m_translation;
return coord;
return translateToDomainCoord(unScaledDisplayCoord);
}
//--------------------------------------------------------------------------------------------------

View File

@ -22,9 +22,13 @@ public:
cvf::Vec3d transformToDisplayCoord(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;