CodePlexProject Hosting for Open Source Software
Documentation DotSpatial.Data Desktop_SampleCode MultypgFSCS
using DotSpatial.Data; using DotSpatial.Topology; private void button1_Click(object sender, EventArgs e) { Random rnd = new Random(); Polygon[] pg = new Polygon[100]; Feature f = new Feature(); FeatureSet fs = new FeatureSet(f.FeatureType); for (int i = 0; i < 100; i++) { Coordinate center = new Coordinate((rnd.Next(50) * 360) - 180, (rnd.Next(60) * 180) - 90); Coordinate[] coord = new Coordinate[50]; for (int ii = 0; ii < 50; 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); fs.Features.Add(pg[i]); } fs.SaveAs("C:\\Temp\\test.shp", true); }
Last edited Aug 3, 2012 at 8:19 PM by mudnug, version 3