Changeset 1772 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2009-07-12T13:11:06+02:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 6 edited
-
BoundingBoxDownloader.java (modified) (1 diff)
-
MultiFetchServerObjectReader.java (modified) (2 diffs)
-
OsmImporter.java (modified) (2 diffs)
-
OsmReader.java (modified) (8 diffs)
-
OsmServerLocationReader.java (modified) (1 diff)
-
OsmServerObjectReader.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r1670 r1772 101 101 return null; 102 102 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 103 final DataSet data = OsmReader.parseDataSet(in, null,Main.pleaseWaitDlg);103 final DataSet data = OsmReader.parseDataSet(in,Main.pleaseWaitDlg); 104 104 in.close(); 105 105 activeConnection = null; -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r1690 r1772 319 319 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 320 320 try { 321 final OsmReader osm = OsmReader.parseDataSetOsm(in, outputDataSet,Main.pleaseWaitDlg);321 final OsmReader osm = OsmReader.parseDataSetOsm(in, Main.pleaseWaitDlg); 322 322 skippedWayIds.addAll(osm.getSkippedWayIds()); 323 323 merge(osm.getDs()); … … 345 345 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 346 346 try { 347 final OsmReader osm = OsmReader.parseDataSetOsm(in, null,Main.pleaseWaitDlg);347 final OsmReader osm = OsmReader.parseDataSetOsm(in,Main.pleaseWaitDlg); 348 348 skippedWayIds.addAll(osm.getSkippedWayIds()); 349 349 merge(osm.getDs()); -
trunk/src/org/openstreetmap/josm/io/OsmImporter.java
r1696 r1772 46 46 47 47 protected void importData(InputStream in, File associatedFile) throws SAXException, IOException { 48 OsmReader osm = OsmReader.parseDataSetOsm(in, null,Main.pleaseWaitDlg);48 OsmReader osm = OsmReader.parseDataSetOsm(in,Main.pleaseWaitDlg); 49 49 DataSet dataSet = osm.getDs(); 50 50 OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile); … … 55 55 String notes = osm.getParseNotes(); 56 56 int j = 0; 57 for (int i = 0; i < 5; i++) 57 for (int i = 0; i < 5; i++) { 58 58 j = notes.indexOf('\n', j + 1); 59 } 59 60 j = j >= 0 ? j : notes.length(); 60 61 JOptionPane.showMessageDialog(Main.parent, notes.substring(0, j)); -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r1690 r1772 52 52 53 53 /** 54 * This is used as (readonly) source for finding missing references when not transferred in the55 * file.56 */57 private DataSet references;58 59 /**60 54 * The dataset to add parsed objects to. 61 55 */ … … 88 82 private Map<Long, Node> nodes = new HashMap<Long, Node>(); 89 83 84 85 /** 86 * constructor (for private use only) 87 * 88 * @see #parseDataSet(InputStream, DataSet, PleaseWaitDialog) 89 * @see #parseDataSetOsm(InputStream, DataSet, PleaseWaitDialog) 90 */ 91 private OsmReader() { 92 } 90 93 91 94 private static class OsmPrimitiveData { … … 342 345 if (n != null) 343 346 return n; 344 for (Node node : references.nodes)345 if (node.id == id)346 return node;347 // TODO: This has to be changed to support multiple layers.348 for (Node node : Main.ds.nodes)349 if (node.id == id)350 return new Node(node);351 347 return null; 352 348 } … … 382 378 /** 383 379 * Return the Way object with the given id, or null if it doesn't 384 * exist yet. This method only looks at ways stored in the data set. 380 * exist yet. This method only looks at ways stored in the already parsed 381 * ways. 385 382 * 386 383 * @param id … … 388 385 */ 389 386 private Way findWay(long id) { 390 for (Way w y : Main.ds.ways)391 if (wy.id == id) 392 return wy; 387 for (Way way : ds.ways) 388 if (way.id == id) 389 return way; 393 390 return null; 394 391 } … … 396 393 /** 397 394 * Return the Relation object with the given id, or null if it doesn't 398 * exist yet. This method only looks at relations stored in the data set. 395 * exist yet. This method only looks at relations in the already parsed 396 * relations. 399 397 * 400 398 * @param id … … 403 401 private Relation findRelation(long id) { 404 402 for (Relation e : ds.relations) 405 if (e.id == id)406 return e;407 for (Relation e : Main.ds.relations)408 403 if (e.id == id) 409 404 return e; … … 476 471 * element found there is returned. 477 472 */ 478 public static DataSet parseDataSet(InputStream source, DataSet ref,PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException {479 return parseDataSetOsm(source, ref,pleaseWaitDlg).ds;480 } 481 482 public static OsmReader parseDataSetOsm(InputStream source, DataSet ref,PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException {473 public static DataSet parseDataSet(InputStream source, PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException { 474 return parseDataSetOsm(source, pleaseWaitDlg).ds; 475 } 476 477 public static OsmReader parseDataSetOsm(InputStream source,PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException { 483 478 OsmReader osm = new OsmReader(); 484 osm.references = ref == null ? new DataSet() : ref;485 479 486 480 // phase 1: Parse nodes and read in raw ways -
trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java
r1670 r1772 32 32 return null; 33 33 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 34 final DataSet data = OsmReader.parseDataSet(in, null,Main.pleaseWaitDlg);34 final DataSet data = OsmReader.parseDataSet(in, Main.pleaseWaitDlg); 35 35 in.close(); 36 36 activeConnection = null; -
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r1670 r1772 48 48 return null; 49 49 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 50 final OsmReader osm = OsmReader.parseDataSetOsm(in, null,Main.pleaseWaitDlg);50 final OsmReader osm = OsmReader.parseDataSetOsm(in,Main.pleaseWaitDlg); 51 51 final DataSet data = osm.getDs(); 52 52
Note:
See TracChangeset
for help on using the changeset viewer.
