(#664) Picking on intersections for eclipse and geo models

This commit is contained in:
Magne Sjaastad 2015-11-24 14:14:14 +01:00
parent 85ca555163
commit 1890ff19f9
5 changed files with 105 additions and 3 deletions

View File

@ -36,6 +36,7 @@ ${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.h
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivCrossSectionSourceInfo.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -68,6 +69,7 @@ ${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.cpp
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivCrossSectionSourceInfo.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -36,6 +36,7 @@
#include "RimGeoMechView.h"
#include "RimTernaryLegendConfig.h"
#include "RivCrossSectionSourceInfo.h"
#include "RivResultToTextureMapper.h"
#include "RivScalarMapperUtils.h"
#include "RivTernaryScalarMapper.h"
@ -303,9 +304,8 @@ void RivCrossSectionPartMgr::generatePartGeometry()
part->setDrawable(geo.p());
// Set mapping from triangle face index to cell index
//cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_grid->gridIndex());
//si->m_cellFaceFromTriangleMapper = m_nativeCrossSectionGenerator->triangleToCellFaceMapper();
//part->setSourceInfo(si.p());
cvf::ref<RivCrossSectionSourceInfo> si = new RivCrossSectionSourceInfo(m_crossSectionGenerator.p());
part->setSourceInfo(si.p());
part->updateBoundingBox();
part->setEnableMask(surfaceBit);

View File

@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivCrossSectionSourceInfo.h"
#include "RivCrossSectionGeometryGenerator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivCrossSectionSourceInfo::RivCrossSectionSourceInfo(RivCrossSectionGeometryGenerator* geometryGenerator)
: m_crossSectionGeometryGenerator(geometryGenerator)
{
CVF_ASSERT(m_crossSectionGeometryGenerator.notNull());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<size_t>& RivCrossSectionSourceInfo::triangleToCellIndex() const
{
CVF_ASSERT(m_crossSectionGeometryGenerator.notNull());
return m_crossSectionGeometryGenerator->triangleToCellIndex();
}

View File

@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfArray.h"
class RivCrossSectionGeometryGenerator;
class RivCrossSectionSourceInfo : public cvf::Object
{
public:
RivCrossSectionSourceInfo(RivCrossSectionGeometryGenerator* geometryGenerator);
const std::vector<size_t>& triangleToCellIndex() const;
private:
cvf::cref<RivCrossSectionGeometryGenerator> m_crossSectionGeometryGenerator;
};

View File

@ -62,6 +62,7 @@
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "RivCrossSectionSourceInfo.h"
#include "RivFemPartGeometryGenerator.h"
#include "RivFemPickSourceInfo.h"
#include "RivSourceInfo.h"
@ -418,6 +419,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
const RivWellPathSourceInfo* wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(firstHitPart->sourceInfo());
const RivCrossSectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivCrossSectionSourceInfo*>(firstHitPart->sourceInfo());
if (rivSourceInfo)
{
@ -439,6 +441,25 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
{
wellPath = wellPathSourceInfo->wellPath();
}
else if (crossSectionSourceInfo)
{
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(m_reservoirView.p());
if (eclipseView)
{
size_t globalCellIndex = crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
const RigCell& cell = eclipseView->eclipseCase()->reservoirData()->mainGrid()->cells()[globalCellIndex];
cellIndex = cell.gridLocalCellIndex();
gridIndex = cell.hostGrid()->gridIndex();
}
else if (geomView)
{
cellIndex = crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
gridIndex = 0;
}
}
}
if (firstNncHitPart && firstNncHitPart->sourceInfo())