/** * Multipolygon for shard with outer smaller than the bounds */ private MultiPolygon multiPolygonForShard(final Shard shard) { final Rectangle bounds = shard.bounds(); final Rectangle outer = bounds.contract(Distance.ONE_METER); final Rectangle inner = outer.contract(Distance.ONE_METER); final MultiMap<Polygon, Polygon> multiMap = new MultiMap<>(); multiMap.put(outer, Arrays.asList(inner)); return new MultiPolygon(multiMap); }
@Test(expected = UnsupportedOperationException.class) public void testUnimplemented() { final Rectangle maxBounds = SlippyTile.forName("1-0-0").bounds() .contract(Distance.ONE_METER); // collection without implemented resolve shard strategy final ShardBucketCollectionTestClasses.UnsupportedOperation unsupportedOperation = new ShardBucketCollectionTestClasses.UnsupportedOperation( maxBounds, 3); // a polyline that will intersect with multiple buckets final PolyLine testPolyLine1 = this.polylineForShards(SlippyTile.allTiles(3, maxBounds)); unsupportedOperation.add(testPolyLine1); }
.contract(Distance.ONE_METER);
/** * Get the original test Atlas. Cut it smaller to a subAtlas, and use that smaller Atlas to * generate the changes. Apply the changes back to the original atlas. * * @param name * The Atlas name for debugging * @param modificationsFunction * The function generating the changes. */ private void resetAndChange(final String name, final AtlasChangeGenerator atlasChangeGenerator) { this.atlas = this.rule.getAtlas(); saveLocally("original.atlas", this.atlas); this.subAtlas = this.atlas.subAtlas(this.atlas.bounds().contract(Distance.meters(500)), AtlasCutType.HARD_CUT_ALL).get(); saveLocally("sub.atlas", this.subAtlas); final Set<FeatureChange> featureChanges = atlasChangeGenerator.apply(this.subAtlas); final ChangeBuilder builder = new ChangeBuilder(); featureChanges.forEach(builder::add); final Change change = builder.get(); this.changeAtlas = new ChangeAtlas(this.atlas, change); saveLocally(name + "_change.atlas", this.changeAtlas.cloneToPackedAtlas()); }
final Rectangle collapsedRectangle1 = this.rectangle1.contract(rectangle1CornerToCorner); Assert.assertEquals(collapsedRectangle1.center().bounds(), collapsedRectangle1); Assert.assertEquals(Surface.forDm7Squared(0), collapsedRectangle1.surface()); Assert.assertEquals(this.rectangle1, expanded.contract(Distance.ONE_METER)); .distanceTo(this.rectangle1.upperRight()).scaleBy(.51); final Rectangle collapsedHorizontally = this.rectangle1 .contract(contractRectangle1Distance); Assert.assertEquals(Surface.forDm7Squared(0), collapsedHorizontally.surface()); Assert.assertEquals(collapsedHorizontally.surface(), this.rectangle1.contract(contractRectangle1Distance.scaleBy(10)).surface()); Assert.assertEquals(Math.round(contractRectangle1Distance.asMeters()), Math.round(new Location(this.rectangle1.lowerLeft().getLatitude(), final Distance contractRectangle2Distance = rectangle2UpperLeft .distanceTo(this.rectangle2.lowerLeft()).scaleBy(.51); final Rectangle collapsedVertically = this.rectangle2.contract(contractRectangle2Distance); Assert.assertEquals(Surface.forDm7Squared(0), collapsedVertically.surface()); Assert.assertEquals(collapsedVertically.surface(), this.rectangle2.contract(contractRectangle2Distance.scaleBy(10)).surface()); Assert.assertEquals(Math.round(contractRectangle2Distance.asMeters()), Math.round(new Location(collapsedVertically.middle().getLatitude(), collapsedHorizontally.contract(Distance.TEN_MILES)); Assert.assertEquals(this.rectangle2.center().bounds(), collapsedVertically.contract(Distance.TEN_MILES));
.contract(Distance.ONE_METER);
.contract(Distance.ONE_METER);