Changeset 343 in josm for trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
- Timestamp:
- 2007-10-07T13:20:27+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r298 r343 17 17 18 18 import org.openstreetmap.josm.Main; 19 import org.openstreetmap.josm.data.osm.Relation; 19 20 import org.openstreetmap.josm.data.osm.Node; 20 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 import org.openstreetmap.josm.data.osm.Segment;22 22 import org.openstreetmap.josm.data.osm.Way; 23 23 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; … … 96 96 97 97 /** 98 * Upload a segment (without the nodes). 99 */ 100 public void visit(Segment ls) { 101 if (ls.id == 0 && !ls.deleted && ls.get("created_by") == null) { 102 ls.put("created_by", "JOSM"); 103 sendRequest("PUT", "segment", ls, true); 104 } else if (ls.deleted) { 105 sendRequest("DELETE", "segment", ls, false); 106 } else { 107 sendRequest("PUT", "segment", ls, true); 108 } 109 processed.add(ls); 110 } 111 112 /** 113 * Upload a whole way with the complete segment id list. 98 * Upload a whole way with the complete node id list. 114 99 */ 115 100 public void visit(Way w) { … … 125 110 } 126 111 112 /** 113 * Upload an relation with all members. 114 */ 115 public void visit(Relation e) { 116 if (e.id == 0 && !e.deleted && e.get("created_by") == null) { 117 e.put("created_by", "JOSM"); 118 sendRequest("PUT", "relation", e, true); 119 } else if (e.deleted) { 120 sendRequest("DELETE", "relation", e, false); 121 } else { 122 sendRequest("PUT", "relation", e, true); 123 } 124 processed.add(e); 125 } 127 126 /** 128 127 * Read a long from the input stream and return it. … … 154 153 OsmPrimitive osm, boolean addBody) { 155 154 try { 156 String version = Main.pref.get("osm-server.version", "0. 4");155 String version = Main.pref.get("osm-server.version", "0.5"); 157 156 URL url = new URL( 158 157 Main.pref.get("osm-server.url") + 159 158 "/" + version + 160 159 "/" + urlSuffix + 161 "/" + ( (version.equals("0.4") && osm.id==0) ? "create":osm.id));160 "/" + (osm.id==0 ? "create" : osm.id)); 162 161 System.out.println("upload to: "+url); 163 162 activeConnection = (HttpURLConnection)url.openConnection();
Note:
See TracChangeset
for help on using the changeset viewer.