Пример #1
0
        public void CanGetMonotonicitySequencesEmpty()
        {
            var polyline = (IPolyline)CurveConstruction.StartLine(CreatePoint(0, 0, 100))
                           .LineTo(CreatePoint(50, 0, double.NaN))
                           .LineTo(CreatePoint(100, 0, 100))
                           .LineTo(CreatePoint(50, 0, double.NaN))
                           .Curve;

            polyline.SpatialReference = CreateSpatialReference(_mTolerance, _xyTolerance);
            GeometryUtils.MakeMAware(polyline);

            IEnumerable <MMonotonicitySequence> result =
                MeasureUtils.GetMonotonicitySequences((ISegmentCollection)polyline,
                                                      esriMonotinicityEnum.esriValuesEmpty);

            Assert.IsTrue(1 == result.Count());

            MMonotonicitySequence[] sequences = result.ToArray();

            Assert.IsTrue(sequences[0].MonotonicityType ==
                          esriMonotinicityEnum.esriValuesEmpty);

            Assert.IsTrue(sequences[0].Segments.Count == 3);

            Assert.IsTrue(sequences[0].Segments[0].FromPoint.M == 100);
            Assert.IsTrue(double.IsNaN(sequences[0].Segments[0].ToPoint.M));
            Assert.IsTrue(double.IsNaN(sequences[0].Segments[1].FromPoint.M));
            Assert.IsTrue(sequences[0].Segments[1].ToPoint.M == 100);
            Assert.IsTrue(sequences[0].Segments[2].FromPoint.M == 100);
            Assert.IsTrue(double.IsNaN(sequences[0].Segments[2].ToPoint.M));
        }
Пример #2
0
        public void CanGetMonotonicitySequencesDecreasing2()
        {
            var polyline = (IPolyline)CurveConstruction.StartLine(CreatePoint(0, 0, -100))
                           .LineTo(CreatePoint(1, 0, -200))
                           .LineTo(CreatePoint(2, 0, -300))
                           .LineTo(CreatePoint(3, 0, -400))
                           .LineTo(CreatePoint(4, 0, -300))
                           .LineTo(CreatePoint(5, 0, -200))
                           .LineTo(CreatePoint(6, 0, -300))
                           .Curve;

            polyline.SpatialReference = CreateSpatialReference(_mTolerance, _xyTolerance);
            GeometryUtils.MakeMAware(polyline);

            IEnumerable <MMonotonicitySequence> result =
                MeasureUtils.GetMonotonicitySequences((ISegmentCollection)polyline,
                                                      esriMonotinicityEnum.esriValueDecreases);

            Assert.IsTrue(2 == result.Count());

            MMonotonicitySequence[] sequences = result.ToArray();

            Assert.IsTrue(sequences[0].MonotonicityType ==
                          esriMonotinicityEnum.esriValueDecreases);

            Assert.IsTrue(sequences[0].Segments.Count == 3);

            Assert.IsTrue(sequences[0].Segments[0].FromPoint.M == -100);
            Assert.IsTrue(sequences[0].Segments[0].ToPoint.M == -200);
            Assert.IsTrue(sequences[0].Segments[1].FromPoint.M == -200);
            Assert.IsTrue(sequences[0].Segments[1].ToPoint.M == -300);
            Assert.IsTrue(sequences[0].Segments[2].FromPoint.M == -300);
            Assert.IsTrue(sequences[0].Segments[2].ToPoint.M == -400);

            Assert.IsTrue(sequences[1].MonotonicityType ==
                          esriMonotinicityEnum.esriValueDecreases);

            Assert.IsTrue(sequences[1].Segments.Count == 1);

            Assert.IsTrue(sequences[1].Segments[0].FromPoint.M == -200);
            Assert.IsTrue(sequences[1].Segments[0].ToPoint.M == -300);
        }