public Rectangle2D GetBounds()
{
Point2DCollection point2Ds = new Point2DCollection();
Rectangle2D bounds = this.Bounds;
int[] parts = new int[this.Parts.Count];
int point2DCount = 0;
foreach (var item in this.Parts)
{
foreach (var item1 in item)
{
point2Ds.Add(item1);
}
parts[point2DCount] = item.Count;
point2DCount++;
}
if (point2Ds == null || point2Ds.Count == 0)
{
//throw new IllegalArgumentException(resource.getMessage("Geometry.getBounds.nopoints")); // %
return Rectangle2D.Empty;
}
else
{
double left, bottom, right, top;
left = point2Ds[0].X;
bottom = point2Ds[0].Y;
right = left;
top = bottom;
int iLength = point2Ds.Count;
for (int i = 1; i < iLength; i++)
{
if (point2Ds[i].X < left)
{
left = point2Ds[i].X;
}
if (point2Ds[i].Y < bottom)
{
bottom = point2Ds[i].Y;
}
if (point2Ds[i].X > right)
{
right = point2Ds[i].X;
}
if (point2Ds[i].Y > top)
{
top = point2Ds[i].Y;
}
}
return new Rectangle2D(left, bottom, right, top);
}
}
}