3d Well Log Plots: Remove curve filled code

This commit is contained in:
Gaute Lindkvist 2018-05-18 11:04:42 +02:00
parent 68dd0ba13e
commit 9e665d5ab1
5 changed files with 3 additions and 156 deletions

View File

@ -167,17 +167,6 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
}
m_curveVertices = projectVerticesOntoTriangles(m_curveVertices, drawSurfaceVertices);
m_bottomVertices.reserve(m_curveVertices.size() + 2);
for (size_t i = 0; i < m_curveVertices.size(); ++i)
{
double md = m_curveMeasuredDepths[i];
cvf::Vec3d point = wellPathGeometry()->interpolatedVectorAlongWellPath(wellPathPoints, md);
cvf::Vec3d normal = wellPathGeometry()->interpolatedVectorAlongWellPath(wellPathCurveNormals, md);
point += planeOffsetFromWellPathCenter * normal;
m_bottomVertices.push_back(point);
}
m_bottomVertices = projectVerticesOntoTriangles(m_bottomVertices, drawSurfaceVertices);
createNewVerticesAlongTriangleEdges(drawSurfaceVertices);
{
@ -212,34 +201,6 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
}
m_curveDrawable->setVertexArray(vertexArray.p());
}
// Disable filled draw style in the GUI because of triangle stitching issue #2860.
#if 0
{
CVF_ASSERT(m_bottomVertices.size() == m_curveVertices.size());
cvf::ref<cvf::Vec3fArray> vertexArray = new cvf::Vec3fArray(m_bottomVertices.size() + m_curveVertices.size());
for (size_t i = 0; i < m_bottomVertices.size(); ++i)
{
(*vertexArray)[2 * i] = cvf::Vec3f(m_bottomVertices[i]);
(*vertexArray)[2 * i + 1] = cvf::Vec3f(m_curveVertices[i]);
}
std::vector<cvf::uint> indices;
indices.reserve(vertexArray->size());
for (size_t i = 0; i < vertexArray->size(); ++i)
{
indices.push_back(cvf::uint(i));
}
cvf::ref<cvf::PrimitiveSetIndexedUInt> indexedUInt = new cvf::PrimitiveSetIndexedUInt(cvf::PrimitiveType::PT_TRIANGLE_STRIP);
cvf::ref<cvf::UIntArray> indexArray = new cvf::UIntArray(indices);
m_curveFilledDrawable = new cvf::DrawableGeo();
indexedUInt->setIndices(indexArray.p());
m_curveFilledDrawable->addPrimitiveSet(indexedUInt.p());
m_curveFilledDrawable->setVertexArray(vertexArray.p());
}
#endif
}
//--------------------------------------------------------------------------------------------------
@ -248,9 +209,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display
void Riv3dWellLogCurveGeometryGenerator::clearCurvePointsAndGeometry()
{
m_curveDrawable = nullptr;
m_curveFilledDrawable = nullptr;
m_curveVertices.clear();
m_bottomVertices.clear();
m_curveMeasuredDepths.clear();
m_curveValues.clear();
}
@ -263,14 +222,6 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::curveDrawable()
return m_curveDrawable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::curveFilledDrawable()
{
return m_curveFilledDrawable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -330,12 +281,10 @@ bool Riv3dWellLogCurveGeometryGenerator::findClosestPointOnCurve(const cvf::Vec3
void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(const std::vector<cvf::Vec3d>& drawSurfaceVertices)
{
std::vector<cvf::Vec3d> expandedCurveVertices;
std::vector<cvf::Vec3d> expandedBottomVertices;
std::vector<double> expandedMeasuredDepths;
std::vector<double> expandedValues;
size_t estimatedNumberOfPoints = m_curveVertices.size() + drawSurfaceVertices.size();
expandedCurveVertices.reserve(estimatedNumberOfPoints);
expandedBottomVertices.reserve(estimatedNumberOfPoints);
expandedMeasuredDepths.reserve(estimatedNumberOfPoints);
expandedValues.reserve(estimatedNumberOfPoints);
@ -348,17 +297,11 @@ void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(con
cvf::Vec3d fullSegmentVector = m_curveVertices[i + 1] - m_curveVertices[i];
std::vector<cvf::Vec3d> extraVertices;
std::vector<cvf::Vec3d> extraBottomVertices;
createNewVerticesAlongSegment(m_curveVertices[i],
m_curveVertices[i + 1],
drawSurfaceVertices,
&extraVertices,
&m_bottomVertices[i],
&m_bottomVertices[i + 1],
&extraBottomVertices);
CVF_ASSERT(extraVertices.size() == extraBottomVertices.size());
&extraVertices);
for (const cvf::Vec3d& extraVertex : extraVertices)
{
@ -375,22 +318,18 @@ void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(con
expandedValues.push_back(valueAtPoint);
lastVertex = extraVertex;
}
expandedBottomVertices.insert(expandedBottomVertices.end(), extraBottomVertices.begin(), extraBottomVertices.end());
}
else
{
// Add the invalid points and values.
expandedCurveVertices.push_back(m_curveVertices[i]);
expandedBottomVertices.push_back(m_bottomVertices[i]);
expandedMeasuredDepths.push_back(m_curveMeasuredDepths[i]);
expandedValues.push_back(m_curveValues[i]);
}
}
CVF_ASSERT(expandedCurveVertices.size() == expandedBottomVertices.size());
m_curveVertices.swap(expandedCurveVertices);
m_bottomVertices.swap(expandedBottomVertices);
m_curveMeasuredDepths.swap(expandedMeasuredDepths);
m_curveValues.swap(expandedValues);
}
@ -401,21 +340,11 @@ void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongTriangleEdges(con
void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongSegment(const cvf::Vec3d& ptStart,
const cvf::Vec3d& ptEnd,
const std::vector<cvf::Vec3d>& drawSurfaceVertices,
std::vector<cvf::Vec3d>* extraVertices,
const cvf::Vec3d* ptBottomStart,
const cvf::Vec3d* ptBottomEnd,
std::vector<cvf::Vec3d>* extraBottomVertices)
std::vector<cvf::Vec3d>* extraVertices)
{
cvf::Vec3d fullSegmentVector = ptEnd - ptStart;
extraVertices->push_back(ptStart);
cvf::Vec3d fullBottomVector;
if (ptBottomStart && ptBottomEnd && extraBottomVertices)
{
fullBottomVector = *ptBottomEnd - *ptBottomStart;
extraBottomVertices->push_back(*ptBottomStart);
}
// Find segments that intersects the triangle edges
for (size_t j = 0; j < drawSurfaceVertices.size() - 2; j += 1)
{
@ -437,34 +366,9 @@ void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongSegment(const cvf
if (withinSegments && newSegmentVector.lengthSquared() < currentSubSegment.lengthSquared())
{
extraVertices->push_back(newVertex);
if (ptBottomStart && ptBottomEnd && extraBottomVertices)
{
// Do the same for the bottom line, however we need to ensure we add the same amount of points.
cvf::Vec3d currentBottomSegment = *ptBottomEnd - extraBottomVertices->back();
cvf::Vec3d projectedBottomVector =
currentBottomSegment - (currentBottomSegment * triangleNormal) * triangleNormal;
caf::Line<double> projectedBottomLine(extraBottomVertices->back(),
extraBottomVertices->back() + projectedBottomVector);
bool withinBottomSegments = false;
caf::Line<double> bottomConnectingLine =
projectedBottomLine.findLineBetweenNearestPoints(triangleEdge1, &withinBottomSegments);
cvf::Vec3d newBottomVertex = bottomConnectingLine.end();
cvf::Vec3d newBottomVector = newBottomVertex - extraBottomVertices->back();
if (!(withinBottomSegments && newBottomVector.lengthSquared() < fullBottomVector.lengthSquared()))
{
newBottomVertex = extraBottomVertices->back();
}
extraBottomVertices->push_back(newBottomVertex);
}
}
}
extraVertices->push_back(ptEnd);
if (ptBottomStart && ptBottomEnd && extraBottomVertices)
{
extraBottomVertices->push_back(*ptBottomEnd);
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -59,7 +59,6 @@ public:
const RigWellPath* wellPathGeometry() const;
cvf::ref<cvf::DrawableGeo> curveDrawable();
cvf::ref<cvf::DrawableGeo> curveFilledDrawable();
bool findClosestPointOnCurve(const cvf::Vec3d& globalIntersection,
cvf::Vec3d* closestPoint,
@ -71,10 +70,7 @@ private:
static void createNewVerticesAlongSegment(const cvf::Vec3d& ptStart,
const cvf::Vec3d& ptEnd,
const std::vector<cvf::Vec3d>& drawSurfaceVertices,
std::vector<cvf::Vec3d>* extraVertices,
const cvf::Vec3d* ptBottomStart = nullptr,
const cvf::Vec3d* ptBottomEnd = nullptr,
std::vector<cvf::Vec3d>* extraBottomVertices = nullptr);
std::vector<cvf::Vec3d>* extraVertices);
static std::vector<cvf::Vec3d> projectVerticesOntoTriangles(const std::vector<cvf::Vec3d>& originalVertices, const std::vector<cvf::Vec3d>& drawSurfaceVertices);
static cvf::Vec3d projectPointOntoTriangle(const cvf::Vec3d& point,
@ -86,9 +82,7 @@ private:
double m_planeWidth;
cvf::ref<cvf::DrawableGeo> m_curveDrawable;
cvf::ref<cvf::DrawableGeo> m_curveFilledDrawable;
std::vector<cvf::Vec3d> m_curveVertices;
std::vector<cvf::Vec3d> m_bottomVertices;
std::vector<double> m_curveMeasuredDepths;
std::vector<double> m_curveValues;

View File

@ -126,30 +126,6 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurveToModel(cvf::ModelBasicList*
model->addPart(part.p());
}
}
if (rim3dWellLogCurve->drawStyle() == Rim3dWellLogCurve::FILLED)
{
Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection();
cvf::ref<RivObjectSourceInfo> sourceInfo = new RivObjectSourceInfo(curveCollection);
cvf::ref<cvf::DrawableGeo> curveFilledDrawable = generator->curveFilledDrawable();
if (curveFilledDrawable.notNull() && curveFilledDrawable->boundingBox().isValid())
{
caf::SurfaceEffectGenerator filledEffectGen(rim3dWellLogCurve->color(), caf::PO_NONE);
filledEffectGen.enableLighting(false);
cvf::ref<cvf::Effect> filledEffect = filledEffectGen.generateCachedEffect();
cvf::ref<cvf::Part> part = new cvf::Part;
part->setDrawable(curveFilledDrawable.p());
part->setEffect(filledEffect.p());
if (part.notNull())
{
model->addPart(part.p());
part->setSourceInfo(sourceInfo.p());
}
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -51,13 +51,6 @@ namespace caf
setDefault(Rim3dWellLogCurve::VERTICAL_ABOVE);
}
template<>
void AppEnum< Rim3dWellLogCurve::DrawStyle >::setUp()
{
addItem(Rim3dWellLogCurve::LINE, "LINE", "Line");
addItem(Rim3dWellLogCurve::FILLED, "FILLED", "Filled");
setDefault(Rim3dWellLogCurve::LINE);
}
}
//--------------------------------------------------------------------------------------------------
@ -75,7 +68,6 @@ Rim3dWellLogCurve::Rim3dWellLogCurve()
CAF_PDM_InitField(&m_maxCurveUIValue, "MaxCurveValue", std::numeric_limits<float>::infinity(), "Maximum Curve Value", "", "Clip curve values above this.", "");
CAF_PDM_InitField(&m_drawPlane, "DrawPlane", DrawPlaneEnum(VERTICAL_ABOVE), "Draw Plane", "", "", "");
CAF_PDM_InitField(&m_drawStyle, "DrawStyle", DrawStyleEnum(LINE), "Draw Style", "", "", "");
CAF_PDM_InitField(&m_color, "CurveColor", cvf::Color3f(0.0f, 0.0f, 0.0f), "Curve Color", "", "", "");
this->uiCapability()->setUiTreeChildrenHidden(true);
}
@ -105,14 +97,6 @@ Rim3dWellLogCurve::DrawPlane Rim3dWellLogCurve::drawPlane() const
return m_drawPlane();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogCurve::DrawStyle Rim3dWellLogCurve::drawStyle() const
{
return m_drawStyle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -207,8 +191,6 @@ void Rim3dWellLogCurve::configurationUiOrdering(caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* configurationGroup = uiOrdering.addNewGroup("Curve Appearance");
configurationGroup->add(&m_drawPlane);
// Disable filled draw style in the GUI because of triangle stitching issue #2860.
// configurationGroup->add(&m_drawStyle);
configurationGroup->add(&m_color);
configurationGroup->add(&m_minCurveUIValue);
configurationGroup->add(&m_maxCurveUIValue);

View File

@ -51,13 +51,6 @@ public:
};
typedef caf::AppEnum<DrawPlane> DrawPlaneEnum;
enum DrawStyle
{
LINE,
FILLED
};
typedef caf::AppEnum<DrawStyle> DrawStyleEnum;
public:
Rim3dWellLogCurve();
virtual ~Rim3dWellLogCurve();
@ -68,7 +61,6 @@ public:
virtual QString resultPropertyString() const = 0;
DrawPlane drawPlane() const;
DrawStyle drawStyle() const;
double drawPlaneAngle() const;
cvf::Color3f color() const;
@ -99,7 +91,6 @@ private:
void resetMinMaxValues();
protected:
caf::PdmField<DrawPlaneEnum> m_drawPlane;
caf::PdmField<DrawStyleEnum> m_drawStyle;
caf::PdmField<cvf::Color3f> m_color;
caf::PdmField<float> m_minCurveUIValue;
caf::PdmField<float> m_maxCurveUIValue;