src/test/java/de/blau/android/util/BentleyOttmannForOsmTest.java
/**
     * Two ways with common start node should intersect once
     */
Two ways with common start node should intersect once
Two ways with common start node should intersect once
@Test
    public void twoWaysWithCommonStart() {
        StorageDelegator d = App.getDelegator();
        OsmElementFactory factory = d.getFactory();
        Way w1 = factory.createWayWithNewId();
        Node n0 = factory.createNodeWithNewId(toE7(51.6525286), toE7(-0.0399686));
        d.addNodeToWay(n0, w1);
        Node n1 = factory.createNodeWithNewId(toE7(51.6526058), toE7(-0.0398883));
        d.addNodeToWay(n1, w1);
        Node n2 = factory.createNodeWithNewId(toE7(51.6525050), toE7(-0.0397415));
        d.addNodeToWay(n2, w1);
        Way w2 = factory.createWayWithNewId();
        d.addNodeToWay(n0, w2);
        Node n4 = factory.createNodeWithNewId(toE7(51.6525101), toE7(-0.0398883));
        d.addNodeToWay(n4, w2);
        Node n5 = factory.createNodeWithNewId(toE7(51.6525912), toE7(-0.0397671));
        d.addNodeToWay(n5, w2);
        List<Coordinates> intersections = BentleyOttmannForOsm.findIntersections(Arrays.asList(w1, w2));
        assertEquals(1, intersections.size());
    }
@ Test public void twoWaysWithCommonStart ( ) { StorageDelegator d = App . getDelegator ( ) ; OsmElementFactory factory = d . getFactory ( ) ; Way w1 = factory . createWayWithNewId ( ) ; Node n0 = factory . createNodeWithNewId ( toE7 ( 51.6525286 ) , toE7 ( - 0.0399686 ) ) ; d . addNodeToWay ( n0 , w1 ) ; Node n1 = factory . createNodeWithNewId ( toE7 ( 51.6526058 ) , toE7 ( - 0.0398883 ) ) ; d . addNodeToWay ( n1 , w1 ) ; Node n2 = factory . createNodeWithNewId ( toE7 ( 51.6525050 ) , toE7 ( - 0.0397415 ) ) ; d . addNodeToWay ( n2 , w1 ) ; Way w2 = factory . createWayWithNewId ( ) ; d . addNodeToWay ( n0 , w2 ) ; Node n4 = factory . createNodeWithNewId ( toE7 ( 51.6525101 ) , toE7 ( - 0.0398883 ) ) ; d . addNodeToWay ( n4 , w2 ) ; Node n5 = factory . createNodeWithNewId ( toE7 ( 51.6525912 ) , toE7 ( - 0.0397671 ) ) ; d . addNodeToWay ( n5 , w2 ) ; List < Coordinates > intersections = BentleyOttmannForOsm . findIntersections ( Arrays . asList ( w1 , w2 ) ) ; assertEquals ( 1 , intersections . size ( ) ) ; }
Two ways with common start node should intersect once
Two ways with common start node should intersect once