public static IShapeCollection SimplifyByArea(IShapeCollection shapes, double threshold) { return(Process(shapes, threshold, (i, t) => ShapeUtility.SimplifyByArea(i, t))); //ShapeCollection<PolyLine> result = new ShapeCollection<PolyLine>(); //foreach (ISimplePoints feature in shapes) //{ // var temp = ShapeUtility.SimplifyByArea(feature.Points, threshold); // if (temp == null) // continue; // if (temp.Length > 2) // { // result.Add(new PolyLine(temp)); // } //} //return result; }
static void SuperSlim(string file) { var shapes = IRI.Ket.ShapefileFormat.Shapefile.Read(file); ShapeCollection <Polygon> polygons = new ShapeCollection <Polygon>(); //var stat = new FeatureStatistics[120]; int index = 0; foreach (Polygon feature in shapes) { index = 0; //UpdateFeatureStat(ref stat[index++], feature.Points, -1); var temp = ShapeUtility.SimplifyByArea(feature.Points, 100); //UpdateFeatureStat(ref stat[index++], temp, 100); if (temp == null) { continue; } for (int i = 1; i < 30; i++) { var threshold = i * 100 + 100; temp = ShapeUtility.SimplifyByArea(temp, threshold); //UpdateFeatureStat(ref stat[index++], temp, threshold); } for (int i = 1; i < 11; i++) { var threshold = (i * 500) + 5000; temp = ShapeUtility.SimplifyByArea(temp, threshold); //UpdateFeatureStat(ref stat[index++], temp, threshold); } for (int i = 1; i < 11; i++) { var threshold = (i * 1000) + 10000; temp = ShapeUtility.SimplifyByArea(temp, threshold); //UpdateFeatureStat(ref stat[index++], temp, threshold); } for (int i = 1; i < 17; i++) { var threshold = (i * 5000) + 20000; temp = ShapeUtility.SimplifyByArea(temp, threshold); //UpdateFeatureStat(ref stat[index++], temp, threshold); } for (int i = 1; i < 25; i++) { var threshold = (i * 20000) + 100000; temp = ShapeUtility.SimplifyByArea(temp, threshold); //UpdateFeatureStat(ref stat[index++], temp, threshold); } if (temp.Length > 0) { polygons.Add(new Polygon(temp)); } } IRI.Ket.ShapefileFormat.Writer.ShpWriter.Write(@"E:\Data\0. Test\Large Data\94.04.10\IRI1OstanMercatorSuperSlim.shp", polygons, true); //Debug.Print("\n****************\n"); //foreach (var item in stat) //{ // Debug.Print(item.ToString()); //} //Debug.Print("\n****************\n"); //foreach (var item in stat) //{ // Debug.Print(item.ToCSV()); //} }