target.cancel();
throw new OsmosisRuntimeException("Cancelled by user");
}
final EntityContainer entityContainer = container.getEntityContainer();
final Entity entity = entityContainer.getEntity();
final ChangeAction changeAction = container.getAction();
if (changeAction.equals(ChangeAction.Delete)) {
SimpleFeatureType ft = entity instanceof Node ? OSMUtils.nodeType() : OSMUtils
.wayType();
String id = Long.toString(entity.getId());
target.put(new FeatureToDelete(ft, id));
return;
}
if (changeAction.equals(ChangeAction.Modify)) {
// Check that the feature to modify exist. If so, we will just treat it as an
// addition, overwriting the previous feature
SimpleFeatureType ft = entity instanceof Node ? OSMUtils.nodeType() : OSMUtils
.wayType();
String path = ft.getName().getLocalPart();
Optional<org.locationtech.geogig.api.Node> opt = workTree.findUnstaged(path);
if (!opt.isPresent()) {
return;
}
}
if (++count % 10 == 0) {
progressListener.setProgress(count);
}
latestChangeset = Math.max(latestChangeset, entity.getChangesetId());
latestTimestamp = Math.max(latestTimestamp, entity.getTimestamp().getTime());
Geometry geom = null;
switch (entity.getType()) {
case Node:
nodeCount++;
geom = parsePoint((Node) entity);
break;
case Way:
wayCount++;
geom = parseLine((Way) entity);
break;
default:
return;
}
if (geom != null) {
System.err.printf("%s within %s? %s\n", geom, bbox, geom.within(bbox));
if (changeAction.equals(ChangeAction.Create) && geom.within(bbox)
|| changeAction.equals(ChangeAction.Modify)) {
Feature feature = converter.toFeature(entity, geom);
target.put(feature);
}
}
}