///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2018- Statoil ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "Riv3dWellLogPlanePartMgr.h" #include "Rim3dWellLogCurveCollection.h" #include "RimGridView.h" #include "RimWellPath.h" #include "Riv3dWellLogCurveGeomertyGenerator.h" #include "cafDisplayCoordTransform.h" #include "cafEffectGenerator.h" #include "cvfBoundingBox.h" #include "cvfColor3.h" #include "cvfDrawableGeo.h" #include "cvfModelBasicList.h" #include "cvfPart.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGridView* gridView) : m_wellPath(wellPath) , m_gridView(gridView) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void Riv3dWellLogPlanePartMgr::appendPlaneToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, const cvf::BoundingBox& wellPathClipBoundingBox) { if (m_wellPath.isNull()) return; if (!m_wellPath->rim3dWellLogCurveCollection()) return; if (!m_wellPath->rim3dWellLogCurveCollection()->showPlot()) return; if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return; append3dWellLogCurvesToModel(model, displayCoordTransform, wellPathClipBoundingBox); if (m_wellPath->rim3dWellLogCurveCollection()->showGrid()) { std::map drawPlanes; for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves()) { drawPlanes[rim3dWellLogCurve->drawPlane()]; } for (const std::pair& drawPlane : drawPlanes) { appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, drawPlane.first, 400); } } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, const cvf::BoundingBox& wellPathClipBoundingBox) { if (m_wellPath.isNull()) return; if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return; if (m_3dWellLogCurveGeometryGenerator.isNull()) { m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p(), m_gridView); } for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves()) { if (!rim3dWellLogCurve->toggleState()) continue; cvf::ref curveDrawable = m_3dWellLogCurveGeometryGenerator->createCurveLine(displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve); if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid()) { continue; } caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.9f, 0.0f, 0.0f)); cvf::ref effect = meshEffectGen.generateCachedEffect(); cvf::ref part = new cvf::Part; part->setDrawable(curveDrawable.p()); part->setEffect(effect.p()); if (part.notNull()) { model->addPart(part.p()); } } } cvf::ref Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable, cvf::Effect* effect) { cvf::ref part = new cvf::Part; if (drawable && drawable->boundingBox().isValid()) { part->setDrawable(drawable); part->setEffect(effect); } return part; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, const cvf::BoundingBox& wellPathClipBoundingBox, const Rim3dWellLogCurve::DrawPlane& drawPlane, double gridIntervalSize) { if (m_wellPath.isNull()) return; if (m_3dWellLogCurveGeometryGenerator.isNull()) { m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p(), m_gridView); } caf::MeshEffectGenerator meshEffectGen(cvf::Color3f(0.4f, 0.4f, 0.4f)); { cvf::ref gridHorizontalDrawable = m_3dWellLogCurveGeometryGenerator->createGrid( displayCoordTransform, wellPathClipBoundingBox, drawPlane, gridIntervalSize); cvf::ref effect = meshEffectGen.generateCachedEffect(); cvf::ref part = createPart(gridHorizontalDrawable.p(), effect.p()); if (part.notNull()) { model->addPart(part.p()); } } }