Changeset 29303 in osm for applications
- Timestamp:
- 2013-03-02T09:30:54+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/FastDraw
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FastDraw/build.xml
r29263 r29303 30 30 <project name="FastDraw" default="dist" basedir="."> 31 31 <!-- enter the SVN commit message --> 32 <property name="commit.message" value="JOSM/FastDraw: a dd option (Q) to draw closed polygons"/>32 <property name="commit.message" value="JOSM/FastDraw: allow automatic tag adding (Q) "/> 33 33 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 34 <property name="plugin.main.version" value="5 035"/>34 <property name="plugin.main.version" value="5738"/> 35 35 <!-- 36 36 ************************************************ -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java
r29263 r29303 37 37 public int simplifyMode; 38 38 public float lineWidth; 39 public String autoTags; 39 40 40 41 public void loadPrefs() { … … 59 60 simplifyMode = Main.pref.getInteger("fastdraw.simplifymode", 0); 60 61 lineWidth = (float) Main.pref.getDouble("fastdraw.linewidth", 2); 62 autoTags = Main.pref.get("fastdraw.autotags"); 61 63 } 62 64 … … 82 84 Main.pref.putInteger("fastdraw.simplifymode", simplifyMode); 83 85 Main.pref.putDouble("fastdraw.linewidth",(double)lineWidth); 86 Main.pref.put("fastdraw.autotags", autoTags); 84 87 try {Main.pref.save();} catch (IOException e) { 85 88 System.err.println(tr("Can not save preferences")); -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java
r29263 r29303 7 7 import java.awt.Component; 8 8 import java.awt.GridBagLayout; 9 import java.awt.event.ActionEvent; 9 10 import javax.swing.JOptionPane; 10 11 import org.openstreetmap.josm.tools.GBC; 11 12 import java.text.NumberFormat; 12 13 import java.text.ParseException; 14 import javax.swing.AbstractAction; 15 import javax.swing.JButton; 13 16 import org.openstreetmap.josm.Main; 14 17 import org.openstreetmap.josm.gui.ExtendedDialog; … … 18 21 import javax.swing.JPanel; 19 22 import javax.swing.JLabel; 23 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 24 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; 20 25 import static org.openstreetmap.josm.tools.I18n.tr; 26 import org.openstreetmap.josm.tools.ImageProvider; 27 import org.openstreetmap.josm.tools.TextTagParser; 28 import org.openstreetmap.josm.tools.Utils; 21 29 22 30 public class FastDrawConfigDialog extends ExtendedDialog { … … 32 40 JLabel label3=new JLabel(tr("Max points count per 1 km")); 33 41 JLabel label4=new JLabel(/* I18n: Combobox to select what a press to return key does */ tr("Enter key mode")); 42 JLabel label5=new JLabel(tr("Auto add tags")); 34 43 JFormattedTextField text1=new JFormattedTextField(NumberFormat.getInstance()); 35 44 JFormattedTextField text2=new JFormattedTextField(NumberFormat.getInstance()); … … 38 47 // tr("Autosimplify and save"),tr("Simplify and wait"),tr("Simplify and save"), 39 48 // tr("Save as is")}); 40 JComboBox combo1=new JComboBox(new String[]{tr("Autosimplify"),49 JComboBox<String> combo1=new JComboBox(new String[]{tr("Autosimplify"), 41 50 tr("Simplify with initial epsilon"),tr("Save as is")}); 42 51 JCheckBox snapCb=new JCheckBox(tr("Snap to nodes")); … … 44 53 JCheckBox fixedSpaceCb = new JCheckBox(tr("Add fixed points on spacebar")); 45 54 JCheckBox drawClosedCb = new JCheckBox(tr("Draw closed polygons only")); 55 final HistoryComboBox addTags = new HistoryComboBox(); 56 JButton pasteButton = new JButton(new AbstractAction(tr("Paste"), ImageProvider.get("apply")) { 57 @Override 58 public void actionPerformed(ActionEvent e) { 59 String s = Utils.getClipboardContent(); 60 if (TextTagParser.getValidatedTagsFromText(s)!=null) { 61 addTags.setText(s); 62 } 63 } 64 }); 65 pasteButton.setToolTipText(tr("Try copying tags from properties table")); 66 67 addTags.setPossibleItems(Main.pref.getCollection("fastdraw.tags-history")); 46 68 47 69 all.add(label1,GBC.std().insets(10,0,0,0)); … … 54 76 all.add(combo1, GBC.eop().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 55 77 78 all.add(label5,GBC.std().insets(10,0,0,0)); 79 all.add(pasteButton, GBC.eop().insets(0,0,0,5)); 80 81 all.add(addTags, GBC.eop().fill(GBC.HORIZONTAL).insets(10,0,5,10)); 82 56 83 all.add(snapCb,GBC.eop().insets(20,0,0,0)); 84 57 85 all.add(fixedClickCb,GBC.eop().insets(20,0,0,0)); 58 86 all.add(fixedSpaceCb,GBC.eop().insets(20,0,0,0)); 59 87 all.add(drawClosedCb,GBC.eop().insets(20,0,0,0)); 60 88 89 addTags.setText(settings.autoTags); 61 90 text1.setValue(settings.epsilonMult); 62 91 text2.setValue(settings.startingEps); … … 91 120 settings.drawClosed=drawClosedCb.isSelected(); 92 121 settings.simplifyMode=combo1.getSelectedIndex(); 122 settings.autoTags=addTags.getText(); 123 addTags.addCurrentItemToHistory(); 124 Main.pref.putCollection("fastdraw.tags-history", addTags.getHistory()); 93 125 settings.savePrefs(); 94 126 } catch (ParseException e) { -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r29263 r29303 51 51 import org.openstreetmap.josm.tools.ImageProvider; 52 52 import org.openstreetmap.josm.tools.Shortcut; 53 import org.openstreetmap.josm.tools.TextTagParser; 53 54 54 55 class FastDrawingMode extends MapMode implements MapViewPaintable, … … 610 611 } 611 612 } 613 if (!settings.autoTags.isEmpty()) { 614 Map<String, String> tags = TextTagParser.readTagsFromText(settings.autoTags); 615 for (String k: tags.keySet()) { 616 w.put(k, tags.get(k)); 617 } 618 } 612 619 if (delCmd!=null) { 613 620 List<Node> nodes = w.getNodes();
Note:
See TracChangeset
for help on using the changeset viewer.