mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2591 3D well log curves: Remove view from geometry generator
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
|
||||
#include "Riv3dWellLogCurveGeomertyGenerator.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
@@ -36,9 +34,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Riv3dWellLogCurveGeometryGenerator::Riv3dWellLogCurveGeometryGenerator(RimWellPath* wellPath, RimGridView* gridView)
|
||||
Riv3dWellLogCurveGeometryGenerator::Riv3dWellLogCurveGeometryGenerator(RimWellPath* wellPath)
|
||||
: m_wellPath(wellPath)
|
||||
, m_gridView(gridView)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,13 +47,15 @@ cvf::ref<cvf::DrawableGeo>
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double rotationAngle) const
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth) const
|
||||
{
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
std::vector<cvf::uint> indices;
|
||||
|
||||
createCurveVerticesAndIndices(
|
||||
resultValues, resultMds, rotationAngle, displayCoordTransform, wellPathClipBoundingBox, &vertices, &indices);
|
||||
resultValues, resultMds, planeAngle, planeOffsetFromWellPathCenter, planeWidth, displayCoordTransform, wellPathClipBoundingBox, &vertices, &indices);
|
||||
|
||||
if (vertices.empty() || indices.empty())
|
||||
{
|
||||
@@ -82,7 +81,9 @@ cvf::ref<cvf::DrawableGeo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
double angle,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth,
|
||||
double gridIntervalSize) const
|
||||
{
|
||||
CVF_ASSERT(gridIntervalSize > 0);
|
||||
@@ -129,7 +130,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
std::vector<cvf::Vec3d> closestPoints;
|
||||
calculatePairsOfClosestPointsAlongWellPath(&closestPoints, gridPoints);
|
||||
|
||||
pointNormals = calculateLineSegmentNormals(angle, closestPoints, LINE_SEGMENTS);
|
||||
pointNormals = calculateLineSegmentNormals(planeAngle, closestPoints, LINE_SEGMENTS);
|
||||
if (pointNormals.size() != gridPoints.size()) return nullptr;
|
||||
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
@@ -140,16 +141,16 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
|
||||
cvf::uint indexCounter = 0;
|
||||
|
||||
double offsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
|
||||
//double planeOffsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
|
||||
|
||||
// Normal lines
|
||||
for (size_t i = 0; i < pointNormals.size(); i++)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(
|
||||
displayCoordTransform->transformToDisplayCoord(gridPoints[i] + pointNormals[i] * offsetFromWellPathCenter)));
|
||||
displayCoordTransform->transformToDisplayCoord(gridPoints[i] + pointNormals[i] * planeOffsetFromWellPathCenter)));
|
||||
|
||||
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(
|
||||
gridPoints[i] + pointNormals[i] * (offsetFromWellPathCenter + gridWidth()))));
|
||||
gridPoints[i] + pointNormals[i] * (planeOffsetFromWellPathCenter + planeWidth))));
|
||||
|
||||
indices.push_back(indexCounter++);
|
||||
indices.push_back(indexCounter++);
|
||||
@@ -157,14 +158,14 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
|
||||
// calculateLineSegmentNormals returns normals for the whole well path. Erase the part which is clipped off
|
||||
std::vector<cvf::Vec3d> wellPathSegmentNormals =
|
||||
calculateLineSegmentNormals(angle, wellPathGeometry()->m_wellPathPoints, POLYLINE);
|
||||
calculateLineSegmentNormals(planeAngle, wellPathGeometry()->m_wellPathPoints, POLYLINE);
|
||||
wellPathSegmentNormals.erase(wellPathSegmentNormals.begin(), wellPathSegmentNormals.end() - wellPathPoints.size());
|
||||
|
||||
// Line along and close to well
|
||||
for (size_t i = 0; i < wellPathPoints.size(); i++)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(
|
||||
wellPathPoints[i] + wellPathSegmentNormals[i] * offsetFromWellPathCenter)));
|
||||
wellPathPoints[i] + wellPathSegmentNormals[i] * planeOffsetFromWellPathCenter)));
|
||||
|
||||
indices.push_back(indexCounter);
|
||||
indices.push_back(++indexCounter);
|
||||
@@ -178,7 +179,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
for (size_t i = 0; i < wellPathPoints.size(); i++)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(
|
||||
wellPathPoints[i] + wellPathSegmentNormals[i] * (offsetFromWellPathCenter + gridWidth()))));
|
||||
wellPathPoints[i] + wellPathSegmentNormals[i] * (planeOffsetFromWellPathCenter + planeWidth))));
|
||||
|
||||
indices.push_back(indexCounter);
|
||||
indices.push_back(++indexCounter);
|
||||
@@ -205,7 +206,9 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double angle,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
@@ -254,7 +257,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
std::vector<cvf::Vec3d> pairsOfWellPathPoints;
|
||||
calculatePairsOfClosestPointsAlongWellPath(&pairsOfWellPathPoints, interpolatedWellPathPoints);
|
||||
|
||||
std::vector<cvf::Vec3d> pointNormals = calculateLineSegmentNormals(angle, pairsOfWellPathPoints, LINE_SEGMENTS);
|
||||
std::vector<cvf::Vec3d> pointNormals = calculateLineSegmentNormals(planeAngle, pairsOfWellPathPoints, LINE_SEGMENTS);
|
||||
if (interpolatedWellPathPoints.size() != pointNormals.size()) return;
|
||||
|
||||
double maxResult = -HUGE_VAL;
|
||||
@@ -270,8 +273,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
|
||||
vertices->resize(interpolatedWellPathPoints.size());
|
||||
|
||||
double plotRangeToResultRangeFactor = gridWidth() / (maxResult - minResult);
|
||||
double offsetFromWellPathCenter = wellPathCenterToPlotStartOffset();
|
||||
double plotRangeToResultRangeFactor = planeWidth / (maxResult - minResult);
|
||||
|
||||
for (size_t i = 0; i < pointNormals.size(); i++)
|
||||
{
|
||||
@@ -280,7 +282,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const std
|
||||
if (RigCurveDataTools::isValidValue(resultValuesForInterpolatedPoints[i], false))
|
||||
{
|
||||
scaledResult =
|
||||
offsetFromWellPathCenter + (resultValuesForInterpolatedPoints[i] - minResult) * plotRangeToResultRangeFactor;
|
||||
planeOffsetFromWellPathCenter + (resultValuesForInterpolatedPoints[i] - minResult) * plotRangeToResultRangeFactor;
|
||||
}
|
||||
|
||||
(*vertices)[i] = cvf::Vec3f(
|
||||
@@ -368,30 +370,6 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculateLineSegment
|
||||
return pointNormals;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double Riv3dWellLogCurveGeometryGenerator::wellPathCenterToPlotStartOffset() const
|
||||
{
|
||||
if (!m_gridView) return 0;
|
||||
|
||||
double cellSize = m_gridView->ownerCase()->characteristicCellSize();
|
||||
|
||||
return m_wellPath->wellPathRadius(cellSize) * 2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double Riv3dWellLogCurveGeometryGenerator::gridWidth() const
|
||||
{
|
||||
if (!m_gridView) return 0;
|
||||
|
||||
double cellSize = m_gridView->ownerCase()->characteristicCellSize();
|
||||
|
||||
return m_wellPath->wellPathRadius(cellSize) * 3;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -38,23 +38,28 @@ class BoundingBox;
|
||||
}
|
||||
|
||||
class RigWellPath;
|
||||
class RimGridView;
|
||||
class RimWellPath;
|
||||
|
||||
class Riv3dWellLogCurveGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
Riv3dWellLogCurveGeometryGenerator(RimWellPath* wellPath, RimGridView* gridView);
|
||||
Riv3dWellLogCurveGeometryGenerator(RimWellPath* wellPath);
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double rotationAngle) const;
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth) const;
|
||||
|
||||
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
double angle,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth,
|
||||
double gridIntervalSize) const;
|
||||
|
||||
private:
|
||||
@@ -67,7 +72,9 @@ private:
|
||||
private:
|
||||
void createCurveVerticesAndIndices(const std::vector<double>& resultValues,
|
||||
const std::vector<double>& resultMds,
|
||||
double angle,
|
||||
double planeAngle,
|
||||
double planeOffsetFromWellPathCenter,
|
||||
double planeWidth,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
std::vector<cvf::Vec3f>* vertices,
|
||||
@@ -77,9 +84,6 @@ private:
|
||||
const std::vector<cvf::Vec3d>& vertices,
|
||||
VertexOrganization organization) const;
|
||||
|
||||
double wellPathCenterToPlotStartOffset() const;
|
||||
double gridWidth() const;
|
||||
|
||||
const RigWellPath* wellPathGeometry() const;
|
||||
|
||||
void calculatePairsOfClosestPointsAlongWellPath(std::vector<cvf::Vec3d>* closestWellPathPoints,
|
||||
@@ -87,5 +91,4 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimWellPath> m_wellPath;
|
||||
caf::PdmPointer<RimGridView> m_gridView;
|
||||
};
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -83,13 +85,10 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox)
|
||||
{
|
||||
if (m_wellPath.isNull()) return;
|
||||
|
||||
if (!m_wellPath->rim3dWellLogCurveCollection()) return;
|
||||
if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return;
|
||||
|
||||
if (m_3dWellLogCurveGeometryGenerator.isNull())
|
||||
{
|
||||
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p(), m_gridView);
|
||||
}
|
||||
|
||||
create3dWellLogCurveGeometryGenerator();
|
||||
|
||||
for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves())
|
||||
{
|
||||
@@ -100,7 +99,7 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
|
||||
rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds);
|
||||
|
||||
cvf::ref<cvf::Drawable> curveDrawable = m_3dWellLogCurveGeometryGenerator->createCurveLine(
|
||||
displayCoordTransform, wellPathClipBoundingBox, resultValues, resultMds, angle(rim3dWellLogCurve->drawPlane()));
|
||||
displayCoordTransform, wellPathClipBoundingBox, resultValues, resultMds, angle(rim3dWellLogCurve->drawPlane()), wellPathCenterToPlotStartOffset(), planeWidth());
|
||||
|
||||
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
|
||||
{
|
||||
@@ -154,6 +153,43 @@ double Riv3dWellLogPlanePartMgr::angle(const Rim3dWellLogCurve::DrawPlane& drawP
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset() const
|
||||
{
|
||||
if (!m_gridView) return 0;
|
||||
|
||||
double cellSize = m_gridView->ownerCase()->characteristicCellSize();
|
||||
|
||||
return -cellSize * 2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double Riv3dWellLogPlanePartMgr::planeWidth() const
|
||||
{
|
||||
if (!m_gridView) return 0;
|
||||
|
||||
double cellSize = m_gridView->ownerCase()->characteristicCellSize();
|
||||
|
||||
return cellSize * 4;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Riv3dWellLogPlanePartMgr::create3dWellLogCurveGeometryGenerator()
|
||||
{
|
||||
if (m_wellPath.isNull()) return;
|
||||
|
||||
if (m_3dWellLogCurveGeometryGenerator.isNull())
|
||||
{
|
||||
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -163,25 +199,18 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
|
||||
const Rim3dWellLogCurve::DrawPlane& drawPlane,
|
||||
double gridIntervalSize)
|
||||
{
|
||||
if (m_wellPath.isNull()) return;
|
||||
|
||||
if (m_3dWellLogCurveGeometryGenerator.isNull())
|
||||
{
|
||||
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p(), m_gridView);
|
||||
}
|
||||
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);
|
||||
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
|
||||
if (part.notNull())
|
||||
{
|
||||
cvf::ref<cvf::Drawable> gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(
|
||||
displayCoordTransform, wellPathClipBoundingBox, angle(drawPlane), gridIntervalSize);
|
||||
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
cvf::ref<cvf::Part> part = createPart(gridHorizontalDrawable.p(), effect.p());
|
||||
|
||||
if (part.notNull())
|
||||
{
|
||||
model->addPart(part.p());
|
||||
}
|
||||
model->addPart(part.p());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Drawable;
|
||||
class Effect;
|
||||
class Part;
|
||||
class BoundingBox;
|
||||
} // namespace cvf
|
||||
}
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@@ -63,10 +63,16 @@ private:
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
const Rim3dWellLogCurve::DrawPlane& drawPlane,
|
||||
double gridIntervalSize);
|
||||
|
||||
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
|
||||
|
||||
static double angle(const Rim3dWellLogCurve::DrawPlane& drawPlane);
|
||||
|
||||
double wellPathCenterToPlotStartOffset() const;
|
||||
double planeWidth() const;
|
||||
|
||||
void create3dWellLogCurveGeometryGenerator();
|
||||
|
||||
private:
|
||||
cvf::ref<Riv3dWellLogCurveGeometryGenerator> m_3dWellLogCurveGeometryGenerator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user