Public Member Functions | Protected Attributes

mitk::DisplayPositionEvent Class Reference
[Interaction Classes]

Event that stores coordinates. More...

#include <mitkDisplayPositionEvent.h>

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

List of all members.

Public Member Functions

 DisplayPositionEvent (BaseRenderer *sender, int type, int button, int buttonState, int key, const Point2D &displPosition)
 Constructor with all necessary arguments.
const Point2D & GetDisplayPosition () const
void SetDisplayPosition (const Point2D &displPosition)
const Point3D & GetWorldPosition () const
mitk::DataNodeGetPickedObjectNode () const
mitk::BaseDataGetPickedObject () const

Protected Attributes

Point2D m_DisplayPosition
Point3D m_WorldPosition
bool m_WorldPositionIsSet
mitk::DataNode::Pointer m_PickedObjectNode
bool m_PickedObjectIsSet

Detailed Description

Event that stores coordinates.

Stores display position of the mouse.

If requested, the correspondent 3D world position in mm is calculated via picking (delegated to the BaseRenderer). Additionally, the mitk::BaseData or mitk::DataNode corresponding to the picked object in the (3D) scene can be retrieved.

Examples:

mitkMoveSurfaceInteractor.cpp.

Definition at line 41 of file mitkDisplayPositionEvent.h.


Constructor & Destructor Documentation

mitk::DisplayPositionEvent::DisplayPositionEvent ( BaseRenderer sender,
int  type,
int  button,
int  buttonState,
int  key,
const Point2D &  displPosition 
)

Constructor with all necessary arguments.

Parameters:
senderis the renderer that caused that event
type,button,buttonState,key,:information from the Event
displPositionis the 2D Position of the mouse

Member Function Documentation

const Point2D& mitk::DisplayPositionEvent::GetDisplayPosition (  ) const [inline]
mitk::BaseData * mitk::DisplayPositionEvent::GetPickedObject (  ) const

Returns object at the current position (NULL if not applicable)

Definition at line 65 of file mitkDisplayPositionEvent.cpp.

References mitk::DataNode::GetData().

{
  mitk::DataNode *node = this->GetPickedObjectNode();

  if ( node != NULL )
  {
    return node->GetData();
  }
  else
  {
    return NULL;
  }
}
mitk::DataNode * mitk::DisplayPositionEvent::GetPickedObjectNode (  ) const

Returns node with object at the current position (NULL if not applicable)

Definition at line 47 of file mitkDisplayPositionEvent.cpp.

Referenced by mitk::SurfaceDeformationInteractor3D::ExecuteAction().

{
  // Method performs object picking and sets both object and world position
  if ( m_PickedObjectIsSet )
  {
    return m_PickedObjectNode;
  }
 
  assert( m_Sender != NULL );

  m_PickedObjectNode = m_Sender->PickObject( m_DisplayPosition, m_WorldPosition );

  m_PickedObjectIsSet = true;
  m_WorldPositionIsSet = true;

  return m_PickedObjectNode;
}
const mitk::Point3D & mitk::DisplayPositionEvent::GetWorldPosition (  ) const
void mitk::DisplayPositionEvent::SetDisplayPosition ( const Point2D &  displPosition ) [inline]

Member Data Documentation

Definition at line 69 of file mitkDisplayPositionEvent.h.

Definition at line 74 of file mitkDisplayPositionEvent.h.

Definition at line 73 of file mitkDisplayPositionEvent.h.

Point3D mitk::DisplayPositionEvent::m_WorldPosition [mutable, protected]

Definition at line 70 of file mitkDisplayPositionEvent.h.

Definition at line 71 of file mitkDisplayPositionEvent.h.


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