/// <summary> /// Calculates the position of the intersection (if any). /// </summary> /// <returns>The position of the intersection (null if it cannot be calculated).</returns> IPosition Calculate() { IPosition xsect; PointFeature closest; if (m_Line1.Intersect(m_Line2, m_CloseTo, out xsect, out closest)) { return(xsect); } else { return(null); } }
/// <summary> /// Saves a line-line intersection. /// </summary> /// <returns>The point feature at the intersection (null if something went wrong).</returns> PointFeature SaveLineLine() { IntersectTwoLinesOperation op = null; try { LineFeature line1 = getLine1.Line; bool wantSplit1 = getLine1.WantSplit; LineFeature line2 = getLine2.Line; bool wantSplit2 = getLine2.WantSplit; IdHandle pointId = intersectInfo.PointId; PointFeature closeTo = intersectInfo.ClosestPoint; if (closeTo == null) { IPosition xsect; if (!line1.Intersect(line2, null, out xsect, out closeTo)) { throw new Exception("Cannot calculate intersection point"); } Debug.Assert(closeTo != null); } op = new IntersectTwoLinesOperation(line1, wantSplit1, line2, wantSplit2, closeTo); op.Execute(pointId); return(op.IntersectionPoint); } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); } return(null); }
/// <summary> /// Returns the point feature closest to an intersection involving one or more line features. /// </summary> /// <returns>Null (always). Dialogs that involve instances of <see cref="GetLineControl"/> /// are expected to override.</returns> internal override PointFeature GetDefaultClosestPoint() { LineFeature line1 = getLine1.Line; if (line1 == null) { return(null); } LineFeature line2 = getLine2.Line; if (line2 == null) { return(null); } // The closest point may be null if the finish page has never been shown PointFeature closeTo = intersectInfo.ClosestPoint; IPosition xsect; PointFeature closest; line1.Intersect(line2, closeTo, out xsect, out closest); return(closest); }