- Timestamp:
- 2009-07-07T19:54:54+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/UTM.java
r1724 r1743 91 91 { 92 92 return Math.toRadians(-183.0 + (zone * 6.0)); 93 } 94 private double UTMCentralMeridianDeg(int zone) 95 { 96 return -183.0 + (zone * 6.0); 93 97 } 94 98 … … 324 328 325 329 public EastNorth latlon2eastNorth(LatLon p) { 326 EastNorth a = MapLatLonToXY(Math.toRadians(p.lat()), Math.toRadians(p.lon()), UTMCentralMeridian( 33));330 EastNorth a = MapLatLonToXY(Math.toRadians(p.lat()), Math.toRadians(p.lon()), UTMCentralMeridian(getzone())); 327 331 return new EastNorth(a.east() * UTMScaleFactor + 3500000.0, a.north() * UTMScaleFactor); 328 332 } 329 333 330 334 public LatLon eastNorth2latlon(EastNorth p) { 331 return MapXYToLatLon((p.east()-3500000.0)/UTMScaleFactor, p.north()/UTMScaleFactor, UTMCentralMeridian(33)); 335 return MapXYToLatLon((p.east()-3500000.0)/UTMScaleFactor, p.north()/UTMScaleFactor, UTMCentralMeridian(getzone())); 336 } 337 338 @Override public String toString() { 339 return tr("UTM Zone {0}", getzone()); 332 340 } 333 341 334 342 /* TODO - support all UTM's not only zone 33 */ 335 @Override public String toString() { 336 return tr("UTM Zone {0}", 33); 343 public int getzone() 344 { 345 return 33; 337 346 } 338 347 … … 354 363 { 355 364 return new Bounds( 356 new LatLon(- 90.0, 14.0),357 new LatLon( 90.0, 22.0));365 new LatLon(-85.0, UTMCentralMeridianDeg(getzone())-5.0), 366 new LatLon(85.0, UTMCentralMeridianDeg(getzone())+5.0)); 358 367 } 359 368 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
r1190 r1743 1 1 package org.openstreetmap.josm.gui.mappaint; 2 3 import java.util.Collection; 4 import java.util.Map; 5 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 import org.openstreetmap.josm.data.osm.OsmUtils; 2 8 3 9 abstract public class ElemStyle … … 9 15 public int priority; 10 16 public String code; 17 Collection<Rule> rules = null; 11 18 12 19 public Boolean equals(ElemStyle s) … … 14 21 return s != null && s.code.equals(code); 15 22 } 23 public boolean check(Map<String, String> keys) 24 { 25 if(rules == null) 26 return true; 27 for(Rule r : rules) 28 { 29 String k = keys.get(r.key); 30 String bv = OsmUtils.getNamedOsmBoolean(r.boolValue); 31 if(k == null || (r.value != null && !k.equals(r.value)) 32 || (bv != null && !bv.equals(OsmUtils.getNamedOsmBoolean(k)))) 33 return false; 34 } 35 return true; 36 } 16 37 } 17 38 -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
r1635 r1743 2 2 3 3 import java.awt.Color; 4 import java.util.Collection; 5 import java.util.LinkedList; 4 6 5 7 import javax.swing.ImageIcon; … … 20 22 21 23 class RuleElem { 22 String key; 23 String value; 24 String boolValue; 24 Rule rule = new Rule(); 25 Collection<Rule> rules; 25 26 long scaleMax; 26 27 long scaleMin; … … 31 32 public void init() 32 33 { 33 key = value = boolValue= null;34 rules = null; 34 35 scaleMax = 1000000000; 35 36 scaleMin = 0; 36 37 line.init(); 38 rule.init(); 37 39 linemod.init(); 38 40 area.init(); … … 71 73 72 74 private void error(String message) { 73 System.out.println(styleName + " (" + rule. key + "=" +rule.value + "): " + message);75 System.out.println(styleName + " (" + rule.rule.key + "=" + rule.rule.value + "): " + message); 74 76 } 75 77 … … 148 150 { 149 151 inCondition=true; 152 Rule r = rule.rule; 153 if(r.key != null) 154 { 155 if(rule.rules == null) 156 rule.rules = new LinkedList<Rule>(); 157 r = new Rule(); 158 r.init(); 159 rule.rules.add(r); 160 } 150 161 for (int count=0; count<atts.getLength(); count++) 151 162 { 152 163 if(atts.getQName(count).equals("k")) 153 r ule.key = atts.getValue(count);164 r.key = atts.getValue(count); 154 165 else if(atts.getQName(count).equals("v")) 155 r ule.value = atts.getValue(count);166 r.value = atts.getValue(count); 156 167 else if(atts.getQName(count).equals("b")) 157 r ule.boolValue = atts.getValue(count);168 r.boolValue = atts.getValue(count); 158 169 else 159 170 error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!"); 160 171 } 172 if(r.key == null) 173 error("The condition has no key!"); 161 174 } 162 175 else if (qName.equals("line")) … … 216 229 { 217 230 if(hadLine) 218 styles.add(styleName, rule.key, rule.value, rule.boolValue, 231 { 232 rule.line.rules = rule.rules; 233 styles.add(styleName, rule.rule, 219 234 new LineElemStyle(rule.line, rule.scaleMax, rule.scaleMin)); 235 } 220 236 if(hadLineMod) 221 styles.addModifier(styleName, rule.key, rule.value, rule.boolValue, 237 { 238 rule.linemod.rules = rule.rules; 239 styles.addModifier(styleName, rule.rule, 222 240 new LineElemStyle(rule.linemod, rule.scaleMax, rule.scaleMin)); 241 } 223 242 if(hadIcon) 224 styles.add(styleName, rule.key, rule.value, rule.boolValue, 243 { 244 rule.icon.rules = rule.rules; 245 styles.add(styleName, rule.rule, 225 246 new IconElemStyle(rule.icon, rule.scaleMax, rule.scaleMin)); 247 } 226 248 if(hadArea) 227 styles.add(styleName, rule.key, rule.value, rule.boolValue, 249 { 250 rule.area.rules = rule.rules; 251 styles.add(styleName, rule.rule, 228 252 new AreaElemStyle(rule.area, rule.scaleMax, rule.scaleMin)); 253 } 229 254 inRule = false; 230 255 hadLine = hadLineMod = hadIcon = hadArea = false; -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r1696 r1743 39 39 if((style = icons.get("n" + key + "=" + val)) != null) 40 40 { 41 if( ret == null || style.priority > ret.priority)41 if((ret == null || style.priority > ret.priority) && style.check(keys)) 42 42 ret = style; 43 43 } 44 44 if((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null) 45 45 { 46 if( ret == null || style.priority > ret.priority)46 if((ret == null || style.priority > ret.priority) && style.check(keys)) 47 47 ret = style; 48 48 } 49 49 if((style = icons.get("x" + key)) != null) 50 50 { 51 if( ret == null || style.priority > ret.priority)51 if((ret == null || style.priority > ret.priority) && style.check(keys)) 52 52 ret = style; 53 53 } … … 70 70 String idx = "n" + key + "=" + val; 71 71 if((styleArea = areas.get(idx)) != null && (retArea == null 72 || styleArea.priority > retArea.priority) && (!noclosed || !styleArea.closed)) 72 || styleArea.priority > retArea.priority) && (!noclosed 73 || !styleArea.closed) && styleArea.check(keys)) 73 74 retArea = styleArea; 74 if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority)) 75 if((styleLine = lines.get(idx)) != null && (retLine == null 76 || styleLine.priority > retLine.priority) && styleLine.check(keys)) 75 77 { 76 78 retLine = styleLine; 77 79 linestring = idx; 78 80 } 79 if((styleLine = modifiers.get(idx)) != null )81 if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys)) 80 82 over.put(idx, styleLine); 81 83 idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val); 82 84 if((styleArea = areas.get(idx)) != null && (retArea == null 83 || styleArea.priority > retArea.priority) && (!noclosed || !styleArea.closed)) 85 || styleArea.priority > retArea.priority) && (!noclosed 86 || !styleArea.closed) && styleArea.check(keys)) 84 87 retArea = styleArea; 85 if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority)) 88 if((styleLine = lines.get(idx)) != null && (retLine == null 89 || styleLine.priority > retLine.priority) && styleLine.check(keys)) 86 90 { 87 91 retLine = styleLine; 88 92 linestring = idx; 89 93 } 90 if((styleLine = modifiers.get(idx)) != null )94 if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys)) 91 95 over.put(idx, styleLine); 92 96 idx = "x" + key; 93 97 if((styleArea = areas.get(idx)) != null && (retArea == null 94 || styleArea.priority > retArea.priority) && (!noclosed || !styleArea.closed)) 98 || styleArea.priority > retArea.priority) && (!noclosed 99 || !styleArea.closed) && styleArea.check(keys)) 95 100 retArea = styleArea; 96 if((styleLine = lines.get(idx)) != null && (retLine == null || styleLine.priority > retLine.priority)) 101 if((styleLine = lines.get(idx)) != null && (retLine == null 102 || styleLine.priority > retLine.priority) && styleLine.check(keys)) 97 103 { 98 104 retLine = styleLine; 99 105 linestring = idx; 100 106 } 101 if((styleLine = modifiers.get(idx)) != null )107 if((styleLine = modifiers.get(idx)) != null && styleLine.check(keys)) 102 108 over.put(idx, styleLine); 103 109 } … … 177 183 } 178 184 179 private String getKey(String k, String v, String b) 180 { 181 if(v != null) 182 return "n" + k + "=" + v; 183 else if(b != null) 184 return "b" + k + "=" + OsmUtils.getNamedOsmBoolean(b); 185 else 186 return "x" + k; 187 } 188 189 public void add(String name, String k, String v, String b, LineElemStyle style) 190 { 191 String key = getKey(k,v,b); 185 public void add(String name, Rule r, LineElemStyle style) 186 { 187 String key = r.getKey(); 192 188 style.code = key; 193 189 getStyleSet(name, true).lines.put(key, style); 194 190 } 195 191 196 public void addModifier(String name, String k, String v, String b, LineElemStyle style)197 { 198 String key = getKey(k,v,b);192 public void addModifier(String name, Rule r, LineElemStyle style) 193 { 194 String key = r.getKey(); 199 195 style.code = key; 200 196 getStyleSet(name, true).modifiers.put(key, style); 201 197 } 202 198 203 public void add(String name, String k, String v, String b, AreaElemStyle style)204 { 205 String key = getKey(k,v,b);199 public void add(String name, Rule r, AreaElemStyle style) 200 { 201 String key = r.getKey(); 206 202 style.code = key; 207 203 getStyleSet(name, true).areas.put(key, style); 208 204 } 209 205 210 public void add(String name, String k, String v, String b, IconElemStyle style)211 { 212 String key = getKey(k,v,b);206 public void add(String name, Rule r, IconElemStyle style) 207 { 208 String key = r.getKey(); 213 209 style.code = key; 214 210 getStyleSet(name, true).icons.put(key, style); -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r1241 r1743 1 1 package org.openstreetmap.josm.gui.mappaint; 2 2 3 import java.util.Collection; 4 import java.util.Collections; 3 5 import java.util.LinkedList; 4 6 import java.util.List; … … 17 19 18 20 private static ElemStyles styles = new ElemStyles(); 19 private static StringiconDirs;21 private static Collection<String> iconDirs; 20 22 21 23 public static ElemStyles getStyles() … … 27 29 { 28 30 List<String> dirs = new LinkedList<String>(); 29 for(String fileset : iconDirs .split(";"))31 for(String fileset : iconDirs) 30 32 { 31 33 String[] a; … … 49 51 50 52 public static void readFromPreferences() { 51 String[] a = null; 53 iconDirs = Main.pref.getCollection("mappaint.icon.sources", Collections.<String>emptySet()); 54 if(Main.pref.getBoolean("mappaint.icon.enable-defaults", true)) 55 { 56 LinkedList<String> f = new LinkedList<String>(iconDirs); 57 /* don't prefix icon path, as it should be generic */ 58 f.add("resource://images/styles/standard/"); 59 f.add("resource://images/styles/"); 60 iconDirs = f; 61 } 52 62 53 /* don't prefix icon path, as it should be generic */ 54 String internalicon = "resource://images/styles/standard/;resource://images/styles/"; 55 String internalfile = "resource://styles/standard/elemstyles.xml"; 63 Collection<String> files = Main.pref.getCollection("mappaint.style.sources", Collections.<String>emptySet()); 64 if(Main.pref.getBoolean("mappaint.style.enable-defaults", true)) 65 { 66 LinkedList<String> f = new LinkedList<String>(); 67 f.add("resource://styles/standard/elemstyles.xml"); 68 f.addAll(files); 69 files = f; 70 } 56 71 57 iconDirs = Main.pref.get("mappaint.icon.sources"); 58 if(Main.pref.getBoolean("mappaint.icon.enable-defaults", true)) 59 iconDirs = iconDirs == null || iconDirs.length() == 0 ? internalicon : iconDirs + ";" + internalicon; 60 61 String file = Main.pref.get("mappaint.style.sources"); 62 if(Main.pref.getBoolean("mappaint.style.enable-defaults", true)) 63 file = (file == null || file.length() == 0) ? internalfile : internalfile + ";" + file; 64 65 for(String fileset : file.split(";")) 72 for(String fileset : files) 66 73 { 74 String[] a = null; 67 75 try 68 76 { … … 81 89 System.out.println("Mappaint-Style \"" + a[0] + "\" file \"" + a[1] + "\""); 82 90 System.out.println("Mappaint-Style problems: " + e); 91 e.printStackTrace(); 83 92 } 84 93 } -
trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java
r1742 r1743 2 2 package org.openstreetmap.josm.gui.preferences; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import java.awt.GridBagLayout; 7 8 import javax.swing.BorderFactory; 9 import javax.swing.JCheckBox; 10 import javax.swing.JComboBox; 11 import javax.swing.JLabel; 12 import javax.swing.JPanel; 13 import javax.swing.JScrollPane; 14 4 15 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.tools.GBC; 5 18 6 19 public class MapPaintPreference implements PreferenceSetting { 20 private StyleSources sources; 21 private JCheckBox enableIconDefault; 22 private JCheckBox enableDefault; 23 private JComboBox styleCombo = new JComboBox(); 7 24 8 25 public static class Factory implements PreferenceSettingFactory { … … 13 30 14 31 public void addGui(final PreferenceDialog gui) { 15 // this is intended for a future configuration panel for mappaint! 32 enableDefault = new JCheckBox(tr("Enable built-in defaults"), 33 Main.pref.getBoolean("mappaint.style.enable-defaults", true)); 34 enableIconDefault = new JCheckBox(tr("Enable built-in icon defaults"), 35 Main.pref.getBoolean("mappaint.icon.enable-defaults", true)); 36 37 styleCombo.addItem("standard"); 38 39 String style = Main.pref.get("mappaint.style", "standard"); 40 styleCombo.setEditable(true); 41 for (int i = 0; i < styleCombo.getItemCount(); ++i) { 42 if (styleCombo.getItemAt(i).getClass().getName().equals(style)) { 43 styleCombo.setSelectedIndex(i); 44 break; 45 } 46 } 47 48 JPanel panel = new JPanel(new GridBagLayout()); 49 JScrollPane scrollpane = new JScrollPane(panel); 50 panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 51 panel.add(enableDefault, GBC.std().insets(5,5,5,0)); 52 panel.add(enableIconDefault, GBC.eol().insets(5,5,5,0)); 53 54 panel.add(new JLabel(tr("Used style")), GBC.std().insets(5,5,0,5)); 55 panel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 56 panel.add(styleCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,0,5,0)); 57 58 sources = new StyleSources("mappaint.style.sources", "mappaint.icon.sources", 59 "http://josm.openstreetmap.de/styles", false, tr("Map Paint Styles")); 60 panel.add(sources, GBC.eol().fill(GBC.BOTH)); 61 gui.mapcontent.addTab(tr("Map Paint Styles"), scrollpane); 16 62 } 17 63 18 64 public boolean ok() { 19 return false; // dummy 65 Boolean restart = Main.pref.put("mappaint.style.enable-defaults", enableDefault.getSelectedObjects() != null); 66 if(Main.pref.put("mappaint.icon.enable-defaults", enableIconDefault.getSelectedObjects() != null)) 67 restart = true; 68 if(sources.finish()) 69 restart = true; 70 Main.pref.put("mappaint.style", styleCombo.getEditor().getItem().toString()); 71 return restart; 20 72 } 21 73 -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r1742 r1743 45 45 46 46 public final javax.swing.JTabbedPane displaycontent = new javax.swing.JTabbedPane(); 47 public final javax.swing.JTabbedPane mapcontent = new javax.swing.JTabbedPane(); 47 48 48 49 /** … … 118 119 119 120 display.add(displaycontent, GBC.eol().fill(GBC.BOTH)); 121 map.add(mapcontent, GBC.eol().fill(GBC.BOTH)); 120 122 for (Iterator<PreferenceSetting> it = settings.iterator(); it.hasNext();) { 121 123 try { … … 150 152 settingsFactory.add(new LafPreference.Factory()); 151 153 settingsFactory.add(new LanguagePreference.Factory()); 152 settingsFactory.add(new MapPaintPreference.Factory());153 154 settingsFactory.add(new ServerAccessPreference.Factory()); 154 155 settingsFactory.add(new FilePreferences.Factory()); 155 156 settingsFactory.add(new ProxyPreferences.Factory()); 156 157 settingsFactory.add(new ProjectionPreference.Factory()); 158 settingsFactory.add(new MapPaintPreference.Factory()); 157 159 settingsFactory.add(new TaggingPresetPreference.Factory()); 158 160 settingsFactory.add(new PluginPreference.Factory()); -
trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
r1742 r1743 8 8 9 9 import javax.swing.BorderFactory; 10 import javax.swing.Box; 10 11 import javax.swing.JComboBox; 11 12 import javax.swing.JLabel; 13 import javax.swing.JScrollPane; 12 14 import javax.swing.JPanel; 13 15 … … 50 52 51 53 JPanel projPanel = new JPanel(); 52 projPanel.setBorder(BorderFactory.create TitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Map Projection")));54 projPanel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 53 55 projPanel.setLayout(new GridBagLayout()); 54 56 projPanel.add(new JLabel(tr("Projection method")), GBC.std().insets(5,5,0,5)); … … 58 60 projPanel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 59 61 projPanel.add(coordinatesCombo, GBC.eop().fill(GBC.HORIZONTAL).insets(0,5,5,5)); 60 gui.map.add(projPanel, GBC.eol().insets(0,0,0,10).fill(GBC.HORIZONTAL)); 62 projPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 63 JScrollPane scrollpane = new JScrollPane(projPanel); 64 gui.mapcontent.addTab(tr("Map Projection"), scrollpane); 61 65 } 62 66 -
trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java
r1742 r1743 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color;7 6 import java.awt.GridBagLayout; 8 import java.awt.event.ActionEvent;9 import java.awt.event.ActionListener;10 import java.util.ArrayList;11 7 import java.util.Collection; 12 8 import java.util.HashMap; 13 9 14 10 import javax.swing.BorderFactory; 15 import javax.swing.Box;16 import javax.swing.DefaultListModel;17 import javax.swing.JButton;18 11 import javax.swing.JCheckBox; 19 import javax.swing.JLabel;20 import javax.swing.JList;21 12 import javax.swing.JMenu; 22 13 import javax.swing.JMenuItem; 23 import javax.swing.JOptionPane;24 14 import javax.swing.JPanel; 15 import javax.swing.JSeparator; 25 16 import javax.swing.JScrollPane; 26 import javax.swing.JSeparator;27 17 28 18 import org.openstreetmap.josm.Main; … … 41 31 42 32 public static Collection<TaggingPreset> taggingPresets; 43 private JList taggingPresetSources;33 private StyleSources sources; 44 34 private JCheckBox sortMenu; 45 35 private JCheckBox enableDefault; 46 36 47 37 public void addGui(final PreferenceDialog gui) { 48 49 taggingPresetSources = new JList(new DefaultListModel());50 38 sortMenu = new JCheckBox(tr("Sort presets menu"), 51 39 Main.pref.getBoolean("taggingpreset.sortmenu", false)); … … 53 41 Main.pref.getBoolean("taggingpreset.enable-defaults", true)); 54 42 55 Collection<String> sources = Main.pref.getCollection("taggingpreset.sources", null); 56 if(sources != null) 57 for(String s : sources) 58 ((DefaultListModel)taggingPresetSources.getModel()).addElement(s); 59 60 JButton addAnno = new JButton(tr("Add")); 61 addAnno.addActionListener(new ActionListener(){ 62 public void actionPerformed(ActionEvent e) { 63 String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source")); 64 if (source != null) 65 ((DefaultListModel)taggingPresetSources.getModel()).addElement(source); 66 } 67 }); 68 69 JButton editAnno = new JButton(tr("Edit")); 70 editAnno.addActionListener(new ActionListener(){ 71 public void actionPerformed(ActionEvent e) { 72 if (taggingPresetSources.getSelectedIndex() == -1) 73 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit.")); 74 else { 75 String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source"), taggingPresetSources.getSelectedValue()); 76 if (source != null) 77 ((DefaultListModel)taggingPresetSources.getModel()).setElementAt(source, taggingPresetSources.getSelectedIndex()); 78 } 79 } 80 }); 81 82 JButton deleteAnno = new JButton(tr("Delete")); 83 deleteAnno.addActionListener(new ActionListener(){ 84 public void actionPerformed(ActionEvent e) { 85 if (taggingPresetSources.getSelectedIndex() == -1) 86 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete.")); 87 else { 88 ((DefaultListModel)taggingPresetSources.getModel()).remove(taggingPresetSources.getSelectedIndex()); 89 } 90 } 91 }); 92 taggingPresetSources.setVisibleRowCount(3); 93 94 taggingPresetSources.setToolTipText(tr("The sources (URL or filename) of tagging preset definition files. See http://josm.openstreetmap.de/wiki/TaggingPresets for help.")); 95 addAnno.setToolTipText(tr("Add a new tagging preset source to the list.")); 96 deleteAnno.setToolTipText(tr("Delete the selected source from the list.")); 97 98 JPanel tpPanel = new JPanel(); 99 tpPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Tagging Presets"))); 100 tpPanel.setLayout(new GridBagLayout()); 101 tpPanel.add(sortMenu, GBC.eol().insets(5,5,5,0)); 102 tpPanel.add(enableDefault, GBC.eol().insets(5,5,5,0)); 103 tpPanel.add(new JLabel(tr("Tagging preset sources")), GBC.eol().insets(5,5,5,0)); 104 tpPanel.add(new JScrollPane(taggingPresetSources), GBC.eol().insets(5,0,5,0).fill(GBC.BOTH)); 105 JPanel buttonPanel = new JPanel(new GridBagLayout()); 106 tpPanel.add(buttonPanel, GBC.eol().insets(5,0,5,5).fill(GBC.HORIZONTAL)); 107 buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); 108 buttonPanel.add(addAnno, GBC.std().insets(0,5,0,0)); 109 buttonPanel.add(editAnno, GBC.std().insets(5,5,5,0)); 110 buttonPanel.add(deleteAnno, GBC.std().insets(0,5,0,0)); 111 gui.map.add(tpPanel, GBC.eol().fill(GBC.BOTH)); 43 JPanel panel = new JPanel(new GridBagLayout()); 44 JScrollPane scrollpane = new JScrollPane(panel); 45 panel.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 46 panel.add(sortMenu, GBC.eol().insets(5,5,5,0)); 47 panel.add(enableDefault, GBC.eol().insets(5,0,5,0)); 48 sources = new StyleSources("taggingpreset.sources", "taggingpreset.icon.sources", 49 "http://josm.openstreetmap.de/presets", false, tr("Tagging Presets")); 50 panel.add(sources, GBC.eol().fill(GBC.BOTH)); 51 gui.mapcontent.addTab(tr("Tagging Presets"), scrollpane); 112 52 } 113 53 114 54 public boolean ok() { 115 boolean restart; 116 Main.pref.put("taggingpreset.enable-defaults", enableDefault.getSelectedObjects() != null); 117 restart = Main.pref.put("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null); 118 int num = taggingPresetSources.getModel().getSize(); 119 if (num > 0) 120 { 121 ArrayList<String> l = new ArrayList<String>(); 122 for (int i = 0; i < num; ++i) 123 l.add((String)taggingPresetSources.getModel().getElementAt(i)); 124 if(Main.pref.putCollection("taggingpreset.sources", l)) 125 restart = true; 126 } 127 else if(Main.pref.putCollection("taggingpreset.sources", null)) 55 boolean restart = Main.pref.put("taggingpreset.enable-defaults", 56 enableDefault.getSelectedObjects() != null); 57 if(Main.pref.put("taggingpreset.sortmenu", sortMenu.getSelectedObjects() != null)) 58 restart = true; 59 if(sources.finish()) 128 60 restart = true; 129 61 return restart; -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r1632 r1743 465 465 */ 466 466 public void setIcon(String iconName) { 467 Collection<String> s = Main.pref.getCollection("taggingpreset.icon paths", null);467 Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null); 468 468 ImageIcon icon = ImageProvider.getIfAvailable(s, "presets", null, iconName); 469 469 if (icon == null) -
trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
r1711 r1743 85 85 destDirFile.mkdirs(); 86 86 87 localPath = "mirror_" + new File(url.getPath()).getName(); 87 String a = url.toString().replaceAll("[^A-Za-z0-9_.-]", "_"); 88 localPath = "mirror_" + a; 88 89 destDirFile = new File(destDir, localPath + ".tmp"); 89 90 BufferedOutputStream bos = null;
Note:
See TracChangeset
for help on using the changeset viewer.