From f78b4db16c91284a9375bbb854b65e152c404f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rnar=20Grip=20Fj=C3=A6r?= Date: Wed, 10 May 2017 17:37:50 +0200 Subject: [PATCH] #1467 Fix how coordinates are displayed in property editor for well path completions --- .../RimWellPathCompletion.cpp | 30 +++++++++++++++++-- .../ProjectDataModel/RimWellPathCompletion.h | 4 +++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCompletion.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCompletion.cpp index 28ca580f16..4ba3abc570 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCompletion.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathCompletion.cpp @@ -32,9 +32,14 @@ RimWellPathCompletion::RimWellPathCompletion() { CAF_PDM_InitObject("WellPathCompletion", ":/Well.png", "", ""); CAF_PDM_InitFieldNoDefault(&m_coordinates, "Coordinates", "Coordinates", "", "", ""); + m_coordinates.uiCapability()->setUiHidden(true); CAF_PDM_InitFieldNoDefault(&m_measuredDepths, "MeasuredDepth", "MeasuredDepth", "", "", ""); - m_measuredDepths.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); + m_measuredDepths.uiCapability()->setUiHidden(true); m_name.uiCapability()->setUiHidden(true); + + CAF_PDM_InitFieldNoDefault(&m_displayCoordinates, "DisplayCoordinates", "Coordinates", "", "", ""); + m_displayCoordinates.registerGetMethod(this, &RimWellPathCompletion::displayCoordinates); + m_displayCoordinates.uiCapability()->setUiReadOnly(true); } @@ -77,6 +82,25 @@ void RimWellPathCompletion::fieldChangedByUi(const caf::PdmFieldHandle* changedF void RimWellPathCompletion::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Geometry"); - geometryGroup->add(&m_coordinates); - geometryGroup->add(&m_measuredDepths); + geometryGroup->add(&m_displayCoordinates); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimWellPathCompletion::displayCoordinates() const +{ + CVF_ASSERT(m_coordinates().size() == m_measuredDepths().size()); + + std::vector displayValues; + + displayValues.push_back(QString("X\tY\tZ\tMD")); + for (size_t i = 0; i < m_coordinates().size(); i++) + { + const cvf::Vec3d& coords = m_coordinates()[i]; + const double& measuredDepth = m_measuredDepths()[i]; + displayValues.push_back(QString("%1\t%2\t%3\t%4\t").arg(coords.x()).arg(coords.y()).arg(coords.z()).arg(measuredDepth)); + } + + return displayValues; } diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCompletion.h b/ApplicationCode/ProjectDataModel/RimWellPathCompletion.h index 60fe5f6177..38309cfeb4 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCompletion.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathCompletion.h @@ -31,6 +31,7 @@ #include "cafPdmFieldCvfColor.h" #include "cafPdmChildArrayField.h" #include "cafPdmFieldCvfVec3d.h" +#include "cafPdmProxyValueField.h" #include "cvfBase.h" #include "cvfObject.h" @@ -57,6 +58,9 @@ public: std::vector< cvf::Vec3d > coordinates() { return m_coordinates(); } std::vector< double > measuredDepths() { return m_measuredDepths(); } private: + std::vector displayCoordinates() const; + caf::PdmField< std::vector< cvf::Vec3d> > m_coordinates; caf::PdmField< std::vector< double > > m_measuredDepths; + caf::PdmProxyValueField< std::vector > m_displayCoordinates; };