Commit 4adcae6e authored by finetjul's avatar finetjul
Browse files

ENH: Add vtkMRMLDisplayNode::GetVisibility()

Displayable managers should test both GetVisiblity() and IsDisplayableInView(),
therefore we add a convenient method.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21535 3bd1e089-480b-0410-8dfb-8563597acbee
parent 74d8379e
......@@ -738,3 +738,11 @@ bool vtkMRMLDisplayNode::IsDisplayableInView(const char* viewNodeID)const
return this->GetNumberOfViewNodeIDs() == 0
|| this->IsViewNodeIDPresent(viewNodeID);
}
//-------------------------------------------------------
bool vtkMRMLDisplayNode::GetVisibility(const char* viewNodeID)
{
bool res = this->GetVisibility() != 0;
res = res && this->IsDisplayableInView(viewNodeID);
return res;
}
......@@ -147,6 +147,12 @@ public:
/// Set the visibility of the display node.
/// \sa Visibility, SetVisibility(), GetVisibility(),
vtkBooleanMacro(Visibility, int);
/// Return true if the display node should be visible in the view node.
/// To be visible in the view, the node needs to be visible
/// (\a Visibility == 1) and the view ID must be in the ViewNodeIDs list
/// or the list must be empty (visible in all views).
/// \sa Visibility, ViewNodeIDs
virtual bool GetVisibility(const char* viewNodeID);
/// Set the clipping of the display node.
/// \sa Clipping, GetClipping(), ClippingOn(), ClippingOff()
......
......@@ -1391,9 +1391,7 @@ void vtkMRMLModelDisplayableManager::SetModelDisplayProperty(vtkMRMLDisplayableN
vtkImageActor *imageActor = vtkImageActor::SafeDownCast(prop);
prop->SetUserMatrix(transformToWorld);
bool visible = modelDisplayNode->GetVisibility() &&
modelDisplayNode->IsDisplayableInView(
this->GetMRMLViewNode()->GetID());
bool visible = modelDisplayNode->GetVisibility(this->GetMRMLViewNode()->GetID());
prop->SetVisibility(visible);
this->Internal->DisplayedVisibility[modelDisplayNode->GetID()] = visible;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment