23 : FEATURE_ID_CIRCUMFERENCE(this->AddFeature(
"Circumference",
"mm")), FEATURE_ID_AREA(this->AddFeature(
"Area",
"mm2"))
44 unsigned int horizontalCorrespondingPointIndex = 1;
45 unsigned int verticalCorrespondingPointIndex = 3;
48 horizontalCorrespondingPointIndex = 0;
49 verticalCorrespondingPointIndex = 2;
53 horizontalCorrespondingPointIndex = 3;
54 verticalCorrespondingPointIndex = 1;
58 horizontalCorrespondingPointIndex = 2;
59 verticalCorrespondingPointIndex = 0;
62 Point2D verticalCorrespondingPoint = GetControlPoint(verticalCorrespondingPointIndex);
63 verticalCorrespondingPoint[0] = point[0];
66 Point2D horizontalCorrespondingPoint = GetControlPoint(horizontalCorrespondingPointIndex);
67 horizontalCorrespondingPoint[1] = point[1];
77 m_SelectedControlPoint = 3;
82 this->ClearPolyLines();
84 for (
unsigned int i = 0; i < this->GetNumberOfControlPoints(); ++i)
85 this->AppendPointToPolyLine(0, this->GetControlPoint(i));
96 double circumference = 0.0;
98 for (i = 0; i < this->GetNumberOfControlPoints(); ++i)
100 circumference += this->GetWorldControlPoint(i).EuclideanDistanceTo(
101 this->GetWorldControlPoint((i + 1) % this->GetNumberOfControlPoints()));
104 this->SetQuantity(FEATURE_ID_CIRCUMFERENCE, circumference);
108 if (this->GetPlaneGeometry() !=
nullptr)
110 for (i = 0; i < this->GetNumberOfControlPoints(); ++i)
112 Point2D p0 = this->GetControlPoint(i);
113 Point2D p1 = this->GetControlPoint((i + 1) % this->GetNumberOfControlPoints());
115 area += p0[0] * p1[1] - p1[0] * p0[1];
120 this->SetQuantity(FEATURE_ID_AREA, fabs(area));
125 Superclass::PrintSelf(os, indent);
127 os << indent <<
"Number of control points: " << this->GetNumberOfControlPoints() << std::endl;
129 os << indent <<
"Control points:" << std::endl;
131 for (
unsigned int i = 0; i < this->GetNumberOfControlPoints(); ++i)
133 os << indent << indent << i <<
": " << GetControlPoint(i) << std::endl;
142 return Superclass::Equals(other);
virtual void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
Implementation of PlanarFigure representing a polygon with two or more control points.
virtual void EvaluateFeaturesInternal() override
Calculates feature quantities of the planar figure.
void SetProperty(const char *propertyKey, BaseProperty *property)
virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override
Generates the poly-lines that should be drawn the same size regardless of zoom.
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual bool SetControlPoint(unsigned int index, const Point2D &point, bool createIfDoesNotExist=false) override
virtual bool Equals(const mitk::PlanarFigure &other) const override
Compare two PlanarFigure objects Note: all subclasses have to implement the method on their own...
virtual void PlaceFigure(const Point2D &point) override
Place figure in its minimal configuration (a point at least) onto the given 2D geometry.