From 06504b6fef5891cca359ea78f0a8d5f0280293b3 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Fri, 9 Mar 2018 13:15:01 +0100 Subject: [PATCH] #2585 3D well log curves: Create visualization for a curve, random offsetted from a well path --- .../ModelVisualization/CMakeLists_files.cmake | 4 + .../Riv3dWellLogCurveGeomertyGenerator.cpp | 41 +++++++++ .../Riv3dWellLogCurveGeomertyGenerator.h | 39 ++++++++ .../Riv3dWellLogPlanePartMgr.cpp | 90 +++++++++++++++++++ .../Riv3dWellLogPlanePartMgr.h | 52 +++++++++++ .../ModelVisualization/RivWellPathPartMgr.cpp | 8 +- .../ModelVisualization/RivWellPathPartMgr.h | 3 + .../Rim3dWellLogCurveCollection.cpp | 14 +++ .../Completions/Rim3dWellLogCurveCollection.h | 2 + .../ProjectDataModel/RimWellPath.cpp | 8 ++ .../ProjectDataModel/RimWellPath.h | 4 +- 11 files changed, 261 insertions(+), 4 deletions(-) create mode 100644 ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp create mode 100644 ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h create mode 100644 ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp create mode 100644 ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h diff --git a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake index c2c1d16094..5a4a9719e4 100644 --- a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake +++ b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake @@ -37,6 +37,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionsPartMgr.h ${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 ) set (SOURCE_GROUP_SOURCE_FILES @@ -72,6 +74,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RivWellConnectionsPartMgr.cpp ${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 ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp new file mode 100644 index 0000000000..8e3430071d --- /dev/null +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "Riv3dWellLogCurveGeomertyGenerator.h" + +#include "cvfDrawableGeo.h" +#include "cvfPrimitiveSetIndexedUInt.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref Riv3dWellLogCurveGeometryGenerator::createDrawable(const std::vector& vertices, const std::vector& indices) const +{ + cvf::ref indexedUInt = new cvf::PrimitiveSetIndexedUInt(cvf::PrimitiveType::PT_LINES); + cvf::ref indexArray = new cvf::UIntArray(indices); + + cvf::ref drawable = new cvf::DrawableGeo(); + + indexedUInt->setIndices(indexArray.p()); + drawable->addPrimitiveSet(indexedUInt.p()); + + cvf::ref vertexArray = new cvf::Vec3fArray(vertices); + drawable->setVertexArray(vertexArray.p()); + + return drawable; +} diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h new file mode 100644 index 0000000000..2e6f67d375 --- /dev/null +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cvfObject.h" +#include "cvfBase.h" +#include "cvfDrawableGeo.h" +#include "cvfVector3.h" + +#include + +namespace caf +{ + class DisplayCoordTransform; +} + +class Riv3dWellLogCurveGeometryGenerator : public cvf::Object +{ +public: + Riv3dWellLogCurveGeometryGenerator() = default; + + cvf::ref createDrawable(const std::vector& vertices, const std::vector& indices ) const; +}; diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp new file mode 100644 index 0000000000..5b600f834d --- /dev/null +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RigWellPath.h" + +#include "Riv3dWellLogCurveGeomertyGenerator.h" + +#include "cafDisplayCoordTransform.h" +#include "cafEffectGenerator.h" + +#include "cvfModelBasicList.h" +#include "cvfPart.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RigWellPath* wellPathGeometry) + :m_wellPathGeometry(wellPathGeometry) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + std::vector* rim3dWellLogCurves) +{ + if (rim3dWellLogCurves->empty()) return; + + m_3dWellLogCurveGeometryGenerator = new Riv3dWellLogCurveGeometryGenerator; + + std::vector wellPathPoints = m_wellPathGeometry->m_wellPathPoints; + + std::vector vertices; + vertices.resize(wellPathPoints.size()); + + cvf::Mat4d transMat; + transMat.setTranslation(cvf::Vec3d(0, 0, 10)); + + for (size_t i = 0; i < wellPathPoints.size(); i++) + { + wellPathPoints[i].transformPoint(transMat); + vertices[i] = cvf::Vec3f(displayCoordTransform->transformToDisplayCoord(wellPathPoints[i])); + } + + std::vector indices; + indices.resize((vertices.size() - 1) * 2); + + cvf::uint counter = 0; + for (size_t i = 0; i < indices.size(); i++) + { + indices[i] = counter; + if (i % 2 == 0) counter++; + } + + for (Rim3dWellLogCurve* rim3dWellLogCurve : *rim3dWellLogCurves) + { + cvf::ref drawable = m_3dWellLogCurveGeometryGenerator->createDrawable(vertices, indices); + + caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(255, 0, 0, 0.5), caf::PO_1); + cvf::ref effect = surfaceGen.generateCachedEffect(); + + cvf::ref part = new cvf::Part; + part->setDrawable(drawable.p()); + part->setEffect(effect.p()); + + if (part.notNull()) + { + model->addPart(part.p()); + } + } +} diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h new file mode 100644 index 0000000000..f398fe3c3b --- /dev/null +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cvfObject.h" +#include "cafPdmPointer.h" + +#include "Rim3dWellLogCurve.h" + +namespace cvf +{ + class ModelBasicList; + class Part; +} + +namespace caf +{ + class DisplayCoordTransform; +} + +class Riv3dWellLogCurveGeometryGenerator; +class RigWellPath; + +class Riv3dWellLogPlanePartMgr : public cvf::Object +{ +public: + Riv3dWellLogPlanePartMgr(RigWellPath* wellPathGeometry); + + void append3dWellLogCurvesToModel(cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + std::vector* rim3dWellLogCurves); + +private: + cvf::ref m_3dWellLogCurveGeometryGenerator; + cvf::ref m_wellPathGeometry; +}; \ No newline at end of file diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 05a1cabc68..ba8576b5a3 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -40,15 +40,14 @@ #include "RimWellPathFractureCollection.h" #include "RimWellPathFracture.h" +#include "Riv3dWellLogPlanePartMgr.h" #include "RivFishbonesSubsPartMgr.h" #include "RivObjectSourceInfo.h" #include "RivPartPriority.h" #include "RivPipeGeometryGenerator.h" -#include "RivWellPathSourceInfo.h" - -#include "RivPartPriority.h" #include "RivWellFracturePartMgr.h" #include "RivWellPathPartMgr.h" +#include "RivWellPathSourceInfo.h" #include "cafDisplayCoordTransform.h" #include "cafEffectGenerator.h" @@ -418,6 +417,9 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* return; appendPerforationsToModel(timeStamp, model, displayCoordTransform, characteristicCellSize); + + m_3dWellLogCurvePartMgr = new Riv3dWellLogPlanePartMgr(m_rimWellPath->wellPathGeometry()); + m_3dWellLogCurvePartMgr->append3dWellLogCurvesToModel(model, displayCoordTransform, &m_rimWellPath->vectorOf3dWellLogCurves()); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h index f7c90e5000..b39d4c3a19 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.h @@ -45,6 +45,7 @@ class RimWellPath; class RivFishbonesSubsPartMgr; class RimWellPathCollection; class Rim3dView; +class Riv3dWellLogPlanePartMgr; class QDateTime; @@ -105,4 +106,6 @@ private: cvf::ref m_centerLinePart; cvf::ref m_centerLineDrawable; cvf::ref m_wellLabelPart; + + cvf::ref m_3dWellLogCurvePartMgr; }; diff --git a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp index c7a87d9a35..c1fe487270 100644 --- a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp @@ -63,6 +63,20 @@ void Rim3dWellLogCurveCollection::add3dWellLogCurve(Rim3dWellLogCurve* curve) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector Rim3dWellLogCurveCollection::vectorOf3dWellLogCurves() const +{ + std::vector curves; + for (auto& wellLogCurve : m_3dWellLogCurves) + { + curves.push_back(wellLogCurve); + } + + return curves; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h index 1b4830395e..9e778436d5 100644 --- a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h +++ b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h @@ -39,6 +39,8 @@ public: bool has3dWellLogCurves() const; void add3dWellLogCurve(Rim3dWellLogCurve* curve); + std::vector vectorOf3dWellLogCurves() const; + private: virtual caf::PdmFieldHandle* objectToggleField() override; diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index 7970fd576a..e594785262 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -809,6 +809,14 @@ void RimWellPath::add3dWellLogCurve(Rim3dWellLogCurve* rim3dWellLogCurve) m_3dWellLogCurves->add3dWellLogCurve(rim3dWellLogCurve); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimWellPath::vectorOf3dWellLogCurves() const +{ + return m_3dWellLogCurves->vectorOf3dWellLogCurves(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.h b/ApplicationCode/ProjectDataModel/RimWellPath.h index 47e29cf4f8..4964f99030 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimWellPath.h @@ -22,6 +22,8 @@ #include "RiaEclipseUnitTools.h" +#include "Rim3dWellLogCurve.h" + #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPointer.h" @@ -51,7 +53,6 @@ class RigWellPathFormations; class RimWellPathFractureCollection; class Rim3dWellLogCurveCollection; -class Rim3dWellLogCurve; //================================================================================================== /// @@ -79,6 +80,7 @@ public: const RigWellPathFormations* formationsGeometry() const; void add3dWellLogCurve(Rim3dWellLogCurve* rim3dWellLogCurve); + std::vector vectorOf3dWellLogCurves() const; virtual caf::PdmFieldHandle* userDescriptionField() override; virtual caf::PdmFieldHandle* objectToggleField() override;