Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkLineWidgetModel2D Class Reference

mitkLineWidgetModel2D - a line widget used in 2D scene More...

#include <mitkLineWidgetModel2D.h>

Inherits mitkWidgetModel2D.

Inheritance diagram for mitkLineWidgetModel2D:

Inheritance graph
[legend]
Collaboration diagram for mitkLineWidgetModel2D:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void PrintSelf (ostream &os)
 mitkLineWidgetModel2D ()
 mitkLineWidgetModel2D (float startPoint[2])
virtual int Render (mitkScene *scene)
virtual void Pick (const WidgetNames &names)
virtual void Release ()
float GetLineLength ()
void SetUnitName (const string &name)
const string & GetUnitName ()
void SetStartPoint (float point[2])
void SetStartPoint (float x, float y)
void SetStartPoint (int sx, int sy)
void SetMovePoint (float point[2])
void SetMovePoint (float x, float y)
void SetMovePoint (int sx, int sy)
void SetEndPoint (float point[2])
void SetEndPoint (float x, float y)
void SetEndPoint (int sx, int sy)
int GetPointsSetNum ()
void GetStartPoint (float &tx, float &ty)
void GetStartPoint (int &ix, int &iy)
void GetEndPoint (float &tx, float &ty)
void GetEndPoint (int &ix, int &iy)

Protected Member Functions

virtual void _onMouseDown (int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos)
virtual void _onMouseUp (int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos)
virtual void _onMouseMove (bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY)

Detailed Description

mitkLineWidgetModel2D - a line widget used in 2D scene

mitkLineWidgetModel2D is a line widget used in 2D scene which can respond the mouse events to change the line status and return the current length of the line. It is supposed to be attached to a 2D data model (e.g. mitkImageModel) and add to a 2D scene (e.g. mitkImageScene), and in other conditions the display could be improper.


Constructor & Destructor Documentation

mitkLineWidgetModel2D::mitkLineWidgetModel2D  ) 
 

The default constructor.

mitkLineWidgetModel2D::mitkLineWidgetModel2D float  startPoint[2]  ) 
 

One and only constructor of mitkLineWidgetModel3D.

Parameters:
startPoint[0] x-coordinate of start point of this line
startPoint[1] y-coordinate of start point of this line
Note:
The coordinates of the start point must be the original coordinates in the object space before all geometrical transforms. (Because this widget is for 2D image, the z-coordinate will always be zero.)


Member Function Documentation

virtual void mitkLineWidgetModel2D::_onMouseDown int  mouseButton,
bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos
[protected, virtual]
 

Deal with mouse down event.

Parameters:
mouseButton indicates which mouse button is pressed
ctrlDown indicates if the key "Ctrl" is pressed
shiftDown indicates if the key "Shift" is pressed
xPos x-coordinate of the mouse position when mouse down event occurs
yPos y-coordinate of the mouse position when mouse down event occurs

Implements mitkWidgetModel.

virtual void mitkLineWidgetModel2D::_onMouseMove bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos,
int  deltaX,
int  deltaY
[protected, virtual]
 

Deal with mouse move event.

Parameters:
ctrlDown indicates if the key "Ctrl" is pressed
shiftDown indicates if the key "Shift" is pressed
xPos x-coordinate of the mouse position when mouse move event occurs
yPos y-coordinate of the mouse position when mouse move event occurs
deltaX movement along x-axis of the mouse when mouse move event occurs
deltaY movement along y-axis of the mouse when mouse move event occurs

Implements mitkWidgetModel.

virtual void mitkLineWidgetModel2D::_onMouseUp int  mouseButton,
bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos
[protected, virtual]
 

Deal with mouse up event.

Parameters:
mouseButton indicates which mouse button was pressed and now released
ctrlDown indicates if the key "Ctrl" is pressed
shiftDown indicates if the key "Shift" is pressed
xPos x-coordinate of the mouse position when mouse up event occurs
yPos y-coordinate of the mouse position when mouse up event occurs

Implements mitkWidgetModel.

void mitkLineWidgetModel2D::GetEndPoint int &  ix,
int &  iy
 

Get the integral coordinates of the end point in the original image.

Parameters:
ix return the x-coordinate
iy return the y-coordinate

void mitkLineWidgetModel2D::GetEndPoint float &  tx,
float &  ty
 

Get the physical coordinates in the object space of the end point.

Parameters:
tx return the x-coordinate of the end point
ty return the y-coordinate of the end point

float mitkLineWidgetModel2D::GetLineLength  ) 
 

Get length of this line.

Returns:
Return the length of the line.

int mitkLineWidgetModel2D::GetPointsSetNum  )  [inline]
 

Get how many points have been set.

Returns:
The number of points set properly. The value should be 0, 1 or 2.

void mitkLineWidgetModel2D::GetStartPoint int &  ix,
int &  iy
 

Get the integral coordinates of the start point in the original image.

Parameters:
ix return the x-coordinate
iy return the y-coordinate

void mitkLineWidgetModel2D::GetStartPoint float &  tx,
float &  ty
 

Get the physical coordinates in the object space of the start point.

Parameters:
tx return the x-coordinate of the start point
ty return the y-coordinate of the start point

const string& mitkLineWidgetModel2D::GetUnitName  )  [inline]
 

