Changeset 10217 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2016-05-15T16:37:33+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 3 edited
-
MultiFetchServerObjectReader.java (modified) (2 diffs)
-
OsmServerWriter.java (modified) (10 diffs)
-
imagery/ImageryReader.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r10216 r10217 311 311 */ 312 312 protected void fetchPrimitives(Set<Long> ids, OsmPrimitiveType type, ProgressMonitor progressMonitor) throws OsmTransferException { 313 String msg = "";313 String msg; 314 314 final String baseUrl = getBaseUrl(); 315 315 switch (type) { … … 317 317 case WAY: msg = tr("Fetching a package of ways from ''{0}''", baseUrl); break; 318 318 case RELATION: msg = tr("Fetching a package of relations from ''{0}''", baseUrl); break; 319 default: throw new AssertionError(); 319 320 } 320 321 progressMonitor.setTicksCount(ids.size()); -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r10216 r10217 39 39 40 40 private static volatile List<OsmServerWritePostprocessor> postprocessors; 41 42 /** 43 * Registers a post-processor. 44 * @param pp post-processor to register 45 */ 41 46 public static void registerPostprocessor(OsmServerWritePostprocessor pp) { 42 47 if (postprocessors == null) { … … 46 51 } 47 52 53 /** 54 * Unregisters a post-processor. 55 * @param pp post-processor to unregister 56 */ 48 57 public static void unregisterPostprocessor(OsmServerWritePostprocessor pp) { 49 58 if (postprocessors != null) { … … 61 70 private long uploadStartTime; 62 71 63 p ublicString timeLeft(int progress, int listSize) {72 protected String timeLeft(int progress, int listSize) { 64 73 long now = System.currentTimeMillis(); 65 74 long elapsed = now - uploadStartTime; … … 93 102 uploadStartTime = System.currentTimeMillis(); 94 103 for (OsmPrimitive osm : primitives) { 95 int progress = progressMonitor.getTicks(); 96 String timeLeftStr = timeLeft(progress, primitives.size()); 97 String msg = ""; 104 String msg; 98 105 switch(OsmPrimitiveType.from(osm)) { 99 106 case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break; 100 107 case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break; 101 108 case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break; 109 default: throw new AssertionError(); 102 110 } 111 int progress = progressMonitor.getTicks(); 103 112 progressMonitor.subTask( 104 113 tr(msg, … … 106 115 progress, 107 116 primitives.size(), 108 timeLeftStr, 109 osm.getName() == null ? osm.getId() : osm.getName(), 110 osm.getId())); 117 timeLeft(progress, primitives.size()), 118 osm.getName() == null ? osm.getId() : osm.getName(), osm.getId())); 111 119 makeApiRequest(osm, progressMonitor); 112 120 processed.add(osm); … … 134 142 progressMonitor.beginTask(tr("Starting to upload in one request ...")); 135 143 processed.addAll(api.uploadDiff(primitives, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false))); 136 } catch (OsmTransferException e) {137 throw e;138 144 } finally { 139 145 progressMonitor.finishTask(); … … 151 157 */ 152 158 protected void uploadChangesInChunks(Collection<? extends OsmPrimitive> primitives, ProgressMonitor progressMonitor, int chunkSize) 153 throws OsmTransferException , IllegalArgumentException{159 throws OsmTransferException { 154 160 if (chunkSize <= 0) 155 161 throw new IllegalArgumentException(tr("Value >0 expected for parameter ''{0}'', got {1}", "chunkSize", chunkSize)); … … 176 182 processed.addAll(api.uploadDiff(chunk, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false))); 177 183 } 178 } catch (OsmTransferException e) {179 throw e;180 184 } finally { 181 185 progressMonitor.finishTask(); … … 223 227 break; 224 228 } 225 } catch (OsmTransferException e) {226 throw e;227 229 } finally { 228 230 executePostprocessors(monitor); … … 242 244 } 243 245 246 /** 247 * Cancel operation. 248 */ 244 249 public void cancel() { 245 250 this.canceled = true; -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r10216 r10217 54 54 } 55 55 56 /** 57 * Constructs a {@code ImageryReader} from a given filename, URL or internal resource. 58 * 59 * @param source can be:<ul> 60 * <li>relative or absolute file name</li> 61 * <li>{@code file:///SOME/FILE} the same as above</li> 62 * <li>{@code http://...} a URL. It will be cached on disk.</li> 63 * <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li> 64 * <li>{@code josmdir://SOME/FILE} file inside josm user data directory (since r7058)</li> 65 * <li>{@code josmplugindir://SOME/FILE} file inside josm plugin directory (since r7834)</li></ul> 66 */ 56 67 public ImageryReader(String source) { 57 68 this.source = source; 58 69 } 59 70 71 /** 72 * Parses imagery source. 73 * @return list of imagery info 74 * @throws SAXException if any SAX error occurs 75 * @throws IOException if any I/O error occurs 76 */ 60 77 public List<ImageryInfo> parse() throws SAXException, IOException { 61 78 Parser parser = new Parser(); … … 328 345 } 329 346 break; 347 default: // Do nothing 330 348 } 331 349 } … … 456 474 projections = null; 457 475 break; 458 /* nothing to do for these or the unknown type:459 476 case NO_TILE: 460 477 case NO_TILESUM: 461 478 case METADATA: 462 479 case UNKNOWN: 463 break;464 */480 default: 481 // nothing to do for these or the unknown type 465 482 } 466 483 }
Note:
See TracChangeset
for help on using the changeset viewer.
