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)
{
for (size_t wIdx = 0; wIdx < m_wellPathCollection->wellPaths.size(); wIdx++)
{
m_wellPathCollection->wellPaths[wIdx]->partMgr()->setScaleTransform(scaleTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
void RivWellPathCollectionPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform)
{
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->appendStaticGeometryPartsToModel(model, displayModelOffset, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
}
}
@@ -98,6 +85,5 @@ void RivWellPathCollectionPartMgr::appendDynamicGeometryPartsToModel(RimView* vi
RivWellPathPartMgr* partMgr = m_wellPathCollection->wellPaths[wIdx]->partMgr();
partMgr->appendDynamicGeometryPartsToModel(view, model);
}
}

View File

@@ -53,12 +53,8 @@ public:
void scheduleGeometryRegen();
void setScaleTransform(cvf::Transform * scaleTransform);
void appendStaticGeometryPartsToModel(
cvf::ModelBasicList* model,
cvf::Vec3d displayModelOffset,
cvf::Transform* scaleTransform,
double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox,
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
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize,
void RivWellPathPartMgr::buildWellPathParts(caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize,
cvf::BoundingBox wellPathClipBoundingBox)
{
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
@@ -223,7 +223,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
clearAllBranchData();
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
{
@@ -263,7 +263,6 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
if (clippedPoints.size() < 2) return;
textPosition = clippedPoints[0];
cvfCoords->assign(clippedPoints);
}
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.
for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx)
{
cvf::Vec4d transfCoord = m_scaleTransform->worldTransform() * cvf::Vec4d((*cvfCoords)[cIdx] - displayModelOffset, 1);
(*cvfCoords)[cIdx][0] = transfCoord[0];
(*cvfCoords)[cIdx][1] = transfCoord[1];
(*cvfCoords)[cIdx][2] = transfCoord[2];
(*cvfCoords)[cIdx] = displayCoordTransform->transformToDisplayCoord((*cvfCoords)[cIdx]);
}
textPosition = cvfCoords->get(0);
pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p());
pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface();
pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine();
@@ -312,10 +310,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
// Generate label with well-path name
textPosition -= displayModelOffset;
textPosition.transformPoint(m_scaleTransform->worldTransform());
textPosition.z() += characteristicCellSize; // * m_rimReservoirView->wellCollection()->wellHeadScaleFactor();
textPosition.z() += 1.2 * characteristicCellSize;
textPosition.z() += 2.2 * characteristicCellSize;
m_wellLabelPart = NULL;
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,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform)
{
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
@@ -372,7 +366,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
if (m_needsTransformUpdate)
{
// 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())
@@ -434,18 +428,6 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(RimView* view, cvf::M
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);
~RivWellPathPartMgr();
void setScaleTransform(cvf::Transform * scaleTransform);
void scheduleGeometryRegen();
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, cvf::Vec3d displayModelOffset,
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox,
caf::DisplayCoordTransform* displayCoordTransform);
@@ -70,7 +68,7 @@ private:
void appendCompletionsToModel(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();
inline RimWellPathCollection* wellPathCollection();
inline double wellPathRadius(double characteristicCellSize, RimWellPathCollection* wellPathCollection);
@@ -78,7 +76,6 @@ private:
private:
caf::PdmPointer<RimWellPath> m_rimWellPath;
cvf::ref<cvf::Transform> m_scaleTransform;
bool m_needsTransformUpdate;
struct RivPipeBranchData

View File

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

View File

@@ -210,15 +210,10 @@ void RimGeoMechView::createDisplayModel()
// Well path model
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
m_wellPathPipeVizModel->removeAllParts();
addWellPathsToModel(m_wellPathPipeVizModel.p(),
cvf::Vec3d(0, 0, 0),
characteristicCellSize,
femBBox,
scaleTransform());
addWellPathsToModel(m_wellPathPipeVizModel.p(), femBBox);
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,
const cvf::Vec3d& displayModelOffset,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
cvf::Transform* scaleTransform)
const cvf::BoundingBox& wellPathClipBoundingBox)
{
if (!this->ownerCase()) return;
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
wellPathsPartManager()->appendStaticGeometryPartsToModel(wellPathModelBasicList,
displayModelOffset,
scaleTransform,
characteristicCellSize,
this->ownerCase()->characteristicCellSize(),
wellPathClipBoundingBox,
transForm.p());

View File

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