- Timestamp:
- 2009-06-17T10:04:22+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExitAction.java
r1286 r1677 28 28 Main.saveGuiGeometry(); 29 29 System.exit(0); 30 30 } 31 31 } 32 32 } -
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r1676 r1677 107 107 p.add(warning, GBC.eol().fill(GBC.HORIZONTAL).insets(15,0,0,0)); 108 108 addDependencies(author, authorName, email, copyright, predefined, copyrightYear, nameLabel, emailLabel, copyrightLabel, copyrightYearLabel, warning); 109 109 110 110 // if the user name is not the email address, but the osm user name 111 111 // move it from the email textfield to the author textfield … … 119 119 p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL)); 120 120 121 int answer = new ExtendedDialog(Main.parent, 122 tr("Export options"), 121 int answer = new ExtendedDialog(Main.parent, 122 tr("Export options"), 123 123 p, 124 new String[] {tr("Export and Save"), tr("Cancel")}, 125 new String[] {"exportgpx.png", "cancel.png"}).getValue(); 124 new String[] {tr("Export and Save"), tr("Cancel")}, 125 new String[] {"exportgpx.png", "cancel.png"}).getValue(); 126 126 if (answer != 1) 127 127 return; … … 140 140 else 141 141 gpxData = OsmDataLayer.toGpxData(Main.ds, file); 142 142 143 143 // add author and copyright details to the gpx data 144 144 if(author.isSelected()) { … … 151 151 if(copyrightYear.getText().length() > 0) gpxData.attr.put(GpxData.META_COPYRIGHT_YEAR, copyrightYear.getText()); 152 152 } 153 153 154 154 // add the description to the gpx data 155 155 if(desc.getText().length() > 0) gpxData.attr.put(GpxData.META_DESC, desc.getText()); 156 156 157 157 // add keywords to the gpx data 158 158 if(keywords.getText().length() > 0) gpxData.attr.put(GpxData.META_KEYWORDS, keywords.getText()); 159 159 160 160 try { 161 161 FileOutputStream fo = new FileOutputStream(file); -
trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java
r1586 r1677 32 32 /** 33 33 * replies the base URL for browsing the the history of an OSM primitive 34 * 34 * 35 35 * @return the base URL, i.e. http://api.openstreetmap.org/browse 36 36 */ … … 43 43 } 44 44 return ret; 45 } 46 45 } 46 47 47 public void actionPerformed(ActionEvent e) { 48 final Collection<Object> sel = new LinkedList<Object>(); 48 final Collection<Object> sel = new LinkedList<Object>(); 49 49 final String baseUrl = getBaseURL(); 50 50 new AbstractVisitor() { -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r1530 r1677 145 145 for (HashSet<Node> nodelinks : backlinks.values()) { 146 146 if (!nodelinks.containsAll(allNodes)) { 147 int option = new ExtendedDialog(Main.parent, 148 tr("Merge nodes with different memberships?"), 147 int option = new ExtendedDialog(Main.parent, 148 tr("Merge nodes with different memberships?"), 149 149 tr("The selected nodes have differing relation memberships. " 150 150 + "Do you still want to merge them?"), 151 new String[] {tr("Merge Anyway"), tr("Cancel")}, 152 new String[] {"mergenodes.png", "cancel.png"}).getValue(); 151 new String[] {tr("Merge Anyway"), tr("Cancel")}, 152 new String[] {"mergenodes.png", "cancel.png"}).getValue(); 153 153 if (option == 1) break; 154 154 return null; … … 186 186 187 187 if (!components.isEmpty()) { 188 int answer = new ExtendedDialog(Main.parent, 189 tr("Enter values for all conflicts."), 188 int answer = new ExtendedDialog(Main.parent, 189 tr("Enter values for all conflicts."), 190 190 p, 191 new String[] {tr("Solve Conflicts"), tr("Cancel")}, 192 new String[] {"dialogs/conflict.png", "cancel.png"}).getValue(); 191 new String[] {tr("Solve Conflicts"), tr("Cancel")}, 192 new String[] {"dialogs/conflict.png", "cancel.png"}).getValue(); 193 193 if (answer != 1) 194 194 return null; -
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r1415 r1677 43 43 all.add(urltext, GBC.eol()); 44 44 all.add(layer, GBC.eol()); 45 int answer = new ExtendedDialog(Main.parent, 46 tr("Download Location"), 45 int answer = new ExtendedDialog(Main.parent, 46 tr("Download Location"), 47 47 all, 48 new String[] {tr("Download URL"), tr("Cancel")}, 49 new String[] {"download.png", "cancel.png"}).getValue(); 48 new String[] {tr("Download URL"), tr("Cancel")}, 49 new String[] {"download.png", "cancel.png"}).getValue(); 50 50 if (answer != 1) return; 51 51 openUrl(layer.isSelected(), urltext.getText()); -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r1676 r1677 150 150 if (gpxImExporter.acceptFile(file)) 151 151 GpxExportAction.exportGpx(file, layer); 152 else if (osmImExporter.acceptFile(file) 152 else if (osmImExporter.acceptFile(file) 153 153 || osmGzipImporter.acceptFile(file) 154 || osmBzip2Importer.acceptFile(file)) 154 || osmBzip2Importer.acceptFile(file)) 155 155 { 156 156 // use a tmp file because if something errors out in the … … 171 171 out = new CBZip2OutputStream(out); 172 172 } 173 Writer writer = new OutputStreamWriter(out, "UTF-8"); 173 Writer writer = new OutputStreamWriter(out, "UTF-8"); 174 174 175 175 OsmWriter w = new OsmWriter(new PrintWriter(writer), false, layer.data.version); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r1636 r1677 35 35 * 36 36 * This is the opposite of the MergeNodesAction. 37 * 37 * 38 38 * If a single node is selected, it will copy that node and remove all tags from the old one 39 39 */ … … 62 62 63 63 Collection<OsmPrimitive> selection = Main.ds.getSelected(); 64 64 65 65 String errMsg = null; 66 66 if (checkSelection(selection)) { … … 121 121 "own copy and all nodes will be selected."); 122 122 } 123 123 124 124 if(errMsg != null) 125 125 JOptionPane.showMessageDialog(Main.parent, errMsg); 126 126 127 127 selectedNode = null; 128 128 selectedWay = null; 129 129 selectedNodes = null; 130 130 } 131 131 132 132 /** 133 133 * Assumes there is one tagged Node stored in selectedNode that it will try to unglue … … 141 141 c.selected = false; 142 142 cmds.add(new ChangeCommand(selectedNode, c)); 143 143 144 144 Node n = new Node(selectedNode); 145 145 n.id = 0; 146 146 147 147 // If this wasn't called from menu, place it where the cursor is/was 148 148 if(e.getSource() instanceof JPanel) { … … 150 150 n.setEastNorth(mv.getEastNorth(mv.lastMEvent.getX(), mv.lastMEvent.getY())); 151 151 } 152 152 153 153 cmds.add(new AddCommand(n)); 154 154 155 155 fixRelations(selectedNode, cmds, Collections.singletonList(n)); 156 156 157 157 Main.main.undoRedo.add(new SequenceCommand(tr("Unglued Node"), cmds)); 158 158 Main.ds.setSelected(n); 159 159 Main.map.mapView.repaint(); 160 160 } 161 161 162 162 /** 163 163 * Checks if selection is suitable for ungluing. This is the case when there's a single, 164 164 * tagged node selected that's part of at least one way (ungluing an unconnected node does 165 165 * not make sense. Due to the call order in actionPerformed, this is only called when the 166 * node is only part of one or less ways. 167 * 166 * node is only part of one or less ways. 167 * 168 168 * @param The selection to check against 169 169 * @return Selection is suitable … … 184 184 if(!isPartOfWay) 185 185 return false; 186 186 187 187 selectedNode = (Node)n; 188 188 return selectedNode.isTagged(); -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r1670 r1677 42 42 * An dialog is displayed asking the user to specify a rectangle to grab. 43 43 * The url and account settings from the preferences are used. 44 * 44 * 45 45 * If the upload fails this action offers various options to resolve conflicts. 46 46 * … … 236 236 * Synchronizes the local state of an {@see OsmPrimitive} with its state on the 237 237 * server. The method uses an individual GET for the primitive. 238 * 238 * 239 239 * @param id the primitive ID 240 240 */ … … 286 286 /** 287 287 * Synchronizes the local state of the dataset with the state on the server. 288 * 288 * 289 289 * Reuses the functionality of {@see UpdateDataAction}. 290 * 290 * 291 291 * @see UpdateDataAction#actionPerformed(ActionEvent) 292 292 */ … … 299 299 * Handles the case that a conflict in a specific {@see OsmPrimitive} was detected while 300 300 * uploading 301 * 301 * 302 302 * @param primitiveType the type of the primitive, either <code>node</code>, <code>way</code> or 303 303 * <code>relation</code> … … 349 349 * Handles the case that a conflict was detected while uploading where we don't 350 350 * know what {@see OsmPrimitive} actually caused the conflict (for whatever reason) 351 * 351 * 352 352 */ 353 353 protected void handleUploadConflictForUnknownConflict() { … … 387 387 /** 388 388 * handles an upload conflict, i.e. an error indicated by a HTTP return code 409. 389 * 389 * 390 390 * @param e the exception 391 391 */ … … 404 404 /** 405 405 * Handles an upload error due to a violated precondition, i.e. a HTTP return code 412 406 * 406 * 407 407 * @param e the exception 408 408 */ … … 428 428 * {@see OsmPrimitive}, i.e. a HTTP response code 410, where we know what 429 429 * {@see OsmPrimitive} is responsible for the error. 430 * 430 * 431 431 * Reuses functionality of the {@see UpdateSelectionAction} to resolve 432 432 * conflicts due to mismatches in the deleted state. 433 * 433 * 434 434 * @param primitiveType the type of the primitive 435 435 * @param id the id of the primitive 436 * 436 * 437 437 * @see UpdateSelectionAction#handlePrimitiveGoneException(long) 438 438 */ … … 446 446 * {@see OsmPrimitive}, i.e. a HTTP response code 410, where we don't know which 447 447 * {@see OsmPrimitive} is causing the error. 448 * 448 * 449 449 * @param e the exception 450 450 */ … … 472 472 * Note that an <strong>update</strong> on an already deleted object results 473 473 * in a 409, not a 410. 474 * 474 * 475 475 * @param e the exception 476 476 */ … … 490 490 /** 491 491 * error handler for any exception thrown during upload 492 * 492 * 493 493 * @param e the exception 494 494 */ … … 543 543 /** 544 544 * handles an exception caught during OSM API initialization 545 * 545 * 546 546 * @param e the exception 547 547 */ -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r1457 r1677 131 131 return tr("Click to delete. Shift: delete way segment. Alt: don't delete unused nodes when deleting a way. Ctrl: delete referring objects."); 132 132 } 133 133 134 134 @Override public boolean layerIsSupported(Layer l) { 135 135 return l instanceof OsmDataLayer; -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1640 r1677 395 395 396 396 // If the above does not apply, the selection is cleared and a new try is started 397 398 399 397 400 398 boolean extendedWay = false; 401 399 boolean wayIsFinishedTemp = wayIsFinished; 402 400 wayIsFinished = false; 403 401 404 402 // don't draw lines if shift is held 405 403 if (selection.size() > 0 && !shift) { … … 925 923 } 926 924 } 927 928 925 return rv; 929 926 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r1640 r1677 218 218 mousePos = e.getPoint(); 219 219 initialMousePos = e.getPoint(); 220 220 221 221 if(selectedSegment != null) 222 222 Main.ds.setSelected(selectedSegment.way); … … 268 268 } 269 269 } 270 271 272 273 270 271 @Override public boolean layerIsSupported(Layer l) { 272 return l instanceof OsmDataLayer; 273 } 274 274 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java
r1379 r1677 72 72 Main.map.selectMapMode(this); 73 73 } 74 74 75 75 // By default, all tools will work with all layers. Can be overwritten to require 76 76 // a special type of layer -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r1641 r1677 80 80 81 81 JPanel right = new JPanel(); 82 JLabel description = 82 JLabel description = 83 83 new JLabel("<html><ul>" 84 84 + "<li>"+tr("<b>Baker Street</b> - 'Baker' and 'Street' in any key or name.")+"</li>" … … 110 110 p.add(left); 111 111 p.add(right); 112 113 int result = new ExtendedDialog(Main.parent, 114 tr("Search"), 112 113 int result = new ExtendedDialog(Main.parent, 114 tr("Search"), 115 115 p, 116 new String[] {tr("Start Search"), tr("Cancel")}, 117 new String[] {"dialogs/search.png", "cancel.png"}).getValue(); 116 new String[] {tr("Start Search"), tr("Cancel")}, 117 new String[] {"dialogs/search.png", "cancel.png"}).getValue(); 118 118 if(result != 1) return; 119 119 -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r1574 r1677 19 19 */ 20 20 public class GpxData extends WithAttributes { 21 21 22 22 public static final String META_PREFIX = "meta."; 23 public static final String META_AUTHOR_NAME = META_PREFIX + "author.name"; 23 public static final String META_AUTHOR_NAME = META_PREFIX + "author.name"; 24 24 public static final String META_AUTHOR_EMAIL = META_PREFIX + "author.email"; 25 25 public static final String META_AUTHOR_LINK = META_PREFIX + "author.link"; … … 32 32 public static final String META_NAME = META_PREFIX + "name"; 33 33 public static final String META_TIME = META_PREFIX + "time"; 34 34 35 35 public File storageFile; 36 36 public boolean fromServer; -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r1523 r1677 3 3 4 4 import org.openstreetmap.josm.data.osm.visitor.Visitor; 5 6 7 8 5 9 6 /** … … 33 30 return 1; 34 31 } 35 36 37 32 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r1670 r1677 278 278 * returns a primitive with a given id from the data set. null, if no such primitive 279 279 * exists 280 * 280 * 281 281 * @param id the id, > 0 required 282 282 * @return the primitive -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r1670 r1677 132 132 /** 133 133 * removes all members with member.member == primitive 134 * 134 * 135 135 * @param primitive the primitive to check for 136 136 */ -
trunk/src/org/openstreetmap/josm/data/osm/User.java
r1604 r1677 21 21 /** the username. */ 22 22 public String name; 23 23 24 24 /** the user ID (since API 0.6) */ 25 25 public String uid; -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r1611 r1677 185 185 186 186 public boolean isFirstLastNode(Node n) { 187 if (incomplete || nodes.size() == 0) return false; 187 if (incomplete || nodes.size() == 0) return false; 188 188 return n == firstNode() || n == lastNode(); 189 189 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/AbstractVisitor.java
r1523 r1677 6 6 /** 7 7 * This class serves as a base class for most simple visitors, 8 * blocking out the "changeset" visit so as to avoid cluttering 8 * blocking out the "changeset" visit so as to avoid cluttering 9 9 * the visitors which are not interested. 10 * 10 * 11 11 * @author fred 12 12 */ -
trunk/src/org/openstreetmap/josm/data/osm/visitor/CreateOsmChangeVisitor.java
r1523 r1677 38 38 // need to set osmConform = false here so that negative IDs get transmitted. 39 39 // this also enables unnecessary and (if the API were more strict) potentially 40 // harmful action="..." attributes. 40 // harmful action="..." attributes. 41 41 osmwriter = new OsmWriter(writer, false, api.getVersion()); 42 42 osmwriter.setChangeset(changeset); … … 45 45 // FIXME: This should really NOT use a visitor pattern, it looks 46 46 // stupid. Just have one method named "write" instead of three "visit"s. 47 47 48 48 public void visit(Node n) { 49 49 if (n.deleted) { … … 79 79 } 80 80 } 81 81 82 82 private void switchMode(String newMode) { 83 83 if ((newMode != null && !newMode.equals(currentMode))||(newMode == null && currentMode != null)) { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1640 r1677 268 268 int tmpWidth = (int) (100 / (float) (circum / realWidth)); 269 269 if (tmpWidth > width) width = tmpWidth; 270 270 271 271 /* if we have a "width" tag, try use it */ 272 272 /* (this might be slow and could be improved by caching the value in the Way, on the other hand only used if "real width" is enabled) */ -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r1640 r1677 218 218 /** 219 219 * Tries to merge a primitive <code>other</code> into an existing primitive with the same id. 220 * 221 * @param myPrimitives the complete set of my primitives (potential merge targets) 220 * 221 * @param myPrimitives the complete set of my primitives (potential merge targets) 222 222 * @param myPrimitivesWithID the map of primitives (potential merge targets) with an id <> 0, for faster lookup 223 * by id. Key is the id, value the primitive with the given value. myPrimitives.valueSet() is a 223 * by id. Key is the id, value the primitive with the given value. myPrimitives.valueSet() is a 224 224 * subset of primitives. 225 225 * @param other the other primitive which is to be merged with a primitive in primitives if possible 226 * @return true, if this method was able to merge <code>other</code> with an existing node; false, otherwise 226 * @return true, if this method was able to merge <code>other</code> with an existing node; false, otherwise 227 227 */ 228 228 private <P extends OsmPrimitive> boolean mergeById( 229 229 Collection<P> myPrimitives, HashMap<Long, P> myPrimitivesWithID, P other) { 230 230 231 231 // merge other into an existing primitive with the same id, if possible 232 232 // … … 246 246 } 247 247 248 // try to merge into one of the existing primitives 248 // try to merge into one of the existing primitives 249 249 // 250 250 for (P my : myPrimitives) { -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r1523 r1677 205 205 } 206 206 } 207 } 208 207 } 208 } -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r1440 r1677 112 112 statusLine = new MapStatus(this); 113 113 } 114 114 115 115 public void selectSelectTool(boolean onlyIfModeless) { 116 116 if(onlyIfModeless && !Main.pref.getBoolean("modeless", false)) 117 117 return; 118 118 119 119 selectMapMode((MapMode)getDefaultButtonAction()); 120 120 } 121 121 122 122 public void selectDrawTool(boolean onlyIfModeless) { 123 123 if(onlyIfModeless && !Main.pref.getBoolean("modeless", false)) 124 124 return; 125 125 126 126 Action drawAction = ((AbstractButton)toolBarActions.getComponent(1)).getAction(); 127 127 selectMapMode((MapMode)drawAction); … … 144 144 // remove menu entries 145 145 Main.main.menu.viewMenu.setVisible(false); 146 146 147 147 // MapFrame gets destroyed when the last layer is removed, but the status line background 148 148 // thread that collects the information doesn't get destroyed automatically. -
trunk/src/org/openstreetmap/josm/gui/MapMover.java
r1518 r1677 185 185 186 186 // New center position so that point under the mouse pointer stays the same place as it was before zooming 187 // You will get the formula by simplifying this expression: newCenter = oldCenter + mouseCoordinatesInNewZoom - mouseCoordinatesInOldZoom 187 // You will get the formula by simplifying this expression: newCenter = oldCenter + mouseCoordinatesInNewZoom - mouseCoordinatesInOldZoom 188 188 double newX = nc.center.east() - (e.getX() - nc.getWidth()/2.0) * (newScale - nc.scale); 189 189 double newY = nc.center.north() + (e.getY() - nc.getHeight()/2.0) * (newScale - nc.scale); 190 190 191 191 nc.zoomTo(new EastNorth(newX, newY), newScale); 192 192 } -
trunk/src/org/openstreetmap/josm/gui/MapSlider.java
r1415 r1677 27 27 public void propertyChange(PropertyChangeEvent evt) { 28 28 if (getModel().getValueIsAdjusting()) return; 29 29 30 30 double sizex = this.mv.scale * this.mv.getWidth(); 31 31 double sizey = this.mv.scale * this.mv.getHeight(); -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r1440 r1677 105 105 */ 106 106 public Thread thread; 107 107 108 108 /** 109 109 * The collector class that waits for notification and then update … … 353 353 return "Statusline"; 354 354 } 355 355 356 356 @Override 357 357 public void addMouseListener(MouseListener ml) { -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r1662 r1677 89 89 @Override public void componentResized(ComponentEvent e) { 90 90 removeComponentListener(this); 91 91 92 92 MapSlider zoomSlider = new MapSlider(MapView.this); 93 93 add(zoomSlider); … … 190 190 return activeLayer != null && activeLayer instanceof OsmDataLayer; 191 191 } 192 192 193 193 public Boolean isVisibleDrawableLayer() { 194 194 return isDrawableLayer() && activeLayer.visible; 195 195 } 196 196 197 197 198 198 /** -
trunk/src/org/openstreetmap/josm/gui/ScrollViewport.java
r1180 r1677 170 170 } 171 171 break; 172 default : 172 default : 173 173 throw new IllegalStateException("Unknown direction : [0]" + direction); 174 174 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r1652 r1677 193 193 /** 194 194 * removes a conflict registered for {@see OsmPrimitive} <code>my</code> 195 * 195 * 196 196 * @param my the {@see OsmPrimitive} for which a conflict is registered 197 197 * with this dialog … … 209 209 * by a pair of {@see OsmPrimitive} with differences in their tag sets, 210 210 * their node lists (for {@see Way}s) or their member lists (for {@see Relation}s) 211 * 211 * 212 212 * @param my my version of the {@see OsmPrimitive} 213 213 * @param their their version of the {@see OsmPrimitive} -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java
r1654 r1677 27 27 /** 28 28 * This is an extended dialog for resolving conflict between {@see OsmPrimitive}. 29 * 29 * 30 30 * 31 31 */ … … 39 39 /** 40 40 * restore position and size on screen from preference settings 41 * 41 * 42 42 */ 43 43 protected void restorePositionAndDimension() { … … 79 79 /** 80 80 * remember position and size on screen in the preferences 81 * 81 * 82 82 */ 83 83 protected void rememberPositionAndDimension() { … … 104 104 /** 105 105 * builds the sub panel with the control buttons 106 * 106 * 107 107 * @return the panel 108 108 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r1397 r1677 80 80 tr("There are unsaved changes. Delete the layer anwyay?"), 81 81 new String[] {tr("Delete Layer"), tr("Cancel")}, 82 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 82 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 83 83 84 84 if(result != 1) return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r1599 r1677 53 53 */ 54 54 private JList displaylist = new JList(list); 55 55 56 56 private SideButton sbEdit = new SideButton(marktr("Edit"), "edit", "Selection", tr( "Open an editor for the selected relation"), new ActionListener() { 57 57 public void actionPerformed(ActionEvent e) { … … 62 62 } 63 63 }); 64 64 65 65 private SideButton sbDel = new SideButton(marktr("Delete"), "delete", "Selection", tr("Delete the selected relation"), new ActionListener() { 66 66 public void actionPerformed(ActionEvent e) { … … 68 68 if (toDelete == null) 69 69 return; 70 70 71 71 Main.main.undoRedo.add( 72 72 new DeleteCommand(Collections.singleton(toDelete))); … … 102 102 Layer.listeners.add(this); 103 103 add(buttonPanel, BorderLayout.SOUTH); 104 104 105 105 displaylist.addListSelectionListener(new ListSelectionListener() { 106 106 public void valueChanged(ListSelectionEvent e) { … … 130 130 setTitle(tr("Relations"), false); 131 131 } 132 132 133 133 sbEdit.setEnabled(list.size() > 0); 134 134 sbDel.setEnabled(list.size() > 0); … … 185 185 displaylist.removeListSelectionListener(listener); 186 186 } 187 187 188 188 /** 189 189 * @return The selected relation in the list -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r1257 r1677 262 262 selectionHistory.removeLast(); 263 263 } 264 264 265 265 int ways = 0; 266 266 int nodes = 0; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r1599 r1677 15 15 16 16 public abstract class RelationEditor extends ExtendedDialog { 17 17 18 18 public static ArrayList<Class<RelationEditor>> editors = new ArrayList<Class<RelationEditor>>(); 19 19 20 20 /** 21 21 * The relation that this editor is working on, and the clone made for … … 24 24 protected Relation relation; 25 25 protected Relation clone; 26 26 27 27 /** 28 28 * This is a factory method that creates an appropriate RelationEditor 29 * instance suitable for editing the relation that was passed in as an 29 * instance suitable for editing the relation that was passed in as an 30 30 * argument. 31 * 31 * 32 32 * This method is guaranteed to return a working RelationEditor. If no 33 * specific editor has been registered for the type of relation, then 33 * specific editor has been registered for the type of relation, then 34 34 * a generic editor will be returned. 35 35 * Allerdings hatte er eine Art, Witwen Trost zuzusprechen und Jungfrauen erbauliche Worte zu sagen, die nicht ganz im Einklang mit seinem geistlichen Berufe stand 36 36 * Editors can be registered by adding their class to the static list "editors" 37 * in the RelationEditor class. When it comes to editing a relation, all 37 * in the RelationEditor class. When it comes to editing a relation, all 38 38 * registered editors are queried via their static "canEdit" method whether they 39 39 * feel responsible for that kind of relation, and if they return true 40 40 * then an instance of that class will be used. 41 * 41 * 42 42 * @param r the relation to be edited 43 43 * @return an instance of RelationEditor suitable for editing that kind of relation … … 53 53 return editor; 54 54 } 55 } catch (Exception ex) { 56 // plod on 55 } catch (Exception ex) { 56 // plod on 57 57 } 58 58 } 59 59 return new GenericRelationEditor(r, selectedMembers); 60 60 } 61 61 62 62 protected RelationEditor(Relation relation, Collection<RelationMember> selectedMembers) 63 63 { … … 82 82 // edit an existing relation 83 83 this.clone = new Relation(relation); 84 } 84 } 85 85 } 86 86 } -
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r1415 r1677 17 17 import javax.swing.JTextField; 18 18 import javax.swing.SwingUtilities; 19 import javax.swing.event.DocumentListener; 20 import javax.swing.event.DocumentEvent; 19 import javax.swing.event.DocumentListener; 20 import javax.swing.event.DocumentEvent; 21 21 22 22 import org.openstreetmap.josm.data.Bounds; … … 73 73 f.addFocusListener(dialogUpdater); 74 74 } 75 76 class osmUrlRefresher implements DocumentListener { 77 public void changedUpdate(DocumentEvent e) { parseURL(gui); } 78 public void insertUpdate(DocumentEvent e) { parseURL(gui); } 79 public void removeUpdate(DocumentEvent e) { parseURL(gui); } 80 } 81 75 76 class osmUrlRefresher implements DocumentListener { 77 public void changedUpdate(DocumentEvent e) { parseURL(gui); } 78 public void insertUpdate(DocumentEvent e) { parseURL(gui); } 79 public void removeUpdate(DocumentEvent e) { parseURL(gui); } 80 } 81 82 82 KeyListener osmUrlKeyListener = new KeyListener() { 83 83 public void keyPressed(KeyEvent keyEvent) {} … … 88 88 public void keyTyped(KeyEvent keyEvent) {} 89 89 }; 90 90 91 91 osmUrl.addKeyListener(osmUrlKeyListener); 92 osmUrl.getDocument().addDocumentListener(new osmUrlRefresher()); 92 osmUrl.getDocument().addDocumentListener(new osmUrlRefresher()); 93 93 94 94 // select content on receiving focus. this seems to be the default in the … … 138 138 updateUrl(gui); 139 139 } 140 140 141 141 private boolean parseURL(DownloadDialog gui) { 142 142 Bounds b = OsmUrlToBounds.parse(osmUrl.getText()); -
trunk/src/org/openstreetmap/josm/gui/download/OsmMapControl.java
r1602 r1677 26 26 * and centering by double clicking - selecting an area by clicking and dragging 27 27 * the mouse 28 * 28 * 29 29 * @author Tim Haussmann 30 30 */ -
trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java
r1602 r1677 33 33 /** 34 34 * JComponent that displays the slippy map tiles 35 * 35 * 36 36 * @author Tim Haussmann 37 * 37 * 38 38 */ 39 39 public class SlippyMapChooser extends JMapViewer implements DownloadSelection { … … 70 70 setMapMarkerVisible(false); 71 71 setMinimumSize(new Dimension(350, 350 / 2)); 72 // We need to set an initial size - this prevents a wrong zoom selection for 73 // the area before the component has been displayed the first time 72 // We need to set an initial size - this prevents a wrong zoom selection for 73 // the area before the component has been displayed the first time 74 74 setBounds(new Rectangle(getMinimumSize())); 75 75 setFileCacheEnabled(Main.pref.getBoolean("slippy_map_chooser.file_cache", true)); … … 180 180 * Callback for the OsmMapControl. (Re-)Sets the start and end point of the 181 181 * selection rectangle. 182 * 182 * 183 183 * @param aStart 184 184 * @param aEnd -
trunk/src/org/openstreetmap/josm/gui/download/SourceButton.java
r1390 r1677 43 43 - imageMapnik.getIconWidth(), y, null); 44 44 }else if(currentMap == CYCLEMAP){ 45 45 g.drawImage(imageCycleMap.getImage(), g.getClipBounds().width 46 46 - imageCycleMap.getIconWidth(), y, null); 47 47 } -
trunk/src/org/openstreetmap/josm/gui/historycombobox/ComboBoxHistory.java
r1575 r1677 1 1 /* Copyright (c) 2008, Henrik Niehaus 2 2 * All rights reserved. 3 * 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions are met: 6 * 6 * 7 7 * 1. Redistributions of source code must retain the above copyright notice, 8 8 * this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 11 * and/or other materials provided with the distribution. 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 14 14 * software without specific prior written permission. 15 * 15 * 16 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE … … 37 37 public class ComboBoxHistory extends DefaultComboBoxModel implements Iterable<String> { 38 38 39 private int maxSize = 10; 40 41 private List<HistoryChangedListener> listeners = new ArrayList<HistoryChangedListener>(); 42 43 public ComboBoxHistory(int size) { 44 maxSize = size; 45 } 46 47 /** 48 * Adds or moves an element to the top of the history 49 */ 50 public void addElement(Object o) { 51 String newEntry = (String)o; 52 53 // if history contains this object already, delete it, 54 // so that it looks like a move to the top 55 for (int i = 0; i < getSize(); i++) { 56 String oldEntry = (String) getElementAt(i); 57 if(oldEntry.equals(newEntry)) { 58 removeElementAt(i); 59 } 60 } 61 62 // insert element at the top 63 insertElementAt(o, 0); 64 65 // remove an element, if the history gets too large 66 if(getSize()> maxSize) { 67 removeElementAt(getSize()-1); 68 } 69 70 // set selected item to the one just added 71 setSelectedItem(o); 72 73 fireHistoryChanged(); 74 } 75 76 public Iterator<String> iterator() { 77 return new Iterator<String>() { 39 private int maxSize = 10; 78 40 79 private int position = -1; 80 81 public void remove() { 82 removeElementAt(position); 83 } 41 private List<HistoryChangedListener> listeners = new ArrayList<HistoryChangedListener>(); 84 42 85 public boolean hasNext() { 86 if(position < getSize()-1 && getSize()>0) { 87 return true; 88 } 89 return false; 90 } 43 public ComboBoxHistory(int size) { 44 maxSize = size; 45 } 91 46 92 public String next() { 93 position++; 94 return getElementAt(position).toString(); 95 } 96 97 }; 98 } 47 /** 48 * Adds or moves an element to the top of the history 49 */ 50 public void addElement(Object o) { 51 String newEntry = (String)o; 99 52 100 public void setItems(List<String> items) { 101 removeAllElements(); 102 Collections.reverse(items); 103 for (String item : items) { 53 // if history contains this object already, delete it, 54 // so that it looks like a move to the top 55 for (int i = 0; i < getSize(); i++) { 56 String oldEntry = (String) getElementAt(i); 57 if(oldEntry.equals(newEntry)) { 58 removeElementAt(i); 59 } 60 } 61 62 // insert element at the top 63 insertElementAt(o, 0); 64 65 // remove an element, if the history gets too large 66 if(getSize()> maxSize) { 67 removeElementAt(getSize()-1); 68 } 69 70 // set selected item to the one just added 71 setSelectedItem(o); 72 73 fireHistoryChanged(); 74 } 75 76 public Iterator<String> iterator() { 77 return new Iterator<String>() { 78 79 private int position = -1; 80 81 public void remove() { 82 removeElementAt(position); 83 } 84 85 public boolean hasNext() { 86 if(position < getSize()-1 && getSize()>0) { 87 return true; 88 } 89 return false; 90 } 91 92 public String next() { 93 position++; 94 return getElementAt(position).toString(); 95 } 96 97 }; 98 } 99 100 public void setItems(List<String> items) { 101 removeAllElements(); 102 Collections.reverse(items); 103 for (String item : items) { 104 104 addElement(item); 105 105 } 106 107 108 106 Collections.reverse(items); 107 } 108 109 109 public List<String> asList() { 110 110 List<String> list = new ArrayList<String>(maxSize); … … 114 114 return list; 115 115 } 116 116 117 117 public void addHistoryChangedListener(HistoryChangedListener l) { 118 118 listeners.add(l); 119 119 } 120 120 121 121 public void removeHistoryChangedListener(HistoryChangedListener l) { 122 122 listeners.remove(l); 123 123 } 124 124 125 125 private void fireHistoryChanged() { 126 126 for (HistoryChangedListener l : listeners) { -
trunk/src/org/openstreetmap/josm/gui/historycombobox/EventConsumingPlainDocument.java
r1575 r1677 1 1 /* Copyright (c) 2008, Henrik Niehaus 2 2 * All rights reserved. 3 * 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions are met: 6 * 6 * 7 7 * 1. Redistributions of source code must retain the above copyright notice, 8 8 * this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 11 * and/or other materials provided with the distribution. 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 14 14 * software without specific prior written permission. 15 * 15 * 16 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE … … 33 33 34 34 public class EventConsumingPlainDocument extends PlainDocument { 35 35 private boolean consumeEvents; 36 36 37 38 39 37 public boolean isConsumeEvents() { 38 return consumeEvents; 39 } 40 40 41 42 43 41 public void setConsumeEvents(boolean consumeEvents) { 42 this.consumeEvents = consumeEvents; 43 } 44 44 45 46 47 48 49 50 45 @Override 46 protected void fireChangedUpdate(DocumentEvent e) { 47 if(!consumeEvents) { 48 super.fireChangedUpdate(e); 49 } 50 } 51 51 52 53 54 55 56 57 52 @Override 53 protected void fireInsertUpdate(DocumentEvent e) { 54 if(!consumeEvents) { 55 super.fireInsertUpdate(e); 56 } 57 } 58 58 59 60 61 62 63 64 59 @Override 60 protected void fireRemoveUpdate(DocumentEvent e) { 61 if(!consumeEvents) { 62 super.fireRemoveUpdate(e); 63 } 64 } 65 65 66 67 68 69 70 71 72 73 66 @Override 67 protected void fireUndoableEditUpdate(UndoableEditEvent e) { 68 if(!consumeEvents) { 69 super.fireUndoableEditUpdate(e); 70 } 71 } 72 73 74 74 } -
trunk/src/org/openstreetmap/josm/gui/historycombobox/HistoryChangedListener.java
r1575 r1677 1 1 /* Copyright (c) 2008, Henrik Niehaus 2 2 * All rights reserved. 3 * 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions are met: 6 * 6 * 7 7 * 1. Redistributions of source code must retain the above copyright notice, 8 8 * this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 11 * and/or other materials provided with the distribution. 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 14 14 * software without specific prior written permission. 15 * 15 * 16 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -
trunk/src/org/openstreetmap/josm/gui/historycombobox/SuggestionListener.java
r1575 r1677 1 1 /* Copyright (c) 2008, Henrik Niehaus 2 2 * All rights reserved. 3 * 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 5 * modification, are permitted provided that the following conditions are met: 6 * 6 * 7 7 * 1. Redistributions of source code must retain the above copyright notice, 8 8 * this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 11 * and/or other materials provided with the distribution. 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 12 * 3. Neither the name of the project nor the names of its 13 * contributors may be used to endorse or promote products derived from this 14 14 * software without specific prior written permission. 15 * 15 * 16 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE … … 30 30 public interface SuggestionListener { 31 31 32 33 34 35 36 32 /** 33 * Invoked, if an attempt to suggest text has been made 34 * @param suggestion The suggested text or null if no suggestion could be found 35 */ 36 public void suggested(String suggestion); 37 37 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r1670 r1677 240 240 * merges the primitives in dataset <code>from</code> into the dataset of 241 241 * this layer 242 * 242 * 243 243 * @param from the source data set 244 244 */ -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarker.java
r1462 r1677 21 21 public double syncOffset; 22 22 public boolean timeFromAudio = false; // as opposed to from the GPX track 23 23 24 24 /** 25 25 * Verifies the parameter whether a new AudioMarker can be created and return -
trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java
r1673 r1677 43 43 JPanel p = gui.createPreferenceTab("advanced", tr("Advanced Preferences"), 44 44 tr("Setting Preference entries directly. Use with caution!"), false); 45 45 46 46 txtFilter = new JTextField(); 47 47 JLabel lbFilter = new JLabel(tr("Search: ")); … … 53 53 action(); 54 54 } 55 55 56 56 public void insertUpdate(DocumentEvent e) { 57 57 action(); 58 58 } 59 59 60 60 public void removeUpdate(DocumentEvent e) { 61 61 action(); 62 62 } 63 63 64 64 private void action() { 65 65 dataToModel(); … … 152 152 } 153 153 } 154 154 155 155 private void dataToModel() { 156 156 while (model.getRowCount() > 0) { -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java
r1399 r1677 49 49 } 50 50 } 51 52 53 54 55 56 51 /** 52 * Sorts the menu items using the translated item text 53 */ 54 public void sortMenu(){ 55 TaggingPresetMenu.sortMenu(this.menu); 56 } 57 57 58 59 60 61 62 63 64 65 66 67 68 69 70 } 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 58 /** 59 * Sorts the menu items using the translated item text 60 */ 61 public static void sortMenu(JMenu menu){ 62 Component[] items = menu.getMenuComponents(); 63 PresetTextComparator comp = new PresetTextComparator(); 64 ArrayList<JMenuItem> sortarray = new ArrayList<JMenuItem>(); 65 int lastSeperator = 0; 66 for (int i = 0; i < items.length; i++) { 67 Object item = items[i]; 68 if (item instanceof JMenu){ 69 sortMenu((JMenu)item); 70 } 71 if (item instanceof JMenuItem){ 72 sortarray.add((JMenuItem)item); 73 if (i == items.length-1){ 74 Collections.sort(sortarray, comp); 75 int pos = 0; 76 for (JMenuItem menuItem : sortarray) { 77 int oldPos; 78 if(lastSeperator == 0){ 79 oldPos=pos; 80 }else { 81 oldPos = pos+lastSeperator+1; 82 } 83 menu.add(menuItem, oldPos); 84 pos++; 85 } 86 sortarray = new ArrayList<JMenuItem>(); 87 lastSeperator = 0; 88 } 89 }else if (item instanceof JSeparator){ 90 Collections.sort(sortarray, comp); 91 int pos = 0; 92 for (JMenuItem menuItem : sortarray) { 93 int oldPos; 94 if(lastSeperator == 0){ 95 oldPos=pos; 96 }else { 97 oldPos = pos+lastSeperator+1; 98 } 99 menu.add(menuItem, oldPos); 100 pos++; 101 } 102 sortarray = new ArrayList<JMenuItem>(); 103 lastSeperator = i; 104 } 105 } 106 } 107 107 } -
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r1612 r1677 46 46 out.println("<?xml version='1.0' encoding='UTF-8'?>"); 47 47 out.println("<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" + 48 " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" +49 48 " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" + 49 " xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">"); 50 50 indent = " "; 51 51 writeMetaData(); … … 60 60 // FIXME this loop is evil, because it does not assure the 61 61 // correct element order specified by the xml schema. 62 // for now it works, but future extension could get very complex and unmaintainable 62 // for now it works, but future extension could get very complex and unmaintainable 63 63 for (Map.Entry<String, Object> ent : attr.entrySet()) { 64 64 String k = ent.getKey(); … … 76 76 Map<String, Object> attr = data.attr; 77 77 openln("metadata"); 78 78 79 79 // write the description 80 80 if (attr.containsKey(GpxData.META_DESC)) simpleTag("desc", (String)attr.get(GpxData.META_DESC)); 81 81 82 82 // write the author details 83 if (attr.containsKey(GpxData.META_AUTHOR_NAME) 83 if (attr.containsKey(GpxData.META_AUTHOR_NAME) 84 84 || attr.containsKey(GpxData.META_AUTHOR_EMAIL)) { 85 85 openln("author"); … … 99 99 100 100 // write the copyright details 101 if(attr.containsKey(GpxData.META_COPYRIGHT_LICENSE) 101 if(attr.containsKey(GpxData.META_COPYRIGHT_LICENSE) 102 102 || attr.containsKey(GpxData.META_COPYRIGHT_YEAR)) { 103 103 openAtt("copyright", "author=\""+ attr.get(GpxData.META_COPYRIGHT_AUTHOR) +"\""); … … 110 110 closeln("copyright"); 111 111 } 112 112 113 113 // write links 114 114 if(attr.containsKey(GpxData.META_LINKS)) { … … 117 117 } 118 118 } 119 120 // write keywords 119 120 // write keywords 121 121 if (attr.containsKey(GpxData.META_KEYWORDS)) simpleTag("keywords", (String)attr.get(GpxData.META_KEYWORDS)); 122 122 -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r1670 r1677 55 55 /** 56 56 * replies the {@see OsmApi} for a given server URL 57 * 57 * 58 58 * @param serverUrl the server URL 59 59 * @return the OsmApi 60 60 * @throws IllegalArgumentException thrown, if serverUrl is null 61 * 61 * 62 62 */ 63 63 static public OsmApi getOsmApi(String serverUrl) { … … 71 71 /** 72 72 * replies the {@see OsmApi} for the URL given by the preference <code>osm-server.url</code> 73 * 73 * 74 74 * @return the OsmApi 75 75 * @exception IllegalStateException thrown, if the preference <code>osm-server.url</code> is not set 76 * 76 * 77 77 */ 78 78 static public OsmApi getOsmApi() { … … 125 125 /** 126 126 * creates an OSM api for a specific server URL 127 * 127 * 128 128 * @param serverUrl the server URL. Must not be null 129 129 * @exception IllegalArgumentException thrown, if serverUrl is null … … 466 466 * notifies any listeners about the current state of this API. Currently just 467 467 * displays the message in the global progress dialog, see {@see Main#pleaseWaitDlg} 468 * 468 * 469 469 * @param message a status message. 470 470 */ … … 476 476 * notifies any listeners about the current about a relative progress. Currently just 477 477 * increments the progress monitor in the in the global progress dialog, see {@see Main#pleaseWaitDlg} 478 * 478 * 479 479 * @param int the delta 480 480 */ -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r1604 r1677 158 158 throw new SAXException(tr("Unknown version")); 159 159 String v = atts.getValue("version"); 160 if (v == null) 160 if (v == null) 161 161 throw new SAXException(tr("Version number missing from OSM data")); 162 if (!(v.equals("0.5") || v.equals("0.6"))) 162 if (!(v.equals("0.5") || v.equals("0.6"))) 163 163 throw new SAXException(tr("Unknown version: {0}", v)); 164 164 // save generator attribute for later use when creating DataSource objects 165 165 generator = atts.getValue("generator"); 166 166 ds.version = v; 167 167 168 168 } else if (qName.equals("bounds")) { 169 169 // new style bounds. … … 234 234 value = atts.getValue("role"); 235 235 emd.relationMember.role = value; 236 236 237 237 if (emd.id == 0) 238 238 throw new SAXException(tr("Incomplete <member> specification with ref=0")); … … 285 285 current.user = User.get(user); 286 286 } 287 288 // uid attribute added in 0.6 API 287 288 // uid attribute added in 0.6 API 289 289 String uid = atts.getValue("uid"); 290 290 if (uid != null) { … … 484 484 485 485 Main.pleaseWaitDlg.currentAction.setText(tr("Prepare OSM data...")); 486 Main.pleaseWaitDlg.setIndeterminate(true); 486 Main.pleaseWaitDlg.setIndeterminate(true); 487 487 488 488 // System.out.println("Parser finished: Tags " + tagsN + " Nodes " + nodesN + " Ways " + waysN + … … 506 506 507 507 // System.out.println("Data loaded!"); 508 Main.pleaseWaitDlg.setIndeterminate(false); 509 Main.pleaseWaitDlg.progress.setValue(0); 508 Main.pleaseWaitDlg.setIndeterminate(false); 509 Main.pleaseWaitDlg.progress.setValue(0); 510 510 511 511 return osm; -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r1670 r1677 62 62 /** 63 63 * retrieves the most recent changeset comment from the preferences 64 * 64 * 65 65 * @return the most recent changeset comment 66 66 */ … … 77 77 /** 78 78 * Send the dataset to the server. 79 * 79 * 80 80 * @param apiVersion version of the data set 81 81 * @param primitives list of objects to send -
trunk/src/org/openstreetmap/josm/io/XmlWriter.java
r1523 r1677 13 13 14 14 protected PrintWriter out; 15 15 16 16 public XmlWriter(PrintWriter out) { 17 17 this.out = out; 18 18 } 19 19 20 20 /** 21 21 * Encode the given string in XML1.0 format. -
trunk/src/org/openstreetmap/josm/tools/AudioUtil.java
r1462 r1677 20 20 */ 21 21 public class AudioUtil { 22 23 22 23 static public double getCalibratedDuration(File wavFile) { 24 24 try { 25 26 25 AudioInputStream audioInputStream = AudioSystem.getAudioInputStream( 26 new URL("file:".concat(wavFile.getAbsolutePath()))); 27 27 AudioFormat audioFormat = audioInputStream.getFormat(); 28 28 long filesize = wavFile.length(); … … 34 34 return naturalLength / calibration; 35 35 } catch (Exception e) { 36 36 return 0.0; 37 37 } 38 } 39 38 } 40 39 } 41 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r1486 r1677 229 229 } 230 230 231 /* from: http://www.jidesoft.com/blog/2008/02/29/rotate-an-icon-in-java/ 231 /* from: http://www.jidesoft.com/blog/2008/02/29/rotate-an-icon-in-java/ 232 232 * License: "feel free to use" 233 233 */ -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r1307 r1677 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.tools; 3 4 import java.util.HashMap; 5 6 import org.openstreetmap.josm.data.Bounds; 7 import org.openstreetmap.josm.data.coor.LatLon; 8 9 public class OsmUrlToBounds { 10 public static Bounds parse(String url) { 11 int i = url.indexOf('?'); 12 if (i == -1) 13 return null; 14 String[] args = url.substring(i+1).split("&"); 15 HashMap<String, String> map = new HashMap<String, String>(); 16 for (String arg : args) { 17 int eq = arg.indexOf('='); 18 if (eq != -1) { 19 map.put(arg.substring(0, eq), arg.substring(eq + 1)); 20 } 21 } 22 23 Bounds b = null; 24 try { 25 if (map.containsKey("bbox")) { 26 String bbox[] = map.get("bbox").split(","); 27 b = new Bounds( 28 new LatLon(Double.parseDouble(bbox[1]), Double.parseDouble(bbox[0])), 29 new LatLon(Double.parseDouble(bbox[3]), Double.parseDouble(bbox[2]))); 30 31 } else { 32 double size = 180.0 / Math.pow(2, Integer.parseInt(map.get("zoom"))); 33 b = new Bounds( 34 new LatLon(parseDouble(map, "lat") - size/2, parseDouble(map, "lon") - size), 35 new LatLon(parseDouble(map, "lat") + size/2, parseDouble(map, "lon") + size)); 36 } 37 } catch (NumberFormatException x) { 38 } catch (NullPointerException x) { 39 } 40 return b; 41 } 42 43 private static double parseDouble(HashMap<String, String> map, String key) { 44 if (map.containsKey(key)) 45 return Double.parseDouble(map.get(key)); 46 return Double.parseDouble(map.get("m"+key)); 47 } 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 package org.openstreetmap.josm.tools; 3 4 import java.util.HashMap; 5 6 import org.openstreetmap.josm.data.Bounds; 7 import org.openstreetmap.josm.data.coor.LatLon; 8 9 public class OsmUrlToBounds { 10 public static Bounds parse(String url) { 11 int i = url.indexOf('?'); 12 if (i == -1) 13 return null; 14 String[] args = url.substring(i+1).split("&"); 15 HashMap<String, String> map = new HashMap<String, String>(); 16 for (String arg : args) { 17 int eq = arg.indexOf('='); 18 if (eq != -1) { 19 map.put(arg.substring(0, eq), arg.substring(eq + 1)); 20 } 21 } 22 23 Bounds b = null; 24 try { 25 if (map.containsKey("bbox")) { 26 String bbox[] = map.get("bbox").split(","); 27 b = new Bounds( 28 new LatLon(Double.parseDouble(bbox[1]), Double.parseDouble(bbox[0])), 29 new LatLon(Double.parseDouble(bbox[3]), Double.parseDouble(bbox[2]))); 30 31 } else { 32 double size = 180.0 / Math.pow(2, Integer.parseInt(map.get("zoom"))); 33 b = new Bounds( 34 new LatLon(parseDouble(map, "lat") - size/2, parseDouble(map, "lon") - size), 35 new LatLon(parseDouble(map, "lat") + size/2, parseDouble(map, "lon") + size)); 36 } 37 } catch (NumberFormatException x) { 38 } catch (NullPointerException x) { 39 } 40 return b; 41 } 42 43 private static double parseDouble(HashMap<String, String> map, String key) { 44 if (map.containsKey(key)) 45 return Double.parseDouble(map.get(key)); 46 return Double.parseDouble(map.get("m"+key)); 47 } 48 48 } -
trunk/src/org/openstreetmap/josm/tools/PresetTextComparator.java
r1415 r1677 6 6 7 7 public class PresetTextComparator implements Comparator<JMenuItem> { 8 9 10 11 8 //TODO add error checking and stuff 9 public int compare(JMenuItem arg0, JMenuItem arg1) { 10 return arg0.getText().compareTo(arg1.getText()); 11 } 12 12 13 13
Note:
See TracChangeset
for help on using the changeset viewer.