Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

mitk::PositionTracker Class Reference
[Interaction Classes]

Interactor for Mouse Tracking. More...

#include <mitkPositionTracker.h>

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

List of all members.

Public Types

typedef PositionTracker Self
typedef StateMachine Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const

Static Public Member Functions

static Pointer New (const char *_arga, OperationActor *_argb)

Protected Member Functions

 PositionTracker (const char *type, OperationActor *operationActor)
 Constructor with needed arguments.
virtual bool ExecuteAction (Action *action, mitk::StateEvent const *stateEvent)
 executes the actions that are sent to this statemachine derived from StateMachine

Detailed Description

Interactor for Mouse Tracking.

Tracks a Point from an input device (usaly mouse pointer)

Definition at line 35 of file mitkPositionTracker.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::PositionTracker::ConstPointer

Reimplemented from mitk::StateMachine.

Definition at line 38 of file mitkPositionTracker.h.

typedef itk::SmartPointer<Self> mitk::PositionTracker::Pointer

Reimplemented from mitk::StateMachine.

Definition at line 38 of file mitkPositionTracker.h.

Reimplemented from mitk::StateMachine.

Definition at line 38 of file mitkPositionTracker.h.

Reimplemented from mitk::StateMachine.

Definition at line 38 of file mitkPositionTracker.h.


Constructor & Destructor Documentation

mitk::PositionTracker::PositionTracker ( const char *  type,
mitk::OperationActor operationActor 
) [protected]

Constructor with needed arguments.

Parameters:
type,:string, that describes the StateMachine-Scheme to take from all SM (see XML-File)
operationActor,:the Data, operations (+ points) are send to

Definition at line 34 of file mitkPositionTracker.cpp.

: mitk::StateMachine(type)
{}

Member Function Documentation

bool mitk::PositionTracker::ExecuteAction ( Action action,
mitk::StateEvent const *  stateEvent 
) [protected, virtual]

executes the actions that are sent to this statemachine derived from StateMachine

Reimplemented from mitk::StateMachine.

Definition at line 39 of file mitkPositionTracker.cpp.

References mitk::BaseRenderer::GetDataStorage(), mitk::StateEvent::GetEvent(), mitk::RenderingManager::GetInstance(), mitk::BaseRenderer::GetMapperID(), mitk::DataStorage::GetNode(), mitk::PointSet::GetPointSet(), mitk::Event::GetSender(), mitk::DisplayPositionEvent::GetWorldPosition(), mitk::BoolProperty::New(), mitk::NodePredicateProperty::New(), mitk::RenderingManager::RequestUpdateAll(), and mitk::DataNode::SetIntProperty().

{
  bool ok = false;
  const DisplayPositionEvent* displayPositionEvent = dynamic_cast<const DisplayPositionEvent*>(stateEvent->GetEvent());

  mitk::DataNode::Pointer  dtnode;
  mitk::DataStorage* ds = NULL;
  if (displayPositionEvent == NULL)
    return false;

  if (stateEvent->GetEvent()->GetSender()!=NULL)
  {
    ds = stateEvent->GetEvent()->GetSender()->GetDataStorage();
  }
  else
  {
    itkWarningMacro(<<"StateEvent::GetSender()==NULL - setting timeInMS to 0");
    return false;
  }
  if (ds == NULL) 
    return false;

  // looking for desired point set
  dtnode = ds->GetNode(mitk::NodePredicateProperty::New("inputdevice", mitk::BoolProperty::New(true)));
  if (dtnode.IsNull())
    return false;

  dtnode->SetIntProperty("BaseRendererMapperID", stateEvent->GetEvent()->GetSender()->GetMapperID());
  mitk::PointSet* ps = dynamic_cast<mitk::PointSet*>(dtnode->GetData());
  if (ps == NULL)
    return false;

  int position = 0;
  if( ps->GetPointSet()->GetPoints()->IndexExists( position )) //first element
  {
    ps->GetPointSet()->GetPoints()->SetElement( position, displayPositionEvent->GetWorldPosition());                            
  }
  else
  {
    mitk::PointSet::PointDataType pointData = {position , false /*selected*/, mitk::PTUNDEFINED};
    ps->GetPointSet()->GetPointData()->InsertElement(position, pointData);
    ps->GetPointSet()->GetPoints()->InsertElement(position, displayPositionEvent->GetWorldPosition());
  }
  ps->Modified();
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
  return ok;
}
virtual const char* mitk::PositionTracker::GetClassName (  ) const [virtual]

Reimplemented from mitk::StateMachine.

static Pointer mitk::PositionTracker::New ( const char *  _arga,
OperationActor _argb 
) [inline, static]

Definition at line 39 of file mitkPositionTracker.h.

Referenced by QmitkStdMultiWidget::EnablePositionTracking().

:
    //##Documentation

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