use of io.jawg.osmcontributor.rest.dtos.osm.NodeDto in project osm-contributor by jawg.
the class PoiMapper method convertPoiToNodeDto.
/**
* @param poi the poi to convert
* @param changeSetId an optional changeSetId to be added to the created NodeDto
* @return the converted NodeDto
*/
public NodeDto convertPoiToNodeDto(Poi poi, String changeSetId) {
NodeDto nodeDto = new NodeDto();
nodeDto.setLat(poi.getLatitude());
nodeDto.setLon(poi.getLongitude());
nodeDto.setId(poi.getBackendId());
nodeDto.setChangeset(changeSetId);
if (poi.getVersion() != null) {
nodeDto.setVersion(Integer.parseInt(poi.getVersion()));
}
nodeDto.setTagsDtoList(poiTagMapper.convertFromPoiTag(poi.getTags()));
return nodeDto;
}
use of io.jawg.osmcontributor.rest.dtos.osm.NodeDto in project osm-contributor by jawg.
the class PoiLoader method loadAndSavePoisFromBackend.
private void loadAndSavePoisFromBackend(MapArea toLoadArea, boolean clean) {
loadingStatus = LOADING_FROM_SERVER;
publishProgress();
loadedElements = 0L;
nodeDtos.clear();
osmDtos = backend.getPoisDtosInBox(toLoadArea.getBox());
for (OsmDto osmDto : osmDtos) {
killIfNeeded();
if (osmDto != null) {
List<NodeDto> nodeDtoList = osmDto.getNodeDtoList();
if (nodeDtoList != null) {
nodeDtos.addAll(nodeDtoList);
}
List<WayDto> wayDtoList = osmDto.getWayDtoList();
if (wayDtoList != null) {
nodeDtos.addAll(wayDtoList);
}
}
}
osmDtos.clear();
loadingStatus = MAPPING_POIS;
totalsElements = nodeDtos.size();
if (clean) {
cleanArea(toLoadArea);
}
savePoisInDB();
}
Aggregations