@Test public void testIsNotParallelRight() { Node start = new Node(1, 1, new Date(), null, 0, 1.0, 1.0); Node end = new Node(3, 1, new Date(), null, 0, 1.0, 10.0); Node afterEnd = new Node(4, 1, new Date(), null, 0, 1.0, 20.0); Node testStart = new Node(2, 1, new Date(), null, 0, 1.00001, 21.0); Node testEnd = new Node(5, 1, new Date(), null, 0, 1.00001, 30.0); Node testEnd2 = new Node(6, 1, new Date(), null, 0, 1.00001, 35.0); List<Node> existingWay = new ArrayList<Node>(); existingWay.add(start); existingWay.add(end); existingWay.add(afterEnd); List<Node> addmeWay = new ArrayList<Node>(); addmeWay.add(testStart); addmeWay.add(testEnd); addmeWay.add(testEnd2); List<Node> actual = WayHelper.isParallel(existingWay, addmeWay); assertNull(actual); }
public static List<Node> isParallel(final List<Node> aFirstWay, final List<Node> aSecondWay) { ArrayList<Node> aFirstWayCopy = new ArrayList<Node>(aFirstWay); ArrayList<Node> aSecondWayCopy = new ArrayList<Node>(aSecondWay); List<Node> retval = isParallelInternal(aFirstWayCopy, aSecondWayCopy); if (retval != null) { return retval; } aFirstWayCopy = new ArrayList<Node>(aFirstWay); aSecondWayCopy = new ArrayList<Node>(aSecondWay); Collections.reverse(aSecondWayCopy); retval = isParallelInternal(aSecondWayCopy, aFirstWayCopy); if (retval != null) { return retval; } return null; }
WayHelper { public static List<Node> isParallel(final List<Node> aFirstWay, final List<Node> aSecondWay) { ArrayList<Node> aFirstWayCopy = new ArrayList<Node>(aFirstWay); ArrayList<Node> aSecondWayCopy = new ArrayList<Node>(aSecondWay); List<Node> retval = isParallelInternal(aFirstWayCopy, aSecondWayCopy); if (retval != null) { return retval; } aFirstWayCopy = new ArrayList<Node>(aFirstWay); aSecondWayCopy = new ArrayList<Node>(aSecondWay); Collections.reverse(aSecondWayCopy); retval = isParallelInternal(aSecondWayCopy, aFirstWayCopy); if (retval != null) { return retval; } return null; } }
WayHelper { public static List<Node> isParallel(final List<Node> aFirstWay, final List<Node> aSecondWay) { ArrayList<Node> aFirstWayCopy = new ArrayList<Node>(aFirstWay); ArrayList<Node> aSecondWayCopy = new ArrayList<Node>(aSecondWay); List<Node> retval = isParallelInternal(aFirstWayCopy, aSecondWayCopy); if (retval != null) { return retval; } aFirstWayCopy = new ArrayList<Node>(aFirstWay); aSecondWayCopy = new ArrayList<Node>(aSecondWay); Collections.reverse(aSecondWayCopy); retval = isParallelInternal(aSecondWayCopy, aFirstWayCopy); if (retval != null) { return retval; } return null; } WayHelper(final IDataSet aMap); }
WayHelper { public static List<Node> isParallel(final List<Node> aFirstWay, final List<Node> aSecondWay) { ArrayList<Node> aFirstWayCopy = new ArrayList<Node>(aFirstWay); ArrayList<Node> aSecondWayCopy = new ArrayList<Node>(aSecondWay); List<Node> retval = isParallelInternal(aFirstWayCopy, aSecondWayCopy); if (retval != null) { return retval; } aFirstWayCopy = new ArrayList<Node>(aFirstWay); aSecondWayCopy = new ArrayList<Node>(aSecondWay); Collections.reverse(aSecondWayCopy); retval = isParallelInternal(aSecondWayCopy, aFirstWayCopy); if (retval != null) { return retval; } return null; } WayHelper(final IDataSet aMap); IDataSet getMap(); static String getTag(final Collection<Tag> way, final String key); static String getTag(final Entity way, final String key); List<Node> getNodes(final Way aWay); List<Node> getNodes(final List<WayNode> aWay); Bounds getWayBounds(final Way way); Bounds getWayBounds(final Collection<Way> ways); List<WayNode> simplifyWay(final Way w); List<WayNode> simplifyWay(final Way w, final double threshold,
            final double maxNodeDistance,
            final boolean keepTaggedNodes,
            final boolean keepIntersectionNodes); List<WayNode> simplifyWay(final List<WayNode> wnew, final double threshold,
            final double minNodeDistance,
            final boolean keepTaggedNodes,
            final boolean keepIntersectionNodes); void simplifyWayRange(final List<WayNode> aWay, final int from,
                                 final int to,
                                 final double thr,
                                 final double minDist); static Bounds getBoundsForWay(final Way street, final IDataSet aMap); static boolean isPolygon(final Way aWay); static boolean isOneway(final Way way); static boolean isReverseOneway(final Way way); static boolean isBridge(final Way way); static long areaBoundingBox(final ExtendedWay way); static double area(final Coordinate[] polyPoints); static double[] centerOfMass(final Coordinate[] polyPoints); static boolean containsNode(final Way aToWay, final long aNodeID); static List<Node> isParallel(final List<Node> aFirstWay, final List<Node> aSecondWay); static double getDistanceAndInsert(final Node aNode, final List<Node> aWay); static double getDistance(final Node aNode, final Node aStart, final Node aEnd); }
