Whitespace

This commit is contained in:
Magne Sjaastad 2018-11-16 11:38:35 +01:00
parent 3c3bb153ac
commit 76abf0fe01
2 changed files with 53 additions and 53 deletions

View File

@ -23,19 +23,19 @@
#include "RigWellPath.h" #include "RigWellPath.h"
#include "Rim3dView.h" #include "Rim3dView.h"
#include "RimModeledWellPath.h"
#include "RimWellPath.h"
#include "RimWellPathGeometryDef.h" #include "RimWellPathGeometryDef.h"
#include "RimWellPathTarget.h" #include "RimWellPathTarget.h"
#include "RimWellPath.h"
#include "RiuViewerCommands.h"
#include "RivWellPathSourceInfo.h" #include "RivWellPathSourceInfo.h"
#include "cafSelectionManager.h"
#include "cafDisplayCoordTransform.h" #include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"
#include <vector> #include <vector>
#include "RiuViewerCommands.h"
#include "RimModeledWellPath.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -43,16 +43,12 @@
RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler(RimWellPathGeometryDef* wellGeometryDef) RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler(RimWellPathGeometryDef* wellGeometryDef)
: m_geometryToAddTargetsTo(wellGeometryDef) : m_geometryToAddTargetsTo(wellGeometryDef)
{ {
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RicCreateWellTargetsPickEventHandler::~RicCreateWellTargetsPickEventHandler() RicCreateWellTargetsPickEventHandler::~RicCreateWellTargetsPickEventHandler() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -74,30 +70,33 @@ bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent&
return false; return false;
} }
if ( m_geometryToAddTargetsTo ) if (m_geometryToAddTargetsTo)
{ {
Rim3dView* rimView = eventObject.m_view; Rim3dView* rimView = eventObject.m_view;
cvf::Vec3d targetPointInDomain = cvf::Vec3d::ZERO; cvf::Vec3d targetPointInDomain = cvf::Vec3d::ZERO;
// If clicked on an other well path, snap target point to well path center line // If clicked on an other well path, snap target point to well path center line
auto firstPickItem = eventObject.m_pickItemInfos.front(); auto firstPickItem = eventObject.m_pickItemInfos.front();
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(firstPickItem.sourceInfo()); auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(firstPickItem.sourceInfo());
auto intersectionPointInDomain = rimView->displayCoordTransform()->transformToDomainCoord(firstPickItem.globalPickedPoint()); auto intersectionPointInDomain =
bool doSetAzimuthAndInclination = false; rimView->displayCoordTransform()->transformToDomainCoord(firstPickItem.globalPickedPoint());
double azimuth = 0.0; bool doSetAzimuthAndInclination = false;
double inclination = 0.0; double azimuth = 0.0;
double inclination = 0.0;
if (wellPathSourceInfo) if (wellPathSourceInfo)
{ {
targetPointInDomain = wellPathSourceInfo->closestPointOnCenterLine(firstPickItem.faceIdx(), intersectionPointInDomain); targetPointInDomain =
wellPathSourceInfo->closestPointOnCenterLine(firstPickItem.faceIdx(), intersectionPointInDomain);
double md = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain); double md = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain);
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd(md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination); doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd(
md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination);
} }
else else
{ {
targetPointInDomain = intersectionPointInDomain; targetPointInDomain = intersectionPointInDomain;
doSetAzimuthAndInclination = false; doSetAzimuthAndInclination = false;
} }
@ -119,14 +118,15 @@ bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent&
} }
} }
cvf::Vec3d referencePoint = m_geometryToAddTargetsTo->referencePointXyz(); cvf::Vec3d referencePoint = m_geometryToAddTargetsTo->referencePointXyz();
cvf::Vec3d relativeTagetPoint = targetPointInDomain - referencePoint; cvf::Vec3d relativeTagetPoint = targetPointInDomain - referencePoint;
RimWellPathTarget* newTarget = new RimWellPathTarget; RimWellPathTarget* newTarget = new RimWellPathTarget;
if (doSetAzimuthAndInclination) if (doSetAzimuthAndInclination)
{ {
newTarget->setAsPointXYZAndTangentTarget(cvf::Vec3d(relativeTagetPoint.x(), relativeTagetPoint.y(), relativeTagetPoint.z()), azimuth, inclination); newTarget->setAsPointXYZAndTangentTarget(
cvf::Vec3d(relativeTagetPoint.x(), relativeTagetPoint.y(), relativeTagetPoint.z()), azimuth, inclination);
} }
else else
{ {
@ -147,13 +147,13 @@ bool RicCreateWellTargetsPickEventHandler::handlePickEvent(const Ric3DPickEvent&
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd(double measuredDepth, bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd(double measuredDepth,
const RigWellPath* wellPathGeometry, const RigWellPath* wellPathGeometry,
double *azimuth, double* azimuth,
double *inclination) const double* inclination) const
{ {
int mdIndex = -1; int mdIndex = -1;
auto mdList = wellPathGeometry->measureDepths(); auto mdList = wellPathGeometry->measureDepths();
for (int i = 0; i < (int)mdList.size(); i++) for (int i = 0; i < (int)mdList.size(); i++)
{ {
@ -184,15 +184,15 @@ bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd(do
auto v24mean = (v32 + v43) / 2; auto v24mean = (v32 + v43) / 2;
double weight = (measuredDepth - mdList[mdIndex]) / (mdList[mdIndex + 1] - mdList[mdIndex]); double weight = (measuredDepth - mdList[mdIndex]) / (mdList[mdIndex + 1] - mdList[mdIndex]);
auto vTan = v13mean * weight + v24mean * (1 - weight); auto vTan = v13mean * weight + v24mean * (1 - weight);
RiaOffshoreSphericalCoords coords(vTan); RiaOffshoreSphericalCoords coords(vTan);
*azimuth = coords.azi(); *azimuth = coords.azi();
*inclination = coords.inc(); *inclination = coords.inc();
return true; return true;
} }
*azimuth = 0.0; *azimuth = 0.0;
*inclination = 0.0; *inclination = 0.0;
return false; return false;
} }

View File

@ -35,15 +35,15 @@ public:
~RicCreateWellTargetsPickEventHandler(); ~RicCreateWellTargetsPickEventHandler();
protected: protected:
caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo;
bool handlePickEvent(const Ric3DPickEvent& eventObject) override; bool handlePickEvent(const Ric3DPickEvent& eventObject) override;
void notifyUnregistered() override; void notifyUnregistered() override;
private: private:
bool calculateAzimuthAndInclinationAtMd(double measuredDepth, bool calculateAzimuthAndInclinationAtMd(double measuredDepth,
const RigWellPath* wellPathGeometry, const RigWellPath* wellPathGeometry,
double *azimuth, double* azimuth,
double *inclination) const; double* inclination) const;
};
private:
caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo;
};