Public Member Functions

mitk::DisplayInteractor Class Reference
[Interaction Classes]

The class handles zooming and panning events. More...

#include <mitkDisplayInteractor.h>

Inheritance diagram for mitk::DisplayInteractor:
Inheritance graph
[legend]
Collaboration diagram for mitk::DisplayInteractor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DisplayInteractor (mitk::BaseRenderer *ren=0)
 constructor for renderer specific zooming panning initialization
virtual void ExecuteOperation (mitk::Operation *operation)
 implementation of ExecuteOperation from mitk::OperationActor interface this method triggers the zooming and panning stuff in the appropriate renderer

Detailed Description

The class handles zooming and panning events.

One can connect it via itk::GlobalInteraction->AddStateMachine(new mitk::DisplayVectorInteractor("move", new DisplayInterActor())); to the global state machine.

Definition at line 34 of file mitkDisplayInteractor.h.


Constructor & Destructor Documentation

mitk::DisplayInteractor::DisplayInteractor ( mitk::BaseRenderer ren = 0 )

constructor for renderer specific zooming panning initialization

The window associated with the passed renderer will be the only one where this interactor works on.

Definition at line 32 of file mitkDisplayInteractor.cpp.

{
  m_ParentRenderer = ren;
}

Member Function Documentation

void mitk::DisplayInteractor::ExecuteOperation ( mitk::Operation operation ) [virtual]

implementation of ExecuteOperation from mitk::OperationActor interface this method triggers the zooming and panning stuff in the appropriate renderer

Implements mitk::OperationActor.

Definition at line 37 of file mitkDisplayInteractor.cpp.

References QuadProgPP::distance(), mitk::BaseRenderer::GetDisplayGeometry(), mitk::DisplayCoordinateOperation::GetLastToCurrentDisplayVector(), mitk::Operation::GetOperationType(), mitk::DisplayCoordinateOperation::GetRenderer(), mitk::BaseRenderer::GetRenderingManager(), mitk::BaseRenderer::GetRenderWindow(), mitk::DisplayCoordinateOperation::GetStartCoordinateInMM(), mitk::DisplayCoordinateOperation::GetStartDisplayCoordinate(), mitk::DisplayGeometry::MoveBy(), mitk::OpMOVE, mitk::OpZOOM, mitk::RenderingManager::RequestUpdate(), and mitk::DisplayGeometry::ZoomWithFixedWorldCoordinates().

{

  bool ok;//as return type

  mitk::DisplayCoordinateOperation* dcOperation=dynamic_cast<mitk::DisplayCoordinateOperation*>(operation);
  if ( dcOperation != NULL )
  {
    /****ZOOM & MOVE of the whole volume****/
    mitk::BaseRenderer* renderer = dcOperation->GetRenderer();
    if( renderer == NULL || (m_ParentRenderer != NULL && m_ParentRenderer != renderer))
      return;
    switch (operation->GetOperationType())
    {
    case OpMOVE :
      {
        renderer->GetDisplayGeometry()->MoveBy(dcOperation->GetLastToCurrentDisplayVector()*(-1.0));
        renderer->GetRenderingManager()->RequestUpdate(renderer->GetRenderWindow());
        ok = true;
      }
      break;
    case OpZOOM :
      {
        float distance = dcOperation->GetLastToCurrentDisplayVector()[1];

        //float factor= 1.0 + distance * 0.05; // stupid because factors from +1 and -1 dont give results that represent inverse zooms

        float factor = 1.0;

        if (distance < 0.0)
        {
          factor = 1.0 / 1.05;
        }
        else if (distance > 0.0)
        {
          factor = 1.0 * 1.05; // 5%
        }
        else // distance == 0.0
        {
          // nothing to do, factor remains 1.0
        }
        
        renderer->GetDisplayGeometry()->ZoomWithFixedWorldCoordinates(factor, dcOperation->GetStartDisplayCoordinate(), dcOperation->GetStartCoordinateInMM());
        
        renderer->GetRenderingManager()->RequestUpdate(renderer->GetRenderWindow());
        ok = true;
      }
      break;
    default:
      ;
    }
  }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines