Changeset 17590 in osm for applications
- Timestamp:
- 2009-09-12T15:17:27+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPreferences.java
r16589 r17590 25 25 { 26 26 private JCheckBox permissionLoadData = new JCheckBox(tr("load data from API")); 27 private JCheckBox permissionCreateObjects = new JCheckBox(tr("create new objects")); 27 28 private JCheckBox permissionChangeSelection = new JCheckBox(tr("change the selection")); 28 29 private JCheckBox permissionChangeViewport = new JCheckBox(tr("change the viewport")); … … 51 52 permissionChangeSelection.setSelected(Main.pref.getBoolean("remotecontrol.permission.change-selection", true)); 52 53 permissionChangeViewport.setSelected(Main.pref.getBoolean("remotecontrol.permission.change-viewport", true)); 54 permissionCreateObjects.setSelected(Main.pref.getBoolean("remotecontrol.permission.create-objects", true)); 53 55 alwaysAskUserConfirm.setSelected(Main.pref.getBoolean("remotecontrol.always-confirm", false)); 54 56 … … 59 61 Main.pref.put("remotecontrol.permission.change-selection", permissionChangeSelection.isSelected()); 60 62 Main.pref.put("remotecontrol.permission.change-viewport", permissionChangeViewport.isSelected()); 63 Main.pref.put("remotecontrol.permission.create-objects", permissionCreateObjects.isSelected()); 61 64 Main.pref.put("remotecontrol.always-confirm", alwaysAskUserConfirm.isSelected()); 62 65 // FIXME confirm return value - really no restart needed? -
applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java
r17457 r17590 25 25 import org.openstreetmap.josm.actions.AutoScaleAction; 26 26 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 27 import org.openstreetmap.josm.command.AddCommand; 27 28 import org.openstreetmap.josm.data.Bounds; 28 29 import org.openstreetmap.josm.data.coor.LatLon; … … 216 217 }); 217 218 } 219 } else if (command.equals("/add_node")) { 220 if (!Main.pref.getBoolean("remotecontrol.permission.create-objects", true)) { 221 sendForbidden(out); 222 return; 223 } 224 if (Main.pref.getBoolean("remotecontrol.always-confirm", false)) { 225 if (JOptionPane.showConfirmDialog(Main.parent, 226 "<html>" + tr("Remote Control has been asked to create a new node.") + 227 "<br>" + tr("Do you want to allow this?"), 228 tr("Confirm Remote Control action"), 229 JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) { 230 sendForbidden(out); 231 return; 232 } 233 } 234 addNode(args, out); 218 235 } else if (command.equals("/import")) { 219 236 if (Main.pref.getBoolean("remotecontrol.always-confirm", false)) { … … 269 286 270 287 /** 288 * Adds a node, reacts to the GET /add_node?lon=...&lat=... request. 289 * @param args 290 * @param out 291 * @throws IOException 292 */ 293 private void addNode(HashMap<String, String> args, Writer out) throws IOException { 294 if(!args.containsKey("lat") || !args.containsKey("lon")) { 295 sendBadRequest(out); 296 return; 297 } 298 299 // Parse the arguments 300 double lat = Double.parseDouble(args.get("lat")); 301 double lon = Double.parseDouble(args.get("lon")); 302 System.out.println("Adding node at (" + lat + ", " + lon + ")"); 303 304 // Create a new node 305 LatLon ll = new LatLon(lat, lon); 306 Node nnew = new Node(ll); 307 308 // Now execute the commands to add this node. 309 Main.main.undoRedo.add(new AddCommand(nnew)); 310 Main.main.getCurrentDataSet().setSelected(nnew); 311 Main.map.mapView.repaint(); 312 313 } 314 315 /** 271 316 * Sends a 500 error: server error 272 317 * @param out The writer where the error is written
Note:
See TracChangeset
for help on using the changeset viewer.