示例#1
0
        private static Linestring CreateWithBoundaryLoop(Linestring containingSourceRing,
                                                         Linestring touchingInteriorRing,
                                                         IntersectionPoint3D touchIntersection,
                                                         double tolerance)
        {
            double sourceTouchPointRatio;
            int    sourceTouchSegmentIdx =
                touchIntersection.GetLocalSourceIntersectionSegmentIdx(
                    containingSourceRing, out sourceTouchPointRatio);
            List <Linestring> subcurves = new List <Linestring>();

            subcurves.Add(containingSourceRing.GetSubcurve(
                              0, 0, sourceTouchSegmentIdx, sourceTouchPointRatio,
                              false));

            double targetTouchPointRatio;
            int    targetTouchSegmentIdx =
                touchIntersection.GetLocalTargetIntersectionSegmentIdx(
                    touchingInteriorRing, out targetTouchPointRatio);

            subcurves.Add(touchingInteriorRing.GetSubcurve(
                              targetTouchSegmentIdx, targetTouchPointRatio, false,
                              true));

            subcurves.Add(containingSourceRing.GetSubcurve(
                              sourceTouchSegmentIdx, sourceTouchPointRatio,
                              containingSourceRing.SegmentCount - 1, 1, false));

            Linestring withBoundaryLoop =
                GeomTopoOpUtils.MergeConnectedLinestrings(subcurves, null, tolerance);

            return(withBoundaryLoop);
        }
示例#2
0
        protected static Linestring GetTargetSubcurve(
            [NotNull] Linestring target,
            [NotNull] IntersectionPoint3D fromIntersection,
            [NotNull] IntersectionPoint3D toIntersection,
            bool forward)
        {
            double fromDistanceAlongAsRatio;
            int    fromIndex = fromIntersection.GetLocalTargetIntersectionSegmentIdx(
                target, out fromDistanceAlongAsRatio);

            double toDistanceAlongAsRatio;
            int    toIndex = toIntersection.GetLocalTargetIntersectionSegmentIdx(
                target, out toDistanceAlongAsRatio);

            if (!forward &&
                fromIntersection.VirtualTargetVertex > toIntersection.VirtualTargetVertex)
            {
            }

            Linestring subcurve = target.GetSubcurve(
                fromIndex, fromDistanceAlongAsRatio,
                toIndex, toDistanceAlongAsRatio,
                false, !forward);

            // Replace the start / end with the actual intersection (correct source Z, exactly matching previous subcurve end)
            subcurve.ReplacePoint(0, fromIntersection.Point);
            subcurve.ReplacePoint(subcurve.SegmentCount, toIntersection.Point);

            return(subcurve);
        }
示例#3
0
        protected Linestring GetSourceSubcurve(
            [NotNull] IntersectionPoint3D fromIntersection,
            [NotNull] IntersectionPoint3D toIntersection)
        {
            Assert.ArgumentCondition(
                fromIntersection.SourcePartIndex == toIntersection.SourcePartIndex,
                "Cannot jump between source parts");

            Linestring source = GetSourcePart(fromIntersection.SourcePartIndex);

            double fromDistanceAlongAsRatio;
            int    fromIndex = fromIntersection.GetLocalSourceIntersectionSegmentIdx(
                source, out fromDistanceAlongAsRatio);

            double toDistanceAlongAsRatio;
            int    toIndex = toIntersection.GetLocalSourceIntersectionSegmentIdx(
                source, out toDistanceAlongAsRatio);

            Linestring subcurve = source.GetSubcurve(
                fromIndex, fromDistanceAlongAsRatio,
                toIndex, toDistanceAlongAsRatio,
                false);

            return(subcurve);
        }
        private static Linestring GetSourceSubcurve(
            [NotNull] Linestring source,
            [NotNull] IntersectionPoint3D fromIntersection,
            [NotNull] IntersectionPoint3D toIntersection)
        {
            double fromDistanceAlongAsRatio;
            int    fromIndex = fromIntersection.GetLocalSourceIntersectionSegmentIdx(
                source, out fromDistanceAlongAsRatio);

            double toDistanceAlongAsRatio;
            int    toIndex = toIntersection.GetLocalSourceIntersectionSegmentIdx(
                source, out toDistanceAlongAsRatio);

            Linestring subcurve = source.GetSubcurve(
                fromIndex, fromDistanceAlongAsRatio,
                toIndex, toDistanceAlongAsRatio,
                false);

            return(subcurve);
        }