Exemplo n.º 1
0
        private static IMultipoint RemoveAllowedInteriorIntersections(
            [NotNull] IMultipoint intersections,
            [NotNull] IPolyline polyline1,
            [NotNull] IPolyline polyline2,
            AllowedLineInteriorIntersections allowedLineInteriorIntersections,
            double vertexSearchDistance)
        {
            switch (allowedLineInteriorIntersections)
            {
            case AllowedLineInteriorIntersections.None:
                return(intersections);

            case AllowedLineInteriorIntersections.AtVertexOnBothLines:
                return(RemoveVertexIntersections(intersections, polyline1, polyline2,
                                                 vertexSearchDistance));

            default:
                throw new ArgumentOutOfRangeException(nameof(allowedLineInteriorIntersections));
            }
        }
Exemplo n.º 2
0
        public static IMultipoint GetInvalidIntersections(
            [NotNull] IPolyline polyline1,
            [NotNull] IPolyline polyline2,
            AllowedEndpointInteriorIntersections allowedEndpointInteriorIntersections,
            AllowedLineInteriorIntersections allowedLineInteriorIntersections,
            bool reportOverlaps,
            double vertexSearchDistance)
        {
            Assert.ArgumentNotNull(polyline1, nameof(polyline1));
            Assert.ArgumentNotNull(polyline2, nameof(polyline2));

            IntersectionPointOptions intersectionPointOptions =
                reportOverlaps
                                        ? IntersectionPointOptions.IncludeLinearIntersectionEndpoints
                                        : IntersectionPointOptions.DisregardLinearIntersections;

            // NOTE: this does not reliably find endpoint/interior intersections -> empty!! (even if Disjoint does return false)
            const bool  assumeIntersecting = true;
            IMultipoint intersections      = IntersectionUtils.GetIntersectionPoints(polyline1,
                                                                                     polyline2,
                                                                                     assumeIntersecting,
                                                                                     intersectionPointOptions);

            // TODO catch missed end point/interior intersections by checking end points explicitly

            if (intersections.IsEmpty)
            {
                return(intersections);
            }

            intersections = RemoveAllowedEndPointIntersections(intersections,
                                                               polyline1, polyline2,
                                                               allowedEndpointInteriorIntersections,
                                                               vertexSearchDistance);

            return(RemoveAllowedInteriorIntersections(intersections,
                                                      polyline1, polyline2,
                                                      allowedLineInteriorIntersections,
                                                      vertexSearchDistance));
        }