Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

mitk::PlanarArrow Class Reference

Implementation of PlanarFigure representing an arrow through two control points. More...

#include <mitkPlanarArrow.h>

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

List of all members.

Public Types

typedef PlanarArrow Self
typedef PlanarFigure Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
unsigned int GetMinimumNumberOfControlPoints () const
 Place figure in its minimal configuration (a point at least) onto the given 2D geometry.
unsigned int GetMaximumNumberOfControlPoints () const
 Line has 2 control points per definition.

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 PlanarArrow ()
virtual ~PlanarArrow ()
virtual void GeneratePolyLine ()
 Generates the poly-line representation of the planar figure.
virtual void GenerateHelperPolyLine (double mmPerDisplayUnit, unsigned int displayHeight)
 Generates the poly-lines that should be drawn the same size regardless of zoom.
virtual void EvaluateFeaturesInternal ()
 Calculates feature quantities of the planar figure.
virtual void PrintSelf (std::ostream &os, itk::Indent indent) const

Protected Attributes

const unsigned int FEATURE_ID_LENGTH

Detailed Description

Implementation of PlanarFigure representing an arrow through two control points.

Definition at line 35 of file mitkPlanarArrow.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::PlanarArrow::ConstPointer

Reimplemented from mitk::PlanarFigure.

Definition at line 38 of file mitkPlanarArrow.h.

typedef itk::SmartPointer<Self> mitk::PlanarArrow::Pointer

Reimplemented from mitk::PlanarFigure.

Definition at line 38 of file mitkPlanarArrow.h.

Reimplemented from mitk::PlanarFigure.

Definition at line 38 of file mitkPlanarArrow.h.

Reimplemented from mitk::PlanarFigure.

Definition at line 38 of file mitkPlanarArrow.h.


Constructor & Destructor Documentation

mitk::PlanarArrow::PlanarArrow (  ) [protected]

Definition at line 23 of file mitkPlanarArrow.cpp.

References mitk::PlanarFigure::m_HelperPolyLines, mitk::PlanarFigure::m_HelperPolyLinesToBePainted, mitk::PlanarFigure::m_PolyLines, and mitk::PlanarFigure::ResetNumberOfControlPoints().

: FEATURE_ID_LENGTH( this->AddFeature( "Length", "mm" ) )
{
  // Directed arrow has two control points
  this->ResetNumberOfControlPoints( 2 );

  m_PolyLines->InsertElement( 0, VertexContainerType::New());

  // Create helper polyline object (for drawing the orthogonal orientation line)
  m_HelperPolyLines->InsertElement( 0, VertexContainerType::New());
  m_HelperPolyLines->InsertElement( 1, VertexContainerType::New());
  m_HelperPolyLines->ElementAt( 0 )->Reserve( 2 );
  m_HelperPolyLines->ElementAt( 1 )->Reserve( 2 );
  m_HelperPolyLinesToBePainted->InsertElement( 0, false );
  m_HelperPolyLinesToBePainted->InsertElement( 1, false );
}
mitk::PlanarArrow::~PlanarArrow (  ) [protected, virtual]

Definition at line 41 of file mitkPlanarArrow.cpp.

{
}

Member Function Documentation

void mitk::PlanarArrow::EvaluateFeaturesInternal (  ) [protected, virtual]

Calculates feature quantities of the planar figure.

Implements mitk::PlanarFigure.

Definition at line 122 of file mitkPlanarArrow.cpp.

{
  // Calculate line length
  const Point3D &p0 = this->GetWorldControlPoint( 0 );
  const Point3D &p1 = this->GetWorldControlPoint( 1 );
  double length = p0.EuclideanDistanceTo( p1 );

  this->SetQuantity( FEATURE_ID_LENGTH, length );
}
void mitk::PlanarArrow::GenerateHelperPolyLine ( double  mmPerDisplayUnit,
unsigned int  displayHeight 
) [protected, virtual]

