public void AddFoundation(FoundationCentreLine fcl, double angle) { FoundationConnection con = new FoundationConnection() { Foundation = fcl, Bearing = angle }; if (fcl.StartPoint.IsEqualTo(Location)) { con.ConnectionPoint = ConnectionPoint.Start; } else { con.ConnectionPoint = ConnectionPoint.End; } _connected.Add(con); }
public void TrimFoundations() { if (_connected.Count > 1) { var sortedConnections = _connected.OrderBy(fc => fc.Bearing).ToArray(); for (int i = 0; i < sortedConnections.Count(); i++) { FoundationCentreLine currentCentreLine = sortedConnections.ElementAt(i).Foundation; ConnectionPoint cp = sortedConnections.ElementAt(i).ConnectionPoint; FoundationConnection nextConnection = Next(i, sortedConnections); FoundationCentreLine nextCentreLine = nextConnection.Foundation; FoundationConnection previouConnection = Previous(i, sortedConnections); FoundationCentreLine previousCentreLine = previouConnection.Foundation; Curve nextSubject, previousSubject; switch (cp) { case ConnectionPoint.Start: nextSubject = currentCentreLine.RightOffsetCached; previousSubject = currentCentreLine.LeftOffsetCached; break; case ConnectionPoint.End: nextSubject = currentCentreLine.LeftOffsetCached; previousSubject = currentCentreLine.RightOffsetCached; break; default: throw new ArgumentOutOfRangeException(); } Curve nextTarget, previousTarget; switch (nextConnection.ConnectionPoint) { case ConnectionPoint.Start: nextTarget = nextCentreLine.LeftOffsetCached; break; case ConnectionPoint.End: nextTarget = nextCentreLine.RightOffsetCached; break; default: throw new ArgumentOutOfRangeException(); } switch (previouConnection.ConnectionPoint) { case ConnectionPoint.Start: previousTarget = previousCentreLine.RightOffsetCached; break; case ConnectionPoint.End: previousTarget = previousCentreLine.LeftOffsetCached; break; default: throw new ArgumentOutOfRangeException(); } TrimToIntersect(nextSubject, nextTarget, cp); TrimToIntersect(previousSubject, previousTarget, cp); } } }