| 338 | } |
| 339 | |
| 340 | void mitk::InteractionTestHelper::Set3dCameraSettings() |
| 341 | { |
| 342 | tinyxml2::XMLDocument document; |
| 343 | if (tinyxml2::XML_SUCCESS == document.LoadFile(m_InteractionFilePath.c_str())) |
| 344 | { |
| 345 | // for each renderer found create a render window and configure |
| 346 | for (auto *element = document.FirstChildElement(mitk::InteractionEventConst::xmlTagInteractions().c_str()) |
| 347 | ->FirstChildElement(mitk::InteractionEventConst::xmlTagConfigRoot().c_str()) |
| 348 | ->FirstChildElement(mitk::InteractionEventConst::xmlTagRenderer().c_str()); |
| 349 | element != nullptr; |
| 350 | element = element->NextSiblingElement(mitk::InteractionEventConst::xmlTagRenderer().c_str())) |
| 351 | { |
| 352 | // get name of renderer |
| 353 | const char *rendererName = |
| 354 | element->Attribute(mitk::InteractionEventConst::xmlEventPropertyRendererName().c_str()); |
| 355 | |
| 356 | // get mapper slot id |
| 357 | MapperSlotId mapperID = mitk::BaseRenderer::Standard2D; |
| 358 | if (element->Attribute(mitk::InteractionEventConst::xmlEventPropertyMapperID().c_str()) != nullptr) |
| 359 | { |
| 360 | int mapperIDNum = |
| 361 | std::atoi(element->Attribute(mitk::InteractionEventConst::xmlEventPropertyMapperID().c_str())); |
| 362 | mapperID = static_cast<MapperSlotId>(mapperIDNum); |
| 363 | } |
| 364 | |
| 365 | if (mapperID == mitk::BaseRenderer::Standard3D) |
| 366 | { |
| 367 | RenderWindow *namedRenderer = nullptr; |
| 368 | |
| 369 | for (const auto &it : m_RenderWindowList) |
| 370 | { |
| 371 | if (strcmp(it->GetRenderer()->GetName(), rendererName) == 0) |
| 372 | { |
| 373 | namedRenderer = it.GetPointer(); |
| 374 | break; |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | if (namedRenderer == nullptr) |
| 379 | { |
| 380 | MITK_ERROR << "No match for render window was found."; |
| 381 | return; |
| 382 | } |
| 383 | namedRenderer->GetRenderer()->PrepareRender(); |
| 384 | |
| 385 | if (element->Attribute(mitk::InteractionEventConst::xmlCameraFocalPointX().c_str()) != nullptr) |
| 386 | { |
| 387 | double cameraFocalPoint[3]; |
| 388 | |
| 389 | cameraFocalPoint[0] = |
| 390 | std::atoi(element->Attribute(mitk::InteractionEventConst::xmlCameraFocalPointX().c_str())); |
| 391 | cameraFocalPoint[1] = |
| 392 | std::atoi(element->Attribute(mitk::InteractionEventConst::xmlCameraFocalPointY().c_str())); |
| 393 | cameraFocalPoint[2] = |
| 394 | std::atoi(element->Attribute(mitk::InteractionEventConst::xmlCameraFocalPointZ().c_str())); |
| 395 | namedRenderer->GetRenderer()->GetVtkRenderer()->GetActiveCamera()->SetFocalPoint(cameraFocalPoint); |
| 396 | } |
| 397 |
no test coverage detected