Ticket #18258: 18258.patch
| File 18258.patch, 3.3 KB (added by , 6 years ago) |
|---|
-
src/org/openstreetmap/josm/io/OsmReader.java
42 42 protected XMLStreamReader parser; 43 43 44 44 protected boolean convertUnknownToTags; 45 protected boolean saveOriginalId; 45 46 46 47 private static final Set<String> COMMON_XML_ATTRIBUTES = new TreeSet<>(); 47 48 … … 64 65 * @see #parseDataSet(InputStream, ProgressMonitor) 65 66 */ 66 67 protected OsmReader() { 67 this(false );68 this(false, false); 68 69 } 69 70 70 71 /** … … 75 76 * @since 15470 76 77 */ 77 78 protected OsmReader(boolean convertUnknownToTags) { 79 this(convertUnknownToTags, false); 78 80 // Restricts visibility 81 } 82 /** 83 * constructor (for private and subclasses use only) 84 * @param convertUnknownToTags if true, keep unknown xml attributes as tags 85 * @param saveOriginalId if true, save the original id in a "current_id" tag 86 * 87 * @see #parseDataSet(InputStream, ProgressMonitor) 88 * @since xxx 89 */ 90 protected OsmReader(boolean convertUnknownToTags, boolean saveOriginalId) { 91 // Restricts visibility 79 92 this.convertUnknownToTags = convertUnknownToTags; 80 93 } 81 94 … … 432 445 } 433 446 } 434 447 } 448 if (saveOriginalId) { 449 parseTag(current, "current_id", Long.toString(getLong("id"))); 450 } 435 451 } catch (UncheckedParseException | XMLStreamException e) { 436 452 throw new IllegalDataException(e); 437 453 } … … 496 512 * @throws IllegalArgumentException if source is null 497 513 */ 498 514 public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException { 499 return parseDataSet(source, progressMonitor, false );515 return parseDataSet(source, progressMonitor, false, false); 500 516 } 501 517 502 518 /** … … 513 529 */ 514 530 public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor, boolean convertUnknownToTags) 515 531 throws IllegalDataException { 516 return new OsmReader(convertUnknownToTags).doParseDataSet(source, progressMonitor);532 return parseDataSet(source, progressMonitor, convertUnknownToTags, false); 517 533 } 534 535 /** 536 * Parse the given input source and return the dataset. 537 * 538 * @param source the source input stream. Must not be null. 539 * @param progressMonitor the progress monitor. If null, {@link NullProgressMonitor#INSTANCE} is assumed 540 * @param convertUnknownToTags true if unknown xml attributes should be kept as tags 541 * @param saveOriginalId if true, keep the original id (as a tag, "current_id") 542 * 543 * @return the dataset with the parsed data 544 * @throws IllegalDataException if an error was found while parsing the data from the source 545 * @throws IllegalArgumentException if source is null 546 * @since xxx 547 */ 548 public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor, boolean convertUnknownToTags, boolean saveOriginalId) 549 throws IllegalDataException { 550 return new OsmReader(convertUnknownToTags, saveOriginalId).doParseDataSet(source, progressMonitor); 551 } 518 552 }
