mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -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 "RimGridView.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RigCurveDataTools.h"
|
||||
#include "RigWellPath.h"
|
||||
@ -28,6 +29,8 @@
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -65,32 +68,47 @@ cvf::ref<cvf::DrawableGeo>
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||
double gridIntervalSize) const
|
||||
double gridIntervalSize) const
|
||||
{
|
||||
CVF_ASSERT(gridIntervalSize > 0);
|
||||
|
||||
if (!wellPathGeometry()) return nullptr;
|
||||
if (!wellPathClipBoundingBox.isValid()) return nullptr;
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
m_wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection);
|
||||
|
||||
std::vector<cvf::Vec3d> wellPathPoints = wellPathGeometry()->m_wellPathPoints;
|
||||
if (wellPathPoints.empty()) return nullptr;
|
||||
|
||||
const cvf::Vec3d globalDirection = (wellPathPoints.back() - wellPathPoints.front()).getNormalized();
|
||||
const cvf::Vec3d up(0, 0, 1);
|
||||
size_t originalWellPathSize = wellPathPoints.size();
|
||||
|
||||
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> gridPoints;
|
||||
|
||||
double firstMd = wellPathGeometry()->m_measuredDepths.front();
|
||||
double lastMd = wellPathGeometry()->m_measuredDepths.back();
|
||||
if (wellPathGeometry()->m_measuredDepths.empty()) return nullptr;
|
||||
|
||||
double md = firstMd;
|
||||
while (md <= lastMd)
|
||||
size_t newStartIndex = originalWellPathSize - wellPathPoints.size();
|
||||
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);
|
||||
gridPoints.push_back(point);
|
||||
md += gridIntervalSize;
|
||||
md -= gridIntervalSize;
|
||||
}
|
||||
|
||||
pointNormals = calculatePointNormals(drawPlane, gridPoints);
|
||||
@ -201,7 +219,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
|
||||
vertices->resize(interpolatedWellPathPoints.size());
|
||||
|
||||
double plotRangeToResultRangeFactor = gridWidth() / (maxResult - minResult);
|
||||
double offsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
|
||||
double offsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
|
||||
|
||||
for (size_t i = 0; i < pointNormals.size(); i++)
|
||||
{
|
||||
|
@ -34,6 +34,11 @@ namespace caf
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
}
|
||||
|
||||
class RigWellPath;
|
||||
class RimGridView;
|
||||
class RimWellPath;
|
||||
@ -48,6 +53,7 @@ public:
|
||||
const Rim3dWellLogCurve* rim3dWellLogCurve) const;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve::DrawPlane drawPlane,
|
||||
double gridIntervalSize) const;
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
@ -35,7 +36,8 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGridView* gridView)
|
||||
:m_wellPath(wellPath), m_gridView(gridView)
|
||||
: m_wellPath(wellPath)
|
||||
, m_gridView(gridView)
|
||||
{
|
||||
}
|
||||
|
||||
@ -57,8 +59,9 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
||||
for (Rim3dWellLogCurve* rim3dWellLogCurve : rim3dWellLogCurves)
|
||||
{
|
||||
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())
|
||||
{
|
||||
@ -66,7 +69,7 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
||||
}
|
||||
|
||||
caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.9f, 0.0f, 0.0f));
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setDrawable(curveDrawable.p());
|
||||
@ -93,9 +96,12 @@ 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())
|
||||
{
|
||||
@ -105,10 +111,11 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, con
|
||||
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::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
|
||||
if (part.notNull())
|
||||
{
|
||||
@ -116,10 +123,11 @@ 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::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
|
||||
if (part.notNull())
|
||||
{
|
||||
|
@ -29,15 +29,16 @@
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class Drawable;
|
||||
class Effect;
|
||||
class Part;
|
||||
}
|
||||
class ModelBasicList;
|
||||
class Drawable;
|
||||
class Effect;
|
||||
class Part;
|
||||
class BoundingBox;
|
||||
} // namespace cvf
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class DisplayCoordTransform;
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
class RimGridView;
|
||||
@ -49,15 +50,18 @@ class Riv3dWellLogPlanePartMgr : public cvf::Object
|
||||
public:
|
||||
Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGridView* gridView);
|
||||
|
||||
void append3dWellLogCurvesToModel(cvf::ModelBasicList* model,
|
||||
void append3dWellLogCurvesToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
std::vector<Rim3dWellLogCurve*> rim3dWellLogCurves);
|
||||
|
||||
void appendGridToModel(cvf::ModelBasicList* model,
|
||||
void appendGridToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
double gridIntervalSize);
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
double gridIntervalSize);
|
||||
|
||||
private:
|
||||
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
|
||||
|
||||
private:
|
||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
|
||||
|
||||
|
@ -548,7 +548,7 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
|
||||
|
||||
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