Remove scale transform

This commit is contained in:
Magne Sjaastad
2017-06-19 22:15:28 +02:00
parent 994198d388
commit 210bdab4c3
8 changed files with 21 additions and 80 deletions

View File

@@ -57,31 +57,18 @@ void RivWellPathCollectionPartMgr::scheduleGeometryRegen()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::setScaleTransform(cvf::Transform * scaleTransform) void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
{ double characteristicCellSize,
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) cvf::BoundingBox wellPathClipBoundingBox,
{
m_wellPathCollection->wellPaths[wIdx]->partMgr()->setScaleTransform(scaleTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform) caf::DisplayCoordTransform* displayCoordTransform)
{ {
setScaleTransform(scaleTransform);
if (!m_wellPathCollection->isActive()) return; if (!m_wellPathCollection->isActive()) return;
if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return; if (m_wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++) for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
{ {
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
partMgr->setScaleTransform(scaleTransform); partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
partMgr->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
} }
} }
@@ -98,6 +85,5 @@ void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(RimView* vi
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr(); RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
partMgr->appendDynamicGeometryPartsToModel(view, model); partMgr->appendDynamicGeometryPartsToModel(view, model);
} }
} }

View File

@@ -53,12 +53,8 @@ public:
void scheduleGeometryRegen(); void scheduleGeometryRegen();
void setScaleTransform(cvf::Transform * scaleTransform);
void appendStaticGeometryPartsToModel( void appendStaticGeometryPartsToModel(
cvf::ModelBasicList* model, cvf::ModelBasicList* model,
cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform,
double characteristicCellSize, double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform); caf::DisplayCoordTransform* displayCoordTransform);

View File

@@ -209,7 +209,7 @@ void RivWellPathPartMgr::appendPerforationsToModel(const QDateTime& currentViewD
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// The pipe geometry needs to be rebuilt on scale change to keep the pipes round /// The pipe geometry needs to be rebuilt on scale change to keep the pipes round
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, void RivWellPathPartMgr::buildWellPathParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox) cvf::BoundingBox wellPathClipBoundingBox)
{ {
RimWellPathCollection* wellPathCollection = this->wellPathCollection(); RimWellPathCollection* wellPathCollection = this->wellPathCollection();
@@ -223,7 +223,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
clearAllBranchData(); clearAllBranchData();
double wellPathRadius = this->wellPathRadius(characteristicCellSize, wellPathCollection); double wellPathRadius = this->wellPathRadius(characteristicCellSize, wellPathCollection);
cvf::Vec3d textPosition = wellPathGeometry->m_wellPathPoints[0]; cvf::Vec3d textPosition;
// Generate the well path geometry as a line and pipe structure // Generate the well path geometry as a line and pipe structure
{ {
@@ -263,7 +263,6 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
if (clippedPoints.size() < 2) return; if (clippedPoints.size() < 2) return;
textPosition = clippedPoints[0];
cvfCoords->assign(clippedPoints); cvfCoords->assign(clippedPoints);
} }
else else
@@ -274,12 +273,11 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
// Scale the centerline coordinates using the Z-scale transform of the grid and correct for the display offset. // Scale the centerline coordinates using the Z-scale transform of the grid and correct for the display offset.
for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx) for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx)
{ {
cvf::Vec4d transfCoord = m_scaleTransform->worldTransform() * cvf::Vec4d((*cvfCoords)[cIdx] - displayModelOffset, 1); (*cvfCoords)[cIdx] = displayCoordTransform->transformToDisplayCoord((*cvfCoords)[cIdx]);
(*cvfCoords)[cIdx][0] = transfCoord[0];
(*cvfCoords)[cIdx][1] = transfCoord[1];
(*cvfCoords)[cIdx][2] = transfCoord[2];
} }
textPosition = cvfCoords->get(0);
pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p()); pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p());
pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface(); pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface();
pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine(); pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine();
@@ -312,10 +310,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
// Generate label with well-path name // Generate label with well-path name
textPosition -= displayModelOffset; textPosition.z() += 2.2 * characteristicCellSize;
textPosition.transformPoint(m_scaleTransform->worldTransform());
textPosition.z() += characteristicCellSize; // * m_rimReservoirView->wellCollection()->wellHeadScaleFactor();
textPosition.z() += 1.2 * characteristicCellSize;
m_wellLabelPart = NULL; m_wellLabelPart = NULL;
if (wellPathCollection->showWellPathLabel() && m_rimWellPath->showWellPathLabel() && !m_rimWellPath->name().isEmpty()) if (wellPathCollection->showWellPathLabel() && m_rimWellPath->showWellPathLabel() && !m_rimWellPath->name().isEmpty())
@@ -354,8 +349,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform) caf::DisplayCoordTransform* displayCoordTransform)
{ {
RimWellPathCollection* wellPathCollection = this->wellPathCollection(); RimWellPathCollection* wellPathCollection = this->wellPathCollection();
@@ -372,7 +366,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
if (m_needsTransformUpdate) if (m_needsTransformUpdate)
{ {
// The pipe geometry needs to be rebuilt on scale change to keep the pipes round // The pipe geometry needs to be rebuilt on scale change to keep the pipes round
buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox); buildWellPathParts(displayCoordTransform, characteristicCellSize, wellPathClipBoundingBox);
} }
if (m_pipeBranchData.m_surfacePart.notNull()) if (m_pipeBranchData.m_surfacePart.notNull())
@@ -434,18 +428,6 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::M
appendPerforationsToModel(currentDateTime, model, displayCoordTransform.p(), characteristicCellSize); appendPerforationsToModel(currentDateTime, model, displayCoordTransform.p(), characteristicCellSize);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::setScaleTransform( cvf::Transform * scaleTransform )
{
if (m_scaleTransform.isNull() || m_scaleTransform.p() != scaleTransform)
{
m_scaleTransform = scaleTransform;
scheduleGeometryRegen();
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -53,11 +53,9 @@ public:
explicit RivWellPathPartMgr(RimWellPath* wellPath); explicit RivWellPathPartMgr(RimWellPath* wellPath);
~RivWellPathPartMgr(); ~RivWellPathPartMgr();
void setScaleTransform(cvf::Transform * scaleTransform);
void scheduleGeometryRegen(); void scheduleGeometryRegen();
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset, void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform); caf::DisplayCoordTransform* displayCoordTransform);
@@ -70,7 +68,7 @@ private:
void appendCompletionsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize); void appendCompletionsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize);
void appendPerforationsToModel(const QDateTime& currentViewDate, 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 buildWellPathParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
void clearAllBranchData(); void clearAllBranchData();
inline RimWellPathCollection* wellPathCollection(); inline RimWellPathCollection* wellPathCollection();
inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection); inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection);
@@ -78,7 +76,6 @@ private:
private: private:
caf::PdmPointer<RimWellPath> m_rimWellPath; caf::PdmPointer<RimWellPath> m_rimWellPath;
cvf::ref<cvf::Transform> m_scaleTransform;
bool m_needsTransformUpdate; bool m_needsTransformUpdate;
struct RivPipeBranchData struct RivPipeBranchData

