Interactor for Mouse Tracking. More...
#include <mitkPositionTracker.h>
Public Types | |
typedef PositionTracker | Self |
typedef StateMachine | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
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 |
Interactor for Mouse Tracking.
Tracks a Point from an input device (usaly mouse pointer)
Definition at line 35 of file mitkPositionTracker.h.
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.
mitk::PositionTracker::PositionTracker | ( | const char * | type, |
mitk::OperationActor * | operationActor | ||
) | [protected] |
Constructor with needed arguments.
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) {}
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