| 57 | } |
| 58 | |
| 59 | void mitk::TextAnnotation3D::UpdateVtkAnnotation(mitk::BaseRenderer *renderer) |
| 60 | { |
| 61 | LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer); |
| 62 | if (ls->IsGenerateDataRequired(renderer, this)) |
| 63 | { |
| 64 | Point3D pos3d = GetPosition3D(); |
| 65 | vtkRenderer *vtkRender = renderer->GetVtkRenderer(); |
| 66 | if (vtkRender) |
| 67 | { |
| 68 | vtkCamera *camera = vtkRender->GetActiveCamera(); |
| 69 | ls->m_follower->SetCamera(camera); |
| 70 | if (camera != nullptr) |
| 71 | { |
| 72 | // calculate the offset relative to the camera's view direction |
| 73 | Point3D offset = GetOffsetVector(); |
| 74 | |
| 75 | Vector3D viewUp; |
| 76 | camera->GetViewUp(viewUp.GetDataPointer()); |
| 77 | Vector3D cameraDirection; |
| 78 | camera->GetDirectionOfProjection(cameraDirection.GetDataPointer()); |
| 79 | Vector3D viewRight; |
| 80 | vtkMath::Cross(cameraDirection.GetDataPointer(), viewUp.GetDataPointer(), viewRight.GetDataPointer()); |
| 81 | |
| 82 | pos3d = pos3d + viewRight * offset[0] + viewUp * offset[1] + cameraDirection * offset[2]; |
| 83 | } |
| 84 | } |
| 85 | ls->m_follower->SetPosition(pos3d.GetDataPointer()); |
| 86 | ls->m_textSource->SetText(GetText().c_str()); |
| 87 | float color[3] = {1, 1, 1}; |
| 88 | float opacity = 1.0; |
| 89 | GetColor(color); |
| 90 | GetOpacity(opacity); |
| 91 | ls->m_follower->GetProperty()->SetColor(color[0], color[1], color[2]); |
| 92 | ls->m_follower->GetProperty()->SetOpacity(opacity); |
| 93 | ls->m_follower->SetScale(this->GetFontSize()); |
| 94 | ls->UpdateGenerateDataTime(); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | vtkProp *mitk::TextAnnotation3D::GetVtkProp(BaseRenderer *renderer) const |
| 99 | { |
nothing calls this directly
no test coverage detected