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

mitk::PlanarFourPointAngle Class Reference

Implementation of PlanarFigure representing a four point angle, which is defined by two non-intersecting lines in 2D. Each of those lines is defined by two control points. More...

#include <mitkPlanarFourPointAngle.h>

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

List of all members.

Public Types

typedef PlanarFourPointAngle 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
 Four point angle has 4 control points per definition.

Static Public Member Functions

static Pointer New ()

Public Attributes

const unsigned int FEATURE_ID_ANGLE

Protected Member Functions

 PlanarFourPointAngle ()
virtual ~PlanarFourPointAngle ()
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

Detailed Description

Implementation of PlanarFigure representing a four point angle, which is defined by two non-intersecting lines in 2D. Each of those lines is defined by two control points.

Definition at line 36 of file mitkPlanarFourPointAngle.h.


Member Typedef Documentation

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

Reimplemented from mitk::PlanarFigure.

Definition at line 39 of file mitkPlanarFourPointAngle.h.

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

Reimplemented from mitk::PlanarFigure.

Definition at line 39 of file mitkPlanarFourPointAngle.h.

Reimplemented from mitk::PlanarFigure.

Definition at line 39 of file mitkPlanarFourPointAngle.h.

Reimplemented from mitk::PlanarFigure.

Definition at line 39 of file mitkPlanarFourPointAngle.h.


Constructor & Destructor Documentation

mitk::PlanarFourPointAngle::PlanarFourPointAngle (  ) [protected]

Definition at line 23 of file mitkPlanarFourPointAngle.cpp.

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

: FEATURE_ID_ANGLE( this->AddFeature( "Angle", "deg" ) )
{
  // Four point angle has two control points
  this->ResetNumberOfControlPoints( 2 );

  m_PolyLines->InsertElement( 0, VertexContainerType::New());
  m_PolyLines->InsertElement( 1, VertexContainerType::New());
}
mitk::PlanarFourPointAngle::~PlanarFourPointAngle (  ) [protected, virtual]

Definition at line 34 of file mitkPlanarFourPointAngle.cpp.

{
}

Member Function Documentation

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

Calculates feature quantities of the planar figure.

Implements mitk::PlanarFigure.

Definition at line 68 of file mitkPlanarFourPointAngle.cpp.

{
  if ( this->GetNumberOfControlPoints() < 4 )
  {
    // Angle not yet complete.
    return;
  }

  // Calculate angle between lines
  const Point2D &p0 = this->GetControlPoint( 0 );
  const Point2D &p1 = this->GetControlPoint( 1 );
  const Point2D &p2 = this->GetControlPoint( 2 );
  const Point2D &p3 = this->GetControlPoint( 3 );

  Vector2D v0 = p1 - p0;
  Vector2D v1 = p3 - p2;

  v0.Normalize();
  v1.Normalize();
  double angle = acos( v0 * v1 );

  this->SetQuantity( FEATURE_ID_ANGLE, angle );
}
void mitk::PlanarFourPointAngle::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 62 of file mitkPlanarFourPointAngle.cpp.

{
  // Generate helper-poly-line for an four point angle
  // Need to discuss a sensible implementation
}
void mitk::PlanarFourPointAngle::GeneratePolyLine (  ) [protected, virtual]

Generates the poly-line representation of the planar figure.

Implements mitk::PlanarFigure.

Definition at line 39 of file mitkPlanarFourPointAngle.cpp.

{
  // TODO: start line at specified start point...
  // Generate poly-line 
  m_PolyLines->ElementAt( 0 )->Reserve( 2 );
  if (m_ControlPoints->Size() > 2)
  {
    m_PolyLines->ElementAt( 1 )->Reserve( this->GetNumberOfControlPoints() - 2 );
  }

  for ( unsigned int i = 0; i < this->GetNumberOfControlPoints(); ++i )
  {
    if (i < 2)
    {
      m_PolyLines->ElementAt( 0 )->ElementAt( i ) = m_ControlPoints->ElementAt( i );
    }
    if (i > 1)
    {
      m_PolyLines->ElementAt( 1 )->ElementAt( i-2 ) = m_ControlPoints->ElementAt( i );
    }
  }
}
virtual const char* mitk::PlanarFourPointAngle::GetClassName (  ) const [virtual]

Reimplemented from mitk::PlanarFigure.

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

Four point angle has 4 control points per definition.

Implements mitk::PlanarFigure.

Definition at line 62 of file mitkPlanarFourPointAngle.h.

  {
    return 4;
  }
unsigned int mitk::PlanarFourPointAngle::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.Four point angle has 4 control points per definition.

Implements mitk::PlanarFigure.

Definition at line 55 of file mitkPlanarFourPointAngle.h.

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

Reimplemented from mitk::PlanarFigure.

Definition at line 93 of file mitkPlanarFourPointAngle.cpp.

{
  Superclass::PrintSelf( os, indent );

}

Member Data Documentation


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