Пример #1
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));
        }
Пример #2
0
        /// <summary>
        /// Creates a crack point calculator that selects also existing vertices as crack points.
        /// To calculate protected points shared with non-generalized geometries the intersection
        /// option IncludeLinearIntersectionAllPoints should be used.
        /// To calculate protected points shared with geometries that also should be generalized
        /// the intersection option IncludeLinearIntersectionEndpoints should be used
        /// </summary>
        /// <param name="intersectionOption"></param>
        /// <returns></returns>
        public static CrackPointCalculator CreateProtectedPointsCalculator(
            IntersectionPointOptions intersectionOption =
            IntersectionPointOptions.IncludeLinearIntersectionAllPoints)
        {
            double?snapTolerance = null;

            // NOTE: do not set the minimum segment length here because a non-null value
            //		 means that crack points should be excluded if they are too close to the
            //       next vertex -> make this more explicit by new property on VertexInfo
            double?    minimumSegmentLength = null;
            const bool addCrackPointsAlsoOnExistingVertices = true;

            // distinguish between selected protecting features (only protect start/end points)
            // and un-selected protecting features (protect every intersecting vertex)
            var crackPointCalculator =
                new CrackPointCalculator(
                    snapTolerance, minimumSegmentLength,
                    addCrackPointsAlsoOnExistingVertices, false,
                    intersectionOption, null);

            return(crackPointCalculator);
        }