#1440 Use view as basis for appending dynamic parts

This commit is contained in:
Magne Sjaastad
2017-06-16 08:56:02 +02:00
parent e50f876cf0
commit 6cd0f0ebd2
5 changed files with 65 additions and 49 deletions

View File

@@ -88,24 +88,16 @@ void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBa
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(size_t timeStep,
cvf::ModelBasicList* model,
cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform)
void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model)
{
setScaleTransform(scaleTransform);
if (!m_wellPathCollection->isActive()) return;
if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
{
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
partMgr->setScaleTransform(scaleTransform);
partMgr->appendDynamicGeometryPartsToModel(timeStep, model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
partMgr->appendDynamicGeometryPartsToModel(view, model);
}
}

View File

@@ -63,14 +63,7 @@ public:
cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform);
void appendDynamicGeometryPartsToModel(
size_t timeStep,
cvf::ModelBasicList* model,
cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform);
void appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model);
private:
caf::PdmPointer<RimWellPathCollection> m_wellPathCollection;

View File

@@ -23,26 +23,29 @@
#include "RiaApplication.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimFishboneWellPath.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimView.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimFishboneWellPath.h"
#include "RimFishbonesCollection.h"
#include "RimFishboneWellPathCollection.h"
#include "RimPerforationInterval.h"
#include "RimPerforationCollection.h"
#include "RivFishbonesSubsPartMgr.h"
#include "RivObjectSourceInfo.h"
#include "RivPartPriority.h"
#include "RivPipeGeometryGenerator.h"
#include "RivWellPathSourceInfo.h"
#include "RivObjectSourceInfo.h"
#include "cafEffectGenerator.h"
#include "cafDisplayCoordTransform.h"
#include "cafEffectGenerator.h"
#include "cvfDrawableGeo.h"
#include "cvfDrawableText.h"
#include "cvfFont.h"
@@ -58,7 +61,7 @@
//--------------------------------------------------------------------------------------------------
RivWellPathPartMgr::RivWellPathPartMgr(RimWellPath* wellPath)
{
m_rimWellPath = wellPath;
m_rimWellPath = wellPath;
m_needsTransformUpdate = true;
@@ -146,13 +149,12 @@ void RivWellPathPartMgr::appendCompletionsToModel(cvf::ModelBasicList* model, ca
model->addPart(part.p());
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize)
void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize)
{
if (!m_rimWellPath || !m_rimWellPath->perforationIntervalCollection()->isChecked()) return;
@@ -176,6 +178,8 @@ void RivWellPathPartMgr::appendPerforationsToModel(cvf::ModelBasicList* model, c
if (!perforation->isChecked()) continue;
if (perforation->startMD() > perforation->endMD()) continue;
if (currentViewDate.isValid() && !perforation->isActiveOnDate(currentViewDate)) continue;
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(wellPathGeometry->interpolatedPointAlongWellPath(perforation->startMD())));
for (size_t i = 0; i < wellPathGeometry->m_measuredDepths.size(); ++i)
@@ -388,20 +392,51 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
appendFishbonesPartsToModel(model, displayCoordTransform, characteristicCellSize);
appendCompletionsToModel(model, displayCoordTransform, characteristicCellSize);
appendPerforationsToModel(model, displayCoordTransform, characteristicCellSize);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(size_t frameIndex,
cvf::ModelBasicList* model,
cvf::Vec3d displayModelOffset,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform)
void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model)
{
// TODO add perforation intervals
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
if (!wellPathCollection) return;
if (m_rimWellPath.isNull()) return;
if (wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF)
return;
if (wellPathCollection->wellPathVisibility() != RimWellPathCollection::FORCE_ALL_ON && m_rimWellPath->showWellPath() == false)
return;
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform = view->displayCoordTransform();
double characteristicCellSize = 10.0;
QDateTime currentDateTime;
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
if (eclipseView)
{
RigMainGrid* mainGrid = eclipseView->mainGrid();
if (mainGrid)
{
characteristicCellSize = mainGrid->characteristicIJCellSize();
}
RimEclipseCase* eclipseCase = nullptr;
view->firstAncestorOrThisOfType(eclipseCase);
if (eclipseCase)
{
std::vector<QDateTime> timeStepDates = eclipseCase->timeStepDates();
if (view->currentTimeStep() < timeStepDates.size())
{
currentDateTime = timeStepDates[view->currentTimeStep()];
}
}
}
appendPerforationsToModel(currentDateTime, model, displayCoordTransform.p(), characteristicCellSize);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -43,6 +43,9 @@ class RimProject;
class RimWellPath;
class RivFishbonesSubsPartMgr;
class RimWellPathCollection;
class RimView;
class QDateTime;
class RivWellPathPartMgr : public cvf::Object
{
@@ -58,16 +61,15 @@ public:
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform);
void appendDynamicGeometryPartsToModel(size_t frameIndex, cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform);
void appendDynamicGeometryPartsToModel(RimView* view, cvf::ModelBasicList* model);
size_t segmentIndexFromTriangleIndex(size_t triangleIndex);
private:
void appendFishbonesPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize);
void appendCompletionsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize);
void appendPerforationsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize);
void appendPerforationsToModel(const QDateTime& currentViewDate, cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize);
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
void clearAllBranchData();
inline RimWellPathCollection* wellPathCollection();

View File

@@ -651,13 +651,7 @@ void RimEclipseView::updateCurrentTimeStep()
RigMainGrid* mainGrid = this->mainGrid();
if (mainGrid)
{
wellPathsPartManager()->appendDynamicGeometryPartsToModel(m_currentTimeStep,
wellPathModelBasicList.p(),
mainGrid->displayModelOffset(),
m_reservoirGridPartManager->scaleTransform(),
mainGrid->characteristicIJCellSize(),
currentActiveCellInfo()->geometryBoundingBox(),
this->displayCoordTransform().p());
wellPathsPartManager()->appendDynamicGeometryPartsToModel(this, wellPathModelBasicList.p());
wellPathModelBasicList->updateBoundingBoxesRecursive();