Search in sources :

Example 1 with LineEqualIgnoreDirectionFilter

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);
    }
}
Also used : RecordGeometryFilter(com.revolsys.record.filter.RecordGeometryFilter) LineString(com.revolsys.geometry.model.LineString) LineEqualIgnoreDirectionFilter(com.revolsys.geometry.filter.LineEqualIgnoreDirectionFilter) Record(com.revolsys.record.Record)

Example 2 with LineEqualIgnoreDirectionFilter

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);
    }
}
Also used : EdgeObjectFilter(com.revolsys.geometry.graph.filter.EdgeObjectFilter) LineEqualIgnoreDirectionFilter(com.revolsys.geometry.filter.LineEqualIgnoreDirectionFilter) LineString(com.revolsys.geometry.model.LineString) RecordGeometryFilter(com.revolsys.record.filter.RecordGeometryFilter) LineString(com.revolsys.geometry.model.LineString) Record(com.revolsys.record.Record) EdgeTypeNameFilter(com.revolsys.geometry.graph.filter.EdgeTypeNameFilter) Edge(com.revolsys.geometry.graph.Edge)

Aggregations

LineEqualIgnoreDirectionFilter (com.revolsys.geometry.filter.LineEqualIgnoreDirectionFilter)2 LineString (com.revolsys.geometry.model.LineString)2 Record (com.revolsys.record.Record)2 RecordGeometryFilter (com.revolsys.record.filter.RecordGeometryFilter)2 Edge (com.revolsys.geometry.graph.Edge)1 EdgeObjectFilter (com.revolsys.geometry.graph.filter.EdgeObjectFilter)1 EdgeTypeNameFilter (com.revolsys.geometry.graph.filter.EdgeTypeNameFilter)1