private void handle(final PackedAtlasBuilder builder, final Area... areas) { final FeatureIDGenerator areaIDGenerator = new FeatureIDGenerator(); for (final Area area : areas) { addArea(builder, areaIDGenerator, area); } }
/** * Do we handle this Field? * * @param field * the field to interrogate * @return true if we can handle it, false otherwise */ private boolean filter(final Field field) { return FieldComparator.sortValueFor(field) < Integer.MAX_VALUE; }
@Override public int compare(final Class<? extends Annotation> first, final Class<? extends Annotation> second) { return sortValueFor(first) - sortValueFor(second); } }
private void handle(final PackedAtlasBuilder builder, final Edge... edges) { final FeatureIDGenerator edgeIDGenerator = new FeatureIDGenerator(); for (final Edge edge : edges) { builder.addEdge(edgeIDGenerator.nextId(edge.id()), convertPolyLine(edge.coordinates()), parseTags(edge.tags())); } }
private void handle(final PackedAtlasBuilder builder, final Line... lines) { final FeatureIDGenerator lineIDGenerator = new FeatureIDGenerator(); for (final Line line : lines) { builder.addLine(lineIDGenerator.nextId(line.id()), convertPolyLine(line.coordinates()), parseTags(line.tags())); } }
private void handle(final PackedAtlasBuilder builder, final Point... points) { final FeatureIDGenerator pointIDGenerator = new FeatureIDGenerator(); for (final Point point : points) { builder.addPoint(pointIDGenerator.nextId(point.id()), convertLoc(point.coordinates()), parseTags(point.tags())); } }
private void handle(final PackedAtlasBuilder builder, final Node... nodes) { final FeatureIDGenerator nodeIDGenerator = new FeatureIDGenerator(); for (final Node node : nodes) { builder.addNode(nodeIDGenerator.nextId(node.id()), convertLoc(node.coordinates()), parseTags(node.tags())); } }
private long addArea(final PackedAtlasBuilder builder, final FeatureIDGenerator areaIDGenerator, final Area area, final String... additionalTags) { final long areaId = areaIDGenerator.nextId(area.id()); builder.addArea(areaId, buildAreaPolygon(area), mergeTags(area.tags(), additionalTags)); return areaId; }
/** * @author matthieun */ public class DynamicAtlasRestrainedExpansionWithPolygonTestRule extends CoreTestRule { @TestAtlas(loadFromJosmOsmResource = "DynamicAtlasRestrainedExpansionWithPolygonTest.osm") private Atlas atlas; public Atlas getAtlas() { return this.atlas; } }
@Test public void loadFromOsmResourceTest() { final Atlas atlas = this.rule.getAtlasFromOsmResource(); assertAtlasCreation(atlas); }
@Test public void loadFromJosmOsmResourceTest() { final Atlas atlas = this.rule.getAtlasFromJosmOsmResource(); assertAtlasCreation(atlas); }
@Override public int compare(final Annotation first, final Annotation second) { return sortValueFor(first) - sortValueFor(second); } }
/** * @author matthieun */ public class DynamicAtlasMovingTooFastTestRule extends CoreTestRule { @TestAtlas(loadFromJosmOsmResource = "DynamicAtlasMovingTooFastTest.osm") private Atlas atlas; public Atlas getAtlas() { return this.atlas; } }
@Override public int compare(final Field first, final Field second) { return sortValueFor(first) - sortValueFor(second); } }
/** * @author matthieun */ public class DynamicAtlasPartialInitialShardsTestRule extends CoreTestRule { @TestAtlas(loadFromJosmOsmResource = "DynamicAtlasPartialInitialShardsTest.osm") private Atlas atlas; public Atlas getAtlas() { return this.atlas; } }
/** * {@link PolygonTest} data * * @author mgostintsev */ public class PolygonTestRule extends CoreTestRule { @TestAtlas(loadFromTextResource = "BLR-small.atlas.txt.gz") private Atlas complexForestPolygon; public Atlas getForestPolygon() { return this.complexForestPolygon; } }
/** * @author matthieun */ public class MultipleChangeAtlasTestRule extends CoreTestRule { // MultipleChangeAtlasTest.osm is the osm file from which MultipleChangeAtlasTest.atlas.txt was // created. // @TestAtlas(loadFromTextResource = "MultipleChangeAtlasTest.osm") @TestAtlas(loadFromTextResource = "MultipleChangeAtlasTest.atlas.txt") private Atlas atlas; public Atlas getAtlas() { return this.atlas; } }
/** * Test case rule for {@link SelfIntersectingHighwayAreaTestCase} * * @author isabellehillberg */ public class SelfIntersectingHighwayAreaTestCaseRule extends CoreTestRule { @TestAtlas(loadFromTextResource = "intersection.txt.gz") private Atlas intersectionAtlas; public StreamIterable<ComplexHighwayArea> findSelfIntersecting() { return Iterables .stream(new ComplexHighwayAreaFinder().find(this.intersectionAtlas, Finder::ignore)) .filter(ComplexHighwayArea::isSelfIntersecting); } }
/** * Test case rule for {@link ZeroSizeHighwayAreaTestCase} * * @author isabellehillberg */ public class ZeroSizeHighwayAreaTestCaseRule extends CoreTestRule { @TestAtlas(loadFromTextResource = "size_zero.txt.gz") private Atlas zeroSizeAtlas; public StreamIterable<ComplexHighwayArea> findZeroSized() { return Iterables .stream(new ComplexHighwayAreaFinder().find(this.zeroSizeAtlas, Finder::ignore)) .filter(ComplexHighwayArea::isZeroSized); } }