Get name string of unit.

Returns:
Return a constant reference to a string contains the name of the length unit this line uses

virtual void mitkLineWidgetModel2D::Pick const WidgetNames &  names  )  [virtual]
 

Maintain the selection status when this widget is picked.

Parameters:
names a constant reference to an WidgerNames which contains the names of selected parts of this widget.

Implements mitkWidgetModel.

virtual void mitkLineWidgetModel2D::PrintSelf ostream &  os  )  [virtual]
 

Print the necessary information about this object for the debugging purpose.

Parameters:
os The specified ostream to output information.

Reimplemented from mitkWidgetModel2D.

virtual void mitkLineWidgetModel2D::Release  )  [virtual]
 

Maintain the selection status when this widget is released.

Implements mitkWidgetModel.

virtual int mitkLineWidgetModel2D::Render mitkScene scene  )  [virtual]
 

Render this model.

Parameters:
scene the pointer of an mitkScene in which this model will be shown
Returns:
Return 1 if this model is rendered successfully. Otherwise return 0.

Reimplemented from mitkModel.

void mitkLineWidgetModel2D::SetEndPoint int  sx,
int  sy
[inline]
 

Set position of the end point.

Parameters:
sx x-coordinate of the end point of this line on screen
sy y-coordinate of the end point of this line on screen
Note:
The coordinates of the point are in the screen coordinate system. This function is useful when you can not get the original coordinates in the object space easily outside. It can do this job for you. But if this widget is attach to a data model, you must ensure the source model and the scene which contains this widget and the source model are properly set to this widget (e.g. call SetSourceModel() of this widget or call AddWidget() of the source model and SetScene() of this widget first) before calling this function, because this function needs the transform matrix of the source model and the scene to calculate the original coordinates.

void mitkLineWidgetModel2D::SetEndPoint float  x,
float  y
[inline]
 

Set position of the end point in the object space.

Parameters:
x x-coordinate of the end point of this line
y y-coordinate of the end point of this line
Note:
Because this widget is for 2D image, the z-coordinate will always be zero.

void mitkLineWidgetModel2D::SetEndPoint float  point[2]  )  [inline]
 

Set position of the end point in the object space.

Parameters:
point[0] x-coordinate of the end point of this line
point[1] y-coordinate of the end point of this line
Note:
Because this widget is for 2D image, the z-coordinate will always be zero.

void mitkLineWidgetModel2D::SetMovePoint int  sx,
int  sy
[inline]
 

Set position of the moving end point.

Parameters:
sx x-coordinate of the moving end point of this line on screen
sy y-coordinate of the moving end point of this line on screen
Note:
The coordinates of the point are in the screen coordinate system. This function is useful when you can not get the original coordinates in the object space easily outside. It can do this job for you. But if this widget is attach to a data model, you must ensure the source model and the scene which contains this widget and the source model are properly set to this widget (e.g. call SetSourceModel() of this widget or call AddWidget() of the source model and SetScene() of this widget first) before calling this function, because this function needs the transform matrix of the source model and the scene to calculate the original coordinates.

void mitkLineWidgetModel2D::SetMovePoint float  x,
float  y
[inline]
 

Set position of the moving end point in the object space.

Parameters:
x x-coordinate of the moving end point of this line
y y-coordinate of the moving end point of this line
Note:
Because this widget is for 2D image, the z-coordinate will always be zero.

void mitkLineWidgetModel2D::SetMovePoint float  point[2]  )  [inline]
 

Set position of the moving end point in the object space.

Parameters:
point[0] x-coordinate of the moving end point of this line
point[1] y-coordinate of the moving end point of this line
Note:
Because this widget is for 2D image, the z-coordinate will always be zero.

void mitkLineWidgetModel2D::SetStartPoint int  sx,
int  sy
[inline]
 

Set position of the start point.

Parameters:
sx x-coordinate of the start point of this line on screen
sy y-coordinate of the start point of this line on screen
Note:
The coordinates of the point are in the screen coordinate system. This function is useful when you can not get the original coordinates in the object space easily outside. It can do this job for you. But if this widget is attach to a data model, you must ensure the source model and the scene which contains this widget and the source model are properly set to this widget (e.g. call SetSourceModel() of this widget or call AddWidget() of the source model and SetScene() of this widget first) before calling this function, because this function needs the transform matrix of the source model and the scene to calculate the original coordinates.

void mitkLineWidgetModel2D::SetStartPoint float  x,
float  y
[inline]
 

Set position of the start point in the object space.

Parameters:
x x-coordinate of the start point of this line
y y-coordinate of the start point of this line
Note:
Because this widget is for 2D image, the z-coordinate will always be zero.

void mitkLineWidgetModel2D::SetStartPoint float  point[2]  )  [inline]
 

Set position of the start point in the object space.

Parameters:
point[0] x-coordinate of the start point of this line
point[1] y-coordinate of the start point of this line
Note:
Because this widget is for 2D image, the z-coordinate will always be zero.

void mitkLineWidgetModel2D::SetUnitName const string &  name  )  [inline]
 

Set name string of unit.

Parameters:
name a constant reference to a string contains the name of the length unit (e.g. mm) this line uses


The documentation for this class was generated from the following file:
Generated on Tue Feb 25 15:03:42 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3