NNC: Prioritize NNC parts when picking in 3D scene

This commit is contained in:
Magne Sjaastad
2013-12-20 10:57:53 +01:00
parent 59eeb0894f
commit 1c80a9dbe8
5 changed files with 55 additions and 31 deletions

View File

@@ -250,7 +250,9 @@ void RivFaultPartMgr::generatePartGeometry()
part->setDrawable(geo.p());
// Set mapping from triangle face index to cell index
part->setSourceInfo(RivSourceInfo::fromCellIndices(m_nativeFaultGenerator->triangleToSourceGridCellMap().p()).p());
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
si->m_cellIndices = m_nativeFaultGenerator->triangleToSourceGridCellMap().p();
part->setSourceInfo(si.p());
part->updateBoundingBox();
part->setEnableMask(faultBit);
@@ -301,7 +303,9 @@ void RivFaultPartMgr::generatePartGeometry()
part->setDrawable(geo.p());
// Set mapping from triangle face index to cell index
part->setSourceInfo(RivSourceInfo::fromCellIndices(m_oppositeFaultGenerator->triangleToSourceGridCellMap().p()).p());
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
si->m_cellIndices = m_oppositeFaultGenerator->triangleToSourceGridCellMap().p();
part->setSourceInfo(si.p());
part->updateBoundingBox();
part->setEnableMask(faultBit);
@@ -350,7 +354,9 @@ void RivFaultPartMgr::generatePartGeometry()
part->setDrawable(geo.p());
// Set mapping from triangle face index to cell index
part->setSourceInfo(RivSourceInfo::fromNNCIndices(m_NNCGenerator->triangleToNNCIndex().p()).p());
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
si->m_NNCIndices = m_NNCGenerator->triangleToNNCIndex().p();
part->setSourceInfo(si.p());
part->updateBoundingBox();
part->setEnableMask(faultBit);

View File

@@ -115,7 +115,9 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
part->setTransform(m_scaleTransform.p());
// Set mapping from triangle face index to cell index
part->setSourceInfo(RivSourceInfo::fromCellIndices(geoBuilder.triangleToSourceGridCellMap().p()).p());
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
si->m_cellIndices = geoBuilder.triangleToSourceGridCellMap().p();
part->setSourceInfo(si.p());
part->updateBoundingBox();

View File

@@ -22,27 +22,15 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RivSourceInfo> RivSourceInfo::fromCellIndices(cvf::Array<size_t>* cellIndices)
bool RivSourceInfo::hasCellIndices() const
{
CVF_ASSERT(cellIndices);
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
si->m_cellIndices = cellIndices;
return si;
return m_cellIndices.notNull();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RivSourceInfo> RivSourceInfo::fromNNCIndices(cvf::Array<size_t>* nncIndices)
bool RivSourceInfo::hasNNCIndices() const
{
CVF_ASSERT(nncIndices);
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
si->m_NNCIndices = nncIndices;
return si;
return m_NNCIndices.notNull();
}

View File

@@ -25,8 +25,8 @@
class RivSourceInfo : public cvf::Object
{
public:
static cvf::ref<RivSourceInfo> fromCellIndices(cvf::Array<size_t>* cellIndices);
static cvf::ref<RivSourceInfo> fromNNCIndices(cvf::Array<size_t>* nncIndices);
bool hasCellIndices() const;
bool hasNNCIndices() const;
public:
cvf::ref<cvf::Array<size_t> > m_cellIndices;