use of net.osmand.osm.edit.EntityInfo in project Osmand by osmandapp.
the class UploadOpenstreetmapPointAsyncTask method doInBackground.
@Override
protected Map<OsmPoint, String> doInBackground(OsmPoint... points) {
Map<OsmPoint, String> loadErrorsMap = new HashMap<>();
boolean uploaded = false;
for (OsmPoint point : points) {
if (interruptUploading)
break;
if (point.getGroup() == OsmPoint.Group.POI) {
OpenstreetmapPoint p = (OpenstreetmapPoint) point;
EntityInfo entityInfo = null;
if (OsmPoint.Action.CREATE != p.getAction()) {
entityInfo = remotepoi.loadNode(p.getEntity());
}
Node n = remotepoi.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo, p.getComment(), false, null);
if (n != null) {
uploaded = true;
plugin.getDBPOI().deletePOI(p);
publishProgress(p);
}
loadErrorsMap.put(point, n != null ? null : "Unknown problem");
} else if (point.getGroup() == OsmPoint.Group.BUG) {
OsmNotesPoint p = (OsmNotesPoint) point;
String errorMessage = remotebug.commit(p, p.getText(), p.getAction(), loadAnonymous).warning;
if (errorMessage == null) {
plugin.getDBBug().deleteAllBugModifications(p);
publishProgress(p);
}
loadErrorsMap.put(point, errorMessage);
}
}
if (uploaded && closeChangeSet) {
remotepoi.closeChangeSet();
}
return loadErrorsMap;
}
Aggregations