- Timestamp:
- 2006-11-24T15:52:34+01:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 1 added
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r146 r167 68 68 69 69 Main.main.editLayer().add(new SequenceCommand(tr("Align Nodes in Circle"), cmds)); 70 Main.ds.setSelected(avn);71 70 Main.map.repaint(); 72 71 } -
src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r144 r167 6 6 7 7 import org.openstreetmap.josm.Main; 8 import org.openstreetmap.josm.data.osm.DataSet; 8 9 import org.openstreetmap.josm.data.osm.Node; 10 import org.openstreetmap.josm.data.osm.OsmPrimitive; 9 11 import org.openstreetmap.josm.data.osm.Segment; 10 12 import org.openstreetmap.josm.data.osm.Way; … … 34 36 35 37 protected static final double PHI = Math.toRadians(20); 38 39 public void visitAll(DataSet data) { 40 for (final OsmPrimitive osm : data.segments) 41 if (!osm.deleted) 42 osm.visit(this); 43 for (final OsmPrimitive osm : data.ways) 44 if (!osm.deleted) 45 osm.visit(this); 46 for (final OsmPrimitive osm : data.nodes) 47 if (!osm.deleted) 48 osm.visit(this); 49 for (final OsmPrimitive osm : data.getSelected()) 50 if (!osm.deleted) 51 osm.visit(this); 52 } 36 53 37 54 /** -
src/org/openstreetmap/josm/gui/MainMenu.java
r160 r167 10 10 import org.openstreetmap.josm.actions.AboutAction; 11 11 import org.openstreetmap.josm.actions.AlignInCircleAction; 12 import org.openstreetmap.josm.actions.AlignInLineAction; 12 13 import org.openstreetmap.josm.actions.DownloadAction; 13 14 import org.openstreetmap.josm.actions.DownloadIncompleteAction; 14 15 import org.openstreetmap.josm.actions.ExitAction; 15 import org.openstreetmap.josm.actions.ExternalToolsAction;16 16 import org.openstreetmap.josm.actions.GpxExportAction; 17 17 import org.openstreetmap.josm.actions.HelpAction; … … 41 41 public final Action reverseSegment = new ReverseSegmentAction(); 42 42 public final Action alignInCircle = new AlignInCircleAction(); 43 public final Action alignInLine = new AlignInLineAction(); 43 44 public final Action upload = new UploadAction(); 44 45 public final Action save = new SaveAction(); … … 52 53 public final JMenu layerMenu = new JMenu(tr("Layer")); 53 54 public final JMenu editMenu = new JMenu(tr("Edit")); 54 public final JMenu externalMenu = ExternalToolsAction.buildMenu();55 55 public final JMenu helpMenu = new JMenu(tr("Help")); 56 56 public final JMenu fileMenu = new JMenu(tr("Files")); … … 76 76 editMenu.add(reverseSegment); 77 77 editMenu.add(alignInCircle); 78 editMenu.add(alignInLine); 78 79 editMenu.addSeparator(); 79 80 editMenu.add(preferences); … … 90 91 layerMenu.setVisible(false); 91 92 93 add(Box.createHorizontalGlue()); 92 94 93 if (externalMenu != null)94 add(externalMenu);95 96 add(Box.createHorizontalGlue());97 98 95 helpMenu.setMnemonic('H'); 99 96 helpMenu.add(help); -
src/org/openstreetmap/josm/gui/MapFrame.java
r155 r167 58 58 */ 59 59 public MapStatus statusLine; 60 60 61 61 public ConflictDialog conflictDialog; 62 62 private JPanel toggleDialogs = new JPanel(); 63 63 64 public final ButtonGroup toolGroup = new ButtonGroup(); 65 64 66 /** 65 67 * Construct a map with a given DataSet. The set cannot be replaced after … … 87 89 toolBarActions.add(new IconToggleButton(new DeleteAction(this))); 88 90 89 // all map modes in one button group90 ButtonGroup toolGroup = new ButtonGroup();91 91 for (Component c : toolBarActions.getComponents()) 92 92 toolGroup.add((AbstractButton)c); … … 112 112 if (!autoScaleButton.groupbutton) 113 113 autoScaleButton.setSelected(true); 114 114 } 115 115 }); 116 116 … … 130 130 131 131 public Action getDefaultButtonAction() { 132 133 132 return ((AbstractButton)toolBarActions.getComponent(0)).getAction(); 133 } 134 134 135 135 /** … … 147 147 148 148 private void addIconToggle(JPanel toggleDialogs, ToggleDialog dlg) { 149 150 149 IconToggleButton button = new IconToggleButton(dlg.action); 150 dlg.action.button = button; 151 151 toolBarActions.add(button); 152 152 toggleDialogs.add(dlg); 153 153 } 154 154 155 155 156 156 /** 157 157 * Fires an property changed event "visible". -
src/org/openstreetmap/josm/gui/annotation/AnnotationPreset.java
r129 r167 46 46 47 47 public static class Text implements Item { 48 String key; 49 String label; 50 JTextField value = new JTextField(); 48 private String key; 49 private String label; 50 private JTextField value = new JTextField(); 51 private boolean deleteIfEmpty; 51 52 52 53 public void addToPanel(JPanel p) { … … 54 55 p.add(value, GBC.eol().fill(GBC.HORIZONTAL)); 55 56 } 56 public Text(String key, String label, String value) { 57 public Text(String key, String label, String value, boolean deleteIfEmpty) { 57 58 this.key = key; 58 59 this.label = label; 59 60 this.value.setText(value == null ? "" : value); 60 } 61 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 62 cmds.add(new ChangePropertyCommand(sel, key, value.getText())); 61 this.deleteIfEmpty = deleteIfEmpty; 62 } 63 public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) { 64 String v = value.getText(); 65 if (deleteIfEmpty && v.length() == 0) 66 v = null; 67 cmds.add(new ChangePropertyCommand(sel, key, v)); 63 68 } 64 69 } 65 70 66 71 public static class Check implements Item { 67 String key; 68 JCheckBox check = new JCheckBox(); 72 private String key; 73 private JCheckBox check = new JCheckBox(); 69 74 70 75 public void addToPanel(JPanel p) { … … 82 87 83 88 public static class Combo implements Item { 84 String key; 85 String label; 86 JComboBox combo; 89 private String key; 90 private String label; 91 private JComboBox combo; 87 92 private final String[] values; 93 private boolean deleteIfEmpty; 88 94 89 95 public void addToPanel(JPanel p) { … … 91 97 p.add(combo, GBC.eol().fill(GBC.HORIZONTAL)); 92 98 } 93 public Combo(String key, String label, String def, String[] values, String[] displayedValues, boolean editable) { 99 public Combo(String key, String label, String def, String[] values, String[] displayedValues, boolean editable, boolean deleteIfEmpty) { 94 100 this.key = key; 95 101 this.label = label; 96 102 this.values = values; 103 this.deleteIfEmpty = deleteIfEmpty; 97 104 combo = new JComboBox(displayedValues); 98 105 combo.setEditable(editable); … … 102 109 String v = combo.getSelectedIndex() == -1 ? null : values[combo.getSelectedIndex()]; 103 110 String str = combo.isEditable()?combo.getEditor().getItem().toString() : v; 111 if (deleteIfEmpty && str != null && str.length() == 0) 112 str = null; 104 113 cmds.add(new ChangePropertyCommand(sel, key, str)); 105 114 } … … 107 116 108 117 public static class Label implements Item { 109 String text; 118 private String text; 110 119 111 120 public void addToPanel(JPanel p) { … … 119 128 120 129 public static class Key implements Item { 121 String key; 122 String value; 130 private String key; 131 private String value; 123 132 124 133 public void addToPanel(JPanel p) {} … … 162 171 } 163 172 } else if (qname.equals("text")) 164 current.add(new Text(a.getValue("key"), a.getValue("text"), a.getValue("default"))); 173 current.add(new Text(a.getValue("key"), a.getValue("text"), a.getValue("default"), parseBoolean(a.getValue("delete_if_empty")))); 165 174 else if (qname.equals("check")) { 166 175 String s = a.getValue("default"); 167 boolean clear = s == null || s.equals("0") || s.startsWith("off") || s.startsWith("false") || s.startsWith("no");176 boolean clear = parseBoolean(s); 168 177 current.add(new Check(a.getValue("key"), a.getValue("text"), !clear)); 169 178 } else if (qname.equals("label")) … … 173 182 String s = a.getValue("readonly"); 174 183 String dvstr = a.getValue("display_values"); 175 boolean editable = s == null || s.equals("0") || s.startsWith("off") || s.startsWith("false") || s.startsWith("no");184 boolean editable = parseBoolean(s); 176 185 if (dvstr != null) { 177 186 if (editable && s != null) … … 184 193 displayValues.length+" "+trn("element", "elements", displayValues.length), 185 194 values.length+" "+trn("element", "elements", values.length))); 186 current.add(new Combo(a.getValue("key"), a.getValue("text"), a.getValue("default"), values, displayValues, editable)); 195 current.add(new Combo(a.getValue("key"), a.getValue("text"), a.getValue("default"), values, displayValues, editable, parseBoolean(a.getValue("delete_if_empty")))); 187 196 } else if (qname.equals("key")) 188 197 current.add(new Key(a.getValue("key"), a.getValue("value"))); … … 190 199 throw new SAXException(tr("Unknown annotation object {0} at line {1} column {2}", qname, getLineNumber(), getColumnNumber())); 191 200 } 201 202 private boolean parseBoolean(String s) { 203 return s == null || s.equals("0") || s.startsWith("off") || s.startsWith("false") || s.startsWith("no"); 204 } 192 205 193 206 @Override public void endElement(String ns, String lname, String qname) { -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r155 r167 142 142 mapPainter.setGraphics(g); 143 143 mapPainter.setNavigatableComponent(mv); 144 for (final OsmPrimitive osm : data.segments) 145 if (!osm.deleted) 146 osm.visit(mapPainter); 147 for (final OsmPrimitive osm : data.ways) 148 if (!osm.deleted) 149 osm.visit(mapPainter); 150 for (final OsmPrimitive osm : data.nodes) 151 if (!osm.deleted) 152 osm.visit(mapPainter); 153 for (final OsmPrimitive osm : data.getSelected()) 154 if (!osm.deleted) 155 osm.visit(mapPainter); 144 mapPainter.visitAll(data); 156 145 Main.map.conflictDialog.paintConflicts(g, mv); 157 146 } -
src/org/openstreetmap/josm/io/OsmWriter.java
r143 r167 62 62 Visitor writer = new OsmWriter(out, osmConform); 63 63 for (Node n : ds.nodes) 64 writer.visit(n); 64 if (shouldWrite(n)) 65 writer.visit(n); 65 66 for (Segment ls : ds.segments) 66 writer.visit(ls); 67 if (shouldWrite(ls)) 68 writer.visit(ls); 67 69 for (Way w : ds.ways) 68 writer.visit(w); 70 if (shouldWrite(w)) 71 writer.visit(w); 72 } 73 74 private boolean shouldWrite(OsmPrimitive osm) { 75 return osm.id != 0 || !osm.deleted; 69 76 } 70 77 } -
src/org/openstreetmap/josm/plugins/PluginInformation.java
r159 r167 6 6 import java.net.URL; 7 7 import java.net.URLClassLoader; 8 import java.util.ArrayList; 9 import java.util.List; 8 10 import java.util.Map; 9 11 import java.util.TreeMap; … … 25 27 public final boolean early; 26 28 public final String author; 29 public final List<URL> libraries = new ArrayList<URL>(); 27 30 28 31 public final Map<String, String> attr = new TreeMap<String, String>(); 29 32 33 /** 34 * @param file the plugin jar file. 35 */ 30 36 public PluginInformation(File file) { 31 37 this.file = file; … … 39 45 early = Boolean.parseBoolean(attr.getValue("Plugin-Early")); 40 46 author = attr.getValue("Author"); 47 libraries.add(new URL(getURLString(file.getAbsolutePath()))); 48 String classPath = attr.getValue("Class-Path"); 49 if (classPath != null) { 50 for (String s : classPath.split(classPath.contains(";") ? ";" : ":")) { 51 if (!s.startsWith("/") && !s.startsWith("\\") && !s.matches("^.:")) 52 s = file.getParent() + File.separator + s; 53 libraries.add(new URL(getURLString(s))); 54 } 55 } 56 41 57 for (Object o : attr.keySet()) 42 58 this.attr.put(o.toString(), attr.getValue(o.toString())); … … 63 79 public Class<?> loadClass() { 64 80 try { 65 ClassLoader loader = URLClassLoader.newInstance(66 new URL[]{new URL(getURLString())},67 81 URL[] urls = new URL[libraries.size()]; 82 urls = libraries.toArray(urls); 83 ClassLoader loader = URLClassLoader.newInstance(urls, getClass().getClassLoader()); 68 84 Class<?> realClass = Class.forName(className, true, loader); 69 85 return realClass; … … 73 89 } 74 90 75 private String getURLString() { 91 private String getURLString(String fileName) { 76 92 if (System.getProperty("os.name").startsWith("Windows")) 77 return "file:/"+file .getAbsolutePath();78 return "file://"+file .getAbsolutePath();93 return "file:/"+fileName; 94 return "file://"+fileName; 79 95 } 80 96 } -
src/org/openstreetmap/josm/tools/WikiReader.java
r155 r167 4 4 import java.io.IOException; 5 5 import java.io.InputStreamReader; 6 import java.net.MalformedURLException;7 6 import java.net.URL; 8 7 … … 27 26 * replace relative pathes etc.. 28 27 * 29 * @return Either the string of the content of the wiki page or <code>null</code>30 * if the page could not be read.28 * @return Either the string of the content of the wiki page. 29 * @throws IOException Throws, if the page could not be loaded. 31 30 */ 32 public String read(String url) { 33 try { 34 BufferedReader in = new BufferedReader(new InputStreamReader(new URL(url).openStream())); 35 if (url.startsWith(baseurl)) 36 return readFromTrac(in, url); 37 return readNormal(in); 38 } catch (MalformedURLException e) { 39 throw new RuntimeException(e); 40 } catch (IOException e) { 41 return null; 42 } 31 public String read(String url) throws IOException { 32 BufferedReader in = new BufferedReader(new InputStreamReader(new URL(url).openStream())); 33 if (url.startsWith(baseurl)) 34 return readFromTrac(in, url); 35 return readNormal(in); 43 36 } 44 37
Note:
See TracChangeset
for help on using the changeset viewer.