Changeset 3479 in josm
- Timestamp:
- 2010-08-29T14:55:25+02:00 (14 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r3444 r3479 654 654 if (map != null) { 655 655 newToggleDlgWidth = Integer.toString(map.getToggleDlgWidth()); 656 if (newToggleDlgWidth.equals(Integer.toString( map.DEF_TOGGLE_DLG_WIDTH))) {656 if (newToggleDlgWidth.equals(Integer.toString(MapFrame.DEF_TOGGLE_DLG_WIDTH))) { 657 657 newToggleDlgWidth = ""; 658 658 } -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r3450 r3479 59 59 /* translator note: other expressions for "purge" might be "forget", "clean", "obliterate", "prune" */ 60 60 super(tr("Purge..."), "purge", tr("Forget objects but do not delete them on server when uploading."), 61 Shortcut.registerShortcut("system:purge", tr("Edit: {0}", tr("Purge")), KeyEvent.VK_P, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT) 62 , true); 61 Shortcut.registerShortcut("system:purge", tr("Edit: {0}", tr("Purge")), KeyEvent.VK_P, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT) 62 , true); 63 63 putValue("help", HelpUtil.ht("/Action/Purge")); 64 64 } … … 81 81 */ 82 82 protected List<OsmPrimitive> toPurgeAdditionally; 83 83 84 84 @Override 85 85 public void actionPerformed(ActionEvent e) { … … 99 99 OsmPrimitive osm = toPurge.iterator().next(); 100 100 for (OsmPrimitive parent: osm.getReferrers()) { 101 if (toPurge.contains(parent) || toPurgeChecked.contains(parent)) 101 if (toPurge.contains(parent) || toPurgeChecked.contains(parent)) { 102 102 continue; 103 } 103 104 if (parent instanceof Way || (parent instanceof Relation && osm.isNew())) { 104 105 toPurgeAdditionally.add(parent); … … 118 119 // to-be-purged or of type relation. 119 120 TOP: 120 for (OsmPrimitive child : toPurgeChecked) { 121 if (child.isNew()) 122 continue; 123 for (OsmPrimitive parent : child.getReferrers()) { 124 if (parent instanceof Relation && !toPurgeChecked.contains(parent)) { 125 makeIncomplete.add(child); 126 continue TOP; 127 } 128 } 129 } 121 for (OsmPrimitive child : toPurgeChecked) { 122 if (child.isNew()) { 123 continue; 124 } 125 for (OsmPrimitive parent : child.getReferrers()) { 126 if (parent instanceof Relation && !toPurgeChecked.contains(parent)) { 127 makeIncomplete.add(child); 128 continue TOP; 129 } 130 } 131 } 130 132 131 133 // Add untagged way nodes. Do not add nodes that have other … … 137 139 Way w = (Way) osm; 138 140 NODE: 139 for (Node n : w.getNodes()) { 140 if (n.isTagged() || toPurgeChecked.contains(n)) 141 continue; 142 for (OsmPrimitive ref : n.getReferrers()) { 143 if (ref != w && !toPurgeChecked.contains(ref)) 144 continue NODE; 141 for (Node n : w.getNodes()) { 142 if (n.isTagged() || toPurgeChecked.contains(n)) { 143 continue; 144 } 145 for (OsmPrimitive ref : n.getReferrers()) { 146 if (ref != w && !toPurgeChecked.contains(ref)) { 147 continue NODE; 148 } 149 } 150 wayNodes.add(n); 145 151 } 146 wayNodes.add(n);147 }148 152 } 149 153 } … … 186 190 pnl.add(new JLabel("<html>"+ 187 191 tr("This operation makes JOSM forget the selected objects.<br> " + 188 "They will be removed from the layer, but <i>not</i> deleted<br> " + 192 "They will be removed from the layer, but <i>not</i> deleted<br> " + 189 193 "on the server when uploading.")+"</html>", 190 194 ImageProvider.get("purge"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL)); … … 193 197 pnl.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(0,5,0,5)); 194 198 pnl.add(new JLabel("<html>"+ 195 tr("The following dependent objects will be purged<br> " + 196 "in addition to the selected objects:")+"</html>", 197 ImageProvider.get("warning-small"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL)); 199 tr("The following dependent objects will be purged<br> " + 200 "in addition to the selected objects:")+"</html>", 201 ImageProvider.get("warning-small"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL)); 198 202 199 203 Collections.sort(toPurgeAdditionally, new Comparator<OsmPrimitive>() { … … 202 206 if (type != 0) 203 207 return -type; 204 return ( new Long(o1.getUniqueId())).compareTo(o2.getUniqueId());208 return (Long.valueOf(o1.getUniqueId())).compareTo(o2.getUniqueId()); 205 209 } 206 210 }); … … 210 214 @Override 211 215 public Component getListCellRendererComponent(JList list, 212 213 214 215 216 Object value, 217 int index, 218 boolean isSelected, 219 boolean cellHasFocus) { 216 220 return super.getListCellRendererComponent(list, value, index, true, false); 217 221 } … … 240 244 pnl.add(new JLabel("<html>"+tr("Some of the objects are modified.<br> " + 241 245 "Proceed, if these changes should be discarded."+"</html>"), 242 246 ImageProvider.get("warning-small"), JLabel.LEFT), 243 247 GBC.eol().fill(GBC.HORIZONTAL)); 244 248 } -
trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java
r3385 r3479 70 70 throw new RuntimeException(e.getMessage(), e); 71 71 } 72 }73 74 private long getNumber() {75 long result = 0;76 while (Character.isDigit(c)) {77 result = result * 10 + (c - '0');78 getChar();79 }80 return result;81 72 } 82 73 -
trunk/src/org/openstreetmap/josm/command/PseudoCommand.java
r3262 r3479 3 3 4 4 import java.util.Collection; 5 import java.util.HashMap;6 import java.util.Map;7 8 import javax.swing.tree.DefaultMutableTreeNode;9 import javax.swing.tree.MutableTreeNode;10 5 11 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; 12 import org.openstreetmap.josm.data.osm.PrimitiveData;13 7 14 8 /** -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r3431 r3479 104 104 PrimitiveData empty; 105 105 switch(osm.getType()) { 106 107 108 109 106 case NODE: empty = new NodeData(); break; 107 case WAY: empty = new WayData(); break; 108 case RELATION: empty = new RelationData(); break; 109 default: throw new AssertionError(); 110 110 } 111 111 empty.setId(osm.getUniqueId()); … … 154 154 */ 155 155 outer: 156 for (Iterator<OsmPrimitive> it = in.iterator(); it.hasNext();) { 157 OsmPrimitive u = it.next(); 158 if (u instanceof Node) { 159 Node n = (Node) u; 160 for (OsmPrimitive ref : n.getReferrers()) { 161 if (ref instanceof Way && in.contains(ref)) 162 continue outer; 163 } 164 it.remove(); 165 out.add(n); 166 } 167 } 156 for (Iterator<OsmPrimitive> it = in.iterator(); it.hasNext();) { 157 OsmPrimitive u = it.next(); 158 if (u instanceof Node) { 159 Node n = (Node) u; 160 for (OsmPrimitive ref : n.getReferrers()) { 161 if (ref instanceof Way && in.contains(ref)) { 162 continue outer; 163 } 164 } 165 it.remove(); 166 out.add(n); 167 } 168 } 168 169 169 170 /** … … 171 172 */ 172 173 top: 173 while (!in.isEmpty()) { 174 for (Iterator<OsmPrimitive> it = in.iterator(); it.hasNext();) { 175 OsmPrimitive u = it.next(); 176 if (u instanceof Way) { 177 Way w = (Way) u; 178 it.remove(); 179 for (Node n : w.getNodes()) { 180 if (in.contains(n)) { 181 in.remove(n); 182 out.add(n); 174 while (!in.isEmpty()) { 175 for (Iterator<OsmPrimitive> it = in.iterator(); it.hasNext();) { 176 OsmPrimitive u = it.next(); 177 if (u instanceof Way) { 178 Way w = (Way) u; 179 it.remove(); 180 for (Node n : w.getNodes()) { 181 if (in.contains(n)) { 182 in.remove(n); 183 out.add(n); 184 } 183 185 } 184 } 185 out.add(w); 186 continue top; 187 } 188 } 189 break; // no more ways left 190 } 191 192 /** 193 * Rest are relations. Do topological sorting on a DAG where each 194 * arrow points from child to parent. (Because it is faster to 195 * loop over getReferrers() than getMembers().) 196 */ 197 Set<Relation> inR = (Set) in; 198 Set<Relation> childlessR = new HashSet<Relation>(); 199 List<Relation> outR = new ArrayList<Relation>(inR.size()); 200 201 HashMap<Relation, Integer> numChilds = new HashMap<Relation, Integer>(); 202 203 // calculate initial number of childs 204 for (Relation r : inR) { 205 numChilds.put(r, 0); 206 } 207 for (Relation r : inR) { 208 for (OsmPrimitive parent : r.getReferrers()) { 209 if (!(parent instanceof Relation)) 210 throw new AssertionError(); 211 Integer i = numChilds.get((Relation)parent); 212 if (i != null) { 213 numChilds.put((Relation)parent, i+1); 214 } 215 } 216 } 217 for (Relation r : inR) { 218 if (numChilds.get(r).equals(0)) { 219 childlessR.add(r); 220 } 221 } 222 223 while (!childlessR.isEmpty()) { 224 // Identify one childless Relation and 225 // let it virtually die. This makes other 226 // relations childless. 227 Iterator<Relation> it = childlessR.iterator(); 228 Relation next = it.next(); 229 it.remove(); 230 outR.add(next); 231 232 for (OsmPrimitive parentPrim : next.getReferrers()) { 233 Relation parent = (Relation) parentPrim; 234 Integer i = numChilds.get(parent); 235 if (i != null) { 236 numChilds.put(parent, i-1); 237 if (i-1 == 0) { 238 childlessR.add(parent); 239 } 240 } 241 } 242 } 243 244 if (outR.size() != inR.size()) 245 throw new AssertionError("topo sort algorithm failed"); 246 247 out.addAll(outR); 248 249 return out; 250 } 251 186 out.add(w); 187 continue top; 188 } 189 } 190 break; // no more ways left 191 } 192 193 /** 194 * Rest are relations. Do topological sorting on a DAG where each 195 * arrow points from child to parent. (Because it is faster to 196 * loop over getReferrers() than getMembers().) 197 */ 198 Set<Relation> inR = (Set) in; 199 Set<Relation> childlessR = new HashSet<Relation>(); 200 List<Relation> outR = new ArrayList<Relation>(inR.size()); 201 202 HashMap<Relation, Integer> numChilds = new HashMap<Relation, Integer>(); 203 204 // calculate initial number of childs 205 for (Relation r : inR) { 206 numChilds.put(r, 0); 207 } 208 for (Relation r : inR) { 209 for (OsmPrimitive parent : r.getReferrers()) { 210 if (!(parent instanceof Relation)) 211 throw new AssertionError(); 212 Integer i = numChilds.get(parent); 213 if (i != null) { 214 numChilds.put((Relation)parent, i+1); 215 } 216 } 217 } 218 for (Relation r : inR) { 219 if (numChilds.get(r).equals(0)) { 220 childlessR.add(r); 221 } 222 } 223 224 while (!childlessR.isEmpty()) { 225 // Identify one childless Relation and 226 // let it virtually die. This makes other 227 // relations childless. 228 Iterator<Relation> it = childlessR.iterator(); 229 Relation next = it.next(); 230 it.remove(); 231 outR.add(next); 232 233 for (OsmPrimitive parentPrim : next.getReferrers()) { 234 Relation parent = (Relation) parentPrim; 235 Integer i = numChilds.get(parent); 236 if (i != null) { 237 numChilds.put(parent, i-1); 238 if (i-1 == 0) { 239 childlessR.add(parent); 240 } 241 } 242 } 243 } 244 245 if (outR.size() != inR.size()) 246 throw new AssertionError("topo sort algorithm failed"); 247 248 out.addAll(outR); 249 250 return out; 251 } 252 252 253 @Override 253 254 public Object getDescription() { -
trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java
r3385 r3479 153 153 } else if (primitive instanceof Relation) { 154 154 clone = new Relation((Relation)primitive); 155 } 155 } else 156 throw new AssertionError(); 156 157 157 158 // use this structure to remember keys that have been set already so that -
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r3275 r3479 5 5 import java.util.Iterator; 6 6 import java.util.LinkedList; 7 import java.util.Stack;8 7 9 8 import org.openstreetmap.josm.Main; … … 79 78 c.undoCommand(); 80 79 redoCommands.addFirst(c); 81 if (commands.isEmpty()) 80 if (commands.isEmpty()) { 82 81 break; 82 } 83 83 } 84 84 fireCommandsChanged(); … … 107 107 c.executeCommand(); 108 108 commands.add(c); 109 if (redoCommands.isEmpty()) 109 if (redoCommands.isEmpty()) { 110 110 break; 111 } 111 112 } 112 113 fireCommandsChanged(); -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
r3425 r3479 6 6 import oauth.signpost.basic.DefaultOAuthConsumer; 7 7 import oauth.signpost.basic.DefaultOAuthProvider; 8 import oauth.signpost.signature.HmacSha1MessageSigner;9 8 10 9 import org.openstreetmap.josm.data.Preferences; … … 13 12 /** 14 13 * This class manages a set of OAuth parameters. 15 * 14 * 16 15 */ 17 16 public class OAuthParameters { … … 27 26 * Replies a set of default parameters for a consumer accessing the standard OSM server 28 27 * at http://api.openstreetmap.org/api 29 * 28 * 30 29 * @return a set of default parameters 31 30 */ … … 42 41 /** 43 42 * Replies a set of parameters as defined in the preferences. 44 * 43 * 45 44 * @param pref the preferences 46 45 * @return the parameters … … 61 60 /** 62 61 * Clears the preferences for OAuth parameters 63 * 62 * 64 63 * @param pref the preferences in which keys related to OAuth parameters are 65 64 * removed … … 84 83 /** 85 84 * Creates a clone of the parameters in <code>other</code>. 86 * 85 * 87 86 * @param other the other parameters. Must not be null. 88 87 * @throws IllegalArgumentException thrown if other is null … … 130 129 /** 131 130 * Builds an {@see OAuthConsumer} based on these parameters 132 * 131 * 133 132 * @return the consumer 134 133 */ … … 140 139 /** 141 140 * Builds an {@see OAuthProvider} based on these parameters and a OAuth consumer <code>consumer</code>. 142 * 141 * 143 142 * @param consumer the consumer. Must not be null. 144 143 * @return the provider -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r3471 r3479 326 326 */ 327 327 public void fireSelectionChanged(){ 328 synchronized (selListeners) { 329 Collection<? extends OsmPrimitive> currentSelection = getSelected(); 330 for (SelectionChangedListener l : selListeners) { 331 l.selectionChanged(currentSelection); 332 } 328 Collection<? extends OsmPrimitive> currentSelection = getSelected(); 329 for (SelectionChangedListener l : selListeners) { 330 l.selectionChanged(currentSelection); 333 331 } 334 332 } -
trunk/src/org/openstreetmap/josm/data/osm/Tag.java
r3083 r3479 68 68 } 69 69 70 @Override71 public Tag clone() {72 return new Tag(this);73 }74 75 70 /** 76 71 * Replies true if the key of this tag is equal to <code>key</code>. -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r3181 r3479 5 5 6 6 import java.awt.Color; 7 import java.awt.Dimension;8 7 import java.awt.Font; 9 8 import java.awt.GridBagConstraints; 10 9 import java.awt.GridBagLayout; 11 10 import java.awt.Insets; 12 import java.awt.Toolkit;13 11 import java.awt.event.MouseAdapter; 14 12 import java.awt.event.MouseEvent; -
trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
r3105 r3479 24 24 import java.util.Set; 25 25 import java.util.Vector; 26 import java.util.logging.Logger;27 26 import java.util.regex.Matcher; 28 27 import java.util.regex.Pattern; … … 55 54 * TileSelectionBBoxChooser allows to select a bounding box (i.e. for downloading) based 56 55 * on OSM tile numbers. 57 * 56 * 58 57 * TileSelectionBBoxChooser can be embedded as component in a Swing container. Example: 59 58 * <pre> … … 70 69 * } 71 70 * }); 72 * 71 * 73 72 * // init the chooser with a bounding box 74 73 * chooser.setBoundingBox(....); 75 * 74 * 76 75 * f.setVisible(true); 77 76 * </pre> 78 77 */ 79 78 public class TileSelectionBBoxChooser extends JPanel implements BBoxChooser{ 80 81 static private final Logger logger = Logger.getLogger(TileSelectionBBoxChooser.class.getName());82 79 83 80 /** the current bounding box */ … … 129 126 /** 130 127 * Replies the current bounding box. null, if no valid bounding box is currently selected. 131 * 128 * 132 129 */ 133 130 public Bounds getBoundingBox() { … … 137 134 /** 138 135 * Sets the current bounding box. 139 * 136 * 140 137 * @param bbox the bounding box. null, if this widget isn't initialized with a bounding box 141 138 */ … … 162 159 /** 163 160 * Computes the bounding box given a tile grid. 164 * 161 * 165 162 * @param tb the description of the tile grid 166 163 * @return the bounding box … … 177 174 /** 178 175 * Replies lat/lon of the north/west-corner of a tile at a specific zoom level 179 * 176 * 180 177 * @param tile the tile address (x,y) 181 178 * @param zoom the zoom level … … 205 202 /** 206 203 * A panel for describing a rectangular area of OSM tiles at a given zoom level. 207 * 204 * 208 205 * The panel emits PropertyChangeEvents for the property {@see TileGridInputPanel#TILE_BOUNDS_PROP} 209 206 * when the user successfully enters a valid tile grid specification. … … 572 569 /** 573 570 * Validates the x- or y-coordinate of a tile at a given zoom level. 574 * 571 * 575 572 */ 576 573 static private class TileCoordinateValidator extends AbstractTextComponentValidator { … … 653 650 */ 654 651 static private class TileBoundsMapView extends JMapViewer { 655 private Bounds bbox;656 652 private Point min; 657 653 private Point max; … … 662 658 663 659 public void setBoundingBox(Bounds bbox){ 664 this.bbox = bbox;665 660 if (bbox == null) { 666 661 min = null; -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java
r3210 r3479 35 35 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 36 36 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 37 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;38 37 import org.openstreetmap.josm.tools.ImageProvider; 39 38 -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandListMutableTreeNode.java
r3262 r3479 4 4 import javax.swing.tree.DefaultMutableTreeNode; 5 5 6 import org.openstreetmap.josm.command.Command;7 6 import org.openstreetmap.josm.command.PseudoCommand; 8 7 -
trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
r3363 r3479 2 2 package org.openstreetmap.josm.gui.dialogs; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;5 4 import static org.openstreetmap.josm.tools.I18n.tr; 6 5 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r3083 r3479 439 439 private JMultilineLabel lblMessage; 440 440 private Changeset current; 441 private DownloadAction actDownload;442 441 443 442 protected void build() { … … 447 446 ); 448 447 add(lblMessage); 449 add(new JButton( actDownload =new DownloadAction()));448 add(new JButton(new DownloadAction())); 450 449 451 450 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberRoleCellEditor.java
r3214 r3479 9 9 import javax.swing.table.TableCellEditor; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.osm.DataSet; 13 12 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 14 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;15 13 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 16 14 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java
r3083 r3479 42 42 private JCheckBox cbReadFull; 43 43 private EditAction editAction; 44 private final GenericRelationEditor relationEditor;45 44 46 45 /** … … 70 69 71 70 public ReferringRelationsBrowser(OsmDataLayer layer, ReferringRelationsBrowserModel model, GenericRelationEditor relationEditor) { 72 this.relationEditor = relationEditor;73 71 this.model = model; 74 72 this.layer = layer; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java
r3200 r3479 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import java.awt.Dimension;5 4 import java.awt.Point; 6 import java.awt.Toolkit;7 5 import java.awt.event.WindowAdapter; 8 6 import java.awt.event.WindowEvent; … … 235 233 protected boolean hasEditorWithCloseUpperLeftCorner(Point p, RelationEditor thisEditor) { 236 234 for (RelationEditor editor: openDialogs.values()) { 237 if (editor == thisEditor) 235 if (editor == thisEditor) { 238 236 continue; 237 } 239 238 Point corner = editor.getLocation(); 240 239 if (p.x >= corner.x -5 && corner.x + 5 >= p.x -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r2990 r3479 34 34 /** The image currently displayed */ 35 35 private Image image = null; 36 private Image image_c = null;37 36 38 37 /** The image currently displayed */ 39 38 private boolean errorLoading = false; 40 private boolean errorLoading_c = false;41 39 42 40 /** The rectangle (in image coordinates) of the image that is visible. This rectangle is calculated 43 41 * each time the zoom is modified */ 44 42 private Rectangle visibleRect = null; 45 private Rectangle visibleRect_c = null;46 43 47 44 /** When a selection is done, the rectangle of the selection (in image coordinates) */ -
trunk/src/org/openstreetmap/josm/gui/preferences/StyleSourceEditor.java
r3474 r3479 773 773 r = new InputStreamReader(stream); 774 774 } 775 BufferedReaderreader = new BufferedReader(r);775 reader = new BufferedReader(r); 776 776 777 777 String line; -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r3385 r3479 118 118 AutoCompletionListItem bestItem = null; 119 119 for (int i = 0, n = model.getSize(); i < n; i++) { 120 AutoCompletionListItem currentItem = (AutoCompletionListItem) model.getElementAt(i); ;120 AutoCompletionListItem currentItem = (AutoCompletionListItem) model.getElementAt(i); 121 121 if (currentItem.getValue().startsWith(pattern)) { 122 122 if (bestItem == null || currentItem.getPriority().compareTo(bestItem.getPriority()) > 0) { -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r3289 r3479 4 4 import java.util.ArrayList; 5 5 import java.util.Collection; 6 import java.util.Comparator;7 6 import java.util.Collections; 8 7 import java.util.HashSet; 9 8 import java.util.List; 10 9 import java.util.Map; 10 import java.util.Set; 11 11 import java.util.Map.Entry; 12 import java.util.Set; 13 import java.util.TreeSet; 14 import java.util.logging.Logger; 15 12 13 import org.openstreetmap.josm.data.osm.DataSet; 16 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 15 import org.openstreetmap.josm.data.osm.OsmUtils; 18 16 import org.openstreetmap.josm.data.osm.Relation; 19 17 import org.openstreetmap.josm.data.osm.RelationMember; 20 import org.openstreetmap.josm.data.osm.DataSet;21 18 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; 22 19 import org.openstreetmap.josm.data.osm.event.DataChangedEvent; … … 28 25 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 29 26 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 30 import org.openstreetmap.josm.gui.MapView;31 import org.openstreetmap.josm.gui.layer.Layer;32 import org.openstreetmap.josm.gui.layer.OsmDataLayer;33 27 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 34 28 import org.openstreetmap.josm.tools.MultiMap; … … 70 64 */ 71 65 protected static MultiMap<String, String> presetTagCache = new MultiMap<String, String>(); 72 /** 73 * the cached list of member roles 66 /** 67 * the cached list of member roles 74 68 * only accessed by getRoleCache(), rebuild() and cacheRelationMemberRoles() 75 69 * use getRoleCache() accessor … … 187 181 TaggingPreset.Roles r = (TaggingPreset.Roles) item; 188 182 for (TaggingPreset.Role i : r.roles) { 189 if (i.key != null) 183 if (i.key != null) { 190 184 presetRoleCache.add(i.key); 185 } 191 186 } 192 187 } -
trunk/src/org/openstreetmap/josm/gui/tagging/tagging-preset.xsd
r3321 r3479 161 161 <attribute name="requisite" type="string"/> 162 162 <attribute name="type" type="string"/> 163 <attribute name="count" type="integer"/> 163 164 </complexType> 164 165 -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r3456 r3479 32 32 import org.openstreetmap.josm.data.osm.RelationMember; 33 33 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 34 import org.openstreetmap.josm.data.osm.Storage;35 34 import org.openstreetmap.josm.data.osm.User; 36 35 import org.openstreetmap.josm.data.osm.Way; -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r3380 r3479 7 7 import java.io.ByteArrayInputStream; 8 8 import java.io.File; 9 import java.io.FileOutputStream; 9 10 import java.io.FilenameFilter; 10 import java.io.FileOutputStream;11 11 import java.io.IOException; 12 12 import java.io.InputStream; … … 48 48 private List<PluginInformation> availablePlugins; 49 49 50 protected enum CacheType {PLUGIN_LIST, ICON_LIST} ;50 protected enum CacheType {PLUGIN_LIST, ICON_LIST} 51 51 52 52 protected void init(Collection<String> sites){ … … 60 60 /** 61 61 * Creates the task 62 * 62 * 63 63 * @param sites the collection of download sites. Defaults to the empty collection if null. 64 64 */ … … 70 70 /** 71 71 * Creates the task 72 * 72 * 73 73 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null 74 74 * @param sites the collection of download sites. Defaults to the empty collection if null. … … 96 96 * Creates the file name for the cached plugin list and the icon cache 97 97 * file. 98 * 98 * 99 99 * @param site the name of the site 100 100 * @param type icon cache or plugin list cache … … 122 122 } 123 123 switch (type) { 124 125 126 127 128 129 124 case PLUGIN_LIST: 125 sb.append(".txt"); 126 break; 127 case ICON_LIST: 128 sb.append("-icons.zip"); 129 break; 130 130 } 131 131 name = sb.toString(); … … 138 138 /** 139 139 * Downloads the list from a remote location 140 * 140 * 141 141 * @param site the site URL 142 142 * @param monitor a progress monitor … … 150 150 String pl = Main.pref.getCollectionAsString("plugins"); 151 151 String printsite = site.replaceAll("%<(.*)>", ""); 152 if(pl != null && pl.length() != 0) 152 if(pl != null && pl.length() != 0) { 153 153 site = site.replaceAll("%<(.*)>", "$1"+pl); 154 else154 } else { 155 155 site = printsite; 156 } 156 157 157 158 monitor.beginTask(""); … … 257 258 /** 258 259 * Writes the list of plugins to a cache file 259 * 260 * 260 261 * @param site the site from where the list was downloaded 261 262 * @param list the downloaded list … … 288 289 * Filter information about deprecated plugins from the list of downloaded 289 290 * plugins 290 * 291 * 291 292 * @param plugins the plugin informations 292 293 * @return the plugin informations, without deprecated plugins … … 306 307 /** 307 308 * Parses the plugin list 308 * 309 * 309 310 * @param site the site from where the list was downloaded 310 311 * @param doc the document with the plugin list … … 335 336 for (String location : PluginInformation.getPluginLocations()) { 336 337 File [] f = new File(location).listFiles( 337 new FilenameFilter() { 338 public boolean accept(File dir, String name) { 339 return name.matches("^([0-9]+-)?site.*\\.txt$") || 340 name.matches("^([0-9]+-)?site.*-icons\\.zip$"); 338 new FilenameFilter() { 339 public boolean accept(File dir, String name) { 340 return name.matches("^([0-9]+-)?site.*\\.txt$") || 341 name.matches("^([0-9]+-)?site.*-icons\\.zip$"); 342 } 341 343 } 342 }343 344 ); 344 if(f != null && f.length > 0) 345 if(f != null && f.length > 0) { 345 346 siteCacheFiles.addAll(Arrays.asList(f)); 347 } 346 348 } 347 349 … … 382 384 /** 383 385 * Replies the list of plugins described in the downloaded plugin lists 384 * 386 * 385 387 * @return the list of plugins 386 388 */ -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r3473 r3479 20 20 */ 21 21 ProjData[] data = { 22 new ProjData("Zimmerwald", d(7,27,54.983506), d(46,52,37.540562), 947.149, 602030.680, 191775.030, 897.915), 23 new ProjData("Chrischona", d(7,40,6.983077), d(47,34, 1.385301), 504.935, 617306.300, 268507.300, 456.064), 24 new ProjData("Pfaender", d(9,47,3.697723), d(47,30,55.172797), 1089.372, 776668.105, 265372.681, 1042.624), 25 new ProjData("La Givrine", d(6,6,7.326361), d(46,27,14.690021), 1258.274, 497313.292, 145625.438, 1207.434), 26 new ProjData("Monte Generoso", d(9,1,16.389053), d(45,55,45.438020), 1685.027, 722758.810, 87649.670, 1636.600) }; 22 new ProjData("Zimmerwald", d(7,27,54.983506), d(46,52,37.540562), 947.149, 602030.680, 191775.030, 897.915), 23 new ProjData("Chrischona", d(7,40,6.983077), d(47,34, 1.385301), 504.935, 617306.300, 268507.300, 456.064), 24 new ProjData("Pfaender", d(9,47,3.697723), d(47,30,55.172797), 1089.372, 776668.105, 265372.681, 1042.624), 25 new ProjData("La Givrine", d(6,6,7.326361), d(46,27,14.690021), 1258.274, 497313.292, 145625.438, 1207.434), 26 new ProjData("Monte Generoso", d(9,1,16.389053), d(45,55,45.438020), 1685.027, 722758.810, 87649.670, 1636.600) }; 27 27 28 28 private double d(double deg, double min, double sec) { 29 29 return deg + min / 60. + sec / 3600.; 30 30 } 31 32 private class ProjData { 31 32 private static class ProjData { 33 33 public String name; 34 34 public LatLon ll; … … 52 52 } 53 53 assertTrue(errs, errs.length() == 0); 54 } 54 } 55 55 56 56 @Test … … 130 130 assertTrue("Berne", Math.abs(ll.lon() - (7.0 + 26.0 / 60 + 19.076595154147 / 3600)) < 0.00001); 131 131 } 132 132 133 133 { 134 134 EastNorth en = new EastNorth(700000.0, 100000.0); … … 142 142 143 143 /** 144 * Send and return should have less than 2mm of difference. 144 * Send and return should have less than 2mm of difference. 145 145 */ 146 146 @Test … … 185 185 assertTrue("Berne", Math.abs(en.north() - en2.north()) < 0.002); 186 186 } 187 187 188 188 { 189 189 EastNorth en = new EastNorth(700000.0, 100000.0);
Note:
See TracChangeset
for help on using the changeset viewer.