当前位置: 首页>>代码示例>>C++>>正文


C++ BaseRenderer::GetRenderWindow方法代码示例

本文整理汇总了C++中BaseRenderer::GetRenderWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseRenderer::GetRenderWindow方法的具体用法?C++ BaseRenderer::GetRenderWindow怎么用?C++ BaseRenderer::GetRenderWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseRenderer的用法示例。


在下文中一共展示了BaseRenderer::GetRenderWindow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
RenderingManager
::RenderingEndCallback( vtkObject *caller, unsigned long , void *, void * )
{
    vtkRenderWindow *renderWindow  = dynamic_cast< vtkRenderWindow * >( caller );

    mitk::RenderingManager* renman = mitk::BaseRenderer::GetInstance(renderWindow)->GetRenderingManager();

    RenderWindowList &renderWindowList = renman->m_RenderWindowList;

    RendererIntMap &nextLODMap = renman->m_NextLODMap;

    if ( renderWindow )
    {
        BaseRenderer *renderer = BaseRenderer::GetInstance( renderWindow );
        if ( renderer )
        {
            renderWindowList[renderer->GetRenderWindow()] = RENDERING_INACTIVE;

            // Level-of-Detail handling
            if ( renderer->GetNumberOfVisibleLODEnabledMappers() > 0 )
            {
                if(nextLODMap[renderer]==0)
                    renman->StartOrResetTimer();
                else
                    nextLODMap[renderer] = 0;
            }
        }
    }
}
开发者ID:david-guerrero,项目名称:MITK,代码行数:30,代码来源:mitkRenderingManager.cpp

示例2:

mitk::StdFunctionCommand::ActionFunction mitk::DisplayActionEventFunctions::ZoomCameraSynchronizedAction()
{
  auto actionFunction = [](const itk::EventObject& displayInteractorEvent)
  {
    if (DisplayZoomEvent().CheckEvent(&displayInteractorEvent))
    {
      const DisplayZoomEvent* displayActionEvent = dynamic_cast<const DisplayZoomEvent*>(&displayInteractorEvent);
      const BaseRenderer::Pointer sendingRenderer = displayActionEvent->GetSender();
      if (nullptr == sendingRenderer)
      {
        return;
      }

      if (1.0 != displayActionEvent->GetZoomFactor())
      {
        auto allRenderWindows = sendingRenderer->GetRenderingManager()->GetAllRegisteredRenderWindows();
        for (auto renderWindow : allRenderWindows)
        {
          if (BaseRenderer::GetInstance(renderWindow)->GetMapperID() == BaseRenderer::Standard2D)
          {
            BaseRenderer* currentRenderer = BaseRenderer::GetInstance(renderWindow);
            currentRenderer->GetCameraController()->Zoom(displayActionEvent->GetZoomFactor(), displayActionEvent->GetStartCoordinate());
            currentRenderer->GetRenderingManager()->RequestUpdate(currentRenderer->GetRenderWindow());
          }
        }
      }
    }
  };

  return actionFunction;
}
开发者ID:Cdebus,项目名称:MITK,代码行数:31,代码来源:mitkDisplayActionEventFunctions.cpp

示例3:

bool mitk::DisplayInteractor::Move(StateMachineAction*, InteractionEvent* interactionEvent)
{
  BaseRenderer* sender = interactionEvent->GetSender();
  InteractionPositionEvent* positionEvent = dynamic_cast<InteractionPositionEvent*>(interactionEvent);
  if (positionEvent == NULL)
  {
    MITK_WARN<< "DisplayVectorInteractor: cannot process the event in Move action: " << interactionEvent->GetNameOfClass();
    return false;
  }
  // perform translation
  sender->GetDisplayGeometry()->MoveBy((positionEvent->GetPointerPositionOnScreen() - m_LastDisplayCoordinate) * (-1.0));
  sender->GetRenderingManager()->RequestUpdate(sender->GetRenderWindow());
  m_LastDisplayCoordinate = positionEvent->GetPointerPositionOnScreen();
  return true;
}
开发者ID:fmorency,项目名称:MITK,代码行数:15,代码来源:mitkDisplayInteractor.cpp

