(#404) Use only one structure for well path geometry

This commit is contained in:
Magne Sjaastad 2015-12-03 19:13:12 +01:00
parent 1977578d90
commit c4eee507a8
2 changed files with 26 additions and 15 deletions

View File

@ -90,7 +90,7 @@ RivWellPathPartMgr::RivWellPathPartMgr(RimWellPathCollection* wellPathCollection
//--------------------------------------------------------------------------------------------------
RivWellPathPartMgr::~RivWellPathPartMgr()
{
clearAllBranchData();
}
//--------------------------------------------------------------------------------------------------
@ -106,15 +106,14 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
if (wellPathGeometry->m_wellPathPoints.size() < 2) return;
m_wellBranches.clear();
clearAllBranchData();
double wellPathRadius = m_wellPathCollection->wellPathRadiusScaleFactor() * m_rimWellPath->wellPathRadiusScaleFactor() * characteristicCellSize;
cvf::Vec3d textPosition = wellPathGeometry->m_wellPathPoints[0];
// Generate the well path geometry as a line and pipe structure
{
m_wellBranches.push_back(RivPipeBranchData());
RivPipeBranchData& pbd = m_wellBranches.back();
RivPipeBranchData& pbd = m_pipeBranchData;
pbd.m_pipeGeomGenerator = new RivPipeGeometryGenerator;
@ -243,17 +242,14 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
buildWellPathParts(displayModelOffset, characteristicCellSize, wellPathClipBoundingBox);
}
std::list<RivPipeBranchData>::iterator it;
for (it = m_wellBranches.begin(); it != m_wellBranches.end(); ++it)
if (m_pipeBranchData.m_surfacePart.notNull())
{
if (it->m_surfacePart.notNull())
{
model->addPart(it->m_surfacePart.p());
}
if (it->m_centerLinePart.notNull())
{
model->addPart(it->m_centerLinePart.p());
}
model->addPart(m_pipeBranchData.m_surfacePart.p());
}
if (m_pipeBranchData.m_centerLinePart.notNull())
{
model->addPart(m_pipeBranchData.m_centerLinePart.p());
}
if (m_wellLabelPart.notNull())
@ -262,6 +258,9 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* m
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::setScaleTransform( cvf::Transform * scaleTransform )
{
if (m_scaleTransform.isNull() || m_scaleTransform.p() != scaleTransform)
@ -270,3 +269,15 @@ void RivWellPathPartMgr::setScaleTransform( cvf::Transform * scaleTransform )
scheduleGeometryRegen();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellPathPartMgr::clearAllBranchData()
{
m_pipeBranchData.m_pipeGeomGenerator = NULL;
m_pipeBranchData.m_surfacePart = NULL;
m_pipeBranchData.m_surfaceDrawable = NULL;
m_pipeBranchData.m_centerLinePart = NULL;
m_pipeBranchData.m_centerLineDrawable = NULL;
}

View File

@ -60,6 +60,7 @@ private:
bool m_needsTransformUpdate;
void buildWellPathParts(cvf::Vec3d displayModelOffset, double characteristicCellSize, cvf::BoundingBox wellPathClipBoundingBox);
void clearAllBranchData();
struct RivPipeBranchData
{
@ -71,7 +72,6 @@ private:
};
RivPipeBranchData m_pipeBranchData;
std::list<RivPipeBranchData> m_wellBranches;
cvf::ref<cvf::Part> m_wellLabelPart;
cvf::ref<cvf::ScalarMapper> m_scalarMapper;