Changeset 22188 in osm for applications/editors
- Timestamp:
- 2010-07-05T00:07:32+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Address.java
r22186 r22188 90 90 private Way selectedWay; 91 91 private Relation selectedRelation; 92 93 MapFrame mapFrame; 94 92 private boolean shift; 93 95 94 public Address(MapFrame mapFrame) { 96 95 super(tr("Add address"), "buildings", … … 98 97 Shortcut.registerShortcut("mapmode:buildings", tr("Mode: {0}", tr("Buildings")), KeyEvent.VK_E, Shortcut.GROUP_EDIT), 99 98 mapFrame, getCursor()); 100 this.mapFrame = mapFrame;101 99 } 102 100 … … 111 109 112 110 @Override public void exitMode() { 113 super.exitMode(); 114 Main.map.mapView.removeMouseListener(this); 111 if (Main.map.mapView != null) { 112 super.exitMode(); 113 Main.map.mapView.removeMouseListener(this); 114 } 115 115 dialog.setVisible(false); 116 116 } … … 120 120 if (e.getButton() != MouseEvent.BUTTON1) 121 121 return; 122 122 shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; 123 123 MapView mv = Main.map.mapView; 124 124 Point mousePos = e.getPoint(); … … 142 142 } 143 143 if (currentMouseNode.get(tagHouseStreet) != null) { 144 inputStreet.setText(currentMouseNode.get(tagHouse Number));144 inputStreet.setText(currentMouseNode.get(tagHouseStreet)); 145 145 setSelectedWay((Way)null); 146 146 } else { … … 203 203 private void addAddrToPolygon(List<Way> mouseOnExistingBuildingWays, Collection<Command> cmds) { 204 204 for (Way w:mouseOnExistingBuildingWays) { 205 cmds.add(new ChangePropertyCommand(w, tagHouseNumber, inputNumber.getText()));206 205 addAddrToPrimitive(w, cmds); 207 206 } … … 210 209 private void addAddrToPrimitive(OsmPrimitive osm, Collection<Command> cmds) { 211 210 // add the current tag addr:housenumber in node and member in relation 211 if (shift) { 212 try { 213 revertInputNumberChange(); 214 } catch (NumberFormatException en) { 215 System.out.println("Unable to parse house number \"" + inputNumber.getText() + "\""); 216 } 217 218 } 212 219 cmds.add(new ChangePropertyCommand(osm, tagHouseNumber, inputNumber.getText())); 213 220 if (Main.pref.getBoolean("cadastrewms.addr.dontUseRelation", false)) { … … 373 380 if (minus_two.isSelected() && num > 2) 374 381 num = num - 2; 382 inputNumber.setText(num.toString()); 383 } 384 385 private void revertInputNumberChange() { 386 Integer num = Integer.parseInt(inputNumber.getText()); 387 if (plus_one.isSelected()) 388 num = num - 1; 389 if (plus_two.isSelected()) 390 num = num - 2; 391 if (minus_one.isSelected() && num > 1) 392 num = num + 1; 393 if (minus_two.isSelected() && num > 2) 394 num = num + 2; 375 395 inputNumber.setText(num.toString()); 376 396 }
Note:
See TracChangeset
for help on using the changeset viewer.