mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
3D well log curves: Code cleanup
This commit is contained in:
parent
3547240fe6
commit
ef1cb3468b
@ -54,8 +54,15 @@ cvf::ref<cvf::DrawableGeo>
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
std::vector<cvf::uint> indices;
|
||||
|
||||
createCurveVerticesAndIndices(
|
||||
resultValues, resultMds, planeAngle, planeOffsetFromWellPathCenter, planeWidth, displayCoordTransform, wellPathClipBoundingBox, &vertices, &indices);
|
||||
createCurveVerticesAndIndices(resultValues,
|
||||
resultMds,
|
||||
planeAngle,
|
||||
planeOffsetFromWellPathCenter,
|
||||
planeWidth,
|
||||
displayCoordTransform,
|
||||
wellPathClipBoundingBox,
|
||||
&vertices,
|
||||
&indices);
|
||||
|
||||
if (vertices.empty() || indices.empty())
|
||||
{
|
||||
@ -128,7 +135,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
std::vector<cvf::Vec3d> pointNormals;
|
||||
|
||||
std::vector<cvf::Vec3d> closestPoints;
|
||||
calculatePairsOfClosestPointsAlongWellPath(&closestPoints, gridPoints);
|
||||
calculatePairsOfClosestSamplingPointsAlongWellPath(&closestPoints, gridPoints);
|
||||
|
||||
pointNormals = calculateLineSegmentNormals(planeAngle, closestPoints, LINE_SEGMENTS);
|
||||
if (pointNormals.size() != gridPoints.size()) return nullptr;
|
||||
@ -141,8 +148,6 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
|
||||
cvf::uint indexCounter = 0;
|
||||
|
||||
//double planeOffsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
|
||||
|
||||
// Normal lines
|
||||
for (size_t i = 0; i < pointNormals.size(); i++)
|
||||
{
|
||||
@ -242,11 +247,6 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
}
|
||||
if (interpolatedWellPathPoints.empty()) return;
|
||||
|
||||
if (interpolatedWellPathPoints.size() % 2 != 0)
|
||||
{
|
||||
interpolatedWellPathPoints.pop_back();
|
||||
}
|
||||
|
||||
// Reverse list, since it was filled in the opposite order
|
||||
std::reverse(interpolatedWellPathPoints.begin(), interpolatedWellPathPoints.end());
|
||||
|
||||
@ -255,7 +255,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
resultValues.end());
|
||||
|
||||
std::vector<cvf::Vec3d> pairsOfWellPathPoints;
|
||||
calculatePairsOfClosestPointsAlongWellPath(&pairsOfWellPathPoints, interpolatedWellPathPoints);
|
||||
calculatePairsOfClosestSamplingPointsAlongWellPath(&pairsOfWellPathPoints, interpolatedWellPathPoints);
|
||||
|
||||
std::vector<cvf::Vec3d> pointNormals = calculateLineSegmentNormals(planeAngle, pairsOfWellPathPoints, LINE_SEGMENTS);
|
||||
if (interpolatedWellPathPoints.size() != pointNormals.size()) return;
|
||||
@ -354,7 +354,6 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateLineSegment
|
||||
}
|
||||
|
||||
cvf::Vec3d Ey = (up ^ Ex).getNormalized();
|
||||
cvf::Vec3d Ez = (Ex ^ Ey).getNormalized();
|
||||
|
||||
cvf::Mat3d rotation;
|
||||
normal = Ey.getTransformedVector(rotation.fromRotation(Ex, angle));
|
||||
@ -381,7 +380,7 @@ const RigWellPath* Riv3dWellLogCurveGeometryGenerator::wellPathGeometry() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogCurveGeometryGenerator::calculatePairsOfClosestPointsAlongWellPath(
|
||||
void Riv3dWellLogCurveGeometryGenerator::calculatePairsOfClosestSamplingPointsAlongWellPath(
|
||||
std::vector<cvf::Vec3d>* closestWellPathPoints,
|
||||
std::vector<cvf::Vec3d>& points) const
|
||||
{
|
||||
|
@ -53,15 +53,12 @@ public:
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth) const;
|
||||
|
||||
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth,
|
||||
double gridIntervalSize) const;
|
||||
|
||||
private:
|
||||
enum VertexOrganization
|
||||
{
|
||||
@ -86,8 +83,8 @@ private:
|
||||
|
||||
const RigWellPath* wellPathGeometry() const;
|
||||
|
||||
void calculatePairsOfClosestPointsAlongWellPath(std::vector<cvf::Vec3d>* closestWellPathPoints,
|
||||
std::vector<cvf::Vec3d>& points) const;
|
||||
void calculatePairsOfClosestSamplingPointsAlongWellPath(std::vector<cvf::Vec3d>* closestWellPathPoints,
|
||||
std::vector<cvf::Vec3d>& points) const;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimWellPath> m_wellPath;
|
||||
|
@ -18,7 +18,9 @@
|
||||
|
||||
#include "Riv3dWellLogPlanePartMgr.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "Rim3dWellLogCurveCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
@ -32,8 +34,6 @@
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -42,6 +42,8 @@ Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGri
|
||||
: m_wellPath(wellPath)
|
||||
, m_gridView(gridView)
|
||||
{
|
||||
CVF_ASSERT(m_wellPath.notNull());
|
||||
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -55,24 +57,24 @@ void Riv3dWellLogPlanePartMgr::appendPlaneToModel(cvf::ModelBasicList*
|
||||
|
||||
if (!m_wellPath->rim3dWellLogCurveCollection()) return;
|
||||
|
||||
if (!m_wellPath->rim3dWellLogCurveCollection()->showPlot()) return;
|
||||
if (!m_wellPath->rim3dWellLogCurveCollection()->isShowingPlot()) return;
|
||||
|
||||
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
|
||||
|
||||
append3dWellLogCurvesToModel(model, displayCoordTransform, wellPathClipBoundingBox);
|
||||
|
||||
if (m_wellPath->rim3dWellLogCurveCollection()->showGrid())
|
||||
if (m_wellPath->rim3dWellLogCurveCollection()->isShowingGrid())
|
||||
{
|
||||
std::map<Rim3dWellLogCurve::DrawPlane, bool> drawPlanes;
|
||||
std::set<Rim3dWellLogCurve::DrawPlane> drawPlanes;
|
||||
|
||||
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
|
||||
{
|
||||
drawPlanes[rim3dWellLogCurve->drawPlane()];
|
||||
drawPlanes.insert(rim3dWellLogCurve->drawPlane());
|
||||
}
|
||||
|
||||
for (const std::pair<Rim3dWellLogCurve::DrawPlane, bool>& drawPlane : drawPlanes)
|
||||
for (const Rim3dWellLogCurve::DrawPlane& drawPlane : drawPlanes)
|
||||
{
|
||||
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, drawPlane.first, 400);
|
||||
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, drawPlane, planeWidth());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,18 +90,16 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
||||
if (!m_wellPath->rim3dWellLogCurveCollection()) return;
|
||||
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
|
||||
|
||||
create3dWellLogCurveGeometryGenerator();
|
||||
|
||||
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
|
||||
{
|
||||
if (!rim3dWellLogCurve->toggleState()) continue;
|
||||
if (!rim3dWellLogCurve->isShowingCurve()) continue;
|
||||
|
||||
std::vector<double> resultValues;
|
||||
std::vector<double> resultMds;
|
||||
rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds);
|
||||
|
||||
cvf::ref<cvf::Drawable> curveDrawable = m_3dWellLogCurveGeometryGenerator->createCurveLine(
|
||||
displayCoordTransform, wellPathClipBoundingBox, resultValues, resultMds, angle(rim3dWellLogCurve->drawPlane()), wellPathCenterToPlotStartOffset(), planeWidth());
|
||||
displayCoordTransform, wellPathClipBoundingBox, resultValues, resultMds, planeAngle(rim3dWellLogCurve->drawPlane()), wellPathCenterToPlotStartOffset(), planeWidth());
|
||||
|
||||
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
|
||||
{
|
||||
@ -136,7 +136,7 @@ cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double Riv3dWellLogPlanePartMgr::angle(const Rim3dWellLogCurve::DrawPlane& drawPlane)
|
||||
double Riv3dWellLogPlanePartMgr::planeAngle(const Rim3dWellLogCurve::DrawPlane& drawPlane)
|
||||
{
|
||||
switch (drawPlane)
|
||||
{
|
||||
@ -177,18 +177,6 @@ double Riv3dWellLogPlanePartMgr::planeWidth() const
|
||||
return cellSize * 4;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogPlanePartMgr::create3dWellLogCurveGeometryGenerator()
|
||||
{
|
||||
if (m_wellPath.isNull()) return;
|
||||
|
||||
if (m_3dWellLogCurveGeometryGenerator.isNull())
|
||||
{
|
||||
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -199,12 +187,10 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
|
||||
const Rim3dWellLogCurve::DrawPlane& drawPlane,
|
||||
double gridIntervalSize)
|
||||
{
|
||||
create3dWellLogCurveGeometryGenerator();
|
||||
|
||||
caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f));
|
||||
|
||||
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(
|
||||
displayCoordTransform, wellPathClipBoundingBox, angle(drawPlane), wellPathCenterToPlotStartOffset(), planeWidth(), gridIntervalSize);
|
||||
displayCoordTransform, wellPathClipBoundingBox, planeAngle(drawPlane), wellPathCenterToPlotStartOffset(), planeWidth(), gridIntervalSize);
|
||||
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
|
@ -66,13 +66,11 @@ private:
|
||||
|
||||
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
|
||||
|
||||
static double angle(const Rim3dWellLogCurve::DrawPlane& drawPlane);
|
||||
static double planeAngle(const Rim3dWellLogCurve::DrawPlane& drawPlane);
|
||||
|
||||
double wellPathCenterToPlotStartOffset() const;
|
||||
double planeWidth() const;
|
||||
|
||||
void create3dWellLogCurveGeometryGenerator();
|
||||
|
||||
private:
|
||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
|
||||
|
||||
|
@ -69,7 +69,7 @@ void Rim3dWellLogCurveCollection::add3dWellLogCurve(Rim3dWellLogCurve* curve)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dWellLogCurveCollection::showGrid() const
|
||||
bool Rim3dWellLogCurveCollection::isShowingGrid() const
|
||||
{
|
||||
return m_showGrid;
|
||||
}
|
||||
@ -77,7 +77,7 @@ bool Rim3dWellLogCurveCollection::showGrid() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dWellLogCurveCollection::showPlot() const
|
||||
bool Rim3dWellLogCurveCollection::isShowingPlot() const
|
||||
{
|
||||
return m_showPlot;
|
||||
}
|
||||
|
@ -39,12 +39,11 @@ public:
|
||||
bool has3dWellLogCurves() const;
|
||||
void add3dWellLogCurve(Rim3dWellLogCurve* curve);
|
||||
|
||||
bool showGrid() const;
|
||||
bool showPlot() const;
|
||||
bool isShowingGrid() const;
|
||||
bool isShowingPlot() const;
|
||||
|
||||
std::vector<Rim3dWellLogCurve*> vectorOf3dWellLogCurves() const;
|
||||
|
||||
|
||||
private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
@ -105,7 +105,7 @@ Rim3dWellLogCurve::DrawPlane Rim3dWellLogCurve::drawPlane() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dWellLogCurve::toggleState() const
|
||||
bool Rim3dWellLogCurve::isShowingCurve() const
|
||||
{
|
||||
return m_showCurve;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
void updateCurveIn3dView();
|
||||
|
||||
DrawPlane drawPlane() const;
|
||||
bool toggleState() const;
|
||||
bool isShowingCurve() const;
|
||||
|
||||
virtual void curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const = 0;
|
||||
|
||||
|
@ -31,7 +31,7 @@ class RimEclipseResultCase;
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// Not in use yet
|
||||
///
|
||||
//==================================================================================================
|
||||
class Rim3dWellLogRftCurve : public Rim3dWellLogCurve
|
||||
|
Loading…
Reference in New Issue
Block a user