From f8254075cddaa6b34d4f62f38a94083cba4eb1a8 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 23 Jan 2014 08:19:37 +0100 Subject: [PATCH] Result Info: Show fault name only when picking on fault --- .../ProjectDataModel/RimReservoirView.cpp | 29 ++++++++++++++----- .../ProjectDataModel/RimReservoirView.h | 4 +-- ApplicationCode/UserInterface/RiuViewer.cpp | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp index 58739f2265..9b0766a371 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp @@ -1098,7 +1098,7 @@ bool RimReservoirView::pickInfo(size_t gridIndex, size_t cellIndex, cvf::StructG //-------------------------------------------------------------------------------------------------- /// Append fault name and result value for the given cell to the string //-------------------------------------------------------------------------------------------------- -void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, QString* resultInfoText) +void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* resultInfoText) { CVF_ASSERT(resultInfoText); @@ -1190,7 +1190,7 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, } } - appendFaultName(grid, cellIndex, resultInfoText); + appendFaultName(grid, cellIndex, face, resultInfoText); } } @@ -1821,7 +1821,7 @@ void RimReservoirView::appendNNCResultInfo(size_t nncIndex, QString* resultInfo) QString gridName = QString::fromStdString(hostGrid->gridName()); resultInfo->append(QString("NNC 1 : cell [%1, %2, %3] face %4 (%5)\n").arg(i).arg(j).arg(k).arg(face.text()).arg(gridName)); - appendFaultName(hostGrid, conn.m_c1GlobIdx, &faultName); + appendFaultName(hostGrid, conn.m_c1GlobIdx, conn.m_c1Face, &faultName); } } @@ -1848,7 +1848,7 @@ void RimReservoirView::appendNNCResultInfo(size_t nncIndex, QString* resultInfo) if (faultName.isEmpty()) { - appendFaultName(hostGrid, conn.m_c2GlobIdx, &faultName); + appendFaultName(hostGrid, conn.m_c2GlobIdx, cvf::StructGridInterface::oppositeFace(conn.m_c1Face), &faultName); } } } @@ -1985,7 +1985,7 @@ void RimReservoirView::updateFaultColors() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimReservoirView::appendFaultName(RigGridBase* grid, size_t cellIndex, QString* resultInfoText) +void RimReservoirView::appendFaultName(RigGridBase* grid, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* resultInfoText) { if (grid->isMainGrid()) { @@ -1998,10 +1998,23 @@ void RimReservoirView::appendFaultName(RigGridBase* grid, size_t cellIndex, QStr for (size_t fIdx = 0; fIdx < faultFaces.size(); fIdx++) { - if (faultFaces[fIdx].m_nativeGlobalCellIndex == cellIndex || - faultFaces[fIdx].m_oppositeGlobalCellIndex == cellIndex) + if (faultFaces[fIdx].m_nativeGlobalCellIndex == cellIndex) { - resultInfoText->append(QString("Fault Name: %1\n").arg(rigFault->name())); + if (face == faultFaces[fIdx].m_nativeFace ) + { + resultInfoText->append(QString("Fault Name: %1\n").arg(rigFault->name())); + } + + return; + } + + if (faultFaces[fIdx].m_oppositeGlobalCellIndex == cellIndex) + { + if (face == cvf::StructGridInterface::oppositeFace(faultFaces[fIdx].m_nativeFace)) + { + resultInfoText->append(QString("Fault Name: %1\n").arg(rigFault->name())); + } + return; } } diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.h b/ApplicationCode/ProjectDataModel/RimReservoirView.h index 4320286e0c..6860e6dab0 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.h +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.h @@ -158,7 +158,7 @@ public: // Picking info bool pickInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, const cvf::Vec3d& point, QString* pickInfoText) const; - void appendCellResultInfo(size_t gridIndex, size_t cellIndex, QString* resultInfoText) ; + void appendCellResultInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* resultInfoText) ; void appendNNCResultInfo(size_t nncIndex, QString* resultInfo); // Does this belong here, really ? @@ -181,7 +181,7 @@ public: // Display model generation private: - void appendFaultName(RigGridBase* grid, size_t cellIndex, QString* resultInfoText); + void appendFaultName(RigGridBase* grid, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* resultInfoText); void createDisplayModel(); void updateDisplayModelVisibility(); diff --git a/ApplicationCode/UserInterface/RiuViewer.cpp b/ApplicationCode/UserInterface/RiuViewer.cpp index 5d4a8dd969..b2af5cf05e 100644 --- a/ApplicationCode/UserInterface/RiuViewer.cpp +++ b/ApplicationCode/UserInterface/RiuViewer.cpp @@ -449,7 +449,7 @@ void RiuViewer::handlePickAction(int winPosX, int winPosY) // Build up result from from both pick info and result values m_reservoirView->pickInfo(gridIndex, cellIndex, face, localIntersectionPoint, &resultInfo); resultInfo += "\n"; - m_reservoirView->appendCellResultInfo(gridIndex, cellIndex, &resultInfo); + m_reservoirView->appendCellResultInfo(gridIndex, cellIndex, face, &resultInfo); #if 0 const RigCaseData* reservoir = m_reservoirView->eclipseCase()->reservoirData(); const RigGridBase* grid = reservoir->grid(gridIndex);