private static IPath GetSharedBoundaryProlongation( [NotNull] ICurve curveToReshape, [NotNull] IPath sharedBoundary, [NotNull] IPoint sourceConnectPoint, [NotNull] IPath reshapePath, double tolerance, [CanBeNull] out IPoint targetConnectPoint) { // try elongate the shared boundary's last segment ISegment sourceSegment = GetConnectSegment(sharedBoundary, sourceConnectPoint, tolerance); LineEnd segmentEndToProlong = GeometryUtils.AreEqualInXY(sourceSegment.FromPoint, sourceConnectPoint) ? LineEnd.From : LineEnd.To; IPath result = ReshapeUtils.GetProlongation(curveToReshape, sourceSegment, reshapePath, segmentEndToProlong, out targetConnectPoint); if (result != null && segmentEndToProlong == LineEnd.From) { result.ReverseOrientation(); } // TODO: The ITopoOp.Difference with the source performed in ReshapeUtils.GetProlongation might handle some // difficult situations, but also prevent a solution where the source intersection is on the // interiour of a segment in one polygon and on a vertex in the other. Currently this must be // dealt with by the user (placing a target intersection point). return(result); }
private static IPath GetSharedBoundaryProlongation([NotNull] ICurve curveToReshape, [NotNull] IPath sourceReplacementPath, bool atSourceReplacementFromPoint, [NotNull] IPath reshapePath, double tolerance, out IPoint targetConnectPoint) { IPoint sourceConnectPoint = atSourceReplacementFromPoint ? sourceReplacementPath.FromPoint : sourceReplacementPath.ToPoint; // try elongate the curveToReshape's last segment that's not part of the replacement path ISegment sourceSegment = GetConnectSegment(sourceReplacementPath, curveToReshape, sourceConnectPoint, tolerance); IPath result = ReshapeUtils.GetProlongation(curveToReshape, sourceSegment, reshapePath, out targetConnectPoint); if (result == null) { // check if the reshape path intersects the source segment: IGeometry highLevelSourceSegment = GeometryUtils.GetHighLevelGeometry(sourceSegment, true); IGeometry highLevelReshapePath = GeometryUtils.GetHighLevelGeometry(reshapePath, true); var intersectionPoints = (IPointCollection)IntersectionUtils.GetIntersectionPoints( highLevelReshapePath, highLevelSourceSegment, false); if (intersectionPoints.PointCount == 1) { result = CreateSinglePointPath(intersectionPoints.Point[0]); targetConnectPoint = intersectionPoints.Point[0]; } else { _msg.DebugFormat( "The source last shared segment has {0} intersection points with the reshape path. Currently not supported", intersectionPoints.PointCount); } } return(result); }