This project is read-only.
Sample code that demonstrates how to create a new mulitpolygon from randomly generated coordinates

using DotSpatial.Geometries;
using DotSpatial.Topology.Geometries;

 private void button1_Click(object sender, EventArgs e)
        {
            Random rnd = new Random();
            Polygon[] pg = new Polygon[50];
            for (int i = 0; i < 50; i++)
            {
                Coordinate center = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
                Coordinate[] coord = new Coordinate[36];
                for (int ii = 0; ii < 36; ii++)
                {
                    coord[ii] = new Coordinate(center.X + Math.Cos((ii * 10) * Math.PI / 10), center.Y + (ii * 10) * Math.PI / 10);
                }
                coord[35] = new Coordinate(coord[0].X, coord[0].Y);
                pg[i] = new Polygon(coord);
            }
            MultiPolygon mpg = new MultiPolygon(pg);
        }

Last edited Jul 13, 2010 at 3:38 PM by AlamoMan, version 3