use of com.revolsys.geometry.filter.LineEqualIgnoreDirectionFilter in project com.revolsys.open by revolsys.
the class CompareProcessor method processExactLineMatch.
private void processExactLineMatch(final Record sourceObject) {
final LineString sourceLine = sourceObject.getGeometry();
final LineEqualIgnoreDirectionFilter lineEqualFilter = new LineEqualIgnoreDirectionFilter(sourceLine, 3);
final Predicate<Record> geometryFilter = new RecordGeometryFilter<>(lineEqualFilter);
final Predicate<Record> equalFilter = this.equalFilterFactory.apply(sourceObject);
final Predicate<Record> filter = equalFilter.and(geometryFilter);
final Record otherObject = this.otherIndex.queryFirst(sourceObject, filter);
if (otherObject != null) {
this.equalStatistics.addCount(sourceObject);
removeObject(sourceObject);
removeOtherObject(otherObject);
}
}
use of com.revolsys.geometry.filter.LineEqualIgnoreDirectionFilter in project com.revolsys.open by revolsys.
the class EqualTypeAndLineEdgeCleanupVisitor method accept.
@Override
public void accept(final Edge<Record> edge) {
if (edge.getProperty(EDGE_PROCESSED) == null) {
final String typePath = edge.getTypeName();
final Graph<Record> graph = edge.getGraph();
final LineString line = edge.getLineString();
Predicate<Edge<Record>> attributeAndGeometryFilter = new EdgeTypeNameFilter<>(typePath);
final Predicate<Edge<Record>> filter = getPredicate();
if (filter != null) {
attributeAndGeometryFilter = attributeAndGeometryFilter.and(filter);
}
final Predicate<Record> equalLineFilter = new RecordGeometryFilter<>(new LineEqualIgnoreDirectionFilter(line, 2));
final EdgeObjectFilter<Record> edgeFilter = new EdgeObjectFilter<>(equalLineFilter);
attributeAndGeometryFilter = attributeAndGeometryFilter.and(edgeFilter);
final List<Edge<Record>> equalEdges;
if (getComparator() == null) {
equalEdges = graph.getEdges(line, attributeAndGeometryFilter);
} else {
equalEdges = graph.getEdges(line, attributeAndGeometryFilter, getComparator());
}
processEqualEdges(equalEdges);
}
}
Aggregations