Interactor for Affine transformations on one or multiple surfaces. More...
#include <mitkSurfaceInteractor.h>
Public Types | |
typedef SurfaceInteractor | Self |
typedef AffineInteractor | 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 | |
SurfaceInteractor (const char *type, DataNode *dataNode) | |
Constructor. | |
~SurfaceInteractor () | |
Destructor. | |
virtual float | CanHandleEvent (StateEvent const *stateEvent) const |
calculates how good the data this state machine handles is hit by the event. |
Interactor for Affine transformations on one or multiple surfaces.
A surface interacted by this class can translate, rotate and scale by modifying its geometry. The surface closest to the picking point is chosen for interaction automatically by CanHandleEvent
Definition at line 35 of file mitkSurfaceInteractor.h.
typedef itk::SmartPointer<const Self> mitk::SurfaceInteractor::ConstPointer |
Reimplemented from mitk::AffineInteractor.
Definition at line 38 of file mitkSurfaceInteractor.h.
typedef itk::SmartPointer<Self> mitk::SurfaceInteractor::Pointer |
Reimplemented from mitk::AffineInteractor.
Definition at line 38 of file mitkSurfaceInteractor.h.
Reimplemented from mitk::AffineInteractor.
Definition at line 38 of file mitkSurfaceInteractor.h.
Reimplemented from mitk::AffineInteractor.
Definition at line 38 of file mitkSurfaceInteractor.h.
mitk::SurfaceInteractor::SurfaceInteractor | ( | const char * | type, |
DataNode * | dataNode | ||
) | [protected] |
Constructor.
dataNode | is the node, this Interactor is connected to |
type | is the type of StateMachine like declared in the XML-Configure-File |
Definition at line 29 of file mitkSurfaceInteractor.cpp.
References mitk::PointLocator::New().
: AffineInteractor(type, dataNode) { m_PtLoc = PLocType::New(); }
mitk::SurfaceInteractor::~SurfaceInteractor | ( | ) | [inline, protected] |
float mitk::SurfaceInteractor::CanHandleEvent | ( | StateEvent const * | stateEvent ) | const [protected, virtual] |
calculates how good the data this state machine handles is hit by the event.
Returns a value between 0 and 1. (Used by GlobalInteraction to decide which DESELECTED state machine to send the event to.)
This is interactor currently does not work for interaction in 3D. Try using mitkAffineInteractor3D instead.
Reimplemented from mitk::AffineInteractor.
Definition at line 36 of file mitkSurfaceInteractor.cpp.
References mitk::BS_ControlButton, mitk::DataStorage::ComputeBoundingBox(), mitk::Event::GetButtonState(), mitk::BaseRenderer::GetDataStorage(), mitk::StateEvent::GetEvent(), mitk::BaseRenderer::GetMapperID(), mitk::Event::GetSender(), mitk::Event::GetType(), mitk::Surface::GetVtkPolyData(), mitk::DisplayPositionEvent::GetWorldPosition(), QuadProgPP::sqrt(), mitk::BaseRenderer::Standard3D, and mitk::Type_MouseButtonPress.
{ float jd = 0.0f; if( ! ( stateEvent->GetEvent()->GetButtonState() == mitk::BS_ControlButton && stateEvent->GetEvent()->GetType() == mitk::Type_MouseButtonPress )) return jd; if ( stateEvent->GetEvent()->GetSender()->GetMapperID() == mitk::BaseRenderer::Standard3D ) return jd; mitk::Surface* surf = dynamic_cast<mitk::Surface*>(this->GetData()); if (surf) { mitk::DisplayPositionEvent const *event = dynamic_cast <const mitk::DisplayPositionEvent *> (stateEvent->GetEvent()); mitk::PointSet::PointType pt = event->GetWorldPosition(); // Use ANN to get the point of the polydata closest to the world event if( surf->GetVtkPolyData(m_TimeStep) == NULL ) itkExceptionMacro(<< "No polydata at this time step!"); m_PtLoc->SetPoints(dynamic_cast<vtkPointSet*>(surf->GetVtkPolyData(m_TimeStep))); mitk::PointLocator::DistanceType dst = m_PtLoc->GetMinimalDistance(pt); mitk::BaseRenderer* ren = stateEvent->GetEvent()->GetSender(); // Get the diameter of the render window bounding box mitk::DataStorage* storage = ren->GetDataStorage(); mitk::BoundingBox::Pointer bb = storage->ComputeBoundingBox(); mitk::BoundingBox::AccumulateType dia = std::sqrt(bb->GetDiagonalLength2()); if (dia > 0.00001) //if diameter not zero { float verh = dst/dia; if (verh>1) verh = 1; //if dst is bigger than dia, then set to 1 //now inverse (0 = bad and 1 = good) and set between 0.5 and 1 jd = ((1-verh)/2)+0.5f; } } return jd; }
virtual const char* mitk::SurfaceInteractor::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::AffineInteractor.
static Pointer mitk::SurfaceInteractor::New | ( | const char * | _arga, |
DataNode * | _argb | ||
) | [inline, static] |
NewMacro with two parameters for calling itk::Lightobject::New(..) method.
Reimplemented from mitk::AffineInteractor.
Definition at line 40 of file mitkSurfaceInteractor.h.
: