(#166) Geomech cross sections in place. Refactor of frame/scene/model usage on top level.

This commit is contained in:
Jacob Støren
2015-11-23 11:21:12 +01:00
parent b5c226aac1
commit c4aed9c487
7 changed files with 64 additions and 140 deletions

View File

@@ -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());
}
}