Changeset 24243 in osm for applications/editors/josm/plugins
- Timestamp:
- 2010-11-15T16:08:46+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/buildings_tools
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/buildings_tools/.settings/org.eclipse.jdt.core.prefs
r23330 r24243 1 # Fri Sep 24 19:30:08 MSD20101 #Mon Nov 15 17:53:13 MSK 2010 2 2 eclipse.preferences.version=1 3 3 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -
applications/editors/josm/plugins/buildings_tools/.settings/org.eclipse.jdt.ui.prefs
r21801 r24243 1 # Sat Jun 19 21:24:56 MSD20101 #Mon Nov 15 17:59:59 MSK 2010 2 2 eclipse.preferences.version=1 3 3 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true 4 formatter_profile=_ BTProf4 formatter_profile=_My Profile 5 5 formatter_settings_version=11 6 6 sp_cleanup.add_default_serial_version_id=true … … 11 11 sp_cleanup.add_missing_nls_tags=false 12 12 sp_cleanup.add_missing_override_annotations=true 13 sp_cleanup.add_missing_override_annotations_interface_methods=true 13 14 sp_cleanup.add_serial_version_id=false 14 15 sp_cleanup.always_use_blocks=true … … 19 20 sp_cleanup.correct_indentation=false 20 21 sp_cleanup.format_source_code=true 21 sp_cleanup.format_source_code_changes_only= false22 sp_cleanup.format_source_code_changes_only=true 22 23 sp_cleanup.make_local_variable_final=false 23 24 sp_cleanup.make_parameters_final=false 24 25 sp_cleanup.make_private_fields_final=true 25 26 sp_cleanup.make_type_abstract_if_missing_method=false 26 sp_cleanup.make_variable_declarations_final= true27 sp_cleanup.make_variable_declarations_final=false 27 28 sp_cleanup.never_use_blocks=false 28 29 sp_cleanup.never_use_parentheses_in_expressions=true 29 sp_cleanup.on_save_use_additional_actions= false30 sp_cleanup.on_save_use_additional_actions=true 30 31 sp_cleanup.organize_imports=false 31 32 sp_cleanup.qualify_static_field_accesses_with_declaring_class=false … … 35 36 sp_cleanup.qualify_static_method_accesses_with_declaring_class=false 36 37 sp_cleanup.remove_private_constructors=true 37 sp_cleanup.remove_trailing_whitespaces= false38 sp_cleanup.remove_trailing_whitespaces=true 38 39 sp_cleanup.remove_trailing_whitespaces_all=true 39 40 sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java
r23190 r24243 4 4 5 5 import java.awt.Choice; 6 import java.awt.Component;7 import java.awt.GridBagLayout;8 import java.awt.Insets;9 6 import java.text.NumberFormat; 10 7 import java.text.ParseException; 11 8 12 9 import javax.swing.JTextField; 13 import javax.swing.JLabel;14 import javax.swing.JPanel;15 16 import org.openstreetmap.josm.Main;17 import org.openstreetmap.josm.gui.ExtendedDialog;18 import org.openstreetmap.josm.tools.GBC;19 10 20 11 @SuppressWarnings("serial") 21 public class AddressDialog extends ExtendedDialog {22 private static String lhousenum, lstreetname;12 public class AddressDialog extends MyDialog { 13 private static String lhousenum, lstreetname; 23 14 private static boolean inc = true; 24 15 private JTextField housenum = new JTextField(); … … 26 17 private Choice cincdec = new Choice(); 27 18 28 private JPanel panel = new JPanel(new GridBagLayout()); 29 private void addLabelled(String str, Component c) { 30 JLabel label = new JLabel(str); 31 panel.add(label, GBC.std()); 32 label.setLabelFor(c); 33 panel.add(c, GBC.eol().fill(GBC.HORIZONTAL)); 34 } 19 public AddressDialog() { 20 super(tr("Building address")); 35 21 36 public AddressDialog() { 37 super(Main.parent, tr("Building address"), 38 new String[] { tr("OK"), tr("Cancel") }, 39 true); 40 41 contentInsets = new Insets(15,15,5,15); 42 setButtonIcons(new String[] {"ok.png", "cancel.png" }); 43 44 addLabelled(tr("House number:"),housenum); 45 addLabelled(tr("Street Name:"),streetname); 22 addLabelled(tr("House number:"), housenum); 23 addLabelled(tr("Street Name:"), streetname); 46 24 housenum.setText(nextHouseNum()); 47 25 streetname.setText(lstreetname); … … 49 27 cincdec.add(tr("Increment")); 50 28 cincdec.add(tr("Decrement")); 51 cincdec.select(inc ?0:1);29 cincdec.select(inc ? 0 : 1); 52 30 addLabelled(tr("Numbers:"), cincdec); 53 31 54 32 setContent(panel); 55 33 setupDialog(); 56 setVisible(true);57 34 } 58 35 59 36 private static String nextHouseNum() { 60 if (lhousenum==null) return ""; 37 if (lhousenum == null) 38 return ""; 61 39 try { 62 40 Integer num = NumberFormat.getInstance().parse(lhousenum).intValue(); 63 if (inc) num=num+2; else num = num-2; 41 if (inc) 42 num = num + 2; 43 else 44 num = num - 2; 64 45 return num.toString(); 65 46 } catch (ParseException e) { … … 67 48 } 68 49 } 50 69 51 public void saveValues() { 70 52 lhousenum = housenum.getText(); … … 72 54 inc = cincdec.getSelectedIndex() == 0; 73 55 } 56 74 57 public String getHouseNum() { 75 58 return housenum.getText(); 76 59 } 60 77 61 public String getStreetName() { 78 62 return streetname.getText(); -
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AdvancedSettingsDialog.java
r23330 r24243 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.awt.GridBagLayout;6 import java.awt.Insets;7 5 import java.util.Map.Entry; 8 6 9 7 import javax.swing.JCheckBox; 10 8 import javax.swing.JLabel; 11 import javax.swing.JPanel;12 9 13 import org.openstreetmap.josm.Main;14 import org.openstreetmap.josm.gui.ExtendedDialog;15 10 import org.openstreetmap.josm.gui.tagging.TagEditorModel; 16 11 import org.openstreetmap.josm.gui.tagging.TagEditorPanel; 17 12 import org.openstreetmap.josm.tools.GBC; 18 13 19 public class AdvancedSettingsDialog extends ExtendedDialog {20 private TagEditorModel tagsModel = new TagEditorModel();14 public class AdvancedSettingsDialog extends MyDialog { 15 private final TagEditorModel tagsModel = new TagEditorModel(); 21 16 22 private JCheckBox cBigMode = new JCheckBox(tr("Big buildings mode"));23 private JCheckBox cSoftCur = new JCheckBox(tr("Rotate crosshair"));17 private final JCheckBox cBigMode = new JCheckBox(tr("Big buildings mode")); 18 private final JCheckBox cSoftCur = new JCheckBox(tr("Rotate crosshair")); 24 19 25 20 public AdvancedSettingsDialog() { 26 super(Main.parent, tr("Advanced settings"), 27 new String[] { tr("OK"), tr("Cancel") }, 28 true); 29 contentInsets = new Insets(15, 15, 5, 15); 30 setButtonIcons(new String[] { "ok.png", "cancel.png" }); 21 super(tr("Advanced settings")); 31 22 32 final JPanel panel = new JPanel(new GridBagLayout());33 23 panel.add(new JLabel(tr("Buildings tags:")), GBC.eol().fill(GBC.HORIZONTAL)); 34 24 … … 44 34 cSoftCur.setSelected(ToolSettings.isSoftCursor()); 45 35 46 setContent(panel);47 48 36 setupDialog(); 49 s etVisible(true);37 showDialog(); 50 38 } 51 39 -
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeDialog.java
r23190 r24243 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.awt.Component;6 import java.awt.GridBagLayout;7 import java.awt.Insets;8 5 import java.awt.event.ActionEvent; 9 6 import java.awt.event.ActionListener; … … 14 11 import javax.swing.JFormattedTextField; 15 12 import javax.swing.JCheckBox; 16 import javax.swing.JLabel;17 import javax.swing.JPanel;18 13 19 import org.openstreetmap.josm.Main;20 import org.openstreetmap.josm.gui.ExtendedDialog;21 14 import org.openstreetmap.josm.tools.GBC; 22 15 23 16 @SuppressWarnings("serial") 24 public class BuildingSizeDialog extends ExtendedDialog {17 public class BuildingSizeDialog extends MyDialog { 25 18 private JFormattedTextField twidth = new JFormattedTextField(NumberFormat.getInstance()); 26 19 private JFormattedTextField tlenstep = new JFormattedTextField(NumberFormat.getInstance()); … … 28 21 private JCheckBox cAutoSelect = new JCheckBox(tr("Auto-select building")); 29 22 30 static void addLabelled(JPanel panel, String str, Component c) { 31 JLabel label = new JLabel(str); 32 panel.add(label, GBC.std()); 33 label.setLabelFor(c); 34 panel.add(c, GBC.eol().fill(GBC.HORIZONTAL)); 35 } 23 public BuildingSizeDialog() { 24 super(tr("Set buildings size")); 36 25 37 public BuildingSizeDialog() { 38 super(Main.parent, tr("Set buildings size"), 39 new String[] { tr("OK"), tr("Cancel") }, 40 true); 41 contentInsets = new Insets(15, 15, 5, 15); 42 setButtonIcons(new String[] { "ok.png", "cancel.png" }); 43 44 final JPanel panel = new JPanel(new GridBagLayout()); 45 addLabelled(panel, tr("Buildings width:"), twidth); 46 addLabelled(panel, tr("Length step:"), tlenstep); 26 addLabelled(tr("Buildings width:"), twidth); 27 addLabelled(tr("Length step:"), tlenstep); 47 28 panel.add(caddr, GBC.eol().fill(GBC.HORIZONTAL)); 48 29 panel.add(cAutoSelect, GBC.eol().fill(GBC.HORIZONTAL)); … … 65 46 panel.add(bAdv, GBC.eol().insets(0, 5, 0, 0).anchor(GBC.EAST)); 66 47 67 setContent(panel);68 48 setupDialog(); 69 s etVisible(true);49 showDialog(); 70 50 } 71 51 -
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingsToolsPlugin.java
r23190 r24243 17 17 return proj.latlon2eastNorth(p); 18 18 } 19 19 20 public static LatLon eastNorth2latlon(EastNorth p) { 20 21 return proj.eastNorth2latlon(p); … … 26 27 MainMenu.add(Main.main.menu.editMenu, new BuildingSizeAction()); 27 28 } 28 @Override public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 29 if (oldFrame==null && newFrame!=null) { 29 30 @Override 31 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 32 if (oldFrame == null && newFrame != null) { 30 33 Main.map.addMapMode(new IconToggleButton(new DrawBuildingAction(Main.map))); 31 34 } -
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java
r23630 r24243 54 54 private Mode nextMode = Mode.None; 55 55 56 private Color selectedColor;56 private final Color selectedColor; 57 57 private Point drawStartPos; 58 58 private Point mousePos; 59 59 private boolean isCtrlDown; 60 60 private boolean isShiftDown; 61 private boolean isAltDown; 61 62 62 63 Building building = new Building(); … … 96 97 // We invoke this to prevent strange things from happening 97 98 EventQueue.invokeLater(new Runnable() { 99 @Override 98 100 public void run() { 99 101 // Don't change cursor when mode has changed already … … 108 110 } 109 111 110 private staticvoid showAddrDialog(Way w) {112 private void showAddrDialog(Way w) { 111 113 AddressDialog dlg = new AddressDialog(); 112 int answer = dlg.getValue(); 113 if (answer == 1) { 114 dlg.saveValues(); 115 String tmp; 116 tmp = dlg.getHouseNum(); 117 if (tmp != null && tmp != "") 118 w.put("addr:housenumber", tmp); 119 tmp = dlg.getStreetName(); 120 if (tmp != null && tmp != "") 121 w.put("addr:street", tmp); 122 } 114 if (!isAltDown) { 115 dlg.showDialog(); 116 if (dlg.getValue() != 1) 117 return; 118 } 119 dlg.saveValues(); 120 String tmp; 121 tmp = dlg.getHouseNum(); 122 if (tmp != null && tmp != "") 123 w.put("addr:housenumber", tmp); 124 tmp = dlg.getStreetName(); 125 if (tmp != null && tmp != "") 126 w.put("addr:street", tmp); 123 127 } 124 128 … … 169 173 } 170 174 175 @Override 171 176 public void eventDispatched(AWTEvent arg0) { 172 177 if (!(arg0 instanceof KeyEvent)) … … 184 189 Main.map.mapView.repaint(); 185 190 } 191 isAltDown = (modifiers & KeyEvent.ALT_DOWN_MASK) != 0; 186 192 187 193 if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) { … … 239 245 isCtrlDown = e.isControlDown(); 240 246 isShiftDown = e.isShiftDown(); 247 isAltDown = e.isAltDown(); 241 248 } 242 249 if (mode == Mode.None) { … … 255 262 } 256 263 264 @Override 257 265 public void paint(Graphics2D g, MapView mv, Bounds bbox) { 258 266 if (mode == Mode.None) … … 453 461 } 454 462 463 @Override 455 464 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 456 465 updateSnap(newSelection);
Note:
See TracChangeset
for help on using the changeset viewer.