Interactor for the creation of an mitk::Contour. More...
#include <mitkExtrudedContourInteractor.h>
Public Types | |
typedef ExtrudedContourInteractor | Self |
typedef Interactor | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual mitk::Contour * | GetContour () |
virtual mitk::DataNode * | GetContourNode () |
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 | |
ExtrudedContourInteractor (const char *type, DataNode *dataNode) | |
virtual | ~ExtrudedContourInteractor () |
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 |
mitk::Contour::Pointer | m_Contour |
mitk::DataNode::Pointer | m_ContourNode |
Interactor for the creation of an mitk::Contour.
Definition at line 33 of file mitkExtrudedContourInteractor.h.
typedef itk::SmartPointer<const Self> mitk::ExtrudedContourInteractor::ConstPointer |
Reimplemented from mitk::Interactor.
Definition at line 36 of file mitkExtrudedContourInteractor.h.
typedef itk::SmartPointer<Self> mitk::ExtrudedContourInteractor::Pointer |
Reimplemented from mitk::Interactor.
Definition at line 36 of file mitkExtrudedContourInteractor.h.
Reimplemented from mitk::Interactor.
Definition at line 36 of file mitkExtrudedContourInteractor.h.
Reimplemented from mitk::Interactor.
Definition at line 36 of file mitkExtrudedContourInteractor.h.
mitk::ExtrudedContourInteractor::ExtrudedContourInteractor | ( | const char * | type, |
mitk::DataNode * | dataNode | ||
) | [protected] |
Definition at line 39 of file mitkExtrudedContourInteractor.cpp.
References m_Contour, m_ContourNode, mitk::Interactor::m_DataNode, m_Started, mitk::FloatProperty::New(), mitk::StringProperty::New(), mitk::IntProperty::New(), New(), mitk::VtkRepresentationProperty::New(), and mitk::DataNode::SetProperty().
: mitk::Interactor(type, dataNode), m_Started(false) { assert(m_DataNode != NULL); m_DataNode->SetProperty( "material.representation", mitk::VtkRepresentationProperty::New("surface") ); m_Contour = mitk::Contour::New(); m_ContourNode = mitk::DataNode::New(); m_ContourNode->SetData(m_Contour); m_ContourNode->SetProperty("layer", mitk::IntProperty::New(100) ); m_ContourNode->SetProperty("name", mitk::StringProperty::New("InteractiveFeedbackData") ); m_ContourNode->SetOpacity(1); m_ContourNode->SetColor(0.4,0.9,0.0); m_ContourNode->SetProperty( "Width", mitk::FloatProperty::New(2.0) ); m_Started = false; }
mitk::ExtrudedContourInteractor::~ExtrudedContourInteractor | ( | ) | [protected, virtual] |
Definition at line 59 of file mitkExtrudedContourInteractor.cpp.
{ }
bool mitk::ExtrudedContourInteractor::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 92 of file mitkExtrudedContourInteractor.cpp.
References mitk::AcFINISHMOVEMENT, mitk::AcINITMOVEMENT, mitk::AcMOVEPOINT, mitk::AcNEWPOINT, mitk::Action::GetActionId(), mitk::Geometry3D::GetAxisVector(), mitk::BaseRenderer::GetCurrentWorldGeometry2D(), mitk::DisplayPositionEvent::GetDisplayPosition(), mitk::StateEvent::GetEvent(), mitk::Event::GetSender(), mitk::BaseRenderer::GetVtkRenderer(), mitk::DisplayPositionEvent::GetWorldPosition(), mitk::ExtrudedContour::SetContour(), and mitk::ExtrudedContour::SetVector().
{ mitk::Point3D eventPoint; mitk::Vector3D eventPlaneNormal; 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(); #if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) )) double *vtkwp = sender->GetVtkRenderer()->GetWorldPoint(); #else float *vtkwp = sender->GetVtkRenderer()->GetWorldPoint(); #endif vtk2itk(vtkwp, eventPoint); double *vtkvpn = sender->GetVtkRenderer()->GetActiveCamera()->GetViewPlaneNormal(); vtk2itk(vtkvpn, eventPlaneNormal); eventPlaneNormal = -eventPlaneNormal; } else { eventPoint = posEvent->GetWorldPosition(); mitk::BaseRenderer* sender = (mitk::BaseRenderer*) stateEvent->GetEvent()->GetSender(); eventPlaneNormal = sender->GetCurrentWorldGeometry2D()->GetAxisVector(2); } 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) { mitk::ExtrudedContour* extrudedcontour = dynamic_cast<mitk::ExtrudedContour*>(m_DataNode->GetData()); extrudedcontour->SetContour(m_Contour); extrudedcontour->SetVector(eventPlaneNormal); Release(eventPoint); ok = true; m_Started = false; InvokeEvent(itk::EndEvent()); } break; } default: ok = false; break; } return ok; }
virtual const char* mitk::ExtrudedContourInteractor::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::Interactor.
virtual mitk::Contour* mitk::ExtrudedContourInteractor::GetContour | ( | ) | [virtual] |
virtual mitk::DataNode* mitk::ExtrudedContourInteractor::GetContourNode | ( | ) | [virtual] |
void mitk::ExtrudedContourInteractor::Move | ( | mitk::Point3D & | op ) | [protected, virtual] |
method is called when the user moves the mouse with left mouse button down
Definition at line 198 of file mitkExtrudedContourInteractor.cpp.
static Pointer mitk::ExtrudedContourInteractor::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 37 of file mitkExtrudedContourInteractor.h.
Referenced by ExtrudedContourInteractor(), and mitkDataNodeExtTestClass::TestInteractorSetting().
void mitk::ExtrudedContourInteractor::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 189 of file mitkExtrudedContourInteractor.cpp.
{ if (!m_Positive) m_ContourNode->SetColor(1.0,0.0,0.0); m_Contour->Initialize(); m_Contour->AddVertex( point ); }
void mitk::ExtrudedContourInteractor::Release | ( | mitk::Point3D & | op ) | [protected, virtual] |
this method is finally called after user release the left mouse button
Definition at line 206 of file mitkExtrudedContourInteractor.cpp.
{
//vermutlich m_Parent->UpdateWidgets();
}
Definition at line 68 of file mitkExtrudedContourInteractor.h.
Referenced by ExtrudedContourInteractor().
Definition at line 69 of file mitkExtrudedContourInteractor.h.
Referenced by ExtrudedContourInteractor().
bool mitk::ExtrudedContourInteractor::m_Positive [protected] |
Definition at line 65 of file mitkExtrudedContourInteractor.h.
bool mitk::ExtrudedContourInteractor::m_Started [protected] |
Definition at line 66 of file mitkExtrudedContourInteractor.h.
Referenced by ExtrudedContourInteractor().