private void btnDifference_Click(object sender, EventArgs e) { ITopologicalOperator2D topoOpera = geo1 as ITopologicalOperator2D; if (topoOpera == null) { return; } IGeometry geo = topoOpera.Difference2D(geo2); draw(geo); }
private void btnDifference_Click(object sender, EventArgs e) { IGeometry p = polygonList[0]; for (int i = 0; i < polygonList.Count - 1; i++) { IPolygon piplus = polygonList[i + 1]; ITopologicalOperator2D topoOpera = p as ITopologicalOperator2D; if (topoOpera == null) { continue; } p = topoOpera.Difference2D(piplus); } if (p.GeometryType == gviGeometryType.gviGeometryMultiPolygon) { _multiPolygon = p as IMultiPolygon; } else if (p.GeometryType == gviGeometryType.gviGeometryPolygon) { _multiPolygon.AddGeometry(p); } }