use of org.openstreetmap.atlas.geography.Segment in project atlas-checks by osmlab.
the class DuplicateNodeCheckTest method testCheck.
@Test
public void testCheck() {
final Rectangle bounds = Rectangle.TEST_RECTANGLE;
final Set<Location> nodes = new HashSet<>();
while (nodes.size() < 10) {
nodes.add(Location.random(bounds));
}
final PackedAtlasBuilder builder = new PackedAtlasBuilder();
int identifier = 0;
for (final Location node : nodes) {
// for first node make it a duplicate
if (identifier == 0) {
builder.addNode(identifier++, node, RandomTagsSupplier.randomTags(5));
}
builder.addNode(identifier++, node, RandomTagsSupplier.randomTags(5));
}
final Iterator<Location> locationIterator = nodes.iterator();
final Location start = locationIterator.next();
identifier = 0;
while (locationIterator.hasNext()) {
if (identifier == 0) {
builder.addEdge(identifier++, new Segment(start, locationIterator.next()), RandomTagsSupplier.randomTags(5));
}
builder.addEdge(identifier++, new Segment(start, locationIterator.next()), RandomTagsSupplier.randomTags(5));
}
final Atlas atlas = builder.get();
final Iterable<CheckFlag> flags = new DuplicateNodeCheck(ConfigurationResolver.emptyConfiguration()).flags(atlas);
Assert.assertEquals(1, Iterables.size(flags));
}
Aggregations