mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
3D Well Log Curves(#2676): Enable pick selection of the 3D Tracks and curves
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection");
|
||||
|
||||
@@ -176,6 +177,36 @@ void Rim3dWellLogCurveCollection::redrawAffectedViewsAndEditors()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dWellLogCurve* Rim3dWellLogCurveCollection::checkForCurveIntersection(const cvf::Vec3d& globalIntersection,
|
||||
cvf::Vec3d* closestPoint,
|
||||
double* measuredDepthAtPoint,
|
||||
double* valueAtPoint)
|
||||
{
|
||||
double smallestDistance = std::numeric_limits<double>::max();
|
||||
Rim3dWellLogCurve* closestCurve = nullptr;
|
||||
for (auto& wellLogCurve : m_3dWellLogCurves)
|
||||
{
|
||||
cvf::Vec3d closestPointOnCurve;
|
||||
double measuredDepthAtPointOnCurve;
|
||||
double valueAtPointOnCurve;
|
||||
if (wellLogCurve->findClosestPointOnCurve(globalIntersection, &closestPointOnCurve, &measuredDepthAtPointOnCurve, &valueAtPointOnCurve))
|
||||
{
|
||||
double distance = globalIntersection.pointDistance(closestPointOnCurve);
|
||||
if (distance < smallestDistance)
|
||||
{
|
||||
closestCurve = wellLogCurve.p();
|
||||
*closestPoint = closestPointOnCurve;
|
||||
*measuredDepthAtPoint = measuredDepthAtPointOnCurve;
|
||||
*valueAtPoint = valueAtPointOnCurve;
|
||||
}
|
||||
}
|
||||
}
|
||||
return closestCurve;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
class Rim3dWellLogCurve;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -58,6 +61,10 @@ public:
|
||||
|
||||
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
|
||||
void redrawAffectedViewsAndEditors();
|
||||
Rim3dWellLogCurve* checkForCurveIntersection(const cvf::Vec3d& globalIntersection,
|
||||
cvf::Vec3d* closestPoint,
|
||||
double* measuredDepthAtPoint,
|
||||
double* valueAtPoint);
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
@@ -19,12 +19,15 @@
|
||||
#include "Rim3dWellLogCurve.h"
|
||||
|
||||
#include "RigCurveDataTools.h"
|
||||
#include "Riv3dWellLogCurveGeomertyGenerator.h"
|
||||
|
||||
#include "Rim3dWellLogCurveCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
@@ -244,6 +247,28 @@ void Rim3dWellLogCurve::resetMinMaxValuesAndUpdateUI()
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
|
||||
void Rim3dWellLogCurve::setGeometryGenerator(Riv3dWellLogCurveGeometryGenerator* generator)
|
||||
{
|
||||
m_geometryGenerator = generator;
|
||||
}
|
||||
|
||||
bool Rim3dWellLogCurve::findClosestPointOnCurve(const cvf::Vec3d& globalIntersection,
|
||||
cvf::Vec3d* closestPoint,
|
||||
double* measuredDepthAtPoint,
|
||||
double* valueAtPoint) const
|
||||
{
|
||||
if (m_geometryGenerator.notNull())
|
||||
{
|
||||
return m_geometryGenerator->findClosestPointOnCurve(globalIntersection, closestPoint, measuredDepthAtPoint, valueAtPoint);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> Rim3dWellLogCurve::geometryGenerator()
|
||||
{
|
||||
return m_geometryGenerator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
class Riv3dWellLogCurveGeometryGenerator;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@@ -47,17 +52,26 @@ public:
|
||||
|
||||
void updateCurveIn3dView();
|
||||
|
||||
DrawPlane drawPlane() const;
|
||||
cvf::Color3f color() const;
|
||||
bool isShowingCurve() const;
|
||||
DrawPlane drawPlane() const;
|
||||
cvf::Color3f color() const;
|
||||
bool isShowingCurve() const;
|
||||
|
||||
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const = 0;
|
||||
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const = 0;
|
||||
|
||||
void setColor(const cvf::Color3f& color);
|
||||
void setColor(const cvf::Color3f& color);
|
||||
|
||||
double minCurveValue() const;
|
||||
double maxCurveValue() const;
|
||||
void resetMinMaxValuesAndUpdateUI();
|
||||
double minCurveValue() const;
|
||||
double maxCurveValue() const;
|
||||
void resetMinMaxValuesAndUpdateUI();
|
||||
bool findClosestPointOnCurve(const cvf::Vec3d& globalIntersection,
|
||||
cvf::Vec3d* closestPoint,
|
||||
double* measuredDepthAtPoint,
|
||||
double* valueAtPoint) const;
|
||||
|
||||
void setGeometryGenerator(Riv3dWellLogCurveGeometryGenerator* generator);
|
||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> geometryGenerator();
|
||||
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
@@ -75,7 +89,7 @@ protected:
|
||||
caf::PdmField<double> m_maxCurveValue;
|
||||
double m_minCurveDataValue;
|
||||
double m_maxCurveDataValue;
|
||||
|
||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_geometryGenerator;
|
||||
private:
|
||||
caf::PdmField<bool> m_showCurve;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user