use of com.revolsys.geometry.model.Location in project com.revolsys.open by revolsys.
the class EdgeEndBundle method computeLabelOn.
/**
* Compute the overall ON location for the list of EdgeStubs.
* (This is essentially equivalent to computing the self-overlay of a single Geometry)
* edgeStubs can be either on the boundary (eg Polygon edge)
* OR in the interior (e.g. segment of a LineString)
* of their parent Geometry.
* In addition, GeometryCollections use a {@link BoundaryNodeRule} to determine
* whether a segment is on the boundary or not.
* Finally, in GeometryCollections it can occur that an edge is both
* on the boundary and in the interior (e.g. a LineString segment lying on
* top of a Polygon edge.) In this case the Boundary is given precendence.
* <br>
* These observations result in the following rules for computing the ON location:
* <ul>
* <li> if there are an odd number of Bdy edges, the attribute is Bdy
* <li> if there are an even number >= 2 of Bdy edges, the attribute is Int
* <li> if there are any Int edges, the attribute is Int
* <li> otherwise, the attribute is NULL.
* </ul>
*/
private void computeLabelOn(final int geomIndex, final BoundaryNodeRule boundaryNodeRule) {
// compute the ON location value
int boundaryCount = 0;
boolean foundInterior = false;
for (final EdgeEnd e : this) {
final Location loc = e.getLabel().getLocation(geomIndex);
if (loc == Location.BOUNDARY) {
boundaryCount++;
}
if (loc == Location.INTERIOR) {
foundInterior = true;
}
}
Location loc = Location.NONE;
if (foundInterior) {
loc = Location.INTERIOR;
}
if (boundaryCount > 0) {
loc = GeometryGraph.determineBoundary(boundaryNodeRule, boundaryCount);
}
getLabel().setLocation(geomIndex, loc);
}
Aggregations