2017-05-05 04:21:40 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-05-16 05:49:36 -05:00
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-05-05 04:21:40 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-05-05 04:21:40 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-05-05 04:21:40 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RivFishbonesSubsPartMgr.h"
|
|
|
|
|
|
|
|
#include "RigWellPath.h"
|
|
|
|
|
2021-02-26 07:27:59 -06:00
|
|
|
#include "RimFishbones.h"
|
2017-05-05 04:21:40 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
|
|
|
|
#include "RivObjectSourceInfo.h"
|
|
|
|
#include "RivPipeGeometryGenerator.h"
|
|
|
|
|
|
|
|
#include "cafDisplayCoordTransform.h"
|
|
|
|
#include "cafEffectGenerator.h"
|
|
|
|
|
|
|
|
#include "cvfDrawableGeo.h"
|
|
|
|
#include "cvfModelBasicList.h"
|
|
|
|
#include "cvfPart.h"
|
|
|
|
#include "cvfTransform.h"
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-05-05 04:21:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2021-02-26 07:27:59 -06:00
|
|
|
RivFishbonesSubsPartMgr::RivFishbonesSubsPartMgr( RimFishbones* subs )
|
2019-09-06 03:40:57 -05:00
|
|
|
: m_rimFishbonesSubs( subs )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-05-05 04:21:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RivFishbonesSubsPartMgr::~RivFishbonesSubsPartMgr()
|
|
|
|
{
|
|
|
|
}
|
2017-05-05 04:21:40 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-05-05 04:21:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RivFishbonesSubsPartMgr::appendGeometryPartsToModel( cvf::ModelBasicList* model,
|
|
|
|
const caf::DisplayCoordTransform* displayCoordTransform,
|
|
|
|
double characteristicCellSize )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
|
|
|
clearGeometryCache();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !m_rimFishbonesSubs->isActive() ) return;
|
2017-05-05 04:21:40 -05:00
|
|
|
|
2023-09-27 01:07:49 -05:00
|
|
|
if ( m_parts.empty() )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
buildParts( displayCoordTransform, characteristicCellSize );
|
2017-05-05 04:21:40 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto part : m_parts )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
model->addPart( part.p() );
|
2017-05-05 04:21:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-05-05 04:21:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivFishbonesSubsPartMgr::clearGeometryCache()
|
|
|
|
{
|
|
|
|
m_parts.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-05-05 04:21:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 03:48:40 -06:00
|
|
|
void RivFishbonesSubsPartMgr::buildParts( const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2023-05-12 14:41:34 -05:00
|
|
|
auto wellPath = m_rimFishbonesSubs->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
|
2017-05-05 04:21:40 -05:00
|
|
|
|
2021-02-26 07:27:59 -06:00
|
|
|
for ( const auto& [subIndex, lateralIndex] : m_rimFishbonesSubs->installedLateralIndices() )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2021-02-26 07:27:59 -06:00
|
|
|
std::vector<cvf::Vec3d> lateralDomainCoords = m_rimFishbonesSubs->coordsForLateral( subIndex, lateralIndex );
|
|
|
|
|
|
|
|
std::vector<cvf::Vec3d> displayCoords = displayCoordTransform->transformToDisplayCoords( lateralDomainCoords );
|
|
|
|
|
2023-03-02 06:06:38 -06:00
|
|
|
RivPipeGeometryGenerator::cylinderWithCenterLineParts( &m_parts,
|
|
|
|
displayCoords,
|
|
|
|
m_rimFishbonesSubs->fishbonesColor(),
|
|
|
|
wellPath->combinedScaleFactor() * characteristicCellSize * 0.5 );
|
2017-05-05 08:09:22 -05:00
|
|
|
}
|
2017-05-05 04:21:40 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo( m_rimFishbonesSubs );
|
|
|
|
for ( auto part : m_parts )
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
part->setSourceInfo( objectSourceInfo.p() );
|
2017-05-05 04:21:40 -05:00
|
|
|
}
|
|
|
|
}
|