Esempio n. 1
0
 @Override
 protected void parseWays(List<Osmformat.Way> osmWays) {
   if (exception == null) {
     try {
       for (Osmformat.Way w : osmWays) {
         final Info info = w.getInfo();
         if (!info.hasVersion()) discourageUpload = true;
         final Way way = new Way(w.getId(), info.hasVersion() ? info.getVersion() : 1);
         setMetadata(way, info);
         Map<String, String> keys = new HashMap<>();
         for (int i = 0; i < w.getKeysCount(); i++) {
           keys.put(getStringById(w.getKeys(i)), getStringById(w.getVals(i)));
         }
         way.setKeys(keys);
         long previousId = 0; // Node ids are delta coded
         Collection<Long> nodeIds = new ArrayList<>();
         for (Long id : w.getRefsList()) {
           nodeIds.add(previousId += id);
         }
         ways.put(way.getUniqueId(), nodeIds);
         externalIdMap.put(way.getPrimitiveId(), way);
       }
     } catch (IllegalDataException e) {
       exception = e;
     }
   }
 }