Changeset 1146 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-12-19T14:43:36+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1138 r1146 484 484 if (s.startsWith("file:")) { 485 485 try { 486 main.menu.open .openFile(new File(new URI(s)));486 main.menu.openFile.openFile(new File(new URI(s))); 487 487 } catch (URISyntaxException e) { 488 488 JOptionPane.showMessageDialog(Main.parent, tr("Ignoring malformed file url: \"{0}\"", s)); … … 501 501 } 502 502 503 main.menu.open .openFile(new File(s));503 main.menu.openFile.openFile(new File(s)); 504 504 } 505 505 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r1082 r1146 16 16 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 17 17 import org.openstreetmap.josm.io.BoundingBoxDownloader; 18 import org.openstreetmap.josm.io.OsmServerLocationReader; 19 import org.openstreetmap.josm.io.OsmServerReader; 18 20 import org.openstreetmap.josm.data.Bounds; 19 21 import org.openstreetmap.josm.data.coor.LatLon; … … 30 32 31 33 private static class Task extends PleaseWaitRunnable { 32 private BoundingBoxDownloader reader;34 private OsmServerReader reader; 33 35 private DataSet dataSet; 34 36 private boolean newLayer; 35 37 36 public Task(boolean newLayer, BoundingBoxDownloader reader) {38 public Task(boolean newLayer, OsmServerReader reader) { 37 39 super(tr("Downloading data")); 38 40 this.reader = reader; … … 83 85 Main.worker.execute(task); 84 86 } 87 88 public void loadUrl(boolean new_layer, String url) { 89 Task task = new Task(new_layer, new OsmServerLocationReader(url)); 90 Main.worker.execute(task); 91 } 92 93 94 85 95 86 96 public JCheckBox getCheckBox() { -
trunk/src/org/openstreetmap/josm/gui/MainApplet.java
r1084 r1146 108 108 m.remove(m.fileMenu); 109 109 m.editMenu.add(new UploadPreferencesAction()); 110 m.open .setEnabled(false);110 m.openFile.setEnabled(false); 111 111 m.exit.setEnabled(false); 112 112 m.save.setEnabled(false); -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r1130 r1146 20 20 import org.openstreetmap.josm.actions.AlignInCircleAction; 21 21 import org.openstreetmap.josm.actions.AlignInLineAction; 22 import org.openstreetmap.josm.actions.OpenLocationAction; 22 23 import org.openstreetmap.josm.actions.OrthogonalizeAction; 23 24 import org.openstreetmap.josm.actions.AutoScaleAction; … … 36 37 import org.openstreetmap.josm.actions.MergeNodesAction; 37 38 import org.openstreetmap.josm.actions.NewAction; 38 import org.openstreetmap.josm.actions.Open Action;39 import org.openstreetmap.josm.actions.OpenFileAction; 39 40 import org.openstreetmap.josm.actions.PasteAction; 40 41 import org.openstreetmap.josm.actions.PasteTagsAction; … … 76 77 /* File menu */ 77 78 public final NewAction newAction = new NewAction(); 78 public final OpenAction open = new OpenAction(); 79 public final OpenFileAction openFile = new OpenFileAction(); 80 public final OpenLocationAction openLocation = new OpenLocationAction(); 79 81 public final JosmAction save = new SaveAction(null); 80 82 public final JosmAction saveAs = new SaveAsAction(null); … … 167 169 168 170 add(fileMenu, newAction); 169 add(fileMenu, open); 171 add(fileMenu, openFile); 172 add(fileMenu, openLocation); 170 173 fileMenu.addSeparator(); 171 174 add(fileMenu, save); -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java
r1113 r1146 539 539 } 540 540 if (download) { 541 OsmServerObjectReader reader = new OsmServerObjectReader( );541 OsmServerObjectReader reader = new OsmServerObjectReader(clone.id, OsmServerObjectReader.TYPE_REL, true); 542 542 try { 543 DataSet dataSet = reader.parseOsm(clone.id, 544 OsmServerObjectReader.TYPE_REL, true); 543 DataSet dataSet = reader.parseOsm(); 545 544 if (dataSet != null) { 546 545 final MergeVisitor visitor = new MergeVisitor(Main.main -
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r1071 r1146 17 17 public final static String TYPE_NODE = "node"; 18 18 19 long id; 20 String type; 21 boolean full; 22 23 public OsmServerObjectReader(long id, String type, boolean full) { 24 this.id = id; 25 this.type = type; 26 this.full = full; 27 } 19 28 /** 20 29 * Method to download single objects from OSM server. ways, relations, nodes … … 26 35 * @throws IOException 27 36 */ 28 public DataSet parseOsm( long id, String type, boolean full) throws SAXException, IOException {37 public DataSet parseOsm() throws SAXException, IOException { 29 38 try { 30 31 39 Main.pleaseWaitDlg.progress.setValue(0); 32 40 Main.pleaseWaitDlg.currentAction.setText(tr("Contacting OSM Server...")); -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r1071 r1146 13 13 14 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.data.osm.DataSet; 15 16 import org.openstreetmap.josm.gui.PleaseWaitDialog; 17 import org.xml.sax.SAXException; 16 18 17 19 /** … … 24 26 * @author imi 25 27 */ 26 abstract class OsmServerReader extends OsmConnection {28 public abstract class OsmServerReader extends OsmConnection { 27 29 /** 28 30 * Open a connection to the given url and return a reader on the input stream … … 35 37 String version = Main.pref.get("osm-server.version", "0.5"); 36 38 urlStr = Main.pref.get("osm-server.url")+"/"+version+"/" + urlStr; 39 return getInputStreamRaw(urlStr, pleaseWaitDlg); 40 } 41 42 protected InputStream getInputStreamRaw(String urlStr, PleaseWaitDialog pleaseWaitDlg) throws IOException { 43 37 44 System.out.println("download: "+urlStr); 38 45 initAuthentication(); … … 50 57 if (isAuthCancelled() && activeConnection.getResponseCode() == 401) 51 58 return null; 52 if ( activeConnection.getResponseCode() == 500)59 if (activeConnection.getResponseCode() == 500) 53 60 { 54 61 throw new IOException(tr("Server returned internal error. Try a reduced area or retry after waiting some time.")); … … 66 73 return inputStream; 67 74 } 75 76 public abstract DataSet parseOsm() throws SAXException, IOException; 77 68 78 }
Note:
See TracChangeset
for help on using the changeset viewer.