コード例 #1
0
void mitk::SurfaceGLMapper2D::ApplyAllProperties(mitk::BaseRenderer* renderer)
{
  ApplyColorAndOpacityProperties(renderer);

  DataNode * node = GetDataNode();

  if(node == NULL)
  {
    return;
  }

  node->GetBoolProperty("draw normals 2D", m_DrawNormals, renderer);

  // check for color and opacity properties, use it for rendering if they exists
  node->GetColor(m_LineColor, renderer, "color");
  node->GetOpacity(m_LineColor[3], renderer, "opacity");

  bool invertNormals(false);
  node->GetBoolProperty("invert normals", invertNormals, renderer);

  if (!invertNormals)
  {
    node->GetColor(m_FrontSideColor, renderer, "front color");
    node->GetOpacity(m_FrontSideColor[3], renderer, "opacity");

    node->GetColor(m_BackSideColor, renderer, "back color");
    node->GetOpacity(m_BackSideColor[3], renderer, "opacity");

    node->GetFloatProperty( "front normal lenth (px)", m_FrontNormalLengthInPixels, renderer );
    node->GetFloatProperty( "back normal lenth (px)", m_BackNormalLengthInPixels, renderer );
  }
  else
  {
    node->GetColor(m_FrontSideColor, renderer, "back color");
    node->GetOpacity(m_FrontSideColor[3], renderer, "opacity");

    node->GetColor(m_BackSideColor, renderer, "front color");
    node->GetOpacity(m_BackSideColor[3], renderer, "opacity");

    node->GetFloatProperty( "back normal lenth (px)", m_FrontNormalLengthInPixels, renderer );
    node->GetFloatProperty( "front normal lenth (px)", m_BackNormalLengthInPixels, renderer );
  }
}
コード例 #2
0
void mitk::ContourModelSetMapper3D::ApplyContourModelSetProperties(BaseRenderer *renderer)
{
  LocalStorage *localStorage = m_LSH.GetLocalStorage(renderer);
  DataNode *dataNode = this->GetDataNode();

  if (dataNode != NULL)
  {
    float lineWidth = 1;
    dataNode->GetFloatProperty("contour.3D.width", lineWidth, renderer);

    vtkSmartPointer<vtkPropCollection> collection = vtkSmartPointer<vtkPropCollection>::New();
    localStorage->m_Assembly->GetActors(collection);
    collection->InitTraversal();
    for (vtkIdType i = 0; i < collection->GetNumberOfItems(); i++)
    {
      vtkActor::SafeDownCast(collection->GetNextProp())->GetProperty()->SetLineWidth(lineWidth);
    }
  }
}