static Rect getPolyMinMax(List<utmpos> utmpos)
{
if (utmpos.Count == 0)
return new Rect();
double minx, miny, maxx, maxy;
minx = maxx = utmpos[0].x;
miny = maxy = utmpos[0].y;
foreach (utmpos pnt in utmpos)
{
minx = Math.Min(minx, pnt.x);
maxx = Math.Max(maxx, pnt.x);
miny = Math.Min(miny, pnt.y);
maxy = Math.Max(maxy, pnt.y);
}
return new Rect(minx, maxy, maxx - minx,miny - maxy);
}