private void testQuery(KdTree index, Envelope queryEnv, Coordinate[] expectedCoord) { Coordinate[] result = KdTree.toCoordinates(index.query(queryEnv)); Arrays.sort(result); Arrays.sort(expectedCoord); assertTrue("Result count = " + result.length + ", expected count = " + expectedCoord.length, result.length == expectedCoord.length); boolean isMatch = CoordinateArrays.equals(result, expectedCoord); assertTrue("Expected result coordinates not found", isMatch); }
private void testQuery(KdTree index, Envelope queryEnv, boolean includeRepeated, Coordinate[] expectedCoord) { Coordinate[] result = KdTree.toCoordinates(index.query(queryEnv), includeRepeated); Arrays.sort(result); Arrays.sort(expectedCoord); assertTrue("Result count = " + result.length + ", expected count = " + expectedCoord.length, result.length == expectedCoord.length); boolean isMatch = CoordinateArrays.equals(result, expectedCoord); assertTrue("Expected result coordinates not found", isMatch); }
public void testIntersection_coords_emptyEnvelope() { assertTrue(CoordinateArrays.equals( CoordinateArrays.intersection(COORDS_1, new Envelope()), COORDS_EMPTY ) ); } }
public void testIntersection_envelopeDisjoint() { assertTrue(CoordinateArrays.equals( CoordinateArrays.intersection(COORDS_1, new Envelope(10, 20, 10, 20)), COORDS_EMPTY ) ); } public void testIntersection_empty_envelope()
public void testIntersection_empty_envelope() { assertTrue(CoordinateArrays.equals( CoordinateArrays.intersection(COORDS_EMPTY, new Envelope(1, 2, 1, 2)), COORDS_EMPTY ) ); } public void testIntersection_coords_emptyEnvelope()
/** * Dissolve the given {@link SegmentString}. * * @param segString the string to dissolve */ public void dissolve(SegmentString segString) { OrientedCoordinateArray oca = new OrientedCoordinateArray(segString.getCoordinates()); SegmentString existing = findMatching(oca, segString); if (existing == null) { add(oca, segString); } else { if (merger != null) { boolean isSameOrientation = CoordinateArrays.equals(existing.getCoordinates(), segString.getCoordinates()); merger.merge(existing, segString, isSameOrientation); } } }
public void testIntersection_envelope1() { assertTrue(CoordinateArrays.equals( CoordinateArrays.intersection(COORDS_1, new Envelope(1, 2, 1, 2)), new Coordinate[] { new Coordinate(1, 1), new Coordinate(2, 2) } )); } public void testIntersection_envelopeDisjoint()