#2591 3D Well Log Curve: Make geometry making more robust

This commit is contained in:
Rebecca Cox 2018-03-15 13:04:39 +01:00
parent ab800390dd
commit 69caf4b3b2
2 changed files with 17 additions and 2 deletions

View File

@ -38,6 +38,11 @@ cvf::ref<cvf::DrawableGeo>
createCurveVerticesAndIndices(rim3dWellLogCurve, displayCoordTransform, &vertices, &indices);
if (vertices.empty() || indices.empty())
{
return nullptr;
}
cvf::ref<cvf::PrimitiveSetIndexedUInt> indexedUInt = new cvf::PrimitiveSetIndexedUInt(cvf::PrimitiveType::PT_LINES);
cvf::ref<cvf::UIntArray> indexArray = new cvf::UIntArray(indices);
@ -58,6 +63,10 @@ cvf::ref<cvf::DrawableGeo>
cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
const Rim3dWellLogCurve* rim3dWellLogCurve) const
{
cvf::ref<cvf::DrawableGeo> drawable = new cvf::DrawableGeo();
if (m_wellPathGeometry.isNull()) return drawable;
std::vector<cvf::Vec3d> wellPathPoints = m_wellPathGeometry->m_wellPathPoints;
cvf::Vec3d globalDirection = (wellPathPoints.back() - wellPathPoints.front()).getNormalized();
@ -84,7 +93,6 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
cvf::ref<cvf::PrimitiveSetIndexedUInt> indexedUInt = new cvf::PrimitiveSetIndexedUInt(cvf::PrimitiveType::PT_LINES);
cvf::ref<cvf::UIntArray> indexArray = new cvf::UIntArray(indices);
cvf::ref<cvf::DrawableGeo> drawable = new cvf::DrawableGeo();
indexedUInt->setIndices(indexArray.p());
drawable->addPrimitiveSet(indexedUInt.p());

View File

@ -46,6 +46,7 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
std::vector<Rim3dWellLogCurve*> rim3dWellLogCurves)
{
if (rim3dWellLogCurves.empty()) return;
if (m_wellPathGeometry.isNull()) return;
m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPathGeometry.p());
@ -55,6 +56,11 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
cvf::ref<cvf::Drawable> curveDrawable = m_3dWellLogCurveGeometryGenerator->createCurveLine(displayCoordTransform, rim3dWellLogCurve);
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
{
continue;
}
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(255, 0, 0, 0.5), caf::PO_1);
cvf::ref<cvf::Effect> effect = surfaceGen.generateCachedEffect();
@ -71,10 +77,11 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
//TODO: Atm, only the grid for the first curve is drawn.
cvf::ref<cvf::Drawable> gridDrawable = m_3dWellLogCurveGeometryGenerator->createGrid(displayCoordTransform, rim3dWellLogCurves[0]);
if (!gridDrawable->boundingBox().isValid())
if (gridDrawable.isNull() || !gridDrawable->boundingBox().isValid())
{
return;
}
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(255, 255, 0, 1), caf::PO_1);
cvf::ref<cvf::Effect> effect = surfaceGen.generateCachedEffect();