mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#166) Geomech cross sections in place. Refactor of frame/scene/model usage on top level.
This commit is contained in:
parent
b5c226aac1
commit
c4aed9c487
@ -279,9 +279,11 @@ void RimEclipseView::createDisplayModel()
|
||||
{
|
||||
if (m_viewer.isNull()) return;
|
||||
|
||||
//static int callCount = 0;
|
||||
//std::cout << "RimReservoirView::createDisplayModel() " << callCount++ << std::endl;
|
||||
//RiuMainWindow::instance()->setResultInfo(QString ("RimReservoirView::createDisplayModel() ") + QString::number(callCount++));
|
||||
#if 0 // Debug info
|
||||
static int callCount = 0;
|
||||
std::cout << "RimReservoirView::createDisplayModel() " << callCount++ << std::endl;
|
||||
RiuMainWindow::instance()->setResultInfo(QString("RimReservoirView::createDisplayModel() ") + QString::number(callCount++));
|
||||
#endif
|
||||
|
||||
if (!(m_reservoir && m_reservoir->reservoirData())) return;
|
||||
|
||||
@ -421,9 +423,9 @@ void RimEclipseView::createDisplayModel()
|
||||
|
||||
// Cross sections
|
||||
|
||||
m_crossSectionModel->removeAllParts();
|
||||
crossSectionCollection->appendPartsToModel(m_crossSectionModel.p(), m_reservoirGridPartManager->scaleTransform());
|
||||
m_viewer->addStaticModel(m_crossSectionModel.p());
|
||||
m_crossSectionVizModel->removeAllParts();
|
||||
crossSectionCollection->appendPartsToModel(m_crossSectionVizModel.p(), m_reservoirGridPartManager->scaleTransform());
|
||||
m_viewer->addStaticModelOnce(m_crossSectionVizModel.p());
|
||||
|
||||
|
||||
// Compute triangle count, Debug only
|
||||
@ -450,14 +452,22 @@ void RimEclipseView::createDisplayModel()
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Well path model
|
||||
|
||||
RigMainGrid* mainGrid = eclipseCase()->reservoirData()->mainGrid();
|
||||
|
||||
m_wellPathPipeVizModel->removeAllParts();
|
||||
addWellPathsToModel(m_wellPathPipeVizModel.p(),
|
||||
mainGrid->displayModelOffset(),
|
||||
mainGrid->characteristicIJCellSize(),
|
||||
currentActiveCellInfo()->geometryBoundingBox(),
|
||||
m_reservoirGridPartManager->scaleTransform());
|
||||
|
||||
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());
|
||||
|
||||
// Create Scenes from the frameModels
|
||||
// Animation frames for results display, starts from frame 1
|
||||
|
||||
RimEclipseCase* eclCase = eclipseCase();
|
||||
RigCaseData* caseData = eclCase ? eclCase->reservoirData() : NULL;
|
||||
RigMainGrid* mainGrid = caseData ? caseData->mainGrid() : NULL;
|
||||
CVF_ASSERT(mainGrid);
|
||||
|
||||
size_t frameIndex;
|
||||
for (frameIndex = 0; frameIndex < frameModels.size(); frameIndex++)
|
||||
@ -468,12 +478,6 @@ void RimEclipseView::createDisplayModel()
|
||||
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
||||
scene->addModel(model);
|
||||
|
||||
// Add well paths, if any
|
||||
addWellPathsToScene(scene.p(), mainGrid->displayModelOffset(),
|
||||
mainGrid->characteristicIJCellSize(),
|
||||
currentActiveCellInfo()->geometryBoundingBox(),
|
||||
m_reservoirGridPartManager->scaleTransform());
|
||||
|
||||
if (frameIndex == 0)
|
||||
m_viewer->setMainScene(scene.p());
|
||||
else
|
||||
@ -506,38 +510,11 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
if (this->viewController() && this->viewController()->isVisibleCellsOveridden())
|
||||
{
|
||||
geometriesToRecolor.push_back(OVERRIDDEN_CELL_VISIBILITY);
|
||||
#if 0 // Experimental
|
||||
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
|
||||
std::vector<size_t> gridIndices;
|
||||
this->indicesToVisibleGrids(&gridIndices);
|
||||
|
||||
|
||||
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), OVERRIDDEN_CELL_VISIBILITY, gridIndices);
|
||||
std::vector<RivCellSetEnum> faultGeometryTypesToAppend = visibleFaultGeometryTypes();
|
||||
|
||||
for (size_t i = 0; i < faultGeometryTypesToAppend.size(); i++)
|
||||
{
|
||||
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameParts.p(), faultGeometryTypesToAppend[i]);
|
||||
}
|
||||
|
||||
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend);
|
||||
m_reservoirGridPartManager->appendFaultLabelsStaticGeometryPartsToModel(frameParts.p(), faultLabelType);
|
||||
|
||||
if (m_viewer)
|
||||
{
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
frameScene->removeAllModels();
|
||||
frameScene->addModel(frameParts.p());
|
||||
frameParts->updateBoundingBoxesRecursive();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (this->eclipsePropertyFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
|
||||
frameParts->setName("GridModel");
|
||||
|
||||
std::vector<size_t> gridIndices;
|
||||
this->indicesToVisibleGrids(&gridIndices);
|
||||
@ -603,7 +580,7 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
frameScene->removeAllModels();
|
||||
this->removeModelByName(frameScene, frameParts->name());
|
||||
frameScene->addModel(frameParts.p());
|
||||
frameParts->updateBoundingBoxesRecursive();
|
||||
}
|
||||
@ -662,40 +639,25 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
crossSectionCollection->applySingleColorEffect();
|
||||
}
|
||||
|
||||
// Well pipes
|
||||
// Simulation Well pipes
|
||||
if (m_viewer)
|
||||
{
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
// Well pipes
|
||||
// ----------
|
||||
cvf::String wellPipeModelName = "WellPipeModel";
|
||||
|
||||
this->removeModelByName(frameScene, wellPipeModelName);
|
||||
// Simulation Well pipes
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> wellPipeModelBasicList = new cvf::ModelBasicList;
|
||||
wellPipeModelBasicList->setName(wellPipeModelName);
|
||||
wellPipeModelBasicList->setName("SimWellPipeMod");
|
||||
|
||||
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
|
||||
m_pipesPartManager->updatePipeResultColor(m_currentTimeStep);
|
||||
|
||||
wellPipeModelBasicList->updateBoundingBoxesRecursive();
|
||||
//printf("updateCurrentTimeStep: Add WellPipeModel to frameScene\n");
|
||||
|
||||
this->removeModelByName(frameScene, wellPipeModelBasicList->name());
|
||||
frameScene->addModel(wellPipeModelBasicList.p());
|
||||
|
||||
// Add well paths, if any
|
||||
RimEclipseCase* eclCase = eclipseCase();
|
||||
RigCaseData* caseData = eclCase ? eclCase->reservoirData() : NULL;
|
||||
RigMainGrid* mainGrid = caseData ? caseData->mainGrid() : NULL;
|
||||
CVF_ASSERT(mainGrid);
|
||||
|
||||
addWellPathsToScene(frameScene,
|
||||
mainGrid->displayModelOffset(),
|
||||
mainGrid->characteristicIJCellSize(),
|
||||
currentActiveCellInfo()->geometryBoundingBox(),
|
||||
m_reservoirGridPartManager->scaleTransform());
|
||||
|
||||
m_pipesPartManager->updatePipeResultColor(m_currentTimeStep);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1569,35 +1531,6 @@ RimCase* RimEclipseView::ownerCase()
|
||||
return eclipseCase();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseView::addWellPathsToScene(cvf::Scene* scene,
|
||||
const cvf::Vec3d& displayModelOffset,
|
||||
double characteristicCellSize,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
cvf::Transform* scaleTransform)
|
||||
{
|
||||
CVF_ASSERT(scene);
|
||||
CVF_ASSERT(scaleTransform);
|
||||
|
||||
cvf::String wellPathModelName = "WellPathModel";
|
||||
this->removeModelByName(scene, wellPathModelName);
|
||||
|
||||
// Append static Well Paths to model
|
||||
cvf::ref<cvf::ModelBasicList> wellPathModelBasicList = new cvf::ModelBasicList;
|
||||
wellPathModelBasicList->setName(wellPathModelName);
|
||||
|
||||
addWellPathsToModel(wellPathModelBasicList.p(),
|
||||
displayModelOffset,
|
||||
characteristicCellSize,
|
||||
wellPathClipBoundingBox,
|
||||
scaleTransform);
|
||||
|
||||
scene->addModel(wellPathModelBasicList.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -165,17 +165,11 @@ private:
|
||||
void updateFaultColors();
|
||||
|
||||
void syncronizeWellsWithResults();
|
||||
void addWellPathsToScene(cvf::Scene* scene,
|
||||
const cvf::Vec3d& displayModelOffset,
|
||||
double characteristicCellSize,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
cvf::Transform* scaleTransform);
|
||||
|
||||
void clampCurrentTimestep();
|
||||
|
||||
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility);
|
||||
|
||||
|
||||
caf::PdmChildField<RimEclipsePropertyFilterCollection*> m_propertyFilterCollection;
|
||||
caf::PdmPointer<RimEclipsePropertyFilterCollection> m_overridePropertyFilterCollection;
|
||||
|
||||
|
@ -221,29 +221,32 @@ void RimGeoMechView::createDisplayModel()
|
||||
m_viewer->setMainScene(mainScene.p());
|
||||
|
||||
// Grid model
|
||||
cvf::ref<cvf::ModelBasicList> mainSceneModel = new cvf::ModelBasicList;
|
||||
m_vizLogic->appendNoAnimPartsToModel(mainSceneModel.p());
|
||||
mainSceneModel->updateBoundingBoxesRecursive();
|
||||
mainScene->addModel(mainSceneModel.p());
|
||||
cvf::ref<cvf::ModelBasicList> mainSceneGridVizModel = new cvf::ModelBasicList;
|
||||
mainSceneGridVizModel->setName("GridModel");
|
||||
m_vizLogic->appendNoAnimPartsToModel(mainSceneGridVizModel.p());
|
||||
mainSceneGridVizModel->updateBoundingBoxesRecursive();
|
||||
mainScene->addModel(mainSceneGridVizModel.p());
|
||||
|
||||
// Well path model
|
||||
|
||||
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
|
||||
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
|
||||
cvf::ref<cvf::ModelBasicList> wellPathModel = new cvf::ModelBasicList;
|
||||
addWellPathsToModel(wellPathModel.p(),
|
||||
|
||||
m_wellPathPipeVizModel->removeAllParts();
|
||||
addWellPathsToModel(m_wellPathPipeVizModel.p(),
|
||||
cvf::Vec3d(0, 0, 0),
|
||||
characteristicCellSize,
|
||||
femBBox,
|
||||
scaleTransform());
|
||||
mainScene->addModel(wellPathModel.p());
|
||||
|
||||
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());
|
||||
|
||||
|
||||
// Cross sections
|
||||
// Cross sections
|
||||
|
||||
m_crossSectionModel->removeAllParts();
|
||||
crossSectionCollection->appendPartsToModel(m_crossSectionModel.p(), scaleTransform());
|
||||
m_viewer->addStaticModel(m_crossSectionModel.p());
|
||||
m_crossSectionVizModel->removeAllParts();
|
||||
crossSectionCollection->appendPartsToModel(m_crossSectionVizModel.p(), scaleTransform());
|
||||
m_viewer->addStaticModelOnce(m_crossSectionVizModel.p());
|
||||
|
||||
// If the animation was active before recreating everything, make viewer view current frame
|
||||
|
||||
@ -274,24 +277,14 @@ void RimGeoMechView::updateCurrentTimeStep()
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
frameScene->removeAllModels();
|
||||
|
||||
// Grid model
|
||||
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
|
||||
frameParts->setName("GridModel");
|
||||
m_vizLogic->appendPartsToModel(m_currentTimeStep, frameParts.p());
|
||||
frameParts->updateBoundingBoxesRecursive();
|
||||
|
||||
this->removeModelByName(frameScene, frameParts->name());
|
||||
frameScene->addModel(frameParts.p());
|
||||
|
||||
// Well Path model
|
||||
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
|
||||
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
|
||||
cvf::ref<cvf::ModelBasicList> wellPathModel = new cvf::ModelBasicList;
|
||||
addWellPathsToModel(wellPathModel.p(),
|
||||
cvf::Vec3d(0, 0, 0),
|
||||
characteristicCellSize,
|
||||
femBBox,
|
||||
scaleTransform());
|
||||
frameScene->addModel(wellPathModel.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,11 +123,14 @@ RimView::RimView(void)
|
||||
|
||||
m_previousGridModeMeshLinesWasFaults = false;
|
||||
|
||||
m_crossSectionModel = new cvf::ModelBasicList;
|
||||
m_crossSectionModel->setName("CrossSectionModel");
|
||||
m_crossSectionVizModel = new cvf::ModelBasicList;
|
||||
m_crossSectionVizModel->setName("CrossSectionModel");
|
||||
|
||||
m_highlightModelBasicList = new cvf::ModelBasicList;
|
||||
m_highlightModelBasicList->setName("HighlightModel");
|
||||
m_highlightVizModel = new cvf::ModelBasicList;
|
||||
m_highlightVizModel->setName("HighlightModel");
|
||||
|
||||
m_wellPathPipeVizModel = new cvf::ModelBasicList;
|
||||
m_wellPathPipeVizModel->setName("WellPathPipeModel");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -822,10 +825,10 @@ void RimView::createHighlightAndGridBoxDisplayModelWithRedraw()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimView::createHighlightAndGridBoxDisplayModel()
|
||||
{
|
||||
m_viewer->removeStaticModel(m_highlightModelBasicList.p());
|
||||
m_viewer->removeStaticModel(m_highlightVizModel.p());
|
||||
m_viewer->removeStaticModel(m_viewer->gridBoxModel());
|
||||
|
||||
m_highlightModelBasicList->removeAllParts();
|
||||
m_highlightVizModel->removeAllParts();
|
||||
|
||||
cvf::Collection<cvf::Part> parts;
|
||||
createPartCollectionFromSelection(&parts);
|
||||
@ -833,16 +836,16 @@ void RimView::createHighlightAndGridBoxDisplayModel()
|
||||
{
|
||||
for (size_t i = 0; i < parts.size(); i++)
|
||||
{
|
||||
m_highlightModelBasicList->addPart(parts[i].p());
|
||||
m_highlightVizModel->addPart(parts[i].p());
|
||||
}
|
||||
|
||||
m_highlightModelBasicList->updateBoundingBoxesRecursive();
|
||||
m_viewer->addStaticModel(m_highlightModelBasicList.p());
|
||||
m_highlightVizModel->updateBoundingBoxesRecursive();
|
||||
m_viewer->addStaticModelOnce(m_highlightVizModel.p());
|
||||
}
|
||||
|
||||
if (showGridBox)
|
||||
{
|
||||
m_viewer->addStaticModel(m_viewer->gridBoxModel());
|
||||
m_viewer->addStaticModelOnce(m_viewer->gridBoxModel());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,9 +200,10 @@ protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> m_crossSectionModel;
|
||||
cvf::ref<cvf::ModelBasicList> m_highlightModelBasicList;
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> m_wellPathPipeVizModel;
|
||||
cvf::ref<cvf::ModelBasicList> m_crossSectionVizModel;
|
||||
cvf::ref<cvf::ModelBasicList> m_highlightVizModel;
|
||||
|
||||
private:
|
||||
RimViewLinker* viewLinkerIfMasterView() const;
|
||||
|
@ -823,7 +823,7 @@ void caf::Viewer::navigationPolicyUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::Viewer::addStaticModel(cvf::Model* model)
|
||||
void caf::Viewer::addStaticModelOnce(cvf::Model* model)
|
||||
{
|
||||
if (m_staticModels.contains(model)) return;
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
void removeAllFrames();
|
||||
|
||||
// Static models to be shown in all frames
|
||||
void addStaticModel(cvf::Model* model);
|
||||
void addStaticModelOnce(cvf::Model* model);
|
||||
void removeStaticModel(cvf::Model* model);
|
||||
void removeAllStaticModels();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user