WayHelper { public static List<Node> isParallel(final List<Node> aFirstWay, final List<Node> aSecondWay) { ArrayList<Node> aFirstWayCopy = new ArrayList<Node>(aFirstWay); ArrayList<Node> aSecondWayCopy = new ArrayList<Node>(aSecondWay); List<Node> retval = isParallelInternal(aFirstWayCopy, aSecondWayCopy); if (retval != null) { return retval; } aFirstWayCopy = new ArrayList<Node>(aFirstWay); aSecondWayCopy = new ArrayList<Node>(aSecondWay); Collections.reverse(aSecondWayCopy); retval = isParallelInternal(aSecondWayCopy, aFirstWayCopy); if (retval != null) { return retval; } return null; } WayHelper(final IDataSet aMap); IDataSet getMap(); static String getTag(final Collection<Tag> way, final String key); static String getTag(final Entity way, final String key); List<Node> getNodes(final Way aWay); List<Node> getNodes(final List<WayNode> aWay); Bounds getWayBounds(final Way way); Bounds getWayBounds(final Collection<Way> ways); List<WayNode> simplifyWay(final Way w); List<WayNode> simplifyWay(final Way w, final double threshold,
            final double maxNodeDistance,
            final boolean keepTaggedNodes,
            final boolean keepIntersectionNodes); List<WayNode> simplifyWay(final List<WayNode> wnew, final double threshold,
            final double minNodeDistance,
            final boolean keepTaggedNodes,
            final boolean keepIntersectionNodes); void simplifyWayRange(final List<WayNode> aWay, final int from,
                                 final int to,
                                 final double thr,
                                 final double minDist); static Bounds getBoundsForWay(final Way street, final IDataSet aMap); static boolean isPolygon(final Way aWay); static boolean isOneway(final Way way); static boolean isReverseOneway(final Way way); static boolean isBridge(final Way way); static long areaBoundingBox(final ExtendedWay way); static double area(final Coordinate[] polyPoints); static double[] centerOfMass(final Coordinate[] polyPoints); static boolean containsNode(final Way aToWay, final long aNodeID); static List<Node> isParallel(final List<Node> aFirstWay, final List<Node> aSecondWay); static double getDistanceAndInsert(final Node aNode, final List<Node> aWay); static double getDistance(final Node aNode, final Node aStart, final Node aEnd);  }