source: josm/src/org/openstreetmap/josm/io/OsmWriter.java@ 22

Last change on this file since 22 was 22, checked in by imi, 18 years ago

starting restructure of dataset. Checkpoint is broken!

File size: 1.3 KB
Line 
1package org.openstreetmap.josm.io;
2
3import java.io.IOException;
4import java.util.Collection;
5import java.util.LinkedList;
6
7import javax.swing.JOptionPane;
8
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.command.Command;
11import org.openstreetmap.josm.data.osm.OsmPrimitive;
12
13
14/**
15 * Send back the modified data to the osm server.
16 * @author imi
17 */
18public class OsmWriter extends OsmConnection {
19
20 /**
21 * The server base url to handle the osm requests.
22 */
23 private final String server;
24 /**
25 * The commands that should be uploaded on the server.
26 */
27 private final Collection<Command> commands;
28
29 public OsmWriter(String server, Collection<Command> commands) {
30 this.server = server;
31 this.commands = commands;
32 }
33
34 /**
35 * Upload the commands to the server.
36 * @throws IOException
37 */
38 public void output() throws IOException {
39 Collection<OsmPrimitive> added = new LinkedList<OsmPrimitive>();
40 Collection<OsmPrimitive> modified = new LinkedList<OsmPrimitive>();
41 Collection<OsmPrimitive> deleted = new LinkedList<OsmPrimitive>();
42 for (Command c : commands)
43 c.fillModifiedData(modified, deleted, added);
44 int answer = JOptionPane.showConfirmDialog(Main.main, "Send "+added.size()+" new, "
45 +modified.size()+" modified and "+deleted.size()+" deleted objects to server?");
46 if (answer != JOptionPane.YES_OPTION)
47 return;
48 }
49}
Note: See TracBrowser for help on using the repository browser.