Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change RelateNG semantics so all EMPTY geometries are topologically equal #1089

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ public boolean evaluate(Geometry b, TopologyPredicate predicate) {

RelateGeometry geomB = new RelateGeometry(b, boundaryNodeRule);

if (geomA.isEmpty() && geomB.isEmpty()) {
//TODO: what if predicate is disjoint? Perhaps use result on disjoint envs?
return finishValue(predicate);
}
int dimA = geomA.getDimensionReal();
int dimB = geomB.getDimensionReal();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,20 @@ public static TopologyPredicate equalsTopo() {
@Override
public void init(int dimA, int dimB) {
super.init(dimA, dimB);
require(dimA == dimB);
//-- don't require equal dims, because EMPTY = EMPTY for all dims
}

@Override
public boolean requireInteraction() {
//-- allow EMPTY = EMPTY
return false;
};

@Override
public void init(Envelope envA, Envelope envB) {
//-- handle EMPTY = EMPTY cases
setValueIf(true, envA.isNull() && envB.isNull());

require(envA.equals(envB));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ public void testRepeatedPointAA() {
checkRelate(a, b, "212F01FF2");
}

//================ Repeated Points ==============
//================ EMPTY geometries ==============

public void testEmptyEquals() {
String empties[] = {
Expand All @@ -614,9 +614,8 @@ public void testEmptyEquals() {
for (int j = 0; j < nempty; j++) {
String a = empties[i];
String b = empties[j];
checkRelate(a, b, "FFFFFFFF2");
//-- currently in JTS empty geometries do NOT test equal
checkEquals(a, b, false);
///-- empty geometries are all topologically equal
checkEquals(a, b, true);
}
}
}
Expand Down
Loading