/// <summary> /// Determines whether the sections in this list can be trimmed using the /// <see cref="TrimLineOperation"/> /// </summary> /// <returns>True if either end dangles, and we would be left with something /// after the trim.</returns> internal bool CanTrim() { // Can't trim if we don't have at least two sections if (m_Sections.Count < 2) { return(false); } // Get the sections at the ends. IDivider s = this.FirstDivider; IDivider e = this.LastDivider; Debug.Assert(s != e); // Return if neither end is dangling bool sDangle = Topology.IsDangle(s, s.From); bool eDangle = Topology.IsDangle(e, e.To); if (!(sDangle || eDangle)) { return(false); } // Can't process if both ends are dangling and the common point is coincident if (sDangle && eDangle && s.To.IsCoincident(e.From)) { return(false); } return(true); }
/// <summary> /// Checks if a divider is a dangle, floating, or a bridge. /// </summary> /// <param name="d">The divider to check</param> /// <returns>Bit mask of the check(s) the divider failed.</returns> static CheckType CheckNeighbours(IDivider d) { Debug.Assert(!d.IsOverlap); // Return if the divider has different polygons on both sides. if (d.Left != d.Right) { return(CheckType.Null); } bool sDangle = Topology.IsDangle(d, d.From); bool eDangle = Topology.IsDangle(d, d.To); if (sDangle && eDangle) { return(CheckType.Floating); } if (sDangle || eDangle) { return(CheckType.Dangle); } return(CheckType.Bridge); }