Whitespace

This commit is contained in:
Magne Sjaastad 2019-01-02 14:41:17 +01:00
parent fe75265053
commit 8709734697

View File

@ -23,11 +23,11 @@
#include "RiaColorTables.h"
#include "RiaDefines.h"
#include "MeasurementCommands/RicMeasurementPickEventHandler.h"
#include "RicContourMapPickEventHandler.h"
#include "RicEclipsePropertyFilterNewExec.h"
#include "RicGeoMechPropertyFilterNewExec.h"
#include "RicPickEventHandler.h"
#include "RicContourMapPickEventHandler.h"
#include "MeasurementCommands/RicMeasurementPickEventHandler.h"
#include "WellLogCommands/Ric3dWellLogCurvePickEventHandler.h"
#include "WellPathCommands/RicIntersectionPickEventHandler.h"
#include "WellPathCommands/RicWellPathPickEventHandler.h"
@ -60,21 +60,22 @@
#include "RimPerforationInterval.h"
#include "RimSimWellInView.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimTextAnnotation.h"
#include "RimViewController.h"
#include "RimWellPath.h"
#include "RimTextAnnotation.h"
#include "RiuMainWindow.h"
#include "RiuResultTextBuilder.h"
#include "Riu3dSelectionManager.h"
#include "RiuViewer.h"
#include "RiuMainWindow.h"
#include "RiuPickItemInfo.h"
#include "RiuResultTextBuilder.h"
#include "RiuViewer.h"
#include "RivFemPartGeometryGenerator.h"
#include "RivFemPickSourceInfo.h"
#include "RivIntersectionBoxSourceInfo.h"
#include "RivIntersectionSourceInfo.h"
#include "RivObjectSourceInfo.h"
#include "RivPartPriority.h"
#include "RivSimWellConnectionSourceInfo.h"
#include "RivSimWellPipeSourceInfo.h"
#include "RivSourceInfo.h"
@ -82,24 +83,23 @@
#include "RivWellConnectionSourceInfo.h"
#include "RivWellFracturePartMgr.h"
#include "RivWellPathSourceInfo.h"
#include "RivPartPriority.h"
#include "cafCmdExecCommandManager.h"
#include "cafCmdFeatureManager.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafDisplayCoordTransform.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cafPdmUiTreeView.h"
#include "cafSelectionManager.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfHitItemCollection.h"
#include "cvfOverlayAxisCross.h"
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfScene.h"
#include "cvfDrawableText.h"
#include "cvfRay.h"
#include "cvfScene.h"
#include "cvfTransform.h"
#include <QMenu>
#include <QMouseEvent>
@ -107,7 +107,6 @@
#include <array>
//==================================================================================================
//
// RiaViewerCommands
@ -127,7 +126,7 @@ RiuViewerCommands::RiuViewerCommands(RiuViewer* ownerViewer)
, m_currentPickPositionInDomainCoords(cvf::Vec3d::UNDEFINED)
, m_viewer(ownerViewer)
{
if ( sm_defaultPickEventHandlers.empty() )
if (sm_defaultPickEventHandlers.empty())
{
addDefaultPickEventHandler(RicIntersectionPickEventHandler::instance());
addDefaultPickEventHandler(Ric3dWellLogCurvePickEventHandler::instance());
@ -139,20 +138,16 @@ RiuViewerCommands::RiuViewerCommands(RiuViewer* ownerViewer)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuViewerCommands::~RiuViewerCommands()
{
}
RiuViewerCommands::~RiuViewerCommands() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::setOwnerView(Rim3dView * owner)
void RiuViewerCommands::setOwnerView(Rim3dView* owner)
{
m_reservoirView = owner;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -163,7 +158,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
std::vector<RiuPickItemInfo> pickItemInfos;
{
cvf::HitItemCollection hitItems;
if (m_viewer->rayPick( event->x(), event->y(), &hitItems))
if (m_viewer->rayPick(event->x(), event->y(), &hitItems))
{
pickItemInfos = RiuPickItemInfo::convertToPickItemInfos(hitItems);
}
@ -182,14 +177,14 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
for (const auto& pickItem : pickItemInfos)
{
const RivObjectSourceInfo* objectSourceInfo = dynamic_cast<const RivObjectSourceInfo*>(pickItem.sourceInfo());
if ( objectSourceInfo && dynamic_cast<RimPerforationInterval*>(objectSourceInfo->object()) )
if (objectSourceInfo && dynamic_cast<RimPerforationInterval*>(objectSourceInfo->object()))
{
// Skip picking on perforation interval, display well path context menu
continue;
}
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(pickItem.sourceInfo());
if ( rivSourceInfo && rivSourceInfo->hasNNCIndices())
if (rivSourceInfo && rivSourceInfo->hasNNCIndices())
{
// Skip picking on nnc-s
continue;
@ -226,8 +221,10 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionSourceInfo* crossSectionSourceInfo =
dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo =
dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
if (rivSourceInfo || femSourceInfo || crossSectionSourceInfo || intersectionBoxSourceInfo)
{
@ -333,12 +330,12 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
menuBuilder.addSeparator();
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
if (eclipseView)
{
// Hide faults command
const RigFault* fault = eclipseView->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
const RigFault* fault =
eclipseView->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
if (fault)
{
menuBuilder.addSeparator();
@ -350,7 +347,8 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
hideFaultList.push_back(currentCellIndex);
hideFaultList.push_back(m_currentFaceIndex);
menuBuilder.addCmdFeatureWithUserData("RicEclipseHideFaultFeature", QString("Hide ") + faultName, hideFaultList);
menuBuilder.addCmdFeatureWithUserData(
"RicEclipseHideFaultFeature", QString("Hide ") + faultName, hideFaultList);
}
}
}
@ -371,12 +369,14 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
if (int2dView) pickedPositionInUTM = int2dView->transformToUtm(pickedPositionInUTM);
double measuredDepth = wellPathSourceInfo->measuredDepth(firstPartTriangleIndex, pickedPositionInUTM);
cvf::Vec3d closestPointOnCenterLine = wellPathSourceInfo->closestPointOnCenterLine(firstPartTriangleIndex, pickedPositionInUTM);
RiuSelectionItem* selItem = new RiuWellPathSelectionItem(wellPathSourceInfo, closestPointOnCenterLine, measuredDepth);
cvf::Vec3d closestPointOnCenterLine =
wellPathSourceInfo->closestPointOnCenterLine(firstPartTriangleIndex, pickedPositionInUTM);
RiuSelectionItem* selItem =
new RiuWellPathSelectionItem(wellPathSourceInfo, closestPointOnCenterLine, measuredDepth);
Riu3dSelectionManager::instance()->setSelectedItem(selItem, Riu3dSelectionManager::RUI_TEMPORARY);
}
//TODO: Update so these also use RiuWellPathSelectionItem
// TODO: Update so these also use RiuWellPathSelectionItem
caf::SelectionManager::instance()->setSelectedItem(wellPath);
menuBuilder << "RicNewWellLogCurveExtractionFeature";
@ -421,7 +421,8 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
}
}
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>(firstHitPart->sourceInfo());
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo =
dynamic_cast<const RivSimWellPipeSourceInfo*>(firstHitPart->sourceInfo());
if (eclipseWellSourceInfo)
{
RimSimWellInView* well = eclipseWellSourceInfo->well();
@ -429,7 +430,8 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
caf::SelectionManager::instance()->setSelectedItem(well);
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(
eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
Riu3dSelectionManager::instance()->setSelectedItem(selItem, Riu3dSelectionManager::RUI_TEMPORARY);
menuBuilder << "RicNewWellLogCurveExtractionFeature";
@ -526,7 +528,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
// Do specialized text pick, since vizfwk does not hit text
handleTextPicking(winPosX, winPosY, &hitItems);
if ( hitItems.count() )
if (hitItems.count())
{
pickItemInfos = RiuPickItemInfo::convertToPickItemInfos(hitItems);
}
@ -534,19 +536,18 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
// Make pickEventHandlers do their stuff
if ( pickItemInfos.size() )
if (pickItemInfos.size())
{
Ric3DPickEvent viewerEventObject(pickItemInfos,
m_reservoirView);
Ric3DPickEvent viewerEventObject(pickItemInfos, m_reservoirView);
if (sm_overridingPickHandler && sm_overridingPickHandler->handlePickEvent(viewerEventObject))
{
return;
}
for ( size_t i = 0; i < sm_defaultPickEventHandlers.size(); i++ )
for (size_t i = 0; i < sm_defaultPickEventHandlers.size(); i++)
{
if ( sm_defaultPickEventHandlers[i]->handlePickEvent(viewerEventObject) )
if (sm_defaultPickEventHandlers[i]->handlePickEvent(viewerEventObject))
{
return;
}
@ -574,14 +575,16 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
const cvf::Part* firstNncHitPart = nullptr;
uint nncPartTriangleIndex = cvf::UNDEFINED_UINT;
if ( pickItemInfos.size() )
if (pickItemInfos.size())
{
size_t indexToFirstNoneNncItem = cvf::UNDEFINED_SIZE_T;;
size_t indexToNncItemNearFirstItem = cvf::UNDEFINED_SIZE_T;;
size_t indexToFirstNoneNncItem = cvf::UNDEFINED_SIZE_T;
;
size_t indexToNncItemNearFirstItem = cvf::UNDEFINED_SIZE_T;
;
findFirstItems(pickItemInfos, &indexToFirstNoneNncItem, &indexToNncItemNearFirstItem);
if ( indexToFirstNoneNncItem != cvf::UNDEFINED_SIZE_T )
if (indexToFirstNoneNncItem != cvf::UNDEFINED_SIZE_T)
{
localIntersectionPoint = pickItemInfos[indexToFirstNoneNncItem].localPickedPoint();
globalIntersectionPoint = pickItemInfos[indexToFirstNoneNncItem].globalPickedPoint();
@ -589,7 +592,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
firstPartTriangleIndex = pickItemInfos[indexToFirstNoneNncItem].faceIdx();
}
if ( indexToNncItemNearFirstItem != cvf::UNDEFINED_SIZE_T )
if (indexToNncItemNearFirstItem != cvf::UNDEFINED_SIZE_T)
{
firstNncHitPart = pickItemInfos[indexToNncItemNearFirstItem].pickedPart();
nncPartTriangleIndex = pickItemInfos[indexToNncItemNearFirstItem].faceIdx();
@ -613,15 +616,19 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
const RivObjectSourceInfo* rivObjectSourceInfo = dynamic_cast<const RivObjectSourceInfo*>(firstHitPart->sourceInfo());
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>(firstHitPart->sourceInfo());
const RivWellConnectionSourceInfo* wellConnectionSourceInfo = dynamic_cast<const RivWellConnectionSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionSourceInfo* crossSectionSourceInfo =
dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo =
dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo =
dynamic_cast<const RivSimWellPipeSourceInfo*>(firstHitPart->sourceInfo());
const RivWellConnectionSourceInfo* wellConnectionSourceInfo =
dynamic_cast<const RivWellConnectionSourceInfo*>(firstHitPart->sourceInfo());
if (rivObjectSourceInfo)
{
RimFracture* fracture = dynamic_cast<RimFracture*>(rivObjectSourceInfo->object());
if ( fracture )
if (fracture)
{
{
bool blockSelectionOfFracture = false;
@ -630,27 +637,29 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
std::vector<caf::PdmUiItem*> uiItems;
RiuMainWindow::instance()->projectTreeView()->selectedUiItems(uiItems);
if ( uiItems.size() == 1 )
if (uiItems.size() == 1)
{
auto selectedFractureTemplate = dynamic_cast<RimFractureTemplate*>(uiItems[0]);
if ( selectedFractureTemplate != nullptr && selectedFractureTemplate == fracture->fractureTemplate() )
if (selectedFractureTemplate != nullptr &&
selectedFractureTemplate == fracture->fractureTemplate())
{
blockSelectionOfFracture = true;
}
}
}
if ( !blockSelectionOfFracture )
if (!blockSelectionOfFracture)
{
RiuMainWindow::instance()->selectAsCurrentItem(fracture);
}
}
RimStimPlanFractureTemplate* stimPlanTempl = fracture ? dynamic_cast<RimStimPlanFractureTemplate*>(fracture->fractureTemplate()) : nullptr;
RimEllipseFractureTemplate* ellipseTempl = fracture ? dynamic_cast<RimEllipseFractureTemplate*>(fracture->fractureTemplate()) : nullptr;
if ( stimPlanTempl || ellipseTempl )
RimStimPlanFractureTemplate* stimPlanTempl =
fracture ? dynamic_cast<RimStimPlanFractureTemplate*>(fracture->fractureTemplate()) : nullptr;
RimEllipseFractureTemplate* ellipseTempl =
fracture ? dynamic_cast<RimEllipseFractureTemplate*>(fracture->fractureTemplate()) : nullptr;
if (stimPlanTempl || ellipseTempl)
{
// Set fracture resultInfo text
QString resultInfoText;
@ -660,12 +669,15 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
RivWellFracturePartMgr* partMgr = fracture->fracturePartManager();
if ( eclView ) resultInfoText = partMgr->resultInfoText(*eclView, domainCoord);
if (eclView) resultInfoText = partMgr->resultInfoText(*eclView, domainCoord);
// Set intersection point result text
QString intersectionPointText;
intersectionPointText.sprintf("Intersection point : Global [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
intersectionPointText.sprintf("Intersection point : Global [E: %.2f, N: %.2f, Depth: %.2f]",
domainCoord.x(),
domainCoord.y(),
-domainCoord.z());
resultInfoText.append(intersectionPointText);
// Display result info text
@ -696,7 +708,6 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
gridIndex = femSourceInfo->femPartIndex();
cellIndex = femSourceInfo->triangleToElmMapper()->elementIndex(firstPartTriangleIndex);
gmFace = femSourceInfo->triangleToElmMapper()->elementFace(firstPartTriangleIndex);
}
else if (crossSectionSourceInfo)
{
@ -715,7 +726,6 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
intersectionTriangleHit = intersectionBoxSourceInfo->triangle(firstPartTriangleIndex);
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBoxSourceInfo->intersectionBox());
}
else if (eclipseWellSourceInfo)
{
@ -743,7 +753,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
auto connectionFactors = eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities();
size_t timeStep = eclipseView->currentTimeStep();
const auto& multipleCompletions = connectionFactors->multipleCompletionsPerEclipseCell(wellConnectionSourceInfo->wellPath(), timeStep);
const auto& multipleCompletions = connectionFactors->multipleCompletionsPerEclipseCell(
wellConnectionSourceInfo->wellPath(), timeStep);
auto completionDataIt = multipleCompletions.find(globalCellIndex);
if (completionDataIt != multipleCompletions.end())
@ -761,7 +772,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
}
QString resultInfoText;
resultInfoText += QString("<b>Well Connection Factor :</b> %1<br><br>").arg(aggregatedConnectionFactor);
resultInfoText +=
QString("<b>Well Connection Factor :</b> %1<br><br>").arg(aggregatedConnectionFactor);
{
RiuResultTextBuilder textBuilder(eclipseView, globalCellIndex, eclipseView->currentTimeStep());
@ -775,7 +787,9 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
{
for (const auto& metaData : completionData.metadata())
{
resultInfoText += QString("<b>Name</b> %1 <b>Description</b> %2 <br>").arg(metaData.name).arg(metaData.comment);
resultInfoText += QString("<b>Name</b> %1 <b>Description</b> %2 <br>")
.arg(metaData.name)
.arg(metaData.comment);
}
}
@ -788,7 +802,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
}
else if (dynamic_cast<const RivSimWellConnectionSourceInfo*>(firstHitPart->sourceInfo()))
{
const RivSimWellConnectionSourceInfo* simWellConnectionSourceInfo = dynamic_cast<const RivSimWellConnectionSourceInfo*>(firstHitPart->sourceInfo());
const RivSimWellConnectionSourceInfo* simWellConnectionSourceInfo =
dynamic_cast<const RivSimWellConnectionSourceInfo*>(firstHitPart->sourceInfo());
bool allowActiveViewChange = dynamic_cast<Rim2dIntersectionView*>(m_viewer->ownerViewWindow()) == nullptr;
@ -801,23 +816,25 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
RimEclipseCase* eclipseCase = nullptr;
eclipseView->firstAncestorOrThisOfTypeAsserted(eclipseCase);
if (eclipseCase->eclipseCaseData() &&
eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities())
if (eclipseCase->eclipseCaseData() && eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities())
{
auto connectionFactors = eclipseCase->eclipseCaseData()->virtualPerforationTransmissibilities();
size_t timeStep = eclipseView->currentTimeStep();
const auto& completionData = connectionFactors->completionsForSimWell(simWellConnectionSourceInfo->simWellInView()->simWellData(), timeStep);
const auto& completionData = connectionFactors->completionsForSimWell(
simWellConnectionSourceInfo->simWellInView()->simWellData(), timeStep);
for (const auto& compData : completionData)
{
if (compData.completionDataGridCell().globalCellIndex() == globalCellIndex)
{
{
QString resultInfoText = QString("<b>Simulation Well Connection Factor :</b> %1<br><br>").arg(connectionFactor);
QString resultInfoText =
QString("<b>Simulation Well Connection Factor :</b> %1<br><br>").arg(connectionFactor);
{
RiuResultTextBuilder textBuilder(eclipseView, globalCellIndex, eclipseView->currentTimeStep());
RiuResultTextBuilder textBuilder(
eclipseView, globalCellIndex, eclipseView->currentTimeStep());
resultInfoText += textBuilder.geometrySelectionText("<br>");
}
@ -829,9 +846,9 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
}
}
}
}
RiuMainWindow::instance()->selectAsCurrentItem(simWellConnectionSourceInfo->simWellInView(), allowActiveViewChange);
RiuMainWindow::instance()->selectAsCurrentItem(simWellConnectionSourceInfo->simWellInView(),
allowActiveViewChange);
}
}
}
@ -874,13 +891,18 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
if (eclipseView)
{
selItem = new RiuEclipseSelectionItem(eclipseView, gridIndex, cellIndex, nncIndex, curveColor, face, localIntersectionPoint);
selItem = new RiuEclipseSelectionItem(
eclipseView, gridIndex, cellIndex, nncIndex, curveColor, face, localIntersectionPoint);
}
if (geomView)
{
if(intersectionHit) selItem = new RiuGeoMechSelectionItem(geomView, gridIndex, cellIndex, curveColor, gmFace, localIntersectionPoint, intersectionTriangleHit);
else selItem = new RiuGeoMechSelectionItem(geomView, gridIndex, cellIndex, curveColor, gmFace, localIntersectionPoint);
if (intersectionHit)
selItem = new RiuGeoMechSelectionItem(
geomView, gridIndex, cellIndex, curveColor, gmFace, localIntersectionPoint, intersectionTriangleHit);
else
selItem =
new RiuGeoMechSelectionItem(geomView, gridIndex, cellIndex, curveColor, gmFace, localIntersectionPoint);
}
if (intersectionView) selItem = new Riu2dIntersectionSelectionItem(intersectionView, selItem);
@ -890,12 +912,11 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
{
Riu3dSelectionManager::instance()->appendItemToSelection(selItem);
}
else if(selItem)
else if (selItem)
{
Riu3dSelectionManager::instance()->setSelectedItem(selItem);
}
}
}
//--------------------------------------------------------------------------------------------------
@ -945,9 +966,9 @@ void RiuViewerCommands::addDefaultPickEventHandler(RicDefaultPickEventHandler* p
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::removeDefaultPickEventHandler(RicDefaultPickEventHandler* pickEventHandler)
{
for ( auto it = sm_defaultPickEventHandlers.begin(); it != sm_defaultPickEventHandlers.end(); ++it )
for (auto it = sm_defaultPickEventHandlers.begin(); it != sm_defaultPickEventHandlers.end(); ++it)
{
if ( *it == pickEventHandler )
if (*it == pickEventHandler)
{
sm_defaultPickEventHandlers.erase(it);
break;
@ -958,7 +979,10 @@ void RiuViewerCommands::removeDefaultPickEventHandler(RicDefaultPickEventHandler
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo,
cvf::uint firstPartTriangleIndex,
size_t* cellIndex,
size_t* gridIndex)
{
CVF_ASSERT(cellIndex && gridIndex);
@ -967,7 +991,7 @@ void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* cr
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(ownerCase);
if (eclipseCase)
{
//RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
// RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
RimEclipseView* eclipseView;
crossSectionSourceInfo->crossSection()->firstAncestorOrThisOfType(eclipseView);
@ -985,7 +1009,10 @@ void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* cr
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo,
cvf::uint firstPartTriangleIndex,
size_t* cellIndex,
size_t* gridIndex)
{
CVF_ASSERT(cellIndex && gridIndex);
@ -1006,11 +1033,10 @@ void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionBoxSourceInfo*
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::findFirstItems(const std::vector<RiuPickItemInfo> & pickItemInfos,
void RiuViewerCommands::findFirstItems(const std::vector<RiuPickItemInfo>& pickItemInfos,
size_t* indexToFirstNoneNncItem,
size_t* indexToNncItemNearFirsItem)
{
@ -1018,7 +1044,7 @@ void RiuViewerCommands::findFirstItems(const std::vector<RiuPickItemInfo> & pick
CVF_ASSERT(indexToFirstNoneNncItem);
CVF_ASSERT(indexToNncItemNearFirsItem);
double pickDepthThresholdSquared = 0.05 *0.05;
double pickDepthThresholdSquared = 0.05 * 0.05;
{
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
@ -1044,14 +1070,15 @@ void RiuViewerCommands::findFirstItems(const std::vector<RiuPickItemInfo> & pick
bool canFindRelvantNNC = true;
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(pickItemInfos[i].sourceInfo());
if ( rivSourceInfo && rivSourceInfo->hasNNCIndices() )
if (rivSourceInfo && rivSourceInfo->hasNNCIndices())
{
if ( nncNearFirstItemIndex == cvf::UNDEFINED_SIZE_T && canFindRelvantNNC)
if (nncNearFirstItemIndex == cvf::UNDEFINED_SIZE_T && canFindRelvantNNC)
{
cvf::Vec3d distFirstNonNNCToCandidate = firstOrFirstNonNncIntersectionPoint - pickItemInfos[i].globalPickedPoint();
cvf::Vec3d distFirstNonNNCToCandidate =
firstOrFirstNonNncIntersectionPoint - pickItemInfos[i].globalPickedPoint();
// This candidate is an NNC hit
if ( distFirstNonNNCToCandidate.lengthSquared() < pickDepthThresholdSquared )
if (distFirstNonNNCToCandidate.lengthSquared() < pickDepthThresholdSquared)
{
nncNearFirstItemIndex = i;
}
@ -1063,13 +1090,14 @@ void RiuViewerCommands::findFirstItems(const std::vector<RiuPickItemInfo> & pick
}
else
{
if ( firstNonNncHitIndex == cvf::UNDEFINED_SIZE_T )
if (firstNonNncHitIndex == cvf::UNDEFINED_SIZE_T)
{
firstNonNncHitIndex = i;
}
}
if (firstNonNncHitIndex != cvf::UNDEFINED_SIZE_T && (nncNearFirstItemIndex != cvf::UNDEFINED_SIZE_T || !canFindRelvantNNC) )
if (firstNonNncHitIndex != cvf::UNDEFINED_SIZE_T &&
(nncNearFirstItemIndex != cvf::UNDEFINED_SIZE_T || !canFindRelvantNNC))
{
break; // Found what can be found
}
@ -1169,4 +1197,3 @@ void RiuViewerCommands::handleTextPicking(int winPosX, int winPosY, cvf::HitItem
hitItems->sort();
}