Porównaj commity

...

3 Commity

Autor SHA1 Wiadomość Data
dependabot[bot] 6f6a4dd6ed
Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.2 to 3.2.3 (#867)
Bumps [org.apache.maven.plugins:maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 3.2.2 to 3.2.3.
- [Release notes](https://github.com/apache/maven-gpg-plugin/releases)
- [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-3.2.2...maven-gpg-plugin-3.2.3)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-gpg-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-11 06:11:07 -04:00
dependabot[bot] 6b9c996df9
Bump org.apache.maven.plugins:maven-source-plugin from 3.3.0 to 3.3.1 (#865)
Bumps [org.apache.maven.plugins:maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.3.0 to 3.3.1.
- [Commits](https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-3.3.0...maven-source-plugin-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-source-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-10 07:13:03 -04:00
Michael Barry 978c64f0c6
Add polygon index intersection utility (#866) 2024-04-10 07:12:29 -04:00
3 zmienionych plików z 28 dodań i 4 usunięć

Wyświetl plik

@ -57,11 +57,29 @@ public class PolygonIndex<T> {
return postFilterContaining(point, items);
}
/** Returns the data associated with all polygons containing {@code point}. */
public List<T> getIntersecting(Geometry geom) {
build();
List<?> items = index.query(geom.getEnvelopeInternal());
return postFilterIntersecting(geom, items);
}
private List<T> postFilterContaining(Point point, List<?> items) {
List<T> result = new ArrayList<>(items.size());
for (Object item : items) {
if (item instanceof GeomWithData<?> value && value.poly.contains(point)) {
@SuppressWarnings("unchecked") T t = (T) value.data;
if (item instanceof GeomWithData<?>(var poly,var data) && poly.contains(point)) {
@SuppressWarnings("unchecked") T t = (T) data;
result.add(t);
}
}
return result;
}
private List<T> postFilterIntersecting(Geometry geom, List<?> items) {
List<T> result = new ArrayList<>(items.size());
for (Object item : items) {
if (item instanceof GeomWithData<?>(var poly,var data) && poly.intersects(geom)) {
@SuppressWarnings("unchecked") T t = (T) data;
result.add(t);
}
}

Wyświetl plik

@ -21,10 +21,13 @@ class PolygonIndexTest {
void testSingle() {
index.put(rectangle(0, 1), 1);
assertListsContainSameElements(List.of(1), index.getContaining(newPoint(0.5, 0.5)));
assertListsContainSameElements(List.of(1), index.getIntersecting(newPoint(0.5, 0.5)));
assertListsContainSameElements(List.of(1), index.getIntersecting(rectangle(1, 2)));
assertListsContainSameElements(List.of(1), index.getContainingOrNearest(newPoint(0.5, 0.5)));
assertListsContainSameElements(List.of(), index.getContaining(newPoint(1.5, 1.5)));
assertListsContainSameElements(List.of(), index.getContainingOrNearest(newPoint(1.5, 1.5)));
assertListsContainSameElements(List.of(), index.getIntersecting(rectangle(2, 3)));
}
@Test
@ -33,6 +36,9 @@ class PolygonIndexTest {
index.put(rectangle(0, 1), 2);
assertListsContainSameElements(List.of(1, 2), index.getContaining(newPoint(0.5, 0.5)));
assertListsContainSameElements(List.of(1, 2), index.getContainingOrNearest(newPoint(0.5, 0.5)));
assertListsContainSameElements(List.of(1, 2), index.getIntersecting(rectangle(0.5, 1.5)));
assertListsContainSameElements(List.of(1, 2), index.getIntersecting(rectangle(1, 2)));
assertListsContainSameElements(List.of(), index.getIntersecting(rectangle(2, 3)));
}
@Test

Wyświetl plik

@ -313,7 +313,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
@ -394,7 +394,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.2</version>
<version>3.2.3</version>
<executions>
<execution>
<id>sign-artifacts</id>