2017-05-05 04:21:40 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-05-16 05:49:36 -05:00
|
|
|
// Copyright (C) 2017 Statoil ASA
|
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.
|
|
|
|
//
|
|
|
|
// 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 "RivFishbonesSubsPartMgr.h"
|
|
|
|
|
|
|
|
#include "RigWellPath.h"
|
|
|
|
|
|
|
|
#include "RimFishbonesMultipleSubs.h"
|
|
|
|
#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"
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RivFishbonesSubsPartMgr::RivFishbonesSubsPartMgr(RimFishbonesMultipleSubs* subs)
|
|
|
|
: m_rimFishbonesSubs(subs)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RivFishbonesSubsPartMgr::~RivFishbonesSubsPartMgr()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-06-19 15:53:19 -05:00
|
|
|
void RivFishbonesSubsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize)
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
|
|
|
clearGeometryCache();
|
|
|
|
|
2017-12-19 04:00:26 -06:00
|
|
|
if (!m_rimFishbonesSubs->isActive()) return;
|
2017-05-05 04:21:40 -05:00
|
|
|
|
|
|
|
if (m_parts.size() == 0)
|
|
|
|
{
|
|
|
|
buildParts(displayCoordTransform, characteristicCellSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto part : m_parts)
|
|
|
|
{
|
|
|
|
model->addPart(part.p());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivFishbonesSubsPartMgr::clearGeometryCache()
|
|
|
|
{
|
|
|
|
m_parts.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-06-19 15:53:19 -05:00
|
|
|
void RivFishbonesSubsPartMgr::buildParts(const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize)
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
|
|
|
RimWellPath* wellPath = nullptr;
|
|
|
|
m_rimFishbonesSubs->firstAncestorOrThisOfTypeAsserted(wellPath);
|
|
|
|
|
|
|
|
RivPipeGeometryGenerator geoGenerator;
|
2017-05-05 06:32:50 -05:00
|
|
|
|
2017-06-02 03:16:16 -05:00
|
|
|
for (auto& sub : m_rimFishbonesSubs->installedLateralIndices())
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2017-06-02 03:16:16 -05:00
|
|
|
for (size_t lateralIndex : sub.lateralIndices)
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2017-06-02 03:16:16 -05:00
|
|
|
std::vector<cvf::Vec3d> lateralDomainCoords = m_rimFishbonesSubs->coordsForLateral(sub.subIndex, lateralIndex);
|
2017-05-05 04:21:40 -05:00
|
|
|
|
2019-01-03 06:16:26 -06:00
|
|
|
std::vector<cvf::Vec3d> displayCoords = displayCoordTransform->transformToDisplayCoords(lateralDomainCoords);
|
2017-05-05 08:09:22 -05:00
|
|
|
|
2017-05-23 02:35:17 -05:00
|
|
|
geoGenerator.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
|
|
|
|
2017-05-10 10:10:23 -05:00
|
|
|
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(m_rimFishbonesSubs);
|
|
|
|
for (auto part : m_parts)
|
2017-05-05 04:21:40 -05:00
|
|
|
{
|
2017-05-10 10:10:23 -05:00
|
|
|
part->setSourceInfo(objectSourceInfo.p());
|
2017-05-05 04:21:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|