public void TestIntersection_envelope1()
 {
     Assert.IsTrue(CoordinateArrays.Equals(
                       CoordinateArrays.Intersection(Coords1, new Envelope(1, 2, 1, 2)),
                       new[] { new Coordinate(1, 1), new Coordinate(2, 2) }
                       ));
 }
 public void EqualsComparerTest()
 {
     Coordinate[] reverse = CoordinateArrays.CopyDeep(array);
     CoordinateArrays.Reverse(reverse);
     Assert.IsFalse(CoordinateArrays.Equals(array, reverse));
     Assert.IsFalse(CoordinateArrays.Equals(array, reverse, new CoordinateArrays.ForwardComparator()));
     Assert.IsTrue(CoordinateArrays.Equals(array, reverse, new CoordinateArrays.BidirectionalComparator()));
 }
        private void TestQuery(KdTree <object> index, Envelope queryEnv,
                               bool includeRepeated, Coordinate[] expectedCoord)
        {
            var result = KdTree <object> .ToCoordinates(index.Query(queryEnv), includeRepeated);

            Array.Sort(result);
            Array.Sort(expectedCoord);

            Assert.IsTrue(result.Length == expectedCoord.Length,
                          "Result count = {0}, expected count = {1}",
                          result.Length, expectedCoord.Length);

            bool isMatch = CoordinateArrays.Equals(result, expectedCoord);

            Assert.IsTrue(isMatch, "Expected result coordinates not found");
        }
Example #4
0
        /// <summary>
        /// Dissolve the given <see cref="ISegmentString" />.
        /// </summary>
        /// <param name="segString"></param>
        public void Dissolve(ISegmentString segString)
        {
            var oca      = new OrientedCoordinateArray(segString.Coordinates);
            var existing = FindMatching(oca /*, segString*/);

            if (existing == null)
            {
                Add(oca, segString);
            }
            else
            {
                if (_merger != null)
                {
                    bool isSameOrientation = CoordinateArrays.Equals(existing.Coordinates, segString.Coordinates);
                    _merger.Merge(existing, segString, isSameOrientation);
                }
            }
        }
 public void TestIntersection_coords_emptyEnvelope()
 {
     Assert.IsTrue(CoordinateArrays.Equals(
                       CoordinateArrays.Intersection(Coords1, new Envelope()), Empty)
                   );
 }
 public void TestIntersection_empty_envelope()
 {
     Assert.IsTrue(CoordinateArrays.Equals(
                       CoordinateArrays.Intersection(Empty, new Envelope(1, 2, 1, 2)), Empty)
                   );
 }
 public void TestIntersection_envelopeDisjoint()
 {
     Assert.IsTrue(CoordinateArrays.Equals(
                       CoordinateArrays.Intersection(Coords1, new Envelope(10, 20, 10, 20)), Empty)
                   );
 }