mirror of
				https://github.com/OPM/ResInsight.git
				synced 2025-02-25 18:55:39 -06:00 
			
		
		
		
	(#404) Displaying well path name when a well path is picked
TODO: Display depth and additional well data
This commit is contained in:
		@@ -18,6 +18,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.h
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivReservoirFaultsPartMgr.h
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.h
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivSourceInfo.h
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPipesPartMgr.h
 | 
			
		||||
@@ -48,6 +49,7 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.cpp
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.cpp
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.cpp
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.cpp
 | 
			
		||||
${CEE_CURRENT_LIST_DIR}RivWellPipesPartMgr.cpp
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBa
 | 
			
		||||
    {
 | 
			
		||||
        RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
 | 
			
		||||
        partMgr->setScaleTransform(scaleTransform);
 | 
			
		||||
        partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
 | 
			
		||||
        partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, wIdx);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,7 @@
 | 
			
		||||
#include "RigCaseData.h"
 | 
			
		||||
#include "RigCell.h"
 | 
			
		||||
#include "RivWellPathPartMgr.h"
 | 
			
		||||
#include "RivWellPathSourceInfo.h"
 | 
			
		||||
#include "RimWellPath.h"
 | 
			
		||||
#include "RivPipeGeometryGenerator.h"
 | 
			
		||||
#include "cvfModelBasicList.h"
 | 
			
		||||
@@ -96,7 +97,7 @@ RivWellPathPartMgr::~RivWellPathPartMgr()
 | 
			
		||||
/// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
 | 
			
		||||
//--------------------------------------------------------------------------------------------------
 | 
			
		||||
void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, 
 | 
			
		||||
                                            cvf::BoundingBox wellPathClipBoundingBox)
 | 
			
		||||
                                            cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex)
 | 
			
		||||
{
 | 
			
		||||
    if (m_wellPathCollection.isNull()) return;
 | 
			
		||||
 | 
			
		||||
@@ -158,6 +159,9 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
 | 
			
		||||
        {
 | 
			
		||||
            pbd.m_surfacePart = new cvf::Part;
 | 
			
		||||
            pbd.m_surfacePart->setDrawable(pbd.m_surfaceDrawable.p());
 | 
			
		||||
            
 | 
			
		||||
            RivWellPathSourceInfo* sourceInfo = new RivWellPathSourceInfo(wellPathIndex);
 | 
			
		||||
            pbd.m_surfacePart->setSourceInfo(sourceInfo);
 | 
			
		||||
 | 
			
		||||
            caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(m_rimWellPath->wellPathColor()), caf::PO_1);
 | 
			
		||||
            cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
 | 
			
		||||
@@ -222,7 +226,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
 | 
			
		||||
/// 
 | 
			
		||||
//--------------------------------------------------------------------------------------------------
 | 
			
		||||
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, 
 | 
			
		||||
                                                          double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox)
 | 
			
		||||
                                                          double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex)
 | 
			
		||||
{
 | 
			
		||||
    if (m_wellPathCollection.isNull()) return;
 | 
			
		||||
    if (m_rimWellPath.isNull()) return;
 | 
			
		||||
@@ -236,7 +240,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
 | 
			
		||||
    if (m_needsTransformUpdate) 
 | 
			
		||||
    {
 | 
			
		||||
        // The pipe geometry needs to be rebuilt on scale change to keep the pipes round
 | 
			
		||||
        buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
 | 
			
		||||
        buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, wellPathIndex);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
    std::list<RivPipeBranchData>::iterator it;
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ public:
 | 
			
		||||
    void                                    scheduleGeometryRegen() { m_needsTransformUpdate = true; }//printf("R"); }
 | 
			
		||||
 | 
			
		||||
    void                                    appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, 
 | 
			
		||||
                                                                             double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
 | 
			
		||||
                                                                             double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    caf::PdmPointer<RimWellPathCollection>  m_wellPathCollection;
 | 
			
		||||
@@ -59,7 +59,7 @@ private:
 | 
			
		||||
    cvf::ref<cvf::Transform>                m_scaleTransform; 
 | 
			
		||||
    bool                                    m_needsTransformUpdate;
 | 
			
		||||
 | 
			
		||||
    void                                    buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
 | 
			
		||||
    void                                    buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, size_t wellPathIndex);
 | 
			
		||||
 | 
			
		||||
    struct RivPipeBranchData
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								ApplicationCode/ModelVisualization/RivWellPathSourceInfo.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								ApplicationCode/ModelVisualization/RivWellPathSourceInfo.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
/////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (C) 2015-     Statoil ASA
 | 
			
		||||
//  Copyright (C) 2015-     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 "RivWellPathSourceInfo.h"
 | 
			
		||||
 | 
			
		||||
//--------------------------------------------------------------------------------------------------
 | 
			
		||||
/// 
 | 
			
		||||
//--------------------------------------------------------------------------------------------------
 | 
			
		||||
