#2431 : Add part manager for all well paths WIP

This commit is contained in:
Magne Sjaastad
2018-02-05 13:13:55 +01:00
parent e8b29f7279
commit 0679ec4ba5
3 changed files with 255 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellPathsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h
@@ -63,6 +64,7 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.cpp

View File

@@ -0,0 +1,164 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// 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 "RivWellPathsPartMgr.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPathCollection.h"
#include "RivWellPathPartMgr.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathsPartMgr::RivWellPathsPartMgr(Rim3dView* view) : m_rimView(view) {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellPathsPartMgr::~RivWellPathsPartMgr() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathsPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform)
{
auto wellPathColl = wellPathCollection();
if (!wellPathColl->isActive()) return;
if (wellPathColl->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
buildPartManagers();
for (auto& partMgr : m_wellPatshsPartMgrs)
{
partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
void RivWellPathsPartMgr::appendStaticFracturePartsToModel(cvf::ModelBasicList* model, const Rim3dView* rimView)
{
/*
// Display of fractures is not supported in geomech view
const RimEclipseView* eclView = dynamic_cast<const RimEclipseView*>(rimView);
if (!eclView) return;
auto wellPathColl = wellPathCollection();
if (!wellPathColl->isActive()) return;
if (wellPathColl->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
buildPartManagers();
for (auto& partMgr : m_wellPatshsPartMgrs)
{
partMgr->appendStaticFracturePartsToModel(model, eclView);
}
*/
}
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, const QDateTime& timeStamp,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform)
{
auto wellPathColl = wellPathCollection();
if (!wellPathColl->isActive()) return;
if (wellPathColl->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
buildPartManagers();
for (auto& partMgr : m_wellPatshsPartMgrs)
{
partMgr->appendDynamicGeometryPartsToModel(model, timeStamp, characteristicCellSize, wellPathClipBoundingBox,
displayCoordTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivWellPathsPartMgr::segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const
{
auto it = m_mapFromViewToIndex.find(wellPath);
if (it == m_mapFromViewToIndex.end()) return -1;
return it->second->segmentIndexFromTriangleIndex(triangleIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathsPartMgr::clearGeometryCache()
{
m_wellPatshsPartMgrs.clear();
m_mapFromViewToIndex.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathsPartMgr::scheduleGeometryRegen() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathsPartMgr::buildPartManagers()
{
/*
RimProject* proj = RiaApplication::instance()->project();
auto wellPaths = proj->allWellPaths();
if (m_wellPatshsPartMgrs.size() != wellPaths.size())
{
clearGeometryCache();
for (auto wellPath : wellPaths)
{
RivWellPathPartMgr* wppm = new RivWellPathPartMgr(wellPath, m_rimView);
m_wellPatshsPartMgrs.push_back(wppm);
m_mapFromViewToIndex[wellPath] = wppm;
}
}
*/
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCollection* RivWellPathsPartMgr::wellPathCollection() const
{
RimProject* proj = RiaApplication::instance()->project();
return proj->activeOilField()->wellPathCollection();
}

View File

@@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// 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 "cvfCollection.h"
#include "cvfObject.h"
#include <QDateTime>
#include <map>
#include "cafPdmPointer.h"
namespace cvf
{
class BoundingBox;
class Transform;
class ModelBasicList;
}
namespace caf
{
class DisplayCoordTransform;
}
class Rim3dView;
class RivWellPathPartMgr;
class RimWellPathCollection;
class RimWellPath;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RivWellPathsPartMgr : public cvf::Object
{
public:
explicit RivWellPathsPartMgr(Rim3dView* view);
~RivWellPathsPartMgr();
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
void appendStaticFracturePartsToModel(cvf::ModelBasicList* model,
const Rim3dView* rimView);
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const QDateTime& timeStamp,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex, RimWellPath* wellPath) const;
private:
void clearGeometryCache();
void scheduleGeometryRegen();
void buildPartManagers();
RimWellPathCollection* wellPathCollection() const;
private:
caf::PdmPointer<Rim3dView> m_rimView;
cvf::Collection<RivWellPathPartMgr> m_wellPatshsPartMgrs;
std::map<RimWellPath*, RivWellPathPartMgr*> m_mapFromViewToIndex;
};