示例4:

bool mitk::DisplayInteractor::Move(StateMachineAction*, InteractionEvent* interactionEvent)
{
  BaseRenderer* sender = interactionEvent->GetSender();
  InteractionPositionEvent* positionEvent = static_cast<InteractionPositionEvent*>(interactionEvent);

  float invertModifier = -1.0;
  if ( m_InvertMoveDirection )
  {
    invertModifier = 1.0;
  }

  // perform translation
  sender->GetDisplayGeometry()->MoveBy( (positionEvent->GetPointerPositionOnScreen() - m_LastDisplayCoordinate) * invertModifier );
  sender->GetRenderingManager()->RequestUpdate(sender->GetRenderWindow());
  m_LastDisplayCoordinate = positionEvent->GetPointerPositionOnScreen();
  return true;
}
开发者ID:DiagnosisMultisystems,项目名称:MITK,代码行数:17,代码来源:mitkDisplayInteractor.cpp

示例5: if

bool AffineInteractor3D
::ExecuteAction( Action *action, StateEvent const *stateEvent )
{
  bool ok = false;

  // Get data object
  BaseData *data = m_DataNode->GetData();
  if ( data == NULL )
  {
    MITK_ERROR << "No data object present!";
    return ok;
  }

  // Get Event and extract renderer
  const Event *event = stateEvent->GetEvent();
  BaseRenderer *renderer = NULL;
  vtkRenderWindow *renderWindow = NULL;
  vtkRenderWindowInteractor *renderWindowInteractor = NULL;
  vtkRenderer *currentVtkRenderer = NULL;
  vtkCamera *camera = NULL;

  if ( event != NULL )
  {
    renderer = event->GetSender();
    if ( renderer != NULL )
    {
      renderWindow = renderer->GetRenderWindow();
      if ( renderWindow != NULL )
      {
        renderWindowInteractor = renderWindow->GetInteractor();
        if ( renderWindowInteractor != NULL )
        {
          currentVtkRenderer = renderWindowInteractor
            ->GetInteractorStyle()->GetCurrentRenderer();
          if ( currentVtkRenderer != NULL )
          {
            camera = currentVtkRenderer->GetActiveCamera();
          }
        }
      }
    }
  }

  // Check if we have a DisplayPositionEvent
  const DisplayPositionEvent *dpe =
    dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
  if ( dpe != NULL )
  {
    m_CurrentPickedPoint = dpe->GetWorldPosition();
    m_CurrentPickedDisplayPoint = dpe->GetDisplayPosition();
  }

  // Get the timestep to also support 3D+t
  int timeStep = 0;
  ScalarType timeInMS = 0.0;
  if ( renderer != NULL )
  {
    timeStep = renderer->GetTimeStep( data );
    timeInMS = renderer->GetTime();
  }

  // If data is an mitk::Surface, extract it
  Surface *surface = dynamic_cast< Surface * >( data );
  vtkPolyData *polyData = NULL;
  if ( surface != NULL )
  {
    polyData = surface->GetVtkPolyData( timeStep );

    // Extract surface normal from surface (if existent, otherwise use default)
    vtkPointData *pointData = polyData->GetPointData();
    if ( pointData != NULL )
    {
      vtkDataArray *normal = polyData->GetPointData()->GetVectors( "planeNormal" );
      if ( normal != NULL )
      {
        m_ObjectNormal[0] = normal->GetComponent( 0, 0 );
        m_ObjectNormal[1] = normal->GetComponent( 0, 1 );
        m_ObjectNormal[2] = normal->GetComponent( 0, 2 );
      }
    }
  }

  // Get geometry object
  m_Geometry = data->GetGeometry( timeStep );


  // Make sure that the data (if time-resolved) has enough entries;
  // if not, create the required extra ones (empty)
  data->Expand( timeStep+1 );


  switch (action->GetActionId())
  {
  case AcDONOTHING:
    ok = true;
    break;


  case AcCHECKOBJECT:
    {
//.........这里部分代码省略.........
开发者ID:Maggunator,项目名称:MITK,代码行数:101,代码来源:mitkAffineInteractor3D.cpp

示例6: ExecuteAction

bool mitk::FiberBundleInteractor::ExecuteAction( Action* action, mitk::StateEvent const* stateEvent )
{
  bool ok = false;//for return type bool

  //checking corresponding Data; has to be a PointSet or a subclass
  mitk::FiberBundle* bundle = dynamic_cast<mitk::FiberBundle*>(m_DataNode->GetData());
  if (bundle == NULL)
    return false;

  // Get Event and extract renderer
  const Event *event = stateEvent->GetEvent();
  BaseRenderer *renderer = NULL;
  vtkRenderWindow *renderWindow = NULL;
  vtkRenderWindowInteractor *renderWindowInteractor = NULL;
  vtkRenderer *currentVtkRenderer = NULL;
  vtkCamera *camera = NULL;

  if ( event != NULL )
  {
    renderer = event->GetSender();
    if ( renderer != NULL )
    {
      renderWindow = renderer->GetRenderWindow();
      if ( renderWindow != NULL )
      {
        renderWindowInteractor = renderWindow->GetInteractor();
        if ( renderWindowInteractor != NULL )
        {
          currentVtkRenderer = renderWindowInteractor
                               ->GetInteractorStyle()->GetCurrentRenderer();
          if ( currentVtkRenderer != NULL )
          {
            camera = currentVtkRenderer->GetActiveCamera();
          }
        }
      }
    }
  }

  /*Each case must watch the type of the event!*/
  switch (action->GetActionId())
  {
  case AcCHECKHOVERING:
    {

      QApplication::restoreOverrideCursor();

      // Re-enable VTK interactor (may have been disabled previously)
      if ( renderWindowInteractor != NULL )
      {
        renderWindowInteractor->Enable();
      }

      const DisplayPositionEvent *dpe =
          dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );

      // Check if we have a DisplayPositionEvent
      if ( dpe != NULL )
      {

        // Check if an object is present at the current mouse position
        DataNode *pickedNode = dpe->GetPickedObjectNode();
        if ( pickedNode != m_DataNode )
        {          
//          if(pickedNode == 0)
//            MITK_INFO << "picked node is NULL, no hovering";
//          else
//            MITK_INFO << "wrong node: " << pickedNode;

          this->HandleEvent( new StateEvent( EIDNOFIGUREHOVER ) );

          ok = true;
          break;
        }

        m_CurrentPickedPoint = dpe->GetWorldPosition();
        m_CurrentPickedDisplayPoint = dpe->GetDisplayPosition();

        QApplication::setOverrideCursor(Qt::UpArrowCursor);
        this->HandleEvent( new StateEvent( EIDFIGUREHOVER ) );

      }

      ok = true;
      break;
    }
    break;
    //  case AcSELECTPICKEDOBJECT:
    //    MITK_INFO << "FiberBundleInteractor AcSELECTPICKEDOBJECT";

    //    break;
    //  case AcDESELECTALL:
    //    MITK_INFO << "FiberBundleInteractor AcDESELECTALL";
    //    break;
  case AcREMOVE:
    {
      MITK_INFO << "picking fiber at " << m_CurrentPickedPoint;

//      QmitkStdMultiWidgetEditor::Pointer multiWidgetEditor;
//      multiWidgetEditor->GetStdMultiWidget()->GetRenderWindow1()->GetRenderer()->GetSliceNavigationController()->SelectSliceByPoint(
//.........这里部分代码省略.........
开发者ID:david-guerrero,项目名称:MITK,代码行数:101,代码来源:mitkFiberBundleInteractor.cpp


注:本文中的BaseRenderer::GetRenderWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。