Interactor for the creation of an mitk::Contour. More...
#include <mitkContourInteractor.h>
Public Types | |
typedef ContourInteractor | Self |
typedef Interactor | 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, DataNode *_argb) |
NewMacro with two parameters for calling itk::Lightobject::New(..) method. | |
Protected Member Functions | |
ContourInteractor (const char *type, DataNode *dataNode) | |
virtual | ~ContourInteractor () |
virtual bool | ExecuteAction (Action *action, mitk::StateEvent const *stateEvent) |
Method called in HandleEvent after Statechange. | |
virtual void | Press (mitk::Point3D &op) |
virtual void | Release (mitk::Point3D &op) |
virtual void | Move (mitk::Point3D &op) |
Protected Attributes | |
bool | m_Positive |
bool | m_Started |
Interactor for the creation of an mitk::Contour.
Definition at line 31 of file mitkContourInteractor.h.
typedef itk::SmartPointer<const Self> mitk::ContourInteractor::ConstPointer |
Reimplemented from mitk::Interactor.
Definition at line 34 of file mitkContourInteractor.h.
typedef itk::SmartPointer<Self> mitk::ContourInteractor::Pointer |
Reimplemented from mitk::Interactor.
Definition at line 34 of file mitkContourInteractor.h.
Reimplemented from mitk::Interactor.
Definition at line 34 of file mitkContourInteractor.h.
Reimplemented from mitk::Interactor.
Definition at line 34 of file mitkContourInteractor.h.
mitk::ContourInteractor::ContourInteractor | ( | const char * | type, |
mitk::DataNode * | dataNode | ||
) | [protected] |
Definition at line 36 of file mitkContourInteractor.cpp.
References mitk::Interactor::m_DataNode, m_Started, mitk::FloatProperty::New(), mitk::StringProperty::New(), mitk::IntProperty::New(), mitk::DataNode::SetColor(), mitk::DataNode::SetOpacity(), and mitk::DataNode::SetProperty().
: mitk::Interactor(type, dataNode), m_Started(false) { assert(m_DataNode != NULL); m_DataNode->SetProperty("layer", mitk::IntProperty::New(100) ); m_DataNode->SetProperty("name", mitk::StringProperty::New("InteractiveFeedbackData") ); m_DataNode->SetOpacity(1); m_DataNode->SetColor(0.4,0.9,0.0); m_DataNode->SetProperty( "Width", mitk::FloatProperty::New(2.0) ); m_Started = false; }
mitk::ContourInteractor::~ContourInteractor | ( | ) | [protected, virtual] |
Definition at line 49 of file mitkContourInteractor.cpp.
{ }
bool mitk::ContourInteractor::ExecuteAction | ( | mitk::Action * | action, |
mitk::StateEvent const * | stateEvent | ||
) | [protected, virtual] |
Method called in HandleEvent after Statechange.
look up which object method is associated to the given action and call the method
Each statechange has actions, which can be assigned by it's number. If you are developing a new statemachine, declare all your operations here and send them to Undo-Controller and to the Data. Object- and group-EventId can also be accessed through static methods from OperationEvent
Reimplemented from mitk::StateMachine.
Definition at line 82 of file mitkContourInteractor.cpp.
References mitk::AcFINISHMOVEMENT, mitk::AcINITMOVEMENT, mitk::AcMOVEPOINT, mitk::AcNEWPOINT, mitk::Action::GetActionId(), mitk::DisplayPositionEvent::GetDisplayPosition(), mitk::StateEvent::GetEvent(), mitk::Event::GetSender(), mitk::BaseRenderer::GetVtkRenderer(), and mitk::DisplayPositionEvent::GetWorldPosition().
{ mitk::Point3D eventPoint; const mitk::PositionEvent* posEvent = dynamic_cast<const mitk::PositionEvent*>(stateEvent->GetEvent()); if(posEvent==NULL) { const mitk::DisplayPositionEvent* displayPosEvent = dynamic_cast<const mitk::DisplayPositionEvent*>(stateEvent->GetEvent()); mitk::VtkPropRenderer* sender = (mitk::VtkPropRenderer*) stateEvent->GetEvent()->GetSender(); if((displayPosEvent == NULL) || (sender == NULL)) return false; eventPoint[0] = displayPosEvent->GetDisplayPosition()[0]; eventPoint[1] = displayPosEvent->GetDisplayPosition()[1]; eventPoint[2] = 0; #if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) )) typedef itk::Point<double,3> DoublePoint3D; DoublePoint3D p; p.CastFrom(eventPoint); sender->GetVtkRenderer()->SetDisplayPoint(p.GetDataPointer()); #else sender->GetVtkRenderer()->SetDisplayPoint(eventPoint.GetDataPointer()); #endif sender->GetVtkRenderer()->DisplayToWorld(); vtkFloatingPointType *vtkwp = sender->GetVtkRenderer()->GetWorldPoint(); vtk2itk(vtkwp, eventPoint); } else { eventPoint = posEvent->GetWorldPosition(); } bool ok = false; switch (action->GetActionId()) { case mitk::AcNEWPOINT: { Press(eventPoint); ok = true; m_Started = true; break; } case mitk::AcINITMOVEMENT: { if (m_Started) { Move(eventPoint); ok = true; break; } } case mitk::AcMOVEPOINT: { if (m_Started) { Move(eventPoint); ok = true; break; } } case mitk::AcFINISHMOVEMENT: { if (m_Started) { Release(eventPoint); ok = true; m_Started = false; } break; } default: ok = false; break; } return ok; }
virtual const char* mitk::ContourInteractor::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::Interactor.
void mitk::ContourInteractor::Move | ( | mitk::Point3D & | op ) | [protected, virtual] |
method is called when the user moves the mouse with left mouse button down
Definition at line 176 of file mitkContourInteractor.cpp.
References mitk::Contour::AddVertex().
{ mitk::Contour* contour = dynamic_cast<mitk::Contour*>(m_DataNode->GetData()); assert(contour!=NULL); contour->AddVertex( point ); // m_Parent->UpdateWidgets(); }
static Pointer mitk::ContourInteractor::New | ( | const char * | _arga, |
DataNode * | _argb | ||
) | [inline, static] |
NewMacro with two parameters for calling itk::Lightobject::New(..) method.
Reimplemented from mitk::Interactor.
Definition at line 35 of file mitkContourInteractor.h.
Referenced by mitkDataNodeExtTestClass::TestInteractorSetting().
: ContourInteractor(const char * type, DataNode* dataNode);
void mitk::ContourInteractor::Press | ( | mitk::Point3D & | op ) | [protected, virtual] |
entry method for any interaction. Method is called if user presses the left mouse button down.
Definition at line 164 of file mitkContourInteractor.cpp.
References mitk::Contour::AddVertex(), and mitk::Contour::Initialize().
{ mitk::Contour* contour = dynamic_cast<mitk::Contour*>(m_DataNode->GetData()); assert(contour!=NULL); if (!m_Positive) m_DataNode->SetColor(1.0,0.0,0.0); contour->Initialize(); contour->AddVertex( point ); }
void mitk::ContourInteractor::Release | ( | mitk::Point3D & | op ) | [protected, virtual] |
this method is finally called after user release the left mouse button
Definition at line 185 of file mitkContourInteractor.cpp.
{
//vermutlich m_Parent->UpdateWidgets();
}
bool mitk::ContourInteractor::m_Positive [protected] |
Definition at line 61 of file mitkContourInteractor.h.
bool mitk::ContourInteractor::m_Started [protected] |
Definition at line 62 of file mitkContourInteractor.h.
Referenced by ContourInteractor().