Refactored GeoMechView createDisplayModel

Made adding well paths less obfuscated
Preparing for #314 Property Filter
This commit is contained in:
Jacob Støren
2015-06-22 09:09:33 +02:00
parent 088bc12459
commit 8f2090eccf
6 changed files with 110 additions and 88 deletions

View File

@@ -473,42 +473,24 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimView::addWellPathsToScene(cvf::Scene* scene, const cvf::Vec3d& displayModelOffset,
double characteristicCellSize, const cvf::BoundingBox& wellPathClipBoundingBox,
void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::Vec3d& displayModelOffset,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
cvf::Transform* scaleTransform)
{
CVF_ASSERT(scene);
CVF_ASSERT(scaleTransform);
cvf::String wellPathModelName = "WellPathModel";
std::vector<cvf::Model*> wellPathModels;
for (cvf::uint i = 0; i < scene->modelCount(); i++)
{
if (scene->model(i)->name() == wellPathModelName)
{
wellPathModels.push_back(scene->model(i));
}
}
for (size_t i = 0; i < wellPathModels.size(); i++)
{
scene->removeModel(wellPathModels[i]);
}
// Append static Well Paths to model
cvf::ref<cvf::ModelBasicList> wellPathModelBasicList = new cvf::ModelBasicList;
wellPathModelBasicList->setName(wellPathModelName);
RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL;
RimWellPathCollection* wellPathCollection = oilFields ? oilFields->wellPathCollection() : NULL;
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = wellPathCollection ? wellPathCollection->wellPathCollectionPartMgr() : NULL;
if (wellPathCollectionPartMgr)
{
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList.p(), displayModelOffset,
scaleTransform, characteristicCellSize, wellPathClipBoundingBox);
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList,
displayModelOffset,
scaleTransform,
characteristicCellSize,
wellPathClipBoundingBox);
}
wellPathModelBasicList->updateBoundingBoxesRecursive();
scene->addModel(wellPathModelBasicList.p());
}