View File

@@ -424,18 +424,9 @@ void RimEclipseView::createDisplayModel()
*/ */
// Well path model // Well path model
m_wellPathPipeVizModel->removeAllParts(); m_wellPathPipeVizModel->removeAllParts();
RigMainGrid* mainGrid = this->mainGrid(); addWellPathsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox());
if (mainGrid)
{
addWellPathsToModel(m_wellPathPipeVizModel.p(),
mainGrid->displayModelOffset(),
mainGrid->characteristicIJCellSize(),
currentActiveCellInfo()->geometryBoundingBox(),
m_reservoirGridPartManager->scaleTransform());
}
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p()); m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());

View File

@@ -210,15 +210,10 @@ void RimGeoMechView::createDisplayModel()
// Well path model // Well path model
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox(); cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
m_wellPathPipeVizModel->removeAllParts(); m_wellPathPipeVizModel->removeAllParts();
addWellPathsToModel(m_wellPathPipeVizModel.p(), addWellPathsToModel(m_wellPathPipeVizModel.p(), femBBox);
cvf::Vec3d(0, 0, 0),
characteristicCellSize,
femBBox,
scaleTransform());
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p()); m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());

View File

@@ -732,17 +732,14 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::Vec3d& displayModelOffset, const cvf::BoundingBox& wellPathClipBoundingBox)
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
cvf::Transform* scaleTransform)
{ {
if (!this->ownerCase()) return;
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform(); cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
wellPathsPartManager()->appendStaticGeometryPartsToModel(wellPathModelBasicList, wellPathsPartManager()->appendStaticGeometryPartsToModel(wellPathModelBasicList,
displayModelOffset, this->ownerCase()->characteristicCellSize(),
scaleTransform,
characteristicCellSize,
wellPathClipBoundingBox, wellPathClipBoundingBox,
transForm.p()); transForm.p());

View File

@@ -178,10 +178,7 @@ protected:
void setDefaultView(); void setDefaultView();
void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::Vec3d& displayModelOffset, const cvf::BoundingBox& wellPathClipBoundingBox);
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
cvf::Transform* scaleTransform);
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName); static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);