private static void CutAndAssignToFootprintParts( [NotNull] GeometryPart multipatchPart, [NotNull] IPolyline cutLine, [NotNull] IDictionary <RingGroup, List <RingGroup> > splitPartsByFootprintPart, ChangeAlongZSource zSource) { double tolerance = GeometryUtils.GetXyTolerance(multipatchPart.FirstGeometry); double zTolerance = GeometryUtils.GetZTolerance(multipatchPart.FirstGeometry); RingGroup ringGroup = GeometryConversionUtils.CreateRingGroup(multipatchPart); int pointId; if (GeometryUtils.HasUniqueVertexId( Assert.NotNull(multipatchPart.MainOuterRing), out pointId)) { ringGroup.Id = pointId; } bool inverted = ringGroup.ClockwiseOriented == false; if (inverted) { ringGroup.ReverseOrientation(); } IList <RingGroup> cutRingGroups = CutRingGroupPlanar(ringGroup, cutLine, tolerance, zSource, zTolerance); AssignResultsToFootprintParts(cutRingGroups, splitPartsByFootprintPart, tolerance); if (inverted) { foreach (RingGroup cutRingGroup in cutRingGroups) { cutRingGroup.ReverseOrientation(); } } }
public void CanReadClockwiseWindingPolygon() { // Some OGC 1.1 implementations do not have counter-clockwise polygon winding order: var ring1 = new List <Pnt3D> { new Pnt3D(0, 0, 9), new Pnt3D(0, 100, 8), new Pnt3D(100, 100, 5), new Pnt3D(100, 20, 9) }; RingGroup polygon = CreatePoly(ring1); polygon.AddInteriorRing(new Linestring(new[] { new Pnt3D(25, 50, 0), new Pnt3D(50, 50, 0), new Pnt3D(50, 75, 0), new Pnt3D(25, 75, 0), new Pnt3D(25, 50, 0) } )); RingGroup inverted = (RingGroup)polygon.Clone(); inverted.ReverseOrientation(); WkbGeomWriter writer = new WkbGeomWriter(); byte[] bytes = writer.WritePolygon(inverted); const bool assumeWkbPolygonsClockwise = true; WkbGeomReader reader = new WkbGeomReader(assumeWkbPolygonsClockwise); RingGroup deserialized = reader.ReadPolygon(new MemoryStream(bytes)); Assert.IsTrue(deserialized.Equals(polygon)); }