mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-16 18:34:54 -06:00
#2633 3D well log curves: Clip grid on well path bounding box
This commit is contained in:
parent
ca8e56cff1
commit
131eb64748
@ -21,6 +21,7 @@
|
|||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
#include "RimGridView.h"
|
#include "RimGridView.h"
|
||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
|
#include "RimWellPathCollection.h"
|
||||||
|
|
||||||
#include "RigCurveDataTools.h"
|
#include "RigCurveDataTools.h"
|
||||||
#include "RigWellPath.h"
|
#include "RigWellPath.h"
|
||||||
@ -28,6 +29,8 @@
|
|||||||
#include "cafDisplayCoordTransform.h"
|
#include "cafDisplayCoordTransform.h"
|
||||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||||
|
|
||||||
|
#include "cvfBoundingBox.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -65,32 +68,47 @@ cvf::ref<cvf::DrawableGeo>
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||||
|
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||||
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||||
double gridIntervalSize) const
|
double gridIntervalSize) const
|
||||||
{
|
{
|
||||||
CVF_ASSERT(gridIntervalSize > 0);
|
CVF_ASSERT(gridIntervalSize > 0);
|
||||||
|
|
||||||
if (!wellPathGeometry()) return nullptr;
|
if (!wellPathGeometry()) return nullptr;
|
||||||
|
if (!wellPathClipBoundingBox.isValid()) return nullptr;
|
||||||
|
|
||||||
|
RimWellPathCollection* wellPathCollection = nullptr;
|
||||||
|
m_wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection);
|
||||||
|
|
||||||
std::vector<cvf::Vec3d> wellPathPoints = wellPathGeometry()->m_wellPathPoints;
|
std::vector<cvf::Vec3d> wellPathPoints = wellPathGeometry()->m_wellPathPoints;
|
||||||
if (wellPathPoints.empty()) return nullptr;
|
if (wellPathPoints.empty()) return nullptr;
|
||||||
|
|
||||||
const cvf::Vec3d globalDirection = (wellPathPoints.back() - wellPathPoints.front()).getNormalized();
|
size_t originalWellPathSize = wellPathPoints.size();
|
||||||
const cvf::Vec3d up(0, 0, 1);
|
|
||||||
|
if (wellPathCollection->wellPathClip)
|
||||||
|
{
|
||||||
|
double horizontalLengthAlongWellToClipPoint;
|
||||||
|
double maxZClipHeight = wellPathClipBoundingBox.max().z() + wellPathCollection->wellPathClipZDistance;
|
||||||
|
wellPathPoints =
|
||||||
|
RigWellPath::clipPolylineStartAboveZ(wellPathPoints, maxZClipHeight, &horizontalLengthAlongWellToClipPoint);
|
||||||
|
}
|
||||||
|
if (wellPathPoints.empty()) return nullptr;
|
||||||
|
|
||||||
std::vector<cvf::Vec3d> pointNormals;
|
std::vector<cvf::Vec3d> pointNormals;
|
||||||
std::vector<cvf::Vec3d> gridPoints;
|
std::vector<cvf::Vec3d> gridPoints;
|
||||||
|
|
||||||
double firstMd = wellPathGeometry()->m_measuredDepths.front();
|
|
||||||
double lastMd = wellPathGeometry()->m_measuredDepths.back();
|
|
||||||
if (wellPathGeometry()->m_measuredDepths.empty()) return nullptr;
|
if (wellPathGeometry()->m_measuredDepths.empty()) return nullptr;
|
||||||
|
|
||||||
double md = firstMd;
|
size_t newStartIndex = originalWellPathSize - wellPathPoints.size();
|
||||||
while (md <= lastMd)
|
double firstMd = wellPathGeometry()->m_measuredDepths.at(newStartIndex);
|
||||||
|
double lastMd = wellPathGeometry()->m_measuredDepths.back();
|
||||||
|
|
||||||
|
double md = lastMd;
|
||||||
|
while (md >= firstMd)
|
||||||
{
|
{
|
||||||
cvf::Vec3d point = wellPathGeometry()->interpolatedPointAlongWellPath(md);
|
cvf::Vec3d point = wellPathGeometry()->interpolatedPointAlongWellPath(md);
|
||||||
gridPoints.push_back(point);
|
gridPoints.push_back(point);
|
||||||
md += gridIntervalSize;
|
md -= gridIntervalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
pointNormals = calculatePointNormals(drawPlane, gridPoints);
|
pointNormals = calculatePointNormals(drawPlane, gridPoints);
|
||||||
|
@ -34,6 +34,11 @@ namespace caf
|
|||||||
class DisplayCoordTransform;
|
class DisplayCoordTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace cvf
|
||||||
|
{
|
||||||
|
class BoundingBox;
|
||||||
|
}
|
||||||
|
|
||||||
class RigWellPath;
|
class RigWellPath;
|
||||||
class RimGridView;
|
class RimGridView;
|
||||||
class RimWellPath;
|
class RimWellPath;
|
||||||
@ -48,6 +53,7 @@ public:
|
|||||||
const Rim3dWellLogCurve* rim3dWellLogCurve) const;
|
const Rim3dWellLogCurve* rim3dWellLogCurve) const;
|
||||||
|
|
||||||
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||||
|
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||||
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||||
double gridIntervalSize) const;
|
double gridIntervalSize) const;
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "cafDisplayCoordTransform.h"
|
#include "cafDisplayCoordTransform.h"
|
||||||
#include "cafEffectGenerator.h"
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
|
#include "cvfBoundingBox.h"
|
||||||
#include "cvfColor3.h"
|
#include "cvfColor3.h"
|
||||||
#include "cvfDrawableGeo.h"
|
#include "cvfDrawableGeo.h"
|
||||||
#include "cvfModelBasicList.h"
|
#include "cvfModelBasicList.h"
|
||||||
@ -35,7 +36,8 @@
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGridView* gridView)
|
Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGridView* gridView)
|
||||||
:m_wellPath(wellPath), m_gridView(gridView)
|
: m_wellPath(wellPath)
|
||||||
|
, m_gridView(gridView)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +60,8 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
|||||||
{
|
{
|
||||||
if (!rim3dWellLogCurve->toggleState()) continue;
|
if (!rim3dWellLogCurve->toggleState()) continue;
|
||||||
|
|
||||||
cvf::ref<cvf::Drawable> curveDrawable = m_3dWellLogCurveGeometryGenerator->createCurveLine(displayCoordTransform, rim3dWellLogCurve);
|
cvf::ref<cvf::Drawable> curveDrawable =
|
||||||
|
m_3dWellLogCurveGeometryGenerator->createCurveLine(displayCoordTransform, rim3dWellLogCurve);
|
||||||
|
|
||||||
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
|
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
|
||||||
{
|
{
|
||||||
@ -95,7 +98,10 @@ cvf::ref<cvf::Part> Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double gridIntervalSize)
|
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model,
|
||||||
|
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||||
|
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||||
|
double gridIntervalSize)
|
||||||
{
|
{
|
||||||
if (m_3dWellLogCurveGeometryGenerator.isNull())
|
if (m_3dWellLogCurveGeometryGenerator.isNull())
|
||||||
{
|
{
|
||||||
@ -105,7 +111,8 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, con
|
|||||||
caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f));
|
caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f));
|
||||||
|
|
||||||
{
|
{
|
||||||
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(displayCoordTransform, Rim3dWellLogCurve::HORIZONTAL_LEFT, gridIntervalSize);
|
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(
|
||||||
|
displayCoordTransform, wellPathClipBoundingBox, Rim3dWellLogCurve::HORIZONTAL_LEFT, gridIntervalSize);
|
||||||
|
|
||||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||||
@ -116,7 +123,8 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(displayCoordTransform, Rim3dWellLogCurve::HORIZONTAL_RIGHT, gridIntervalSize);
|
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(
|
||||||
|
displayCoordTransform, wellPathClipBoundingBox, Rim3dWellLogCurve::HORIZONTAL_RIGHT, gridIntervalSize);
|
||||||
|
|
||||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||||
|
@ -33,7 +33,8 @@ namespace cvf
|
|||||||
class Drawable;
|
class Drawable;
|
||||||
class Effect;
|
class Effect;
|
||||||
class Part;
|
class Part;
|
||||||
}
|
class BoundingBox;
|
||||||
|
} // namespace cvf
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@ -55,9 +56,12 @@ public:
|
|||||||
|
|
||||||
void appendGridToModel(cvf::ModelBasicList* model,
|
void appendGridToModel(cvf::ModelBasicList* model,
|
||||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||||
|
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||||
double gridIntervalSize);
|
double gridIntervalSize);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
|
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
|
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
|
|||||||
|
|
||||||
if (m_rimWellPath->rim3dWellLogCurveCollection()->showGrid())
|
if (m_rimWellPath->rim3dWellLogCurveCollection()->showGrid())
|
||||||
{
|
{
|
||||||
m_3dWellLogCurvePartMgr->appendGridToModel(model, displayCoordTransform, 200);
|
m_3dWellLogCurvePartMgr->appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user