@Test(expected = CoreException.class) public void testInvalidPrepend() { final PolyLine line = new PolyLine(Location.CROSSING_85_280, Location.TEST_1); final PolyLine line2 = new PolyLine(Location.CROSSING_85_280, Location.TEST_7); @SuppressWarnings("unused") final PolyLine prepended = line.prepend(line2); }
@Test public void testPrepend() { final PolyLine line = new PolyLine(Location.CROSSING_85_280, Location.TEST_1); final PolyLine line2 = new PolyLine(Location.TEST_7, Location.CROSSING_85_280); final PolyLine prepended = line.prepend(line2); Assert.assertTrue(prepended.equalsShape( new PolyLine(Location.TEST_7, Location.CROSSING_85_280, Location.TEST_1))); }
/** * @return Feature change 1: Update the first location in the edge 39001000001L's polyLine */ private Tuple<FeatureChange, FeatureChange> getFeatureChangeUpdatedEdgePolyLine() { final Atlas atlas = this.rule.getAtlasEdge(); final Edge originalEdge1 = atlas.edge(39001000001L); final Edge originalEdge1Reverse = atlas.edge(-39001000001L); // Forward: final PolyLine originalPolyLine1 = originalEdge1.asPolyLine(); final PolyLine originalPolyLine1Modified = new PolyLine( originalPolyLine1.prepend(new PolyLine(NEW_LOCATION, originalPolyLine1.first()))); final CompleteEdge bloatedEdge1 = CompleteEdge.shallowFrom(originalEdge1) .withPolyLine(originalPolyLine1Modified); final FeatureChange featureChange1 = new FeatureChange(ChangeType.ADD, bloatedEdge1); // Backward final PolyLine originalPolyLine1Reverse = originalEdge1Reverse.asPolyLine(); final PolyLine originalPolyLine1ModifiedReverse = new PolyLine(originalPolyLine1Reverse .append(new PolyLine(originalPolyLine1Reverse.last(), NEW_LOCATION))); final CompleteEdge bloatedEdge1Reverse = CompleteEdge.shallowFrom(originalEdge1Reverse) .withPolyLine(originalPolyLine1ModifiedReverse); final FeatureChange featureChange1Reverse = new FeatureChange(ChangeType.ADD, bloatedEdge1Reverse); return new Tuple<>(featureChange1, featureChange1Reverse); } }