RivWellPathSourceInfo::RivWellPathSourceInfo(size_t wellPathIndex)
 | 
			
		||||
{
 | 
			
		||||
    m_wellPathIndex = wellPathIndex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//--------------------------------------------------------------------------------------------------
 | 
			
		||||
/// 
 | 
			
		||||
//--------------------------------------------------------------------------------------------------
 | 
			
		||||
size_t RivWellPathSourceInfo::wellPathIndex() const
 | 
			
		||||
{
 | 
			
		||||
    return m_wellPathIndex;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								ApplicationCode/ModelVisualization/RivWellPathSourceInfo.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								ApplicationCode/ModelVisualization/RivWellPathSourceInfo.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
/////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
//
 | 
			
		||||
//  Copyright (C) 2015-     Statoil ASA
 | 
			
		||||
//  Copyright (C) 2015-     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 "cvfObject.h"
 | 
			
		||||
 | 
			
		||||
//==================================================================================================
 | 
			
		||||
///  
 | 
			
		||||
///  
 | 
			
		||||
//==================================================================================================
 | 
			
		||||
class RivWellPathSourceInfo : public cvf::Object
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    RivWellPathSourceInfo(size_t wellPathIndex);
 | 
			
		||||
 | 
			
		||||
    size_t wellPathIndex() const;
 | 
			
		||||
 | 
			
		||||
private:    
 | 
			
		||||
    size_t m_wellPathIndex;
 | 
			
		||||
};
 | 
			
		||||
@@ -33,8 +33,13 @@
 | 
			
		||||
#include "RimGeoMechPropertyFilter.h"
 | 
			
		||||
#include "RimGeoMechPropertyFilterCollection.h"
 | 
			
		||||
#include "RimGeoMechCellColors.h"
 | 
			
		||||
#include "RimProject.h"
 | 
			
		||||
#include "RimOilField.h"
 | 
			
		||||
#include "RimWellPathCollection.h"
 | 
			
		||||
#include "RimWellPath.h"
 | 
			
		||||
 | 
			
		||||
#include "RivSourceInfo.h"
 | 
			
		||||
#include "RivWellPathSourceInfo.h"
 | 
			
		||||
#include "RivFemPickSourceInfo.h"
 | 
			
		||||
#include "RivFemPartGeometryGenerator.h"
 | 
			
		||||
#include "RigCaseData.h"
 | 
			
		||||
@@ -120,7 +125,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
 | 
			
		||||
    if (faceIndex == cvf::UNDEFINED_UINT) return;
 | 
			
		||||
 | 
			
		||||
    if (!firstHitPart->sourceInfo()) return;
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
 | 
			
		||||
    const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
 | 
			
		||||
 | 
			
		||||
@@ -312,6 +317,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
 | 
			
		||||
    size_t gridIndex = cvf::UNDEFINED_SIZE_T;
 | 
			
		||||
    size_t cellIndex = cvf::UNDEFINED_SIZE_T;
 | 
			
		||||
    size_t nncIndex = cvf::UNDEFINED_SIZE_T;
 | 
			
		||||
    size_t wellPathIndex = cvf::UNDEFINED_SIZE_T;
 | 
			
		||||
    cvf::StructGridInterface::FaceType face = cvf::StructGridInterface::NO_FACE;
 | 
			
		||||
    cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
 | 
			
		||||
 | 
			
		||||
@@ -334,6 +340,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
 | 
			
		||||
        {
 | 
			
		||||
            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());
 | 
			
		||||
 | 
			
		||||
            if (rivSourceInfo)
 | 
			
		||||
            {
 | 
			
		||||
@@ -351,6 +358,10 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
 | 
			
		||||
                gridIndex = femSourceInfo->femPartIndex();
 | 
			
		||||
                cellIndex = femSourceInfo->triangleToElmMapper()->elementIndex(firstPartTriangleIndex);
 | 
			
		||||
            }
 | 
			
		||||
            else if (wellPathSourceInfo)
 | 
			
		||||
            {
 | 
			
		||||
                wellPathIndex = wellPathSourceInfo->wellPathIndex();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
       
 | 
			
		||||
 | 
			
		||||
@@ -402,6 +413,19 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (wellPathIndex != cvf::UNDEFINED_SIZE_T)
 | 
			
		||||
    {
 | 
			
		||||
        RimProject* project = RiaApplication::instance()->project();
 | 
			
		||||
        CVF_ASSERT(project);
 | 
			
		||||
 | 
			
		||||
        RimOilField* oilField = project->activeOilField();
 | 
			
		||||
        if (oilField)
 | 
			
		||||
        {
 | 
			
		||||
            RimWellPath* wellPath = oilField->wellPathCollection()->wellPaths[wellPathIndex];
 | 
			
		||||
            pickInfo = QString("Well path hit: %1").arg(wellPath->name());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Display the text
 | 
			
		||||
 | 
			
		||||
    RiuMainWindow* mainWnd = RiuMainWindow::instance();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user