#2609 Add a well path target class

This commit is contained in:
Jacob Støren
2018-06-18 16:02:28 +02:00
parent bc28b4b8f1
commit 22bf33d02f
3 changed files with 159 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.h
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathTarget.h
${CMAKE_CURRENT_LIST_DIR}/RimScriptCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCase.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseCollection.h
@@ -134,6 +135,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathTarget.cpp
${CMAKE_CURRENT_LIST_DIR}/RimScriptCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCase.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseCollection.cpp

View File

@@ -0,0 +1,107 @@
#include "RimWellPathTarget.h"
CAF_PDM_SOURCE_INIT(RimWellPathTarget, "WellPathTarget");
namespace caf
{
template<>
void caf::AppEnum< RimWellPathTarget::TargetTypeEnum >::setUp()
{
addItem(RimWellPathTarget::POINT_AND_TANGENT, "POINT_AND_TANGENT", "Point and Tangent");
addItem(RimWellPathTarget::POINT, "POINT", "Point");
setDefault(RimWellPathTarget::POINT_AND_TANGENT);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathTarget::RimWellPathTarget()
: m_targetType(POINT_AND_TANGENT)
, m_targetPoint(cvf::Vec3d::ZERO)
, m_azimuth(0.0)
, m_inclination(0.0)
{
CAF_PDM_InitFieldNoDefault(&m_targetType, "TargetType", "Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_targetPoint, "TargetPoint", "Point", "", "", "");
CAF_PDM_InitField(&m_azimuth, "Azimuth", 0.0, "Azimuth", "", "", "");
CAF_PDM_InitField(&m_inclination, "Inclination", 0.0, "Inclination", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathTarget::~RimWellPathTarget()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setAsPointTarget(const cvf::Vec3d& point)
{
m_targetType = POINT;
m_targetPoint = point;
m_azimuth = 0.0;
m_inclination = 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setAsPointAndTangentTarget(const cvf::Vec3d& point,
double azimuth,
double inclination)
{
m_targetType = POINT_AND_TANGENT;
m_targetPoint = point;
m_azimuth = azimuth;
m_inclination = inclination;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathTarget::TargetTypeEnum RimWellPathTarget::targetType()
{
return m_targetType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathTarget::targetPoint()
{
return m_targetPoint();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathTarget::azimuth()
{
if ( m_targetType() == POINT_AND_TANGENT )
{
return m_azimuth;
}
else
{
return std::numeric_limits<double>::infinity();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathTarget::inclination()
{
if ( m_targetType() == POINT_AND_TANGENT )
{
return m_inclination;
}
else
{
return std::numeric_limits<double>::infinity();
}
}

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 - equinor
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cvfBase.h"
#include "cvfVector3.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmCoreVec3d.h"
class RimWellPathTarget : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellPathTarget();
~RimWellPathTarget();
void setAsPointTarget(const cvf::Vec3d& point);
void setAsPointAndTangentTarget(const cvf::Vec3d& point, double azimuth, double inclination);
enum TargetTypeEnum { POINT_AND_TANGENT, POINT };
TargetTypeEnum targetType();
cvf::Vec3d targetPoint();
double azimuth();
double inclination();
private:
caf::PdmField<caf::AppEnum<TargetTypeEnum> > m_targetType;
caf::PdmField<cvf::Vec3d> m_targetPoint;
caf::PdmField<double> m_azimuth;
caf::PdmField<double> m_inclination;
};