Use new Geometry.filterInsideAnyPolygon (JOSM r15730)

Signed-off-by: Taylor Smock <taylor.smock@kaart.com>
pull/1/head
Taylor Smock 2020-01-30 14:51:12 -07:00
rodzic 9d4e7bdbf1
commit b798cef706
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
2 zmienionych plików z 4 dodań i 22 usunięć

Wyświetl plik

@ -72,15 +72,7 @@ public class MergeAddressBuildings extends AbstractConflationCommand {
private static Collection<? extends Command> mergeAddressBuilding(DataSet affectedDataSet, OsmPrimitive object) {
final List<IPrimitive> toCheck = new ArrayList<>();
toCheck.addAll(affectedDataSet.searchNodes(object.getBBox()));
final Collection<IPrimitive> nodesInside;
if (object instanceof Way) {
nodesInside = Geometry.filterInsidePolygon(toCheck, (Way) object);
} else if (object instanceof Relation) {
nodesInside = Geometry.filterInsideMultipolygon(toCheck, (Relation) object);
} else {
throw new IllegalArgumentException("The method needs a way or a relation");
}
final Collection<IPrimitive> nodesInside = Geometry.filterInsideAnyPolygon(toCheck, object);
final List<Node> nodesWithAddresses = nodesInside.stream().filter(Node.class::isInstance).map(Node.class::cast)
.filter(node -> node.hasKey("addr:housenumber", "addr:housename")).collect(Collectors.toList());

Wyświetl plik

@ -95,19 +95,9 @@ public class MergeBuildingAddress extends AbstractConflationCommand {
}
private static Collection<Node> getAddressPoints(OsmPrimitive prim) {
if (prim instanceof Way && ((Way) prim).isClosed()) {
return Geometry
.filterInsidePolygon(new ArrayList<>(prim.getDataSet().allNonDeletedPrimitives()), (Way) prim)
.parallelStream().filter(Node.class::isInstance).map(Node.class::cast).filter(n -> n.hasTag(KEY))
.collect(Collectors.toList());
} else if (prim instanceof Relation) {
return Geometry
.filterInsideMultipolygon(new ArrayList<>(prim.getDataSet().allNonDeletedPrimitives()),
(Relation) prim)
.parallelStream().filter(Node.class::isInstance).map(Node.class::cast).filter(n -> n.hasKey(KEY))
.collect(Collectors.toList());
}
return Collections.emptyList();
return Geometry.filterInsideAnyPolygon(new ArrayList<>(prim.getDataSet().allNonDeletedPrimitives()), prim)
.parallelStream().filter(Node.class::isInstance).map(Node.class::cast).filter(n -> n.hasTag(KEY))
.collect(Collectors.toList());
}
/**