private Point2D GetCenter()
{
Point2D center = Point2D.Empty;
int maxCountIndex = 0;
if (this.Parts != null && this.Parts.Count > 0)
{
for (int i = 1; i < this.Parts.Count; i++)
{
if (this.Parts[maxCountIndex].Count < this.Parts[i].Count)
{
maxCountIndex = i;
}
}
if (this.Parts[maxCountIndex].Count == 2)
{
center.X = (this.Parts[maxCountIndex][0].X + this.Parts[maxCountIndex][1].X) / 2.0;
center.Y = (this.Parts[maxCountIndex][0].Y + this.Parts[maxCountIndex][1].Y) / 2.0;
}
else
{
int centerPointPosition = this.Parts[maxCountIndex].Count / 2;
center.X = this.Parts[maxCountIndex][centerPointPosition].X;
center.Y = this.Parts[maxCountIndex][centerPointPosition].Y;
}
}
return center;
}
}