Clean up 3D well log generator code. Renamed Grid -> DrawSurface and fixed spelling.

This commit is contained in:
Gaute Lindkvist 2018-05-02 12:10:05 +02:00
parent 6e3d989b2f
commit a37957824a
8 changed files with 73 additions and 73 deletions

View File

@ -38,12 +38,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RivFishbonesSubsPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivTensorResultPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivWellFracturePartMgr.h
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogPlanePartMgr.h
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogCurveGeomertyGenerator.h
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogCurveGeometryGenerator.h
${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionFactorPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionFactorGeometryGenerator.h
${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/RivSimWellConnectionSourceInfo.h
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogGridGeomertyGenerator.h
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogDrawSurfaceGenerator.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -80,12 +80,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RivFishbonesSubsPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivTensorResultPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivWellFracturePartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogPlanePartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogCurveGeomertyGenerator.cpp
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogCurveGeometryGenerator.cpp
${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionFactorPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionFactorGeometryGenerator.cpp
${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RivSimWellConnectionSourceInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogGridGeomertyGenerator.cpp
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogDrawSurfaceGenerator.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "Riv3dWellLogCurveGeomertyGenerator.h"
#include "Riv3dWellLogCurveGeometryGenerator.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@ -51,7 +51,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
const Rim3dWellLogCurve* rim3dWellLogCurve,
double planeOffsetFromWellPathCenter,
double planeWidth,
const std::vector<cvf::Vec3f>& gridVertices)
const std::vector<cvf::Vec3f>& drawSurfaceVertices)
{
// Make sure all drawables are cleared in case we return early to avoid a
// previous drawable being "stuck" when changing result type.
@ -152,8 +152,8 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
m_curveVertices.push_back(cvf::Vec3f(curvePoint));
}
createNewVerticesAlongTriangleEdges(gridVertices);
projectVerticesOntoTriangles(gridVertices);
createNewVerticesAlongTriangleEdges(drawSurfaceVertices);
projectVerticesOntoTriangles(drawSurfaceVertices);
std::vector<cvf::uint> indices;
@ -252,12 +252,12 @@ bool Riv3dWellLogCurveGeometryGenerator::findClosestPointOnCurve(const cvf::Vec3
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(const std::vector<cvf::Vec3f>& gridVertices)
void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(const std::vector<cvf::Vec3f>& drawSurfaceVertices)
{
std::vector<cvf::Vec3f> expandedCurveVertices;
std::vector<double> expandedMeasuredDepths;
std::vector<double> expandedValues;
size_t estimatedNumberOfPoints = m_curveVertices.size() + gridVertices.size();
size_t estimatedNumberOfPoints = m_curveVertices.size() + drawSurfaceVertices.size();
expandedCurveVertices.reserve(estimatedNumberOfPoints);
expandedMeasuredDepths.reserve(estimatedNumberOfPoints);
expandedValues.reserve(estimatedNumberOfPoints);
@ -272,24 +272,24 @@ void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(con
// Find segments that intersects the triangle edge
caf::Line<float> curveLine(m_curveVertices[i], m_curveVertices[i + 1]);
for (size_t j = 0; j < gridVertices.size() - 1; ++j)
for (size_t j = 0; j < drawSurfaceVertices.size() - 1; ++j)
{
caf::Line<float> gridLine(gridVertices[j], gridVertices[j + 1]);
caf::Line<float> drawSurfaceLine(drawSurfaceVertices[j], drawSurfaceVertices[j + 1]);
bool withinSegments = false;
caf::Line<float> connectingLine = curveLine.findLineBetweenNearestPoints(gridLine, &withinSegments);
caf::Line<float> connectingLine = curveLine.findLineBetweenNearestPoints(drawSurfaceLine, &withinSegments);
if (withinSegments)
{
cvf::Vec3f closestGridPoint = connectingLine.end();
cvf::Vec3f closestDrawSurfacePoint = connectingLine.end();
double measuredDepth;
double valueAtPoint;
cvf::Vec3d closestPoint(closestGridPoint);
cvf::Vec3d closestPoint(closestDrawSurfacePoint);
cvf::Vec3d dummyArgument;
// Interpolate measured depth and value
bool worked = findClosestPointOnCurve(closestPoint, &dummyArgument, &measuredDepth, &valueAtPoint);
if (worked)
{
expandedCurveVertices.push_back(closestGridPoint);
expandedCurveVertices.push_back(closestDrawSurfacePoint);
expandedMeasuredDepths.push_back(measuredDepth);
expandedValues.push_back(valueAtPoint);
}
@ -312,24 +312,24 @@ void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(con
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogCurveGeometryGenerator::projectVerticesOntoTriangles(const std::vector<cvf::Vec3f>& gridVertices)
void Riv3dWellLogCurveGeometryGenerator::projectVerticesOntoTriangles(const std::vector<cvf::Vec3f>& drawSurfaceVertices)
{
for (size_t i = 0; i < m_curveVertices.size(); ++i)
{
for (size_t j = 0; j < gridVertices.size() - 2; j += 1)
for (size_t j = 0; j < drawSurfaceVertices.size() - 2; j += 1)
{
cvf::Vec3f triangleVertex1, triangleVertex2, triangleVertex3;
if (j % 2 == 0)
{
triangleVertex1 = gridVertices[j];
triangleVertex2 = gridVertices[j + 1];
triangleVertex3 = gridVertices[j + 2];
triangleVertex1 = drawSurfaceVertices[j];
triangleVertex2 = drawSurfaceVertices[j + 1];
triangleVertex3 = drawSurfaceVertices[j + 2];
}
else
{
triangleVertex1 = gridVertices[j];
triangleVertex2 = gridVertices[j + 2];
triangleVertex3 = gridVertices[j + 1];
triangleVertex1 = drawSurfaceVertices[j];
triangleVertex2 = drawSurfaceVertices[j + 2];
triangleVertex3 = drawSurfaceVertices[j + 1];
}
bool wasInsideTriangle = false;

View File

@ -52,7 +52,7 @@ public:
const Rim3dWellLogCurve* rim3dWellLogCurve,
double planeOffsetFromWellPathCenter,
double planeWidth,
const std::vector<cvf::Vec3f>& gridVertices);
const std::vector<cvf::Vec3f>& drawSurfaceVertices);
void clearCurvePointsAndGeometry();
@ -66,8 +66,8 @@ public:
double* valueAtClosestPoint) const;
private:
void createNewVerticesAlongTriangleEdges(const std::vector<cvf::Vec3f>& gridVertices);
void projectVerticesOntoTriangles(const std::vector<cvf::Vec3f>& gridVertices);
void createNewVerticesAlongTriangleEdges(const std::vector<cvf::Vec3f>& drawSurfaceVertices);
void projectVerticesOntoTriangles(const std::vector<cvf::Vec3f>& drawSurfaceVertices);
static cvf::Vec3f projectPointOntoTriangle(const cvf::Vec3f& point,
const cvf::Vec3f& triangleVertex1,
const cvf::Vec3f& triangleVertex2,

View File

@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "Riv3dWellLogGridGeomertyGenerator.h"
#include "Riv3dWellLogDrawSurfaceGenerator.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@ -38,7 +38,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Riv3dWellLogGridGeometryGenerator::Riv3dWellLogGridGeometryGenerator(RimWellPath* wellPath)
Riv3dWellLogDrawSurfaceGenerator::Riv3dWellLogDrawSurfaceGenerator(RimWellPath* wellPath)
: m_wellPath(wellPath)
{
}
@ -47,14 +47,14 @@ Riv3dWellLogGridGeometryGenerator::Riv3dWellLogGridGeometryGenerator(RimWellPath
///
//--------------------------------------------------------------------------------------------------
bool
Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
Riv3dWellLogDrawSurfaceGenerator::createDrawSurface(const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
double planeAngle,
double planeOffsetFromWellPathCenter,
double planeWidth,
double gridIntervalSize)
double samplingIntervalSize)
{
CVF_ASSERT(gridIntervalSize > 0);
CVF_ASSERT(samplingIntervalSize > 0);
clearGeometry();
@ -194,7 +194,7 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
cvf::Vec3d curveNormal = wellPathGeometry()->interpolatedVectorAlongWellPath(segmentNormals, md);
interpolatedGridPoints.push_back(point);
interpolatedGridCurveNormals.push_back(curveNormal.getNormalized());
md -= gridIntervalSize;
md -= samplingIntervalSize;
}
std::vector<cvf::Vec3f> arrowVertices;
@ -237,7 +237,7 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogGridGeometryGenerator::clearGeometry()
void Riv3dWellLogDrawSurfaceGenerator::clearGeometry()
{
m_background = nullptr;
m_border = nullptr;
@ -248,7 +248,7 @@ void Riv3dWellLogGridGeometryGenerator::clearGeometry()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::background() const
cvf::ref<cvf::DrawableGeo> Riv3dWellLogDrawSurfaceGenerator::background() const
{
return m_background;
}
@ -256,7 +256,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::background() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::border() const
cvf::ref<cvf::DrawableGeo> Riv3dWellLogDrawSurfaceGenerator::border() const
{
return m_border;
}
@ -264,7 +264,7 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogGridGeometryGenerator::border() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableVectors> Riv3dWellLogGridGeometryGenerator::curveNormalVectors() const
cvf::ref<cvf::DrawableVectors> Riv3dWellLogDrawSurfaceGenerator::curveNormalVectors() const
{
return m_curveNormalVectors;
}
@ -272,7 +272,7 @@ cvf::ref<cvf::DrawableVectors> Riv3dWellLogGridGeometryGenerator::curveNormalVec
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<cvf::Vec3f>& Riv3dWellLogGridGeometryGenerator::vertices() const
const std::vector<cvf::Vec3f>& Riv3dWellLogDrawSurfaceGenerator::vertices() const
{
return m_vertices;
}
@ -280,7 +280,7 @@ const std::vector<cvf::Vec3f>& Riv3dWellLogGridGeometryGenerator::vertices() con
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigWellPath* Riv3dWellLogGridGeometryGenerator::wellPathGeometry() const
const RigWellPath* Riv3dWellLogDrawSurfaceGenerator::wellPathGeometry() const
{
return m_wellPath->wellPathGeometry();
}

View File

@ -40,17 +40,17 @@ class BoundingBox;
class RigWellPath;
class RimWellPath;
class Riv3dWellLogGridGeometryGenerator : public cvf::Object
class Riv3dWellLogDrawSurfaceGenerator : public cvf::Object
{
public:
Riv3dWellLogGridGeometryGenerator(RimWellPath* wellPath);
Riv3dWellLogDrawSurfaceGenerator(RimWellPath* wellPath);
bool createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
bool createDrawSurface(const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
double planeAngle,
double planeOffsetFromWellPathCenter,
double planeWidth,
double gridIntervalSize);
double samplingIntervalSize);
void clearGeometry();

View File

@ -27,8 +27,8 @@
#include "RimGridView.h"
#include "RimWellPath.h"
#include "Riv3dWellLogCurveGeomertyGenerator.h"
#include "Riv3dWellLogGridGeomertyGenerator.h"
#include "Riv3dWellLogCurveGeometryGenerator.h"
#include "Riv3dWellLogDrawSurfaceGenerator.h"
#include "RivObjectSourceInfo.h"
#include "cafDisplayCoordTransform.h"
@ -52,7 +52,7 @@ Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGri
, m_gridView(gridView)
{
CVF_ASSERT(m_wellPath.notNull());
m_3dWellLogGridGeometryGenerator = new Riv3dWellLogGridGeometryGenerator(m_wellPath.p());
m_3dWellLogDrawSurfaceGeometryGenerator = new Riv3dWellLogDrawSurfaceGenerator(m_wellPath.p());
}
//--------------------------------------------------------------------------------------------------
@ -74,12 +74,12 @@ void Riv3dWellLogPlanePartMgr::appendPlaneToModel(cvf::ModelBasicList*
{
if (rim3dWellLogCurve->isShowingCurve())
{
appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth());
appendDrawSurfaceToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth());
append3dWellLogCurveToModel(model,
displayCoordTransform,
wellPathClipBoundingBox,
rim3dWellLogCurve,
m_3dWellLogGridGeometryGenerator->vertices());
m_3dWellLogDrawSurfaceGeometryGenerator->vertices());
}
}
}
@ -91,7 +91,7 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurveToModel(cvf::ModelBasicList*
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
Rim3dWellLogCurve* rim3dWellLogCurve,
const std::vector<cvf::Vec3f>& gridVertices)
const std::vector<cvf::Vec3f>& drawSurfaceVertices)
{
CVF_ASSERT(rim3dWellLogCurve);
@ -107,7 +107,7 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurveToModel(cvf::ModelBasicList*
rim3dWellLogCurve,
wellPathCenterToPlotStartOffset(rim3dWellLogCurve),
planeWidth(),
gridVertices);
drawSurfaceVertices);
cvf::ref<cvf::DrawableGeo> curveDrawable = generator->curveDrawable();
@ -179,19 +179,19 @@ double Riv3dWellLogPlanePartMgr::planeWidth() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model,
void Riv3dWellLogPlanePartMgr::appendDrawSurfaceToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve* rim3dWellLogCurve,
double gridIntervalSize)
double samplingInterval)
{
Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection();
bool showGrid = curveCollection->isShowingGrid();
bool showCoordinateSystemMesh = curveCollection->isShowingGrid();
bool showBackground = curveCollection->isShowingBackground();
cvf::Color3f gridColor(0.4f, 0.4f, 0.4f);
cvf::Color3f borderColor(0.4f, 0.4f, 0.4f);
caf::SurfaceEffectGenerator backgroundEffectGen(cvf::Color4f(1.0, 1.0, 1.0, 1.0), caf::PO_2);
caf::MeshEffectGenerator gridBorderEffectGen(gridColor);
caf::MeshEffectGenerator borderEffectGen(borderColor);
caf::VectorEffectGenerator curveNormalsEffectGen;
backgroundEffectGen.enableLighting(false);
@ -203,19 +203,19 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
backgroundEffectGen.enableDepthWrite(false);
}
bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform,
bool drawSurfaceCreated = m_3dWellLogDrawSurfaceGeometryGenerator->createDrawSurface(displayCoordTransform,
wellPathClipBoundingBox,
rim3dWellLogCurve->drawPlaneAngle(),
wellPathCenterToPlotStartOffset(rim3dWellLogCurve),
planeWidth(),
gridIntervalSize);
if (!gridCreated) return;
samplingInterval);
if (!drawSurfaceCreated) return;
cvf::ref<cvf::Effect> backgroundEffect = backgroundEffectGen.generateCachedEffect();
cvf::ref<cvf::Effect> borderEffect = gridBorderEffectGen.generateCachedEffect();
cvf::ref<cvf::Effect> borderEffect = borderEffectGen.generateCachedEffect();
cvf::ref<cvf::Effect> curveNormalsEffect = curveNormalsEffectGen.generateCachedEffect();
cvf::ref<cvf::DrawableGeo> background = m_3dWellLogGridGeometryGenerator->background();
cvf::ref<cvf::DrawableGeo> background = m_3dWellLogDrawSurfaceGeometryGenerator->background();
cvf::ref<RivObjectSourceInfo> sourceInfo = new RivObjectSourceInfo(curveCollection);
if (background.notNull())
{
@ -227,9 +227,9 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
}
}
if (showGrid)
if (showCoordinateSystemMesh)
{
cvf::ref<cvf::DrawableGeo> border = m_3dWellLogGridGeometryGenerator->border();
cvf::ref<cvf::DrawableGeo> border = m_3dWellLogDrawSurfaceGeometryGenerator->border();
if (border.notNull())
{
cvf::ref<cvf::Part> part = createPart(border.p(), borderEffect.p());
@ -239,10 +239,10 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList*
}
}
cvf::ref<cvf::DrawableVectors> normals = m_3dWellLogGridGeometryGenerator->curveNormalVectors();
cvf::ref<cvf::DrawableVectors> normals = m_3dWellLogDrawSurfaceGeometryGenerator->curveNormalVectors();
if (normals.notNull())
{
normals->setSingleColor(gridColor);
normals->setSingleColor(borderColor);
if (RiaApplication::instance()->useShaders())
{
normals->setUniformNames("u_transformationMatrix", "u_color");

View File

@ -45,7 +45,7 @@ class DisplayCoordTransform;
class RimGridView;
class RimWellPath;
class Riv3dWellLogGridGeometryGenerator;
class Riv3dWellLogDrawSurfaceGenerator;
class Riv3dWellLogPlanePartMgr : public cvf::Object
{
@ -60,13 +60,13 @@ private:
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
Rim3dWellLogCurve* rim3dWellLogCurve,
const std::vector<cvf::Vec3f>& gridVertices);
const std::vector<cvf::Vec3f>& drawSurfaceVertices);
void appendGridToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve* rim3dWellLogCurve,
double gridIntervalSize);
void appendDrawSurfaceToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve* rim3dWellLogCurve,
double samplingInterval);
cvf::ref<cvf::Part> createPart(cvf::Drawable* drawable, cvf::Effect* effect);
@ -74,7 +74,7 @@ private:
double planeWidth() const;
private:
cvf::ref<Riv3dWellLogGridGeometryGenerator> m_3dWellLogGridGeometryGenerator;
cvf::ref<Riv3dWellLogDrawSurfaceGenerator> m_3dWellLogDrawSurfaceGeometryGenerator;
caf::PdmPointer<RimWellPath> m_wellPath;
caf::PdmPointer<RimGridView> m_gridView;

View File

@ -19,7 +19,7 @@
#include "Rim3dWellLogCurve.h"
#include "RigCurveDataTools.h"
#include "Riv3dWellLogCurveGeomertyGenerator.h"
#include "Riv3dWellLogCurveGeometryGenerator.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimProject.h"