Generates the poly-lines that should be drawn the same size regardless of zoom.

Implements mitk::PlanarFigure.

Definition at line 82 of file mitkPlanarArrow.cpp.

{
   // Generate helper polyline (orientation line orthogonal to first line)
  // if the third control point is currently being set
  if ( this->GetNumberOfControlPoints() != 2 )
  {
    m_HelperPolyLinesToBePainted->SetElement( 0, false );
    m_HelperPolyLinesToBePainted->SetElement( 1, false );
 
    return;
  }

  m_HelperPolyLinesToBePainted->SetElement( 0, true );
  m_HelperPolyLinesToBePainted->SetElement( 1, true );
 
  //Fixed size depending on screen size for the angle
  double nonScalingLength = displayHeight * mmPerDisplayUnit * 0.015;

  // Calculate arrow peak
  const Point2D& p1 = m_ControlPoints->ElementAt( 0 );
  const Point2D& p2 = m_ControlPoints->ElementAt( 1 );
  Vector2D n1 = p1 - p2;
  n1.Normalize();
 
  double degrees = 100.0;
  Vector2D temp;
  temp[0] = n1[0] * cos(degrees) - n1[1] * sin(degrees);
  temp[1] = n1[0] * sin(degrees) + n1[1] * cos(degrees);
  Vector2D temp2;
  temp2[0] = n1[0] * cos(-degrees) - n1[1] * sin(-degrees);
  temp2[1] = n1[0] * sin(-degrees) + n1[1] * cos(-degrees);

  m_HelperPolyLines->ElementAt( 0 )->ElementAt( 0 ) = p1;
  m_HelperPolyLines->ElementAt( 0 )->ElementAt( 1 ) = p1 - temp * nonScalingLength;
  m_HelperPolyLines->ElementAt( 1 )->ElementAt( 0 ) = p1;
  m_HelperPolyLines->ElementAt( 1 )->ElementAt( 1 ) = p1 - temp2 * nonScalingLength;
 
}
void mitk::PlanarArrow::GeneratePolyLine (  ) [protected, virtual]

Generates the poly-line representation of the planar figure.

Implements mitk::PlanarFigure.

Definition at line 73 of file mitkPlanarArrow.cpp.

{
  // TODO: start line at specified start point...
  // Generate poly-line 
  m_PolyLines->ElementAt( 0 )->Reserve( 2 );
  m_PolyLines->ElementAt( 0 )->ElementAt( 0 ) = m_ControlPoints->ElementAt( 0 );
  m_PolyLines->ElementAt( 0 )->ElementAt( 1 ) = m_ControlPoints->ElementAt( 1 );
}
virtual const char* mitk::PlanarArrow::GetClassName (  ) const [virtual]

Reimplemented from mitk::PlanarFigure.

unsigned int mitk::PlanarArrow::GetMaximumNumberOfControlPoints (  ) const [inline, virtual]

Line has 2 control points per definition.

Implements mitk::PlanarFigure.

Definition at line 59 of file mitkPlanarArrow.h.

  {
    return 2;
  }
unsigned int mitk::PlanarArrow::GetMinimumNumberOfControlPoints (  ) const [inline, virtual]

Place figure in its minimal configuration (a point at least) onto the given 2D geometry.

Must be implemented in sub-classes.Line has 2 control points per definition.

Implements mitk::PlanarFigure.

Definition at line 52 of file mitkPlanarArrow.h.

  {
    return 2;
  }
static Pointer mitk::PlanarArrow::New (  ) [static]
void mitk::PlanarArrow::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const [protected, virtual]

Reimplemented from mitk::PlanarFigure.

Definition at line 133 of file mitkPlanarArrow.cpp.

{
  Superclass::PrintSelf( os, indent );
}

Member Data Documentation

const unsigned int mitk::PlanarArrow::FEATURE_ID_LENGTH [protected]

Definition at line 82 of file mitkPlanarArrow.h.


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