use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class CompareProcessor method addOtherObject.
@Override
protected void addOtherObject(final Record record) {
final Geometry geometry = record.getGeometry();
if (geometry instanceof Point) {
boolean add = true;
if (this.cleanDuplicatePoints) {
final List<Record> objects = this.otherPointMap.getRecords(record);
if (!objects.isEmpty()) {
final Predicate<Record> filter = this.equalFilterFactory.apply(record);
add = !Predicates.matches(objects, filter);
}
if (add) {
this.otherPointMap.addRecord(record);
} else {
this.duplicateOtherStatistics.addCount(record);
}
}
} else if (geometry instanceof LineString) {
this.otherIndex.addRecord(record);
}
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class CompareProcessor method processPartialMatch.
private void processPartialMatch(final Record sourceObject) {
final Geometry sourceGeometry = sourceObject.getGeometry();
if (sourceGeometry instanceof LineString) {
final LineString sourceLine = (LineString) sourceGeometry;
final LineIntersectsFilter intersectsFilter = new LineIntersectsFilter(sourceLine);
final Predicate<Record> geometryFilter = new RecordGeometryFilter<>(intersectsFilter);
final Predicate<Record> equalFilter = this.equalFilterFactory.apply(sourceObject);
final Predicate<Record> filter = equalFilter.and(geometryFilter);
final List<Record> otherObjects = this.otherIndex.queryList(sourceGeometry, filter);
if (!otherObjects.isEmpty()) {
final LineMatchGraph<Record> graph = new LineMatchGraph<>(sourceObject, sourceLine);
for (final Record otherObject : otherObjects) {
final LineString otherLine = otherObject.getGeometry();
graph.add(otherLine);
}
final Lineal nonMatchedLines = graph.getNonMatchedLines(0);
if (nonMatchedLines.isEmpty()) {
removeObject(sourceObject);
} else {
removeObject(sourceObject);
if (nonMatchedLines.getGeometryCount() == 1 && nonMatchedLines.getGeometry(0).getLength() == 1) {
} else {
for (int j = 0; j < nonMatchedLines.getGeometryCount(); j++) {
final Geometry newGeometry = nonMatchedLines.getGeometry(j);
final Record newObject = Records.copy(sourceObject, newGeometry);
addSourceObject(newObject);
}
}
}
for (int i = 0; i < otherObjects.size(); i++) {
final Record otherObject = otherObjects.get(i);
final Lineal otherNonMatched = graph.getNonMatchedLines(i + 1, 0);
for (int j = 0; j < otherNonMatched.getGeometryCount(); j++) {
final Geometry newGeometry = otherNonMatched.getGeometry(j);
final Record newOtherObject = Records.copy(otherObject, newGeometry);
addOtherObject(newOtherObject);
}
removeOtherObject(otherObject);
}
}
}
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class ConverterProcess method process.
@Override
protected void process(final Channel<Record> in, final Channel<Record> out, final Record object) {
if (this.converter != null) {
final Record target = this.converter.convert(object);
out.write(target);
}
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class CopyProcess method copy.
protected Record copy(final Record object) {
Record targetObject;
if (this.recordDefinition == null) {
targetObject = object;
} else {
targetObject = new ArrayRecord(this.recordDefinition);
for (final String fieldName : this.recordDefinition.getFieldNames()) {
copyAttribute(object, fieldName, targetObject, fieldName);
}
if (this.attributeMap != null) {
for (final Entry<String, String> mapping : this.attributeMap.entrySet()) {
final String sourceFieldName = mapping.getKey();
final String targetFieldName = mapping.getValue();
copyAttribute(object, sourceFieldName, targetObject, targetFieldName);
}
}
}
return targetObject;
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class CopyProcess method process.
@Override
protected void process(final Channel<Record> in, final Channel<Record> out, final Record object) {
final Record targetObject = copy(object);
out.write(targetObject);
}
Aggregations