#884 Intersection collection is responsible for adding box manipulator geometry to model used in 3D viewer

This commit is contained in:
Magne Sjaastad
2016-10-03 14:26:46 +02:00
parent 1f1fd72f02
commit 7659f58fd6
9 changed files with 39 additions and 251 deletions

View File

@@ -96,10 +96,8 @@ RimIntersectionBox::RimIntersectionBox()
//--------------------------------------------------------------------------------------------------
RimIntersectionBox::~RimIntersectionBox()
{
if (m_boxManipulator && viewer())
if (m_boxManipulator)
{
viewer()->removeStaticModel(m_boxManipulator->model());
m_boxManipulator->deleteLater();
}
}
@@ -144,6 +142,14 @@ void RimIntersectionBox::setFromOriginAndSize(const cvf::Vec3d& origin, const cv
rebuildGeometryAndScheduleCreateDisplayModel();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionBox::show3dManipulator() const
{
return m_show3DManipulator;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -213,6 +219,17 @@ RivIntersectionBoxPartMgr* RimIntersectionBox::intersectionBoxPartMgr()
return m_intersectionBoxPartMgr.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::appendManipulatorPartsToModel(cvf::ModelBasicList* model)
{
if (show3dManipulator() && m_boxManipulator)
{
m_boxManipulator->appendPartsToModel(model);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -269,11 +286,6 @@ void RimIntersectionBox::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
{
if (m_boxManipulator)
{
if (viewer())
{
viewer()->removeStaticModel(m_boxManipulator->model());
}
m_boxManipulator->deleteLater();
m_boxManipulator = nullptr;
}
@@ -410,15 +422,10 @@ void RimIntersectionBox::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::slotScheduleRedraw()
{
if (viewer())
{
viewer()->addStaticModelOnce(m_boxManipulator->model());
RimView* rimView = nullptr;
this->firstAncestorOrThisOfType(rimView);
RimView* rimView = nullptr;
this->firstAncestorOrThisOfType(rimView);
rimView->scheduleCreateDisplayModelAndRedraw();
}
rimView->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -32,6 +32,10 @@ class RicBoxManipulatorEventHandler;
class RiuViewer;
class RivIntersectionBoxPartMgr;
namespace cvf {
class ModelBasicList;
}
//==================================================================================================
//
//
@@ -66,7 +70,9 @@ public:
SinglePlaneState singlePlaneState() const;
void setFromOriginAndSize(const cvf::Vec3d& origin, const cvf::Vec3d& size);
bool show3dManipulator() const;
RivIntersectionBoxPartMgr* intersectionBoxPartMgr();
void appendManipulatorPartsToModel(cvf::ModelBasicList* model);
void setToDefaultSizeBox();
void setToDefaultSizeSlice(SinglePlaneState plane, const cvf::Vec3d& position);

View File

@@ -147,6 +147,11 @@ void RimIntersectionCollection::appendPartsToModel(cvf::ModelBasicList* model, c
{
cs->intersectionBoxPartMgr()->appendNativeCrossSectionFacesToModel(model, scaleTransform);
cs->intersectionBoxPartMgr()->appendMeshLinePartsToModel(model, scaleTransform);
if (cs->show3dManipulator())
{
cs->appendManipulatorPartsToModel(model);
}
}
}
}