[josm-dev] further missing nodes patch
Russ Nelson
nelson at crynwr.com
Tue Feb 24 18:40:48 GMT 2009
A few improvements to my earlier missing nodes patch:
o Add a missing call to parseDataSetOsm
o Don't report *every* error, just the first five.
Index: src/org/openstreetmap/josm/io/OsmServerObjectReader.java
===================================================================
--- src/org/openstreetmap/josm/io/OsmServerObjectReader.java (revision 1442)
+++ src/org/openstreetmap/josm/io/OsmServerObjectReader.java (working copy)
@@ -10,6 +10,8 @@
import org.openstreetmap.josm.data.osm.DataSet;
import org.xml.sax.SAXException;
+import javax.swing.JOptionPane;
+
public class OsmServerObjectReader extends OsmServerReader {
public final static String TYPE_WAY = "way";
@@ -46,11 +48,16 @@
if (in == null)
return null;
Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data..."));
- final DataSet data = OsmReader.parseDataSet(in, null, Main.pleaseWaitDlg);
+ final OsmReader osm = OsmReader.parseDataSetOsm(in, null, Main.pleaseWaitDlg);
+ final DataSet data = osm.getDs();
+
// String origin = Main.pref.get("osm-server.url")+"/"+Main.pref.get("osm-server.version", "0.5");
// Bounds bounds = new Bounds(new LatLon(lat1, lon1), new LatLon(lat2, lon2));
// DataSource src = new DataSource(bounds, origin);
// data.dataSources.add(src);
+ if (osm.getParseNotes().length() != 0) {
+ JOptionPane.showMessageDialog(Main.parent, osm.getParseNotes());
+ }
in.close();
activeConnection = null;
return data;
Index: src/org/openstreetmap/josm/io/OsmReader.java
===================================================================
--- src/org/openstreetmap/josm/io/OsmReader.java (revision 1442)
+++ src/org/openstreetmap/josm/io/OsmReader.java (working copy)
@@ -74,6 +74,7 @@
* a newline-terminated string.
*/
private String parseNotes = new String();
+ private int parseNotesCount = 0;
public String getParseNotes() {
return parseNotes;
}
@@ -372,7 +373,12 @@
for (long id : e.getValue()) {
Node n = findNode(id);
if (n == null) {
- parseNotes += tr("Skipping a way because it includes a node that doesn''t exist: {0}\n", id);
+ /* don't report ALL of them, just a few */
+ if (parseNotesCount++ < 6) {
+ parseNotes += tr("Skipping a way because it includes a node that doesn''t exist: {0}\n", id);
+ } else if (parseNotesCount == 6) {
+ parseNotes += "...\n";
+ }
failed = true;
break;
}
More information about the josm-dev
mailing list