Changeset 286 in josm
- Timestamp:
- 2007-07-11T23:05:56+02:00 (17 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/DownloadAction.java
r242 r286 47 47 dlg.setSize(dlg.getWidth(),600); 48 48 49 dlg.setVisible(true); 50 if (pane.getValue() instanceof Integer && (Integer)pane.getValue() == JOptionPane.OK_OPTION) { 51 Main.pref.put("download.tab", Integer.toString(dialog.getSelectedTab())); 52 for (DownloadTask task : dialog.downloadTasks) { 53 Main.pref.put("download."+task.getPreferencesSuffix(), task.getCheckBox().isSelected()); 54 if (task.getCheckBox().isSelected()) { 55 task.download(this, dialog.minlat, dialog.minlon, dialog.maxlat, dialog.maxlon); 56 } 57 } 58 } 49 boolean finish = false; 50 while (!finish) { 51 dlg.setVisible(true); 52 if (pane.getValue() instanceof Integer && (Integer)pane.getValue() == JOptionPane.OK_OPTION) { 53 Main.pref.put("download.tab", Integer.toString(dialog.getSelectedTab())); 54 for (DownloadTask task : dialog.downloadTasks) { 55 Main.pref.put("download."+task.getPreferencesSuffix(), task.getCheckBox().isSelected()); 56 if (task.getCheckBox().isSelected()) { 57 task.download(this, dialog.minlat, dialog.minlon, dialog.maxlat, dialog.maxlon); 58 finish = true; 59 } 60 } 61 } else 62 finish = true; 63 if (!finish) 64 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least one task to download")); 65 } 59 66 } 60 67 } -
src/org/openstreetmap/josm/actions/OpenAction.java
r247 r286 19 19 import org.openstreetmap.josm.Main; 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 import org.openstreetmap.josm.data.osm.DataSource;22 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 23 22 import org.openstreetmap.josm.gui.layer.RawGpsLayer; … … 87 86 if (ExtensionFileFilter.filters[ExtensionFileFilter.OSM].acceptName(fn)) { 88 87 dataSet = OsmReader.parseDataSet(new FileInputStream(file), null, Main.pleaseWaitDlg); 89 DataSource src = new DataSource();90 src.sourceSpec = "File " + fn;91 dataSet.dataSources.add(src);92 88 } else if (ExtensionFileFilter.filters[ExtensionFileFilter.CSV].acceptName(fn)) { 93 89 JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("CSV Data import for non-GPS data is not implemented yet.")); -
src/org/openstreetmap/josm/data/osm/DataSource.java
r247 r286 4 4 5 5 public class DataSource { 6 7 public Bounds sourceBounds; 8 public String sourceSpec; 9 6 public Bounds bounds; 7 public String origin; 10 8 } -
src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r242 r286 65 65 public JTabbedPane tabpane = new JTabbedPane(); 66 66 67 public DownloadDialog(int tabindex) 68 { 67 public DownloadDialog(int tabindex) { 69 68 setLayout(new GridBagLayout()); 70 69 -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r276 r286 148 148 // of drawing the outline, the outlying areas should perhaps be shaded. 149 149 for (DataSource src : data.dataSources) { 150 if (src. sourceBounds != null) {151 EastNorth en1 = Main.proj.latlon2eastNorth(src. sourceBounds.min);152 EastNorth en2 = Main.proj.latlon2eastNorth(src. sourceBounds.max);150 if (src.bounds != null) { 151 EastNorth en1 = Main.proj.latlon2eastNorth(src.bounds.min); 152 EastNorth en2 = Main.proj.latlon2eastNorth(src.bounds.max); 153 153 Point p1 = mv.getPoint(en1); 154 154 Point p2 = mv.getPoint(en2); -
src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r269 r286 103 103 final DataSet data = OsmReader.parseDataSet(in, null, Main.pleaseWaitDlg); 104 104 DataSource src = new DataSource(); 105 src. sourceSpec = "Server";106 src. sourceBounds = new Bounds(new LatLon(lat1, lon1), new LatLon(lat2, lon2));105 src.origin = Main.pref.get("osm-server.url")+"/"+Main.pref.get("osm-server.version", "0.4"); 106 src.bounds = new Bounds(new LatLon(lat1, lon1), new LatLon(lat2, lon2)); 107 107 data.dataSources.add(src); 108 108 in.close(); -
src/org/openstreetmap/josm/io/OsmReader.java
r283 r286 16 16 17 17 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.data.Bounds; 18 19 import org.openstreetmap.josm.data.coor.LatLon; 19 20 import org.openstreetmap.josm.data.osm.DataSet; 21 import org.openstreetmap.josm.data.osm.DataSource; 20 22 import org.openstreetmap.josm.data.osm.Node; 21 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 67 69 private Map<Long, Node> nodes = new HashMap<Long, Node>(); 68 70 71 // TODO: What the hack? Is this really from me? Please, clean this up! 69 72 private static class OsmPrimitiveData extends OsmPrimitive { 70 73 @Override public void visit(Visitor visitor) {} … … 112 115 if (!allowedVersions.contains(atts.getValue("version"))) 113 116 throw new SAXException(tr("Unknown version")+": "+atts.getValue("version")); 117 } else if (qName.equals("bound")) { 118 String bbox = atts.getValue("box"); 119 String origin = atts.getValue("origin"); 120 if (bbox != null) { 121 DataSource src = new DataSource(); 122 String[] b = bbox.split(","); 123 if (b.length == 4) 124 src.bounds = new Bounds( 125 new LatLon(Double.parseDouble(b[0]),Double.parseDouble(b[1])), 126 new LatLon(Double.parseDouble(b[2]),Double.parseDouble(b[3]))); 127 if (origin != null) 128 src.origin = origin; 129 ds.dataSources.add(src); 130 } 114 131 } else if (qName.equals("node")) { 115 132 current = new Node(new LatLon(getDouble(atts, "lat"), getDouble(atts, "lon"))); -
src/org/openstreetmap/josm/io/OsmWriter.java
r227 r286 7 7 import org.openstreetmap.josm.Main; 8 8 import org.openstreetmap.josm.data.osm.DataSet; 9 import org.openstreetmap.josm.data.osm.DataSource; 9 10 import org.openstreetmap.josm.data.osm.Node; 10 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 77 78 private boolean shouldWrite(OsmPrimitive osm) { 78 79 return osm.id != 0 || !osm.deleted; 80 } 81 82 @Override public void header(PrintWriter out) { 83 super.header(out); 84 for (DataSource s : ds.dataSources) { 85 out.print(" <bound box='"+ 86 s.bounds.min.lat()+","+ 87 s.bounds.min.lon()+","+ 88 s.bounds.max.lat()+","+ 89 s.bounds.max.lon()+"' "); 90 out.println("origin='"+XmlWriter.encode(s.origin)+"' />"); 91 } 79 92 } 80 93 }
Note:
See TracChangeset
for help on using the changeset viewer.