From 1f44ea1ea3b9c075d3cab7d018fb57bc5f3f9c25 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Mon, 30 Apr 2018 09:22:59 +0200 Subject: [PATCH] Make draw plane selection for curves be unrelated to 3d Track (somewhat related to #2825). * Makes more sense user wise and makes for better code. * Helps refactor code to relate grids to curves so the curves can have access to the grid it is being drawn on. * This will help fix #2825 by being able to project curve points onto the exact triangle geometry. --- .../Riv3dWellLogCurveGeomertyGenerator.cpp | 16 +-- .../Riv3dWellLogCurveGeomertyGenerator.h | 9 +- .../Riv3dWellLogGridGeomertyGenerator.cpp | 73 +++++++--- .../Riv3dWellLogGridGeomertyGenerator.h | 13 +- .../Riv3dWellLogPlanePartMgr.cpp | 126 +++++------------- .../Riv3dWellLogPlanePartMgr.h | 10 +- .../Rim3dWellLogCurveCollection.cpp | 31 ----- .../Completions/Rim3dWellLogCurveCollection.h | 11 -- .../ProjectDataModel/Rim3dWellLogCurve.cpp | 53 ++++---- .../ProjectDataModel/Rim3dWellLogCurve.h | 10 +- .../Rim3dWellLogExtractionCurve.cpp | 4 +- .../Rim3dWellLogFileCurve.cpp | 2 +- .../ProjectDataModel/Rim3dWellLogRftCurve.cpp | 2 + .../RimWellLogCurveNameConfig.cpp | 9 +- 14 files changed, 153 insertions(+), 216 deletions(-) diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp index 4d0dcc4b49..d7c5ef1a1b 100644 --- a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp @@ -47,14 +47,14 @@ Riv3dWellLogCurveGeometryGenerator::Riv3dWellLogCurveGeometryGenerator(RimWellPa //-------------------------------------------------------------------------------------------------- void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::DisplayCoordTransform* displayCoordTransform, const cvf::BoundingBox& wellPathClipBoundingBox, - const std::vector& resultValues, - const std::vector& resultMds, - double minResultValue, - double maxResultValue, - double planeAngle, + const Rim3dWellLogCurve* rim3dWellLogCurve, double planeOffsetFromWellPathCenter, double planeWidth) { + std::vector resultValues; + std::vector resultMds; + rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds); + m_planeWidth = planeWidth; // Make sure all drawables are cleared in case we return early to avoid a @@ -68,7 +68,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display if (resultValues.empty()) return; CVF_ASSERT(resultValues.size() == resultMds.size()); - if (maxResultValue - minResultValue < 1.0e-6) + if (rim3dWellLogCurve->maxCurveValue() - rim3dWellLogCurve->minCurveValue() < 1.0e-6) { return; } @@ -90,7 +90,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display wellPathPoint = displayCoordTransform->transformToDisplayCoord(wellPathPoint); } - std::vector wellPathCurveNormals = RigWellPathGeometryTools::calculateLineSegmentNormals(wellPathPoints, planeAngle); + std::vector wellPathCurveNormals = RigWellPathGeometryTools::calculateLineSegmentNormals(wellPathPoints, rim3dWellLogCurve->drawPlaneAngle()); std::vector interpolatedWellPathPoints; std::vector interpolatedCurveNormals; @@ -123,7 +123,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables(const caf::Display { if (!RigCurveDataTools::isValidValue(result, false)) continue; - result = cvf::Math::clamp(result, minResultValue, maxResultValue); + result = cvf::Math::clamp(result, rim3dWellLogCurve->minCurveValue(), rim3dWellLogCurve->maxCurveValue()); maxClampedResult = std::max(result, maxClampedResult); minClampedResult = std::min(result, minClampedResult); diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h index 5905300657..23dd4e27a9 100644 --- a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.h @@ -39,6 +39,7 @@ class BoundingBox; class RigWellPath; class RimWellPath; +class Rim3dWellLogCurve; class Riv3dWellLogCurveGeometryGenerator : public cvf::Object { @@ -48,13 +49,9 @@ public: void createCurveDrawables(const caf::DisplayCoordTransform* displayCoordTransform, const cvf::BoundingBox& wellPathClipBoundingBox, - const std::vector& resultValues, - const std::vector& resultMds, - double planeAngle, + const Rim3dWellLogCurve* rim3dWellLogCurve, double planeOffsetFromWellPathCenter, - double planeWidth, - double minResultValue, - double maxResultValue); + double planeWidth); void clearCurvePointsAndGeometry(); diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.cpp b/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.cpp index dba5542126..4d44520580 100644 --- a/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.cpp +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.cpp @@ -56,6 +56,8 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* { CVF_ASSERT(gridIntervalSize > 0); + clearGeometry(); + if (!wellPathGeometry() || wellPathGeometry()->m_measuredDepths.empty()) { return false; @@ -81,7 +83,7 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* wellPathPoint = displayCoordTransform->transformToDisplayCoord(wellPathPoint); } - std::vector wellPathSegmentNormals = + std::vector segmentNormals = RigWellPathGeometryTools::calculateLineSegmentNormals(wellPathPoints, planeAngle); @@ -106,11 +108,10 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* // Note that normals are calculated on the full non-clipped well path to increase the likelihood of creating good normals // for the end points of the curve. So we need to clip the remainder here. - wellPathSegmentNormals.erase(wellPathSegmentNormals.begin(), wellPathSegmentNormals.end() - wellPathPoints.size()); + segmentNormals.erase(segmentNormals.begin(), segmentNormals.end() - wellPathPoints.size()); { - std::vector vertices; - vertices.reserve(wellPathPoints.size() * 2); + m_vertices.reserve(wellPathPoints.size() * 2); std::vector backgroundIndices; backgroundIndices.reserve(wellPathPoints.size() * 2); @@ -118,15 +119,15 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* // Vertices are used for both surface and border for (size_t i = 0; i < wellPathPoints.size(); i++) { - vertices.push_back(cvf::Vec3f( - wellPathPoints[i] + wellPathSegmentNormals[i] * planeOffsetFromWellPathCenter)); - vertices.push_back(cvf::Vec3f( - wellPathPoints[i] + wellPathSegmentNormals[i] * (planeOffsetFromWellPathCenter + planeWidth))); + m_vertices.push_back(cvf::Vec3f( + wellPathPoints[i] + segmentNormals[i] * planeOffsetFromWellPathCenter)); + m_vertices.push_back(cvf::Vec3f( + wellPathPoints[i] + segmentNormals[i] * (planeOffsetFromWellPathCenter + planeWidth))); backgroundIndices.push_back((cvf::uint) (2 * i)); backgroundIndices.push_back((cvf::uint) (2 * i + 1)); } - cvf::ref vertexArray = new cvf::Vec3fArray(vertices); + cvf::ref vertexArray = new cvf::Vec3fArray(m_vertices); { // Background specific @@ -141,9 +142,9 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* { std::vector borderIndices; - borderIndices.reserve(vertices.size()); + borderIndices.reserve(m_vertices.size()); - int secondLastEvenVertex = (int) vertices.size() - 4; + int secondLastEvenVertex = (int) m_vertices.size() - 4; // Border close to the well. All even indices. for (int i = 0; i <= secondLastEvenVertex; i += 2) @@ -153,11 +154,11 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* } // Connect to border away from well - borderIndices.push_back((cvf::uint) (vertices.size() - 2)); - borderIndices.push_back((cvf::uint) (vertices.size() - 1)); + borderIndices.push_back((cvf::uint) (m_vertices.size() - 2)); + borderIndices.push_back((cvf::uint) (m_vertices.size() - 1)); int secondOddVertex = 3; - int lastOddVertex = (int) vertices.size() - 1; + int lastOddVertex = (int) m_vertices.size() - 1; // Border away from from well are odd indices in reverse order to create a closed surface. for (int i = lastOddVertex; i >= secondOddVertex; i -= 2) @@ -190,15 +191,15 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* while (md >= firstMd) { cvf::Vec3d point = wellPathGeometry()->interpolatedVectorAlongWellPath(wellPathPoints, md); - cvf::Vec3d curveNormal = wellPathGeometry()->interpolatedVectorAlongWellPath(wellPathSegmentNormals, md); + cvf::Vec3d curveNormal = wellPathGeometry()->interpolatedVectorAlongWellPath(segmentNormals, md); interpolatedGridPoints.push_back(point); interpolatedGridCurveNormals.push_back(curveNormal.getNormalized()); md -= gridIntervalSize; } - std::vector vertices; + std::vector arrowVertices; std::vector arrowVectors; - vertices.reserve(interpolatedGridPoints.size()); + arrowVertices.reserve(interpolatedGridPoints.size()); arrowVectors.reserve(interpolatedGridPoints.size()); double shaftRelativeRadius = 0.0125f; @@ -208,14 +209,14 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* // Normal lines. Start from one to avoid drawing at surface edge. for (size_t i = 1; i < interpolatedGridCurveNormals.size(); i++) { - vertices.push_back(cvf::Vec3f(interpolatedGridPoints[i] + interpolatedGridCurveNormals[i] * planeOffsetFromWellPathCenter)); + arrowVertices.push_back(cvf::Vec3f(interpolatedGridPoints[i] + interpolatedGridCurveNormals[i] * planeOffsetFromWellPathCenter)); arrowVectors.push_back(cvf::Vec3f(interpolatedGridCurveNormals[i] * planeWidth * totalArrowScaling)); } m_curveNormalVectors = new cvf::DrawableVectors(); - cvf::ref vertexArray = new cvf::Vec3fArray(vertices); + cvf::ref vertexArray = new cvf::Vec3fArray(arrowVertices); cvf::ref vectorArray = new cvf::Vec3fArray(arrowVectors); // Create the arrow glyph for the vector drawer @@ -233,21 +234,49 @@ Riv3dWellLogGridGeometryGenerator::createGrid(const caf::DisplayCoordTransform* return true; } -cvf::ref Riv3dWellLogGridGeometryGenerator::background() +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Riv3dWellLogGridGeometryGenerator::clearGeometry() +{ + m_background = nullptr; + m_border = nullptr; + m_curveNormalVectors = nullptr; + m_vertices.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref Riv3dWellLogGridGeometryGenerator::background() const { return m_background; } -cvf::ref Riv3dWellLogGridGeometryGenerator::border() +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref Riv3dWellLogGridGeometryGenerator::border() const { return m_border; } -cvf::ref Riv3dWellLogGridGeometryGenerator::curveNormalVectors() +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref Riv3dWellLogGridGeometryGenerator::curveNormalVectors() const { return m_curveNormalVectors; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& Riv3dWellLogGridGeometryGenerator::vertices() const +{ + return m_vertices; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.h b/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.h index 36e69aef76..b506115127 100644 --- a/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.h +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogGridGeomertyGenerator.h @@ -51,10 +51,15 @@ public: double planeOffsetFromWellPathCenter, double planeWidth, double gridIntervalSize); + + void clearGeometry(); + + cvf::ref background() const; + cvf::ref border() const; + cvf::ref curveNormalVectors() const; + + const std::vector& vertices() const; - cvf::ref background(); - cvf::ref border(); - cvf::ref curveNormalVectors(); private: const RigWellPath* wellPathGeometry() const; @@ -63,4 +68,6 @@ private: cvf::ref m_background; cvf::ref m_border; cvf::ref m_curveNormalVectors; + + std::vector m_vertices; }; diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp index 415f8104f0..b169a5c9bd 100644 --- a/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.cpp @@ -70,71 +70,55 @@ void Riv3dWellLogPlanePartMgr::appendPlaneToModel(cvf::ModelBasicList* if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return; - append3dWellLogCurvesToModel(model, displayCoordTransform, wellPathClipBoundingBox); - for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves()) { appendGridToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve, planeWidth()); + append3dWellLogCurveToModel(model, displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList* model, - const caf::DisplayCoordTransform* displayCoordTransform, - const cvf::BoundingBox& wellPathClipBoundingBox) +void Riv3dWellLogPlanePartMgr::append3dWellLogCurveToModel(cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + const cvf::BoundingBox& wellPathClipBoundingBox, + Rim3dWellLogCurve* rim3dWellLogCurve) { - if (m_wellPath.isNull()) return; - if (!m_wellPath->rim3dWellLogCurveCollection()) return; - if (m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves().empty()) return; + CVF_ASSERT(rim3dWellLogCurve); + if (!rim3dWellLogCurve->isShowingCurve()) return; - Rim3dWellLogCurveCollection* curveCollection = m_wellPath->rim3dWellLogCurveCollection(); - - for (Rim3dWellLogCurve* rim3dWellLogCurve : m_wellPath->rim3dWellLogCurveCollection()->vectorOf3dWellLogCurves()) + cvf::ref generator = rim3dWellLogCurve->geometryGenerator(); + if (generator.isNull()) { - cvf::ref generator = rim3dWellLogCurve->geometryGenerator(); - if (generator.isNull()) - { - generator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p()); - rim3dWellLogCurve->setGeometryGenerator(generator.p()); - } - - if (!rim3dWellLogCurve->isShowingCurve()) continue; + generator = new Riv3dWellLogCurveGeometryGenerator(m_wellPath.p()); + rim3dWellLogCurve->setGeometryGenerator(generator.p()); + } - std::vector resultValues; - std::vector resultMds; - rim3dWellLogCurve->curveValuesAndMds(&resultValues, &resultMds); + generator->createCurveDrawables(displayCoordTransform, + wellPathClipBoundingBox, + rim3dWellLogCurve, + wellPathCenterToPlotStartOffset(rim3dWellLogCurve), + planeWidth()); - generator->createCurveDrawables(displayCoordTransform, - wellPathClipBoundingBox, - resultValues, - resultMds, - rim3dWellLogCurve->minCurveValue(), - rim3dWellLogCurve->maxCurveValue(), - planeAngle(curveCollection, rim3dWellLogCurve), - wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve), - planeWidth()); + cvf::ref curveDrawable = generator->curveDrawable(); - cvf::ref curveDrawable = generator->curveDrawable(); + if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid()) + { + return; + } - if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid()) - { - continue; - } + caf::MeshEffectGenerator meshEffectGen(rim3dWellLogCurve->color()); + meshEffectGen.setLineWidth(2.0f); + cvf::ref effect = meshEffectGen.generateCachedEffect(); - caf::MeshEffectGenerator meshEffectGen(rim3dWellLogCurve->color()); - meshEffectGen.setLineWidth(2.0f); - cvf::ref effect = meshEffectGen.generateCachedEffect(); + cvf::ref part = new cvf::Part; + part->setDrawable(curveDrawable.p()); + part->setEffect(effect.p()); - cvf::ref part = new cvf::Part; - part->setDrawable(curveDrawable.p()); - part->setEffect(effect.p()); - - if (part.notNull()) - { - model->addPart(part.p()); - } + if (part.notNull()) + { + model->addPart(part.p()); } } @@ -157,48 +141,10 @@ cvf::ref Riv3dWellLogPlanePartMgr::createPart(cvf::Drawable* drawable //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double Riv3dWellLogPlanePartMgr::planeAngle(const Rim3dWellLogCurveCollection* collection, - const Rim3dWellLogCurve* curve) +double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset(const Rim3dWellLogCurve* curve) const { - switch (curve->drawPlane()) - { - case Rim3dWellLogCurve::HORIZONTAL_LEFT: - return cvf::PI_D / 2.0; - case Rim3dWellLogCurve::HORIZONTAL_RIGHT: - if (collection->planePositionHorizontal() == Rim3dWellLogCurveCollection::ON_WELLPATH) - { - return cvf::PI_D / 2.0; // Always left when on well path - } - return -cvf::PI_D / 2.0; - case Rim3dWellLogCurve::VERTICAL_ABOVE: - return 0.0; - case Rim3dWellLogCurve::VERTICAL_BELOW: - if (collection->planePositionVertical() == Rim3dWellLogCurveCollection::ON_WELLPATH) - { - return 0.0; // Always above when on well path. - } - return cvf::PI_D; - default: - return 0; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double Riv3dWellLogPlanePartMgr::wellPathCenterToPlotStartOffset(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve) const -{ - bool centered = false; - if (curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_LEFT || - curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_RIGHT) - { - centered = collection->planePositionHorizontal() == Rim3dWellLogCurveCollection::ON_WELLPATH; - } - else - { - centered = collection->planePositionVertical() == Rim3dWellLogCurveCollection::ON_WELLPATH; - } - if (centered) + if (curve->drawPlane() == Rim3dWellLogCurve::HORIZONTAL_CENTER || + curve->drawPlane() == Rim3dWellLogCurve::VERTICAL_CENTER) { return -0.5*planeWidth(); } @@ -251,8 +197,8 @@ void Riv3dWellLogPlanePartMgr::appendGridToModel(cvf::ModelBasicList* bool gridCreated = m_3dWellLogGridGeometryGenerator->createGrid(displayCoordTransform, wellPathClipBoundingBox, - planeAngle(curveCollection, rim3dWellLogCurve), - wellPathCenterToPlotStartOffset(curveCollection, rim3dWellLogCurve), + rim3dWellLogCurve->drawPlaneAngle(), + wellPathCenterToPlotStartOffset(rim3dWellLogCurve), planeWidth(), gridIntervalSize); if (!gridCreated) return; diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h index fa6b639612..44772acb03 100644 --- a/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogPlanePartMgr.h @@ -56,9 +56,10 @@ public: const caf::DisplayCoordTransform* displayCoordTransform, const cvf::BoundingBox& wellPathClipBoundingBox); private: - void append3dWellLogCurvesToModel(cvf::ModelBasicList* model, - const caf::DisplayCoordTransform* displayCoordTransform, - const cvf::BoundingBox& wellPathClipBoundingBox); + void append3dWellLogCurveToModel(cvf::ModelBasicList* model, + const caf::DisplayCoordTransform* displayCoordTransform, + const cvf::BoundingBox& wellPathClipBoundingBox, + Rim3dWellLogCurve* rim3dWellLogCurve); void appendGridToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, @@ -68,8 +69,7 @@ private: cvf::ref createPart(cvf::Drawable* drawable, cvf::Effect* effect); - static double planeAngle(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve); - double wellPathCenterToPlotStartOffset(const Rim3dWellLogCurveCollection* collection, const Rim3dWellLogCurve* curve) const; + double wellPathCenterToPlotStartOffset(const Rim3dWellLogCurve* curve) const; double planeWidth() const; private: diff --git a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp index bb5524a750..2ad6866768 100644 --- a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp @@ -28,17 +28,6 @@ CAF_PDM_SOURCE_INIT(Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection"); -namespace caf -{ - template<> - void AppEnum< Rim3dWellLogCurveCollection::PlanePosition >::setUp() - { - addItem(Rim3dWellLogCurveCollection::ALONG_WELLPATH, "ALONG_WELLPATH", "Beside Well Path"); - addItem(Rim3dWellLogCurveCollection::ON_WELLPATH, "ON_WELLPATH", "Centered On Well Path"); - setDefault(Rim3dWellLogCurveCollection::ALONG_WELLPATH); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -49,8 +38,6 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection() CAF_PDM_InitField(&m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", ""); m_showPlot.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault(&m_planePositionVertical, "PlanePositionVertical", "Vertical Position", "", "", ""); - CAF_PDM_InitFieldNoDefault(&m_planePositionHorizontal, "PlanePositionHorizontal", "Horizontal Position", "", "", ""); CAF_PDM_InitField(&m_planeWidthScaling, "PlaneWidthScaling", 1.0f, "Width Scaling", "", "", ""); m_planeWidthScaling.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName()); CAF_PDM_InitField(&m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", ""); @@ -121,22 +108,6 @@ bool Rim3dWellLogCurveCollection::isShowingBackground() const return m_showBackground; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePositionVertical() const -{ - return m_planePositionVertical(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -Rim3dWellLogCurveCollection::PlanePosition Rim3dWellLogCurveCollection::planePositionHorizontal() const -{ - return m_planePositionHorizontal(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -232,8 +203,6 @@ caf::PdmFieldHandle* Rim3dWellLogCurveCollection::objectToggleField() void Rim3dWellLogCurveCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { caf::PdmUiGroup* settingsGroup = uiOrdering.addNewGroup("Draw Plane Configuration"); - settingsGroup->add(&m_planePositionVertical); - settingsGroup->add(&m_planePositionHorizontal); settingsGroup->add(&m_planeWidthScaling); caf::PdmUiGroup* appearanceSettingsGroup = uiOrdering.addNewGroup("Draw Plane Appearance"); diff --git a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h index f495e9ab0e..1121aefa26 100644 --- a/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h +++ b/ApplicationCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.h @@ -36,13 +36,6 @@ class Rim3dWellLogCurveCollection : public caf::PdmObject { CAF_PDM_HEADER_INIT; -public: - enum PlanePosition - { - ALONG_WELLPATH, - ON_WELLPATH - }; - public: Rim3dWellLogCurveCollection(); virtual ~Rim3dWellLogCurveCollection(); @@ -55,8 +48,6 @@ public: bool isShowingGrid() const; bool isShowingBackground() const; - PlanePosition planePositionVertical() const; - PlanePosition planePositionHorizontal() const; float planeWidthScaling() const; std::vector vectorOf3dWellLogCurves() const; @@ -73,8 +64,6 @@ private: virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); private: caf::PdmField m_showPlot; - caf::PdmField> m_planePositionVertical; - caf::PdmField> m_planePositionHorizontal; caf::PdmField m_planeWidthScaling; caf::PdmField m_showGrid; diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp index 9d3d75f0b0..421caa654a 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp @@ -44,8 +44,10 @@ namespace caf void AppEnum< Rim3dWellLogCurve::DrawPlane >::setUp() { addItem(Rim3dWellLogCurve::VERTICAL_ABOVE, "VERTICAL_ABOVE", "Above"); + addItem(Rim3dWellLogCurve::VERTICAL_CENTER, "VERTICAL_CENTER", "Centered - Vertical"); addItem(Rim3dWellLogCurve::VERTICAL_BELOW, "VERTICAL_BELOW", "Below"); addItem(Rim3dWellLogCurve::HORIZONTAL_LEFT, "HORIZONTAL_LEFT", "Left"); + addItem(Rim3dWellLogCurve::HORIZONTAL_CENTER, "HORIZONTAL_CENTER", "Centered - Horizontal"); addItem(Rim3dWellLogCurve::HORIZONTAL_RIGHT, "HORIZONTAL_RIGHT", "Right"); setDefault(Rim3dWellLogCurve::VERTICAL_ABOVE); } @@ -96,6 +98,28 @@ Rim3dWellLogCurve::DrawPlane Rim3dWellLogCurve::drawPlane() const return m_drawPlane(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double Rim3dWellLogCurve::drawPlaneAngle() const +{ + switch (drawPlane()) + { + case HORIZONTAL_LEFT: + case HORIZONTAL_CENTER: + return cvf::PI_D / 2.0; + case HORIZONTAL_RIGHT: + return -cvf::PI_D / 2.0; + case VERTICAL_ABOVE: + case VERTICAL_CENTER: + return 0.0; + case VERTICAL_BELOW: + return cvf::PI_D; + default: + return 0; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -173,35 +197,6 @@ void Rim3dWellLogCurve::configurationUiOrdering(caf::PdmUiOrdering& uiOrdering) configurationGroup->add(&m_maxCurveValue); } -QList Rim3dWellLogCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) -{ - QList options; - if (fieldNeedingOptions == &m_drawPlane) - { - Rim3dWellLogCurveCollection* collection; - this->firstAncestorOrThisOfTypeAsserted(collection); - if (collection->planePositionVertical() == Rim3dWellLogCurveCollection::ALONG_WELLPATH) - { - options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::VERTICAL_ABOVE), Rim3dWellLogCurve::VERTICAL_ABOVE)); - options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::VERTICAL_BELOW), Rim3dWellLogCurve::VERTICAL_BELOW)); - } - else - { - options.push_back(caf::PdmOptionItemInfo(QString("Vertical"), Rim3dWellLogCurve::VERTICAL_ABOVE)); - } - if (collection->planePositionHorizontal() == Rim3dWellLogCurveCollection::ALONG_WELLPATH) - { - options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::HORIZONTAL_LEFT), Rim3dWellLogCurve::HORIZONTAL_LEFT)); - options.push_back(caf::PdmOptionItemInfo(DrawPlaneEnum::uiText(Rim3dWellLogCurve::HORIZONTAL_RIGHT), Rim3dWellLogCurve::HORIZONTAL_RIGHT)); - } - else - { - options.push_back(caf::PdmOptionItemInfo(QString("Horizontal"), Rim3dWellLogCurve::HORIZONTAL_LEFT)); - } - } - return options; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h index 1b3f68ad47..b14fe8e0bf 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h @@ -43,9 +43,11 @@ public: enum DrawPlane { VERTICAL_ABOVE, - VERTICAL_BELOW, + VERTICAL_CENTER, + VERTICAL_BELOW, HORIZONTAL_LEFT, - HORIZONTAL_RIGHT + HORIZONTAL_CENTER, + HORIZONTAL_RIGHT }; typedef caf::AppEnum DrawPlaneEnum; public: @@ -56,7 +58,10 @@ public: virtual QString name() const = 0; virtual QString resultPropertyString() const = 0; + DrawPlane drawPlane() const; + double drawPlaneAngle() const; + cvf::Color3f color() const; bool isShowingCurve() const; @@ -79,7 +84,6 @@ protected: virtual caf::PdmFieldHandle* objectToggleField() override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void configurationUiOrdering(caf::PdmUiOrdering& uiOrdering); - virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute); virtual void initAfterRead(); private: diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp index 8d02ef6745..d7cb84510b 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp @@ -78,7 +78,7 @@ Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve() m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden(true); m_geomResultDefinition = new RimGeoMechResultDefinition; - CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameGenerator", "", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); m_nameConfig = new RimWellLogExtractionCurveNameConfig(this); } @@ -328,7 +328,7 @@ void Rim3dWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::Pd Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); - caf::PdmUiGroup* nameGroup = m_nameConfig()->createUiGroup(uiConfigName, uiOrdering); + m_nameConfig()->createUiGroup(uiConfigName, uiOrdering); uiOrdering.skipRemainingFields(true); } diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp index dcd47d0bca..40976b2b95 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp @@ -252,7 +252,7 @@ void Rim3dWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); - caf::PdmUiGroup* nameGroup = m_nameConfig()->createUiGroup(uiConfigName, uiOrdering); + m_nameConfig()->createUiGroup(uiConfigName, uiOrdering); uiOrdering.skipRemainingFields(true); } diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp index 85ad411929..94cf60912d 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp @@ -213,6 +213,8 @@ void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); + m_nameConfig()->createUiGroup(uiConfigName, uiOrdering); + uiOrdering.skipRemainingFields(true); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurveNameConfig.cpp b/ApplicationCode/ProjectDataModel/RimWellLogCurveNameConfig.cpp index 7bbc4903b8..c153c7c271 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurveNameConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurveNameConfig.cpp @@ -26,7 +26,7 @@ /// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimCurveNameConfig, "RimCurveNameGenerator"); +CAF_PDM_SOURCE_INIT(RimCurveNameConfig, "RimCurveNameConfig"); //-------------------------------------------------------------------------------------------------- /// @@ -108,7 +108,6 @@ void RimCurveNameConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel if (changedField == &m_isUsingAutoName && !isUsingAutoName()) { m_customName = m_configHolder->createCurveAutoName(); - m_customName.uiCapability()->updateConnectedEditors(); } updateAllSettings(); @@ -152,7 +151,7 @@ void RimCurveNameConfig::updateAllSettings() /// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameGenerator"); +CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig"); //-------------------------------------------------------------------------------------------------- /// @@ -244,7 +243,7 @@ void RimWellLogExtractionCurveNameConfig::updateAllSettings() /// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameGenerator"); +CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig"); //-------------------------------------------------------------------------------------------------- /// @@ -261,7 +260,7 @@ RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig(const RimCurveNameC /// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameGenerator"); +CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig"); //-------------------------------------------------------------------------------------------------- ///