Changeset 30859 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Address.java
- Timestamp:
- 2014-12-19T17:12:01+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Address.java
r30737 r30859 43 43 44 44 import org.openstreetmap.josm.Main; 45 import org.openstreetmap.josm.actions.mapmode.MapMode; 45 46 import org.openstreetmap.josm.command.AddCommand; 46 47 import org.openstreetmap.josm.command.ChangeCommand; … … 48 49 import org.openstreetmap.josm.command.Command; 49 50 import org.openstreetmap.josm.command.SequenceCommand; 50 import org.openstreetmap.josm.actions.mapmode.MapMode;51 51 import org.openstreetmap.josm.data.coor.EastNorth; 52 52 import org.openstreetmap.josm.data.osm.Node; … … 65 65 public class Address extends MapMode implements MouseListener, MouseMotionListener, ActionListener { 66 66 private static final long serialVersionUID = 1L; 67 67 68 68 // perhaps make all these tags configurable in the future 69 69 private String tagHighway = "highway"; … … 76 76 private String relationAddrStreetRole = "street"; 77 77 private String relationMemberHouse = "house"; 78 78 79 79 private JRadioButton plus_one = new JRadioButton("+1", false); 80 80 private JRadioButton plus_two = new JRadioButton("+2", true); // enable this by default … … 93 93 94 94 public Address(MapFrame mapFrame) { 95 super(tr("Add address"), "buildings", 95 super(tr("Add address"), "buildings", 96 96 tr("Helping tool for tag address"), 97 97 Shortcut.registerShortcut("mapmode:cadastre-fr-buildings", tr("Mode: {0}", tr("CadastreFR - Buildings")), KeyEvent.VK_E, Shortcut.DIRECT), … … 153 153 try { 154 154 // add new address 155 Integer.parseInt(num); 155 Integer.parseInt(num); 156 156 inputNumber.setText(num); 157 157 applyInputNumberChange(); 158 158 } catch (NumberFormatException en) { 159 System.out.println("Unable to parse house number \"" + num + "\"");159 Main.warn("Unable to parse house number \"" + num + "\""); 160 160 } 161 161 } … … 202 202 setNewSelection(mouseOnExistingWays.get(0)); 203 203 } else if (mouseOnExistingWays.size() == 0) { 204 // clicked a non highway and not a node => add the new address 204 // clicked a non highway and not a node => add the new address 205 205 if (inputStreet.getText().equals("") || inputNumber.getText().equals("")) { 206 206 Toolkit.getDefaultToolkit().beep(); … … 221 221 222 222 } 223 223 224 224 private Way findWayInRelationAddr(Node n) { 225 225 List<OsmPrimitive> l = n.getReferrers(); … … 238 238 return null; 239 239 } 240 240 241 241 private void addAddrToPolygon(List<Way> mouseOnExistingBuildingWays, Collection<Command> cmds) { 242 242 for (Way w:mouseOnExistingBuildingWays) { … … 244 244 } 245 245 } 246 246 247 247 private void addAddrToPrimitive(OsmPrimitive osm, Collection<Command> cmds) { 248 248 // add the current tag addr:housenumber in node and member in relation (if so configured) … … 251 251 revertInputNumberChange(); 252 252 } catch (NumberFormatException en) { 253 System.out.println("Unable to parse house number \"" + inputNumber.getText() + "\"");253 Main.warn("Unable to parse house number \"" + inputNumber.getText() + "\""); 254 254 } 255 255 … … 263 263 setNewSelection(osm); 264 264 } catch (NumberFormatException en) { 265 System.out.println("Unable to parse house number \"" + inputNumber.getText() + "\"");266 } 267 } 268 265 Main.warn("Unable to parse house number \"" + inputNumber.getText() + "\""); 266 } 267 } 268 269 269 private Relation findRelationAddr(Way w) { 270 270 List<OsmPrimitive> l = w.getReferrers(); … … 276 276 return null; 277 277 } 278 278 279 279 private void addStreetNameOrRelation(OsmPrimitive osm, Collection<Command> cmds) { 280 280 if (Main.pref.getBoolean("cadastrewms.addr.dontUseRelation", false)) { … … 339 339 return n; 340 340 } 341 341 342 342 private static void adjustNode(Collection<Pair<Node,Node>> segs, Node n) { 343 343 … … 395 395 } 396 396 } 397 397 398 398 static double det(double a, double b, double c, double d) { 399 399 return a * d - b * c; … … 422 422 return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); 423 423 } 424 424 425 425 private void applyInputNumberChange() { 426 426 Integer num = Integer.parseInt(inputNumber.getText()); … … 435 435 inputNumber.setText(num.toString()); 436 436 } 437 437 438 438 private void revertInputNumberChange() { 439 439 Integer num = Integer.parseInt(inputNumber.getText()); … … 448 448 inputNumber.setText(num.toString()); 449 449 } 450 450 451 451 private void createDialog() { 452 452 ImageIcon iconLink = ImageProvider.get(null, "Mf_relation.png"); … … 466 466 clearButton = new JButton("Clear"); 467 467 clearButton.addActionListener(new ActionListener() { 468 public void actionPerformed(ActionEvent e) { 468 @Override 469 public void actionPerformed(ActionEvent e) { 469 470 inputNumber.setText(""); 470 471 inputStreet.setText(""); … … 491 492 p.add(plus_two, GBC.std().insets(0, 0, 10, 0)); 492 493 p.add(clearButton, GBC.eol().fill(GBC.HORIZONTAL).insets(0, 0, 0, 0)); 493 494 494 495 final Object[] options = {}; 495 496 final JOptionPane pane = new JOptionPane(p, … … 516 517 Main.map.selectMapMode((MapMode)Main.map.getDefaultButtonAction()); 517 518 } 518 public void windowClosed(WindowEvent e) {} 519 public void windowActivated(WindowEvent arg0) {} 520 public void windowDeactivated(WindowEvent arg0) {} 521 public void windowDeiconified(WindowEvent arg0) {} 522 public void windowIconified(WindowEvent arg0) {} 523 public void windowOpened(WindowEvent arg0) {} 519 @Override 520 public void windowClosed(WindowEvent e) {} 521 @Override 522 public void windowActivated(WindowEvent arg0) {} 523 @Override 524 public void windowDeactivated(WindowEvent arg0) {} 525 @Override 526 public void windowDeiconified(WindowEvent arg0) {} 527 @Override 528 public void windowIconified(WindowEvent arg0) {} 529 @Override 530 public void windowOpened(WindowEvent arg0) {} 524 531 }); 525 532 String bounds = Main.pref.get("cadastrewms.addr.bounds",null); … … 530 537 } 531 538 } 532 539 533 540 private void setSelectedWay(Way w) { 534 541 this.selectedWay = w; … … 539 546 link.repaint(); 540 547 } 541 548 542 549 private void setNewSelection(OsmPrimitive osm) { 543 550 Collection<OsmPrimitive> newSelection = new LinkedList<>(Main.main.getCurrentDataSet().getSelected());
Note:
See TracChangeset
for help on using the changeset viewer.