findShell method
This method takes a list of MinimalEdgeRings derived from a MaximalEdgeRing, and tests whether they form a Polygon. This is the case if there is a single shell in the list. In this case the shell is returned. The other possibility is that they are a series of connected holes, in which case no shell is returned.
@return the shell EdgeRing, if there is one or null, if all the rings are holes
Implementation
EdgeRing? findShell(List minEdgeRings) {
int shellCount = 0;
EdgeRing? shell;
for (EdgeRing er in minEdgeRings) {
if (!er.isHole()) {
shell = er;
shellCount++;
}
}
Assert.isTrue(shellCount <= 1, "found two shells in MinimalEdgeRing list");
return shell;
}