private static void _addRecursive(PolygonList hierarchicalList, ref PolygonList flatList) { foreach (Polygon polygon in hierarchicalList) { flatList.Add(polygon); _addRecursive(polygon.Holes, ref flatList); } }
public PolygonList GetPolygons(IncentiveType type) { PolygonList polygons = new PolygonList(); foreach (TimedArea area in GetAllAreas(type)) { polygons.Add(area.Area); } return(polygons); }
private void _flattenRecursive(ref PolygonList result) { foreach (Polygon polygon in Holes) { polygon._flattenRecursive(ref result); // if this is a contour, remove the hole's holes if (!IsHole) { polygon.Holes = new PolygonList(); } } // if this is a contour, add it to the result list if (!IsHole) { result.Add(this); } }
/// <summary> /// Create a polygon from a Clipper Treenode. This creates a hierarchical polygon (the holes may contain "holes" themselves, which describe nested polygons). /// </summary> /// <param name="node">The treenode which should be turned into a polygon</param> public Polygon(PolyNode node) : this(node.Contour) { //if (IsHole != node.IsHole) // Logger.Warn("Area returned by clipper is marked as " + (node.IsHole ? "Hole" : "Contour") + " but the vertices are " + (IsHole ? "CW." : "CCW.")); node.Childs.ForEach((childNode) => Holes.Add(new Polygon(childNode))); }