mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2609 Update the visualization when the well path geometry definition changes
This commit is contained in:
parent
0f39356fcb
commit
dc95b217c5
@ -60,6 +60,7 @@ void RicDeleteWellPathTargetFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
|
||||
wellGeomDef->updateConnectedEditors();
|
||||
wellGeomDef->updateWellPathVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
wellGeomDef->insertTarget(targets[0], new RimWellPathTarget);
|
||||
wellGeomDef->updateConnectedEditors();
|
||||
wellGeomDef->updateWellPathVisualization();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -76,6 +77,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
wellGeomDef->insertTarget(nullptr, new RimWellPathTarget);
|
||||
wellGeomDef->updateConnectedEditors();
|
||||
wellGeomDef->updateWellPathVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,12 @@
|
||||
#include "RimWellPathTarget.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "RigWellPath.h"
|
||||
#include "RimProject.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "cvfMatrix4.h"
|
||||
|
||||
#include "RiaPolyArcLineSampler.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimModeledWellPath, "ModeledWellPath");
|
||||
|
||||
@ -27,6 +33,17 @@ RimModeledWellPath::~RimModeledWellPath()
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimModeledWellPath::updateWellPathVisualization()
|
||||
{
|
||||
this->setWellPathGeometry(m_geometryDefinition->createWellPathGeometry().p());
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfTypeAsserted(proj);
|
||||
proj->createDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -60,7 +77,7 @@ RimWellPathGeometryDef::RimWellPathGeometryDef()
|
||||
CAF_PDM_InitObject("Trajectory", ":/Well.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellStartType, "WellStartType", "Start Type", "", "", "");
|
||||
CAF_PDM_InitField(&m_startPos, "StartPos", cvf::Vec3d(0,0,0), "UTM Start Pos", "", "", "");
|
||||
CAF_PDM_InitField(&m_referencePoint, "ReferencePos", cvf::Vec3d(0,0,0), "UTM Reference Point", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_parentWell, "ParentWell", "Parent Well", "", "", "");
|
||||
CAF_PDM_InitField(&m_kickoffDepthOrMD, "KickoffDepthOrMD", 100.0, "Kickoff Depth", "", "", "");
|
||||
@ -84,6 +101,50 @@ RimWellPathGeometryDef::~RimWellPathGeometryDef()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
|
||||
{
|
||||
cvf::ref<RigWellPath> wellPathGeometry = new RigWellPath;
|
||||
|
||||
if (m_wellTargets.size() < 2) return wellPathGeometry;
|
||||
|
||||
RiaPolyArcLineSampler arcLineSampler(lineArcEndpoints());
|
||||
|
||||
arcLineSampler.sampledPointsAndMDs(30,
|
||||
false,
|
||||
&(wellPathGeometry->m_wellPathPoints),
|
||||
&(wellPathGeometry->m_measuredDepths));
|
||||
#if 0
|
||||
|
||||
double md = 0.0;
|
||||
wellPathGeometry->m_wellPathPoints.push_back(m_referencePoint() + m_wellTargets[0]->targetPointXYZ());
|
||||
wellPathGeometry->m_measuredDepths.push_back(md);
|
||||
|
||||
for (size_t tIdx = 1; tIdx < m_wellTargets.size(); ++tIdx)
|
||||
{
|
||||
cvf::Vec3d p1 = wellPathGeometry->m_wellPathPoints.back();
|
||||
RimWellPathTarget* target = m_wellTargets[tIdx];
|
||||
wellPathGeometry->m_wellPathPoints.push_back(m_referencePoint() + target->targetPointXYZ());
|
||||
cvf::Vec3d p2 = wellPathGeometry->m_wellPathPoints.back();
|
||||
md += (p2 - p1).length();
|
||||
wellPathGeometry->m_measuredDepths.push_back( md );
|
||||
}
|
||||
#endif
|
||||
return wellPathGeometry;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathGeometryDef::updateWellPathVisualization()
|
||||
{
|
||||
RimModeledWellPath* modWellPath;
|
||||
this->firstAncestorOrThisOfTypeAsserted(modWellPath);
|
||||
modWellPath->updateWellPathVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -106,12 +167,16 @@ void RimWellPathGeometryDef::deleteTarget(RimWellPathTarget* targetTodelete)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathGeometryDef::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimWellPathGeometryDef::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (&m_startPos == changedField)
|
||||
if (&m_referencePoint == changedField)
|
||||
{
|
||||
std::cout << "fieldChanged" << std::endl;
|
||||
}
|
||||
|
||||
updateWellPathVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -129,11 +194,11 @@ void RimWellPathGeometryDef::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
||||
|
||||
if (m_wellStartType == START_AT_SURFACE)
|
||||
{
|
||||
uiOrdering.add(&m_startPos);
|
||||
m_kickoffDepthOrMD.uiCapability()->setUiName("Kick Off Depth");
|
||||
m_kickoffDepthOrMD.uiCapability()->setUiName("Kick-Off Depth");
|
||||
uiOrdering.add(&m_kickoffDepthOrMD);
|
||||
}
|
||||
|
||||
uiOrdering.add(&m_referencePoint);
|
||||
uiOrdering.add(&m_wellTargets);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
@ -146,6 +211,20 @@ void RimWellPathGeometryDef::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTree
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3d> RimWellPathGeometryDef::lineArcEndpoints()
|
||||
{
|
||||
std::vector<cvf::Vec3d> endPoints;
|
||||
for (RimWellPathTarget* target: m_wellTargets)
|
||||
{
|
||||
endPoints.push_back( target->targetPointXYZ() + m_referencePoint() );
|
||||
}
|
||||
|
||||
return endPoints;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
RimModeledWellPath();
|
||||
~RimModeledWellPath();
|
||||
|
||||
void updateWellPathVisualization();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -57,17 +59,22 @@ public:
|
||||
|
||||
enum WellStartType { START_AT_FIRST_TARGET, START_AT_SURFACE, START_FROM_OTHER_WELL, START_AT_AUTO_SURFACE };
|
||||
|
||||
cvf::ref<RigWellPath> createWellPathGeometry();
|
||||
|
||||
void updateWellPathVisualization();
|
||||
|
||||
void insertTarget(RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert);
|
||||
void deleteTarget(RimWellPathTarget* targetTodelete);
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
|
||||
|
||||
std::vector<cvf::Vec3d> lineArcEndpoints();
|
||||
|
||||
caf::PdmField<caf::AppEnum<WellStartType> > m_wellStartType;
|
||||
caf::PdmField<cvf::Vec3d> m_startPos;
|
||||
caf::PdmField<cvf::Vec3d> m_referencePoint;
|
||||
|
||||
caf::PdmField<double> m_kickoffDepthOrMD;
|
||||
caf::PdmPtrField<RimWellPath*> m_parentWell;
|
||||
@ -80,3 +87,4 @@ protected:
|
||||
QWidget* fieldEditorWidget) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "RimWellPathTarget.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellPathTarget, "WellPathTarget");
|
||||
|
||||
@ -41,7 +42,7 @@ RimWellPathTarget::~RimWellPathTarget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathTarget::setAsPointTarget(const cvf::Vec3d& point)
|
||||
void RimWellPathTarget::setAsPointTargetXYD(const cvf::Vec3d& point)
|
||||
{
|
||||
m_targetType = POINT;
|
||||
m_targetPoint = point;
|
||||
@ -73,9 +74,11 @@ RimWellPathTarget::TargetTypeEnum RimWellPathTarget::targetType()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimWellPathTarget::targetPoint()
|
||||
cvf::Vec3d RimWellPathTarget::targetPointXYZ()
|
||||
{
|
||||
return m_targetPoint();
|
||||
cvf::Vec3d xyzPoint(m_targetPoint());
|
||||
xyzPoint.z() = -xyzPoint.z();
|
||||
return xyzPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -107,3 +110,13 @@ double RimWellPathTarget::inclination()
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimModeledWellPath* wellPath;
|
||||
firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
wellPath->updateWellPathVisualization();
|
||||
}
|
||||
|
@ -32,16 +32,18 @@ public:
|
||||
RimWellPathTarget();
|
||||
~RimWellPathTarget();
|
||||
|
||||
void setAsPointTarget(const cvf::Vec3d& point);
|
||||
void setAsPointTargetXYD(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();
|
||||
cvf::Vec3d targetPointXYZ();
|
||||
double azimuth();
|
||||
double inclination();
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
caf::PdmField<bool> m_isEnabled;
|
||||
caf::PdmField<caf::AppEnum<TargetTypeEnum> > m_targetType;
|
||||
caf::PdmField<cvf::Vec3d> m_targetPoint;
|
||||
|
@ -40,6 +40,9 @@ public:
|
||||
std::vector<cvf::Vec3d> m_wellPathPoints;
|
||||
std::vector<double> m_measuredDepths;
|
||||
|
||||
const std::vector<cvf::Vec3d>& wellPathPoints() const;
|
||||
const std::vector<double>& measureDepths() const;
|
||||
|
||||
RigWellPath();
|
||||
void setDatumElevation(double value);
|
||||
bool hasDatumElevation() const;
|
||||
@ -67,9 +70,6 @@ public:
|
||||
double maxZ,
|
||||
double * horizontalLengthAlongWellToClipPoint,
|
||||
size_t * indexToFirstVisibleSegment);
|
||||
const std::vector<cvf::Vec3d>& wellPathPoints() const;
|
||||
const std::vector<double>& measureDepths() const;
|
||||
|
||||
private:
|
||||
bool m_hasDatumElevation;
|
||||
double m_datumElevation;
|
||||
|
Loading…
Reference in New Issue
Block a user