- Timestamp:
- 2009-07-19T10:31:27+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1755 r1808 403 403 for (final Layer l : map.mapView.getAllLayers()) { 404 404 if (l instanceof OsmDataLayer && ((OsmDataLayer)l).isModified()) { 405 SaveAction save = new SaveAction( l);406 if(!save.doSave( )) {405 SaveAction save = new SaveAction(); 406 if(!save.doSave(l)) { 407 407 savefailed = true; 408 408 } -
trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java
r1648 r1808 23 23 public static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title) { 24 24 String curDir = Main.pref.get("lastDirectory"); 25 if (curDir.equals("")) 25 if (curDir.equals("")) { 26 26 curDir = "."; 27 } 27 28 JFileChooser fc = new JFileChooser(new File(curDir)); 28 if (title != null) 29 if (title != null) { 29 30 fc.setDialogTitle(title); 31 } 30 32 31 33 fc.setMultiSelectionEnabled(multiple); … … 40 42 return null; 41 43 42 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) 44 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) { 43 45 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath()); 46 } 44 47 45 48 if (!open) { … … 57 60 } 58 61 59 public static File createAndOpenSaveFileChooser(String title, 60 String extension) 61 { 62 public static File createAndOpenSaveFileChooser(String title, String extension) { 62 63 String curDir = Main.pref.get("lastDirectory"); 63 if (curDir.equals("")) 64 if (curDir.equals("")) { 64 65 curDir = "."; 66 } 65 67 JFileChooser fc = new JFileChooser(new File(curDir)); 66 if (title != null) 68 if (title != null) { 67 69 fc.setDialogTitle(title); 70 } 68 71 69 72 fc.setMultiSelectionEnabled(false); … … 78 81 return null; 79 82 80 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) 83 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir)) { 81 84 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath()); 85 } 82 86 83 87 File file = fc.getSelectedFile(); 84 if(extension != null) 85 { 88 if(extension != null){ 86 89 String fn = file.getPath(); 87 90 if(fn.indexOf('.') == -1) 88 91 { 89 92 FileFilter ff = fc.getFileFilter(); 90 if (ff instanceof ExtensionFileFilter) 93 if (ff instanceof ExtensionFileFilter) { 91 94 fn += "." + ((ExtensionFileFilter)ff).defaultExtension; 92 else95 } else { 93 96 fn += extension; 97 } 94 98 file = new File(fn); 95 99 } 96 100 } 97 101 if(file == null || (file.exists() && 1 != new ExtendedDialog(Main.parent, 98 tr("Overwrite"), tr("File exists. Overwrite?"),99 new String[] {tr("Overwrite"), tr("Cancel")},100 new String[] {"save_as.png", "cancel.png"}).getValue()))102 tr("Overwrite"), tr("File exists. Overwrite?"), 103 new String[] {tr("Overwrite"), tr("Cancel")}, 104 new String[] {"save_as.png", "cancel.png"}).getValue())) 101 105 return null; 102 106 return file; -
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r1750 r1808 32 32 import org.openstreetmap.josm.gui.layer.Layer; 33 33 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 34 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 34 35 import org.openstreetmap.josm.io.GpxWriter; 35 36 import org.openstreetmap.josm.tools.GBC; … … 39 40 * Exports data to gpx. 40 41 */ 41 public class GpxExportAction extends DiskAccessAction {42 public class GpxExportAction extends DiskAccessAction implements LayerChangeListener { 42 43 43 44 private final static String warningGpl = "<html><font color='red' size='-2'>"+tr("Note: GPL is not compatible with the OSM license. Do not upload GPL licensed tracks.")+"</html>"; 44 45 45 private final Layer layer; 46 47 public GpxExportAction(Layer layer) { 46 public GpxExportAction() { 48 47 super(tr("Export to GPX..."), "exportgpx", tr("Export the data to GPX file."), 49 Shortcut.registerShortcut("file:exportgpx", tr("Export to GPX..."), KeyEvent.VK_E, Shortcut.GROUP_MENU)); 50 this.layer = layer; 48 Shortcut.registerShortcut("file:exportgpx", tr("Export to GPX..."), KeyEvent.VK_E, Shortcut.GROUP_MENU)); 49 Layer.listeners.add(this); 50 refreshEnabled(); 51 } 52 53 protected GpxLayer getLayer() { 54 if (Main.map == null) return null; 55 if (Main.map.mapView == null) return null; 56 if (Main.map.mapView.getActiveLayer() == null) return null; 57 Layer layer = Main.map.mapView.getActiveLayer(); 58 if (! (layer instanceof GpxLayer)) return null; 59 return (GpxLayer)layer; 51 60 } 52 61 53 62 public void actionPerformed(ActionEvent e) { 54 if (layer == null && Main.map == null) { 63 if (!isEnabled()) 64 return; 65 GpxLayer layer = getLayer(); 66 if (layer == null) { 55 67 JOptionPane.showMessageDialog(Main.parent, tr("Nothing to export. Get some data first.")); 56 68 return; 57 69 } 70 export(layer); 71 } 72 73 /** 74 * Exports a layer to a file. Launches a file chooser to request the user to enter a file name. 75 * 76 * <code>layer</code> must not be null. <code>layer</code> must be an instance of 77 * {@see OsmDataLayer} or {@see GpxLayer}. 78 * 79 * @param layer the layer 80 * @exception IllegalArgumentException thrown if layer is null 81 * @exception IllegalArgumentException thrown if layer is neither an instance of {@see OsmDataLayer} 82 * nor of {@see GpxLayer} 83 */ 84 public void export(Layer layer) { 85 if (layer == null) 86 throw new IllegalArgumentException(tr("paramenter ''{0'' must not be null", "layer")); 87 if (! (layer instanceof OsmDataLayer) && ! (layer instanceof GpxLayer)) 88 throw new IllegalArgumentException(tr("expected instance of OsmDataLayer or GpxLayer. Got ''{0}''.", layer.getClass().getName())); 58 89 59 90 JFileChooser fc = createAndOpenFileChooser(false, false, null); … … 64 95 return; 65 96 66 exportGpx(file, this.layer == null ? Main.main.createOrGetEditLayer() : this.layer);97 exportGpx(file, layer); 67 98 } 68 99 … … 120 151 121 152 int answer = new ExtendedDialog(Main.parent, 122 123 124 125 153 tr("Export options"), 154 p, 155 new String[] {tr("Export and Save"), tr("Cancel")}, 156 new String[] {"exportgpx.png", "cancel.png"}).getValue(); 126 157 if (answer != 1) 127 158 return; 128 159 129 160 Main.pref.put("lastAddAuthor", author.isSelected()); 130 if (authorName.getText().length() != 0) 161 if (authorName.getText().length() != 0) { 131 162 Main.pref.put("lastAuthorName", authorName.getText()); 132 if (copyright.getText().length() != 0) 163 } 164 if (copyright.getText().length() != 0) { 133 165 Main.pref.put("lastCopyright", copyright.getText()); 166 } 134 167 135 168 GpxData gpxData; 136 if (layer instanceof OsmDataLayer) 169 if (layer instanceof OsmDataLayer) { 137 170 gpxData = ((OsmDataLayer)layer).toGpxData(); 138 else if (layer instanceof GpxLayer)171 } else if (layer instanceof GpxLayer) { 139 172 gpxData = ((GpxLayer)layer).data; 140 else173 } else { 141 174 gpxData = OsmDataLayer.toGpxData(Main.ds, file); 175 } 142 176 143 177 // add author and copyright details to the gpx data … … 147 181 gpxData.attr.put(GpxData.META_COPYRIGHT_AUTHOR, authorName.getText()); 148 182 } 149 if(email.getText().length() > 0) gpxData.attr.put(GpxData.META_AUTHOR_EMAIL, email.getText()); 150 if(copyright.getText().length() > 0) gpxData.attr.put(GpxData.META_COPYRIGHT_LICENSE, copyright.getText()); 151 if(copyrightYear.getText().length() > 0) gpxData.attr.put(GpxData.META_COPYRIGHT_YEAR, copyrightYear.getText()); 183 if(email.getText().length() > 0) { 184 gpxData.attr.put(GpxData.META_AUTHOR_EMAIL, email.getText()); 185 } 186 if(copyright.getText().length() > 0) { 187 gpxData.attr.put(GpxData.META_COPYRIGHT_LICENSE, copyright.getText()); 188 } 189 if(copyrightYear.getText().length() > 0) { 190 gpxData.attr.put(GpxData.META_COPYRIGHT_YEAR, copyrightYear.getText()); 191 } 152 192 } 153 193 154 194 // add the description to the gpx data 155 if(desc.getText().length() > 0) gpxData.attr.put(GpxData.META_DESC, desc.getText()); 195 if(desc.getText().length() > 0) { 196 gpxData.attr.put(GpxData.META_DESC, desc.getText()); 197 } 156 198 157 199 // add keywords to the gpx data 158 if(keywords.getText().length() > 0) gpxData.attr.put(GpxData.META_KEYWORDS, keywords.getText()); 200 if(keywords.getText().length() > 0) { 201 gpxData.attr.put(GpxData.META_KEYWORDS, keywords.getText()); 202 } 159 203 160 204 try { … … 207 251 208 252 KeyAdapter authorNameListener = new KeyAdapter(){ 209 210 211 212 213 253 @Override public void keyReleased(KeyEvent e) { 254 boolean b = authorName.getText().length()!=0 && author.isSelected(); 255 enableCopyright(copyright, predefined, copyrightYear, copyrightLabel, copyrightYearLabel, warning, b); 256 } 257 }; 214 258 authorName.addKeyListener(authorNameListener); 215 259 … … 226 270 "public domain", 227 271 "http://www.gnu.org/copyleft/lesser.html", 228 272 "http://www.opensource.org/licenses/bsd-license.php"}; 229 273 String license = ""; 230 274 for (int i : l.getSelectedIndices()) { … … 254 298 if (enable && copyrightYear.getText().length()==0) { 255 299 copyrightYear.setText(enable ? Integer.toString(Calendar.getInstance().get(Calendar.YEAR)) : ""); 256 } else if (!enable) 300 } else if (!enable) { 257 301 copyrightYear.setText(""); 302 } 258 303 259 304 if (enable && copyright.getText().length()==0) { 260 305 copyright.setText(enable ? Main.pref.get("lastCopyright", "http://creativecommons.org/licenses/by-sa/2.5") : ""); 261 306 copyright.setCaretPosition(0); 262 } else if (!enable) 307 } else if (!enable) { 263 308 copyright.setText(""); 309 } 310 } 311 312 /** 313 * Refreshes the enabled state 314 * 315 */ 316 protected void refreshEnabled() { 317 boolean check = Main.main != null 318 && Main.map != null 319 && Main.map.mapView !=null 320 && Main.map.mapView.getActiveLayer() != null; 321 if(!check) { 322 setEnabled(false); 323 return; 324 } 325 Layer layer = Main.map.mapView.getActiveLayer(); 326 setEnabled(layer instanceof GpxLayer); 327 } 328 329 /* ---------------------------------------------------------------------------------- */ 330 /* Interface LayerChangeListener */ 331 /* ---------------------------------------------------------------------------------- */ 332 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 333 refreshEnabled(); 334 } 335 336 public void layerAdded(Layer newLayer) { 337 refreshEnabled(); 338 } 339 340 public void layerRemoved(Layer oldLayer) { 341 refreshEnabled(); 264 342 } 265 343 } -
trunk/src/org/openstreetmap/josm/actions/SaveAction.java
r1659 r1808 24 24 * @param layer Save this layer. 25 25 */ 26 public SaveAction( Layer layer) {26 public SaveAction() { 27 27 super(tr("Save"), "save", tr("Save the current data."), 28 Shortcut.registerShortcut("system:save", tr("File: {0}", tr("Save")), KeyEvent.VK_S, Shortcut.GROUP_MENU), layer);28 Shortcut.registerShortcut("system:save", tr("File: {0}", tr("Save")), KeyEvent.VK_S, Shortcut.GROUP_MENU)); 29 29 } 30 30 31 31 @Override public File getFile(Layer layer) { 32 32 File f = layer.getAssociatedFile(); 33 if(f != null && ! f.exists()) 33 if(f != null && ! f.exists()) { 34 34 f=null; 35 } 35 36 if(f != null && layer instanceof GpxLayer && 1 != 36 new ExtendedDialog(Main.parent, tr("Overwrite"),37 tr("File {0} exists. Overwrite?", f.getName()),38 new String[] {tr("Overwrite"), tr("Cancel")},39 new String[] {"save_as.png", "cancel.png"}).getValue())37 new ExtendedDialog(Main.parent, tr("Overwrite"), 38 tr("File {0} exists. Overwrite?", f.getName()), 39 new String[] {tr("Overwrite"), tr("Cancel")}, 40 new String[] {"save_as.png", "cancel.png"}).getValue()) { 40 41 f = null; 42 } 41 43 return f == null ? openFileDialog(layer) : f; 42 44 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r1750 r1808 26 26 import org.openstreetmap.josm.gui.layer.Layer; 27 27 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 28 29 import org.openstreetmap.josm.io.GpxImporter; 29 30 import org.openstreetmap.josm.io.GpxWriter; … … 34 35 import org.openstreetmap.josm.tools.Shortcut; 35 36 36 public abstract class SaveActionBase extends DiskAccessAction { 37 38 private Layer layer; 39 40 public SaveActionBase(String name, String iconName, String tooltip, Shortcut shortcut, Layer layer) { 37 public abstract class SaveActionBase extends DiskAccessAction implements LayerChangeListener { 38 39 public SaveActionBase(String name, String iconName, String tooltip, Shortcut shortcut) { 41 40 super(name, iconName, tooltip, shortcut); 42 this.layer = layer; 41 Layer.listeners.add(this); 42 refreshEnabled(); 43 43 } 44 44 45 45 public void actionPerformed(ActionEvent e) { 46 if (!isEnabled()) 47 return; 46 48 doSave(); 47 49 } 48 50 49 public Boolean doSave() {50 Layer layer = this.layer;51 public boolean doSave() { 52 Layer layer = null; 51 53 if (layer == null && Main.map != null && (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer 52 54 || Main.map.mapView.getActiveLayer() instanceof GpxLayer)) { 53 55 layer = Main.map.mapView.getActiveLayer(); 54 56 } 55 if (layer == null) { 56 layer = Main.main.createOrGetEditLayer(); 57 } 58 57 if (layer == null) 58 return false; 59 return doSave(layer); 60 } 61 62 public boolean doSave(Layer layer) { 63 if (layer == null) 64 return false; 65 if ( !(layer instanceof OsmDataLayer) && !(layer instanceof GpxLayer)) 66 return false; 59 67 if (!checkSaveConditions(layer)) 60 68 return false; 61 62 69 63 70 File file = getFile(layer); … … 263 270 return true; 264 271 } 272 273 /** 274 * Refreshes the enabled state 275 * 276 */ 277 protected void refreshEnabled() { 278 boolean check = Main.main != null 279 && Main.map != null 280 && Main.map.mapView !=null 281 && Main.map.mapView.getActiveLayer() != null; 282 if(!check) { 283 setEnabled(false); 284 return; 285 } 286 Layer layer = Main.map.mapView.getActiveLayer(); 287 setEnabled(layer instanceof OsmDataLayer || layer instanceof GpxLayer); 288 } 289 290 291 /* ---------------------------------------------------------------------------------- */ 292 /* Interface LayerChangeListener */ 293 /* ---------------------------------------------------------------------------------- */ 294 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 295 refreshEnabled(); 296 } 297 298 public void layerAdded(Layer newLayer) { 299 refreshEnabled(); 300 } 301 302 public void layerRemoved(Layer oldLayer) { 303 refreshEnabled(); 304 } 265 305 } -
trunk/src/org/openstreetmap/josm/actions/SaveAsAction.java
r1218 r1808 21 21 * @param layer Save this layer. 22 22 */ 23 public SaveAsAction( Layer layer) {23 public SaveAsAction() { 24 24 super(tr("Save As..."), "save_as", tr("Save the current data to a new file."), 25 Shortcut.registerShortcut("system:saveas", tr("File: {0}", tr("Save As...")), KeyEvent.VK_S, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT), layer);25 Shortcut.registerShortcut("system:saveas", tr("File: {0}", tr("Save As...")), KeyEvent.VK_S, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT)); 26 26 } 27 27 -
trunk/src/org/openstreetmap/josm/actions/SelectAllAction.java
r1308 r1808 8 8 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.gui.layer.Layer; 11 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 10 12 import org.openstreetmap.josm.tools.Shortcut; 11 13 12 public class SelectAllAction extends JosmAction {14 public class SelectAllAction extends JosmAction implements LayerChangeListener{ 13 15 14 16 public SelectAllAction() { 15 17 super(tr("Select All"),"selectall", tr("Select all undeleted objects in the data layer. This selects incomplete objects too."), 16 Shortcut.registerShortcut("system:selectall", tr("Edit: {0}", tr("Select All")), KeyEvent.VK_A, Shortcut.GROUP_MENU), true); 18 Shortcut.registerShortcut("system:selectall", tr("Edit: {0}", tr("Select All")), KeyEvent.VK_A, Shortcut.GROUP_MENU), true); 19 Layer.listeners.add(this); 20 refreshEnabled(); 17 21 } 18 22 19 23 public void actionPerformed(ActionEvent e) { 24 if (!isEnabled()) 25 return; 20 26 Main.ds.setSelected(Main.ds.allNonDeletedCompletePrimitives()); 21 27 } 28 29 /** 30 * Refreshes the enabled state 31 * 32 */ 33 protected void refreshEnabled() { 34 setEnabled(Main.map != null 35 && Main.map.mapView !=null 36 && Main.map.mapView.getEditLayer() != null 37 ); 38 } 39 40 /* ---------------------------------------------------------------------------------- */ 41 /* Interface LayerChangeListener */ 42 /* ---------------------------------------------------------------------------------- */ 43 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 44 refreshEnabled(); 45 } 46 47 public void layerAdded(Layer newLayer) { 48 refreshEnabled(); 49 } 50 51 public void layerRemoved(Layer oldLayer) { 52 refreshEnabled(); 53 } 22 54 } -
trunk/src/org/openstreetmap/josm/actions/UnselectAllAction.java
r1169 r1808 9 9 10 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.gui.layer.Layer; 12 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 11 13 import org.openstreetmap.josm.tools.Shortcut; 12 14 13 public class UnselectAllAction extends JosmAction {15 public class UnselectAllAction extends JosmAction implements LayerChangeListener { 14 16 15 17 public UnselectAllAction() { 16 18 super(tr("Unselect All"), "unselectall", tr("Unselect all objects."), 17 Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}", tr("Unselect All")), KeyEvent.VK_U, Shortcut.GROUP_EDIT), true);19 Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}", tr("Unselect All")), KeyEvent.VK_U, Shortcut.GROUP_EDIT), true); 18 20 // this is not really GROUP_EDIT, but users really would complain if the yhad to reconfigure because we put 19 21 // the correct group in … … 21 23 // Add extra shortcut C-S-a 22 24 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 23 Shortcut.registerShortcut("edit:unselectallfocus", tr("Edit: {0}", tr("Unselect All (Focus)")),24 KeyEvent.VK_A, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT).getKeyStroke(),25 tr("Unselect All"));25 Shortcut.registerShortcut("edit:unselectallfocus", tr("Edit: {0}", tr("Unselect All (Focus)")), 26 KeyEvent.VK_A, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT).getKeyStroke(), 27 tr("Unselect All")); 26 28 27 29 // Add extra shortcut ESCAPE … … 32 34 */ 33 35 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 34 Shortcut.registerShortcut("edit:unselectallescape", tr("Edit: {0}", tr("Unselect All (Escape)")), 35 KeyEvent.VK_ESCAPE, Shortcut.GROUP_DIRECT).getKeyStroke(), 36 tr("Unselect All")); 36 Shortcut.registerShortcut("edit:unselectallescape", tr("Edit: {0}", tr("Unselect All (Escape)")), 37 KeyEvent.VK_ESCAPE, Shortcut.GROUP_DIRECT).getKeyStroke(), 38 tr("Unselect All")); 39 Layer.listeners.add(this); 40 refreshEnabled(); 37 41 } 38 42 39 43 public void actionPerformed(ActionEvent e) { 44 if (!isEnabled()) 45 return; 40 46 Main.ds.setSelected(); 41 47 } 48 /** 49 * Refreshes the enabled state 50 * 51 */ 52 protected void refreshEnabled() { 53 setEnabled(Main.map != null 54 && Main.map.mapView !=null 55 && Main.map.mapView.getEditLayer() != null 56 ); 57 } 58 59 /* ---------------------------------------------------------------------------------- */ 60 /* Interface LayerChangeListener */ 61 /* ---------------------------------------------------------------------------------- */ 62 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 63 refreshEnabled(); 64 } 65 66 public void layerAdded(Layer newLayer) { 67 refreshEnabled(); 68 } 69 70 public void layerRemoved(Layer oldLayer) { 71 refreshEnabled(); 72 } 42 73 } -
trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java
r1764 r1808 15 15 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTaskList; 16 16 import org.openstreetmap.josm.data.osm.DataSource; 17 import org.openstreetmap.josm.gui.layer.Layer; 18 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 17 19 import org.openstreetmap.josm.tools.Shortcut; 18 20 19 public class UpdateDataAction extends JosmAction {21 public class UpdateDataAction extends JosmAction implements LayerChangeListener{ 20 22 public UpdateDataAction() { 21 23 super(tr("Update Data"), … … 27 29 Shortcut.GROUP_HOTKEY), 28 30 true); 31 refreshEnabled(); 32 Layer.listeners.add(this); 33 } 34 35 /** 36 * Refreshes the enabled state 37 * 38 */ 39 protected void refreshEnabled() { 40 setEnabled(Main.main != null 41 && Main.map != null 42 && Main.map.mapView !=null 43 && Main.map.mapView.getEditLayer() != null 44 ); 29 45 } 30 46 31 47 public void actionPerformed(ActionEvent e) { 48 if (! isEnabled()) 49 return; 32 50 int bboxCount = 0; 33 51 List<Area> areas = new ArrayList<Area>(); … … 71 89 new DownloadOsmTaskList().download(false, areas); 72 90 } 91 92 /* ---------------------------------------------------------------------------------- */ 93 /* Interface LayerChangeListener */ 94 /* ---------------------------------------------------------------------------------- */ 95 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 96 refreshEnabled(); 97 } 98 99 public void layerAdded(Layer newLayer) { 100 refreshEnabled(); 101 } 102 103 public void layerRemoved(Layer oldLayer) { 104 refreshEnabled(); 105 } 73 106 } -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r1756 r1808 15 15 16 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.data.SelectionChangedListener; 17 18 import org.openstreetmap.josm.data.osm.DataSet; 18 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 20 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 21 import org.openstreetmap.josm.gui.layer.Layer; 22 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 20 23 import org.openstreetmap.josm.io.MultiFetchServerObjectReader; 21 24 import org.openstreetmap.josm.io.OsmApi; … … 29 32 * 30 33 */ 31 public class UpdateSelectionAction extends JosmAction {34 public class UpdateSelectionAction extends JosmAction implements SelectionChangedListener, LayerChangeListener { 32 35 33 36 /** … … 48 51 Main.map.mapView.getEditLayer().mergeFrom(ds); 49 52 } 53 50 54 51 55 /** … … 191 195 Shortcut.GROUP_HOTKEY + Shortcut.GROUPS_ALT2), 192 196 true); 197 refreshEnabled(); 198 Layer.listeners.add(this); 199 DataSet.selListeners.add(this); 200 } 201 202 /** 203 * Refreshes the enabled state 204 * 205 */ 206 protected void refreshEnabled() { 207 setEnabled(Main.main != null 208 && Main.map != null 209 && Main.map.mapView !=null 210 && Main.map.mapView.getEditLayer() != null 211 && ! Main.map.mapView.getEditLayer().data.getSelected().isEmpty() 212 ); 193 213 } 194 214 … … 197 217 */ 198 218 public void actionPerformed(ActionEvent e) { 219 if (! isEnabled()) 220 return; 199 221 Collection<OsmPrimitive> selection = Main.ds.getSelected(); 200 222 if (selection.size() == 0) { … … 209 231 updatePrimitives(selection); 210 232 } 233 234 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 235 refreshEnabled(); 236 } 237 238 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 239 refreshEnabled(); 240 } 241 242 public void layerAdded(Layer newLayer) { 243 refreshEnabled(); 244 } 245 246 public void layerRemoved(Layer oldLayer) { 247 refreshEnabled(); 248 } 211 249 } -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r1760 r1808 29 29 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 30 30 import org.openstreetmap.josm.gui.historycombobox.SuggestingJHistoryComboBox; 31 import org.openstreetmap.josm.gui.layer.Layer; 32 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 31 33 import org.openstreetmap.josm.io.OsmApi; 32 34 import org.openstreetmap.josm.io.OsmApiException; … … 48 50 * @author imi 49 51 */ 50 public class UploadAction extends JosmAction {52 public class UploadAction extends JosmAction implements LayerChangeListener{ 51 53 static private Logger logger = Logger.getLogger(UploadAction.class.getName()); 52 54 … … 152 154 } 153 155 }); 156 157 Layer.listeners.add(this); 158 refreshEnabled(); 159 } 160 161 /** 162 * Refreshes the enabled state 163 * 164 */ 165 protected void refreshEnabled() { 166 setEnabled(Main.main != null 167 && Main.map != null 168 && Main.map.mapView !=null 169 && Main.map.mapView.getEditLayer() != null 170 ); 154 171 } 155 172 … … 582 599 e.printStackTrace(); 583 600 } 601 602 /* ---------------------------------------------------------------------------------- */ 603 /* Interface LayerChangeListener */ 604 /* ---------------------------------------------------------------------------------- */ 605 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 606 refreshEnabled(); 607 } 608 609 public void layerAdded(Layer newLayer) { 610 refreshEnabled(); 611 } 612 613 public void layerRemoved(Layer oldLayer) { 614 refreshEnabled(); 615 } 584 616 } -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r1677 r1808 23 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 24 import org.openstreetmap.josm.gui.ExtendedDialog; 25 import org.openstreetmap.josm.gui.layer.Layer; 26 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 25 27 import org.openstreetmap.josm.tools.GBC; 26 28 import org.openstreetmap.josm.tools.Shortcut; 27 29 28 public class SearchAction extends JosmAction {30 public class SearchAction extends JosmAction implements LayerChangeListener{ 29 31 30 32 public static final int SEARCH_HISTORY_SIZE = 10; … … 40 42 public SearchAction() { 41 43 super(tr("Search..."), "dialogs/search", tr("Search for objects."), 42 Shortcut.registerShortcut("system:find", tr("Search..."), KeyEvent.VK_F, Shortcut.GROUP_HOTKEY), true); 44 Shortcut.registerShortcut("system:find", tr("Search..."), KeyEvent.VK_F, Shortcut.GROUP_HOTKEY), true); 45 Layer.listeners.add(this); 46 refreshEnabled(); 43 47 } 44 48 45 49 public void actionPerformed(ActionEvent e) { 50 if (!isEnabled()) 51 return; 46 52 if (Main.map == null) { 47 53 JOptionPane.showMessageDialog(Main.parent, tr("No data loaded.")); … … 49 55 } 50 56 SearchSetting s = lastSearch; 51 if (s == null) 57 if (s == null) { 52 58 s = new SearchSetting("", false, false, SearchMode.replace); 59 } 53 60 showSearchDialog(s); 54 61 } … … 81 88 JPanel right = new JPanel(); 82 89 JLabel description = 83 new JLabel("<html><ul>"84 + "<li>"+tr("<b>Baker Street</b> - 'Baker' and 'Street' in any key or name.")+"</li>"85 + "<li>"+tr("<b>\"Baker Street\"</b> - 'Baker Street' in any key or name.")+"</li>"86 + "<li>"+tr("<b>name:Bak</b> - 'Bak' anywhere in the name.")+"</li>"87 + "<li>"+tr("<b>type=route</b> - key 'type' with value exactly 'route'.") + "</li>"88 + "<li>"+tr("<b>type=*</b> - key 'type' with any value. Try also <b>*=value</b>, <b>type=</b>, <b>*=*</b>, <b>*=</b>") + "</li>"89 + "<li>"+tr("<b>-name:Bak</b> - not 'Bak' in the name.")+"</li>"90 + "<li>"+tr("<b>foot:</b> - key=foot set to any value.")+"</li>"91 + "<li>"+tr("<u>Special targets:</u>")+"</li>"92 + "<li>"+tr("<b>type:</b> - type of the object (<b>node</b>, <b>way</b>, <b>relation</b>)")+"</li>"93 + "<li>"+tr("<b>user:</b>... - all objects changed by user")+"</li>"94 + "<li>"+tr("<b>id:</b>... - object with given ID")+"</li>"95 + "<li>"+tr("<b>nodes:</b>... - object with given number of nodes")+"</li>"96 + "<li>"+tr("<b>modified</b> - all changed objects")+"</li>"97 + "<li>"+tr("<b>selected</b> - all selected objects")+"</li>"98 + "<li>"+tr("<b>incomplete</b> - all incomplete objects")+"</li>"99 + "<li>"+tr("<b>untagged</b> - all untagged objects")+"</li>"100 + "<li>"+tr("<b>child <i>expr</i></b> - all children of objects matching the expression")+"</li>"101 + "<li>"+tr("<b>parent <i>expr</i></b> - all parents of objects matching the expression")+"</li>"102 + "<li>"+tr("Use <b>|</b> or <b>OR</b> to combine with logical or")+"</li>"103 + "<li>"+tr("Use <b>\"</b> to quote operators (e.g. if key contains :)")+"</li>"104 + "<li>"+tr("Use <b>(</b> and <b>)</b> to group expressions")+"</li>"105 + "</ul></html>");90 new JLabel("<html><ul>" 91 + "<li>"+tr("<b>Baker Street</b> - 'Baker' and 'Street' in any key or name.")+"</li>" 92 + "<li>"+tr("<b>\"Baker Street\"</b> - 'Baker Street' in any key or name.")+"</li>" 93 + "<li>"+tr("<b>name:Bak</b> - 'Bak' anywhere in the name.")+"</li>" 94 + "<li>"+tr("<b>type=route</b> - key 'type' with value exactly 'route'.") + "</li>" 95 + "<li>"+tr("<b>type=*</b> - key 'type' with any value. Try also <b>*=value</b>, <b>type=</b>, <b>*=*</b>, <b>*=</b>") + "</li>" 96 + "<li>"+tr("<b>-name:Bak</b> - not 'Bak' in the name.")+"</li>" 97 + "<li>"+tr("<b>foot:</b> - key=foot set to any value.")+"</li>" 98 + "<li>"+tr("<u>Special targets:</u>")+"</li>" 99 + "<li>"+tr("<b>type:</b> - type of the object (<b>node</b>, <b>way</b>, <b>relation</b>)")+"</li>" 100 + "<li>"+tr("<b>user:</b>... - all objects changed by user")+"</li>" 101 + "<li>"+tr("<b>id:</b>... - object with given ID")+"</li>" 102 + "<li>"+tr("<b>nodes:</b>... - object with given number of nodes")+"</li>" 103 + "<li>"+tr("<b>modified</b> - all changed objects")+"</li>" 104 + "<li>"+tr("<b>selected</b> - all selected objects")+"</li>" 105 + "<li>"+tr("<b>incomplete</b> - all incomplete objects")+"</li>" 106 + "<li>"+tr("<b>untagged</b> - all untagged objects")+"</li>" 107 + "<li>"+tr("<b>child <i>expr</i></b> - all children of objects matching the expression")+"</li>" 108 + "<li>"+tr("<b>parent <i>expr</i></b> - all parents of objects matching the expression")+"</li>" 109 + "<li>"+tr("Use <b>|</b> or <b>OR</b> to combine with logical or")+"</li>" 110 + "<li>"+tr("Use <b>\"</b> to quote operators (e.g. if key contains :)")+"</li>" 111 + "<li>"+tr("Use <b>(</b> and <b>)</b> to group expressions")+"</li>" 112 + "</ul></html>"); 106 113 description.setFont(description.getFont().deriveFont(Font.PLAIN)); 107 114 right.add(description); … … 112 119 113 120 int result = new ExtendedDialog(Main.parent, 114 tr("Search"),115 p,116 new String[] {tr("Start Search"), tr("Cancel")},117 new String[] {"dialogs/search.png", "cancel.png"}).getValue();121 tr("Search"), 122 p, 123 new String[] {tr("Start Search"), tr("Cancel")}, 124 new String[] {"dialogs/search.png", "cancel.png"}).getValue(); 118 125 if(result != 1) return; 119 126 … … 132 139 */ 133 140 public static void searchWithHistory(SearchSetting s) { 134 if(searchHistory.isEmpty() || !s.equals(searchHistory.getFirst())) 141 if(searchHistory.isEmpty() || !s.equals(searchHistory.getFirst())) { 135 142 searchHistory.addFirst(s); 136 while (searchHistory.size() > SEARCH_HISTORY_SIZE) 143 } 144 while (searchHistory.size() > SEARCH_HISTORY_SIZE) { 137 145 searchHistory.removeLast(); 146 } 138 147 lastSearch = s; 139 148 search(s.text, s.mode, s.caseSensitive, s.regexSearch); … … 163 172 sel.add(osm); 164 173 ++foundMatches; 165 } else 174 } else { 166 175 sel.remove(osm); 176 } 167 177 } else if (mode == SearchMode.add && !osm.selected && matcher.match(osm)) { 168 178 sel.add(osm); … … 176 186 if (foundMatches == 0) { 177 187 String msg = null; 178 if (mode == SearchMode.replace) 188 if (mode == SearchMode.replace) { 179 189 msg = tr("No match found for ''{0}''", search); 180 else if (mode == SearchMode.add)190 } else if (mode == SearchMode.add) { 181 191 msg = tr("Nothing added to selection by searching for ''{0}''", search); 182 else if (mode == SearchMode.remove)192 } else if (mode == SearchMode.remove) { 183 193 msg = tr("Nothing removed from selection by searching for ''{0}''", search); 194 } 184 195 Main.map.statusLine.setHelpText(msg); 185 196 JOptionPane.showMessageDialog(Main.parent, msg); 186 } else 197 } else { 187 198 Main.map.statusLine.setHelpText(tr("Found {0} matches", foundMatches)); 199 } 188 200 } catch (SearchCompiler.ParseError e) { 189 201 JOptionPane.showMessageDialog(Main.parent, e.getMessage()); … … 212 224 } 213 225 226 @Override 214 227 public boolean equals(Object other) { 215 228 if(!(other instanceof SearchSetting)) … … 217 230 SearchSetting o = (SearchSetting) other; 218 231 return (o.caseSensitive == this.caseSensitive 219 && o.regexSearch == this.regexSearch 220 && o.mode.equals(this.mode) 221 && o.text.equals(this.text)); 222 } 232 && o.regexSearch == this.regexSearch 233 && o.mode.equals(this.mode) 234 && o.text.equals(this.text)); 235 } 236 } 237 238 /** 239 * Refreshes the enabled state 240 * 241 */ 242 protected void refreshEnabled() { 243 setEnabled(Main.map != null 244 && Main.map.mapView !=null 245 && Main.map.mapView.getEditLayer() != null 246 ); 247 } 248 249 /* ---------------------------------------------------------------------------------- */ 250 /* Interface LayerChangeListener */ 251 /* ---------------------------------------------------------------------------------- */ 252 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 253 refreshEnabled(); 254 } 255 256 public void layerAdded(Layer newLayer) { 257 refreshEnabled(); 258 } 259 260 public void layerRemoved(Layer oldLayer) { 261 refreshEnabled(); 223 262 } 224 263 } -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r1700 r1808 75 75 import org.openstreetmap.josm.actions.audio.AudioSlowerAction; 76 76 import org.openstreetmap.josm.actions.search.SearchAction; 77 import org.openstreetmap.josm.gui.layer.Layer; 78 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 77 79 import org.openstreetmap.josm.tools.Shortcut; 78 80 … … 91 93 public final OpenFileAction openFile = new OpenFileAction(); 92 94 public final OpenLocationAction openLocation = new OpenLocationAction(); 93 public final JosmAction save = new SaveAction( null);94 public final JosmAction saveAs = new SaveAsAction( null);95 public final JosmAction gpxExport = new GpxExportAction( null);95 public final JosmAction save = new SaveAction(); 96 public final JosmAction saveAs = new SaveAsAction(); 97 public final JosmAction gpxExport = new GpxExportAction(); 96 98 public final DownloadAction download = new DownloadAction(); 97 99 public final JosmAction update = new UpdateDataAction(); … … 306 308 Shortcut.GROUP_DIRECT).getKeyStroke()); 307 309 add(helpMenu, about); 310 311 new PresetsMenuEnabler(presetsMenu).refreshEnabled(); 312 } 313 314 class PresetsMenuEnabler implements LayerChangeListener { 315 private JMenu presetsMenu; 316 public PresetsMenuEnabler(JMenu presetsMenu) { 317 Layer.listeners.add(this); 318 this.presetsMenu = presetsMenu; 319 } 320 /** 321 * Refreshes the enabled state 322 * 323 */ 324 protected void refreshEnabled() { 325 presetsMenu.setEnabled(Main.map != null 326 && Main.map.mapView !=null 327 && Main.map.mapView.getEditLayer() != null 328 ); 329 } 330 331 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 332 refreshEnabled(); 333 } 334 335 public void layerAdded(Layer newLayer) { 336 refreshEnabled(); 337 } 338 339 public void layerRemoved(Layer oldLayer) { 340 refreshEnabled(); 341 } 308 342 } 309 343 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r1797 r1808 210 210 */ 211 211 public void removeLayer(Layer layer) { 212 if (layer == activeLayer) { 213 if (layer instanceof OsmDataLayer) { 214 Main.ds = null; 215 } 216 activeLayer = null; 217 } 212 218 if (layers.remove(layer)) { 213 219 for (Layer.LayerChangeListener l : Layer.listeners) { 214 220 l.layerRemoved(layer); 215 }216 }217 if (layer == activeLayer) {218 if (layer instanceof OsmDataLayer) {219 Main.ds = null;220 221 } 221 222 } … … 419 420 // workaround for #1461 (zoom to download bounding box instead of all data) 420 421 // In case we already have an existing data layer ... 421 Collection<DataSource> dataSources = Main.main.createOrGetEditLayer().data.dataSources; 422 OsmDataLayer layer= getEditLayer(); 423 if (layer == null) 424 return false; 425 Collection<DataSource> dataSources = layer.data.dataSources; 422 426 // ... with bounding box[es] of data loaded from OSM or a file... 423 427 BoundingXYVisitor bbox = new BoundingXYVisitor(); -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r1744 r1808 127 127 } 128 128 String propName = "draw.rawgps.lines.layer "+name; 129 if (Main.pref.hasKey(propName)) 129 if (Main.pref.hasKey(propName)) { 130 130 group.setSelected(r[Main.pref.getBoolean(propName) ? 1:2].getModel(), true); 131 else131 } else { 132 132 group.setSelected(r[0].getModel(), true); 133 } 133 134 int answer = JOptionPane.showConfirmDialog(Main.parent, panel, tr("Select line drawing options"), JOptionPane.OK_CANCEL_OPTION); 134 135 if (answer == JOptionPane.CANCEL_OPTION) 135 136 return; 136 if (group.getSelection() == r[0].getModel()) 137 if (group.getSelection() == r[0].getModel()) { 137 138 Main.pref.put(propName, null); 138 else139 } else { 139 140 Main.pref.put(propName, group.getSelection() == r[1].getModel()); 141 } 140 142 Main.map.repaint(); 141 143 } … … 149 151 Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")}; 150 152 int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION, 151 JOptionPane.PLAIN_MESSAGE, null, options, options[0]);153 JOptionPane.PLAIN_MESSAGE, null, options, options[0]); 152 154 switch (answer) { 153 155 case 0: … … 169 171 public void actionPerformed(ActionEvent e) { 170 172 GpxData namedTrackPoints = new GpxData(); 171 for (GpxTrack track : data.tracks) 172 for (Collection<WayPoint> seg : track.trackSegs) 173 for (GpxTrack track : data.tracks) { 174 for (Collection<WayPoint> seg : track.trackSegs) { 173 175 for (WayPoint point : seg) 174 if (point.attr.containsKey("name") || point.attr.containsKey("desc")) 176 if (point.attr.containsKey("name") || point.attr.containsKey("desc")) { 175 177 namedTrackPoints.waypoints.add(point); 178 } 179 } 180 } 176 181 177 182 MarkerLayer ml = new MarkerLayer(namedTrackPoints, tr("Named Trackpoints from {0}", name), getAssociatedFile(), me); … … 200 205 fc.setMultiSelectionEnabled(true); 201 206 if(fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) { 202 if (!fc.getCurrentDirectory().getAbsolutePath().equals(dir)) 207 if (!fc.getCurrentDirectory().getAbsolutePath().equals(dir)) { 203 208 Main.pref.put("markers.lastaudiodirectory", fc.getCurrentDirectory().getAbsolutePath()); 209 } 204 210 205 211 File sel[] = fc.getSelectedFiles(); … … 217 223 String names = null; 218 224 for (int i = 0; i < sel.length; i++) { 219 if(names == null) 225 if(names == null) { 220 226 names = " ("; 221 else227 } else { 222 228 names += ", "; 229 } 223 230 names += sel[i].getName(); 224 231 } 225 if(names != null) 232 if(names != null) { 226 233 names += ")"; 227 else234 } else { 228 235 names = ""; 236 } 229 237 MarkerLayer ml = new MarkerLayer(new GpxData(), tr("Audio markers from {0}", name) + names, 230 getAssociatedFile(), me);238 getAssociatedFile(), me); 231 239 if(sel != null) 232 240 { … … 270 278 private void addRecursiveFiles(LinkedList<File> files, File[] sel) { 271 279 for (File f : sel) { 272 if (f.isDirectory()) 280 if (f.isDirectory()) { 273 281 addRecursiveFiles(files, f.listFiles()); 274 else if (f.getName().toLowerCase().endsWith(".jpg"))282 } else if (f.getName().toLowerCase().endsWith(".jpg")) { 275 283 files.add(f); 284 } 276 285 } 277 286 } … … 291 300 new JMenuItem(new LayerListPopup.InfoAction(this))}; 292 301 return new Component[] { 293 new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),294 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),295 new JSeparator(),296 new JMenuItem(newSaveAction(this)),297 new JMenuItem(newSaveAsAction(this)),298 color,299 line,300 tagimage,301 importAudio,302 markersFromNamedTrackpoints,303 new JMenuItem(new ConvertToDataLayerAction()),304 new JMenuItem(new DownloadAlongTrackAction()),305 new JSeparator(),306 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)),307 new JSeparator(),308 new JMenuItem(new LayerListPopup.InfoAction(this))};302 new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)), 303 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 304 new JSeparator(), 305 new JMenuItem(new LayerSaveAction(this)), 306 new JMenuItem(new LayerSaveAsAction(this)), 307 color, 308 line, 309 tagimage, 310 importAudio, 311 markersFromNamedTrackpoints, 312 new JMenuItem(new ConvertToDataLayerAction()), 313 new JMenuItem(new DownloadAlongTrackAction()), 314 new JSeparator(), 315 new JMenuItem(new RenameLayerAction(getAssociatedFile(), this)), 316 new JSeparator(), 317 new JMenuItem(new LayerListPopup.InfoAction(this))}; 309 318 } 310 319 … … 313 322 314 323 info.append(trn("{0} track, ", "{0} tracks, ", 315 data.tracks.size(), data.tracks.size())).append(trn("{0} route, ", "{0} routes, ",316 data.routes.size(), data.routes.size())).append(trn("{0} waypoint", "{0} waypoints",317 data.waypoints.size(), data.waypoints.size())).append("<br>");318 319 if (data.attr.containsKey("name")) 324 data.tracks.size(), data.tracks.size())).append(trn("{0} route, ", "{0} routes, ", 325 data.routes.size(), data.routes.size())).append(trn("{0} waypoint", "{0} waypoints", 326 data.waypoints.size(), data.waypoints.size())).append("<br>"); 327 328 if (data.attr.containsKey("name")) { 320 329 info.append(tr("Name: {0}", data.attr.get(GpxData.META_NAME))).append("<br>"); 321 322 if (data.attr.containsKey("desc")) 330 } 331 332 if (data.attr.containsKey("desc")) { 323 333 info.append(tr("Description: {0}", data.attr.get(GpxData.META_DESC))).append("<br>"); 334 } 324 335 325 336 if(data.tracks.size() > 0){ … … 346 357 DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); 347 358 info.append(tr("Timespan: ") + df.format(new Date((long)(earliest.time * 1000))) + " - " 348 + df.format(new Date((long)(latest.time * 1000))));359 + df.format(new Date((long)(latest.time * 1000)))); 349 360 int diff = (int)(latest.time - earliest.time); 350 361 info.append(" (" + (diff / 3600) + ":" + ((diff % 3600)/60) + ")"); … … 418 429 String linesKey = "draw.rawgps.lines.layer "+name; 419 430 // draw lines, per-layer setting 420 if (Main.pref.hasKey(linesKey)) 431 if (Main.pref.hasKey(linesKey)) { 421 432 lines = Main.pref.getBoolean(linesKey); 433 } 422 434 // paint large dots for points 423 435 boolean large = Main.pref.getBoolean("draw.rawgps.large"); … … 437 449 ****************************************************************/ 438 450 if (computeCacheInSync && ((computeCacheMaxLineLengthUsed != maxLineLength) || 439 440 441 442 // System.out.println("(re-)computing gpx line styles, reason: CCIS=" + computeCacheInSync + " CCMLLU=" + (computeCacheMaxLineLengthUsed != maxLineLength) + " CCCU=" + (!neutralColor.equals(computeCacheColorUsed)) + " CCC=" + (computeCacheColored != colored));451 (!neutralColor.equals(computeCacheColorUsed)) || 452 (computeCacheColored != colored) || 453 (computeCacheColorTracksTune != colorTracksTune))) { 454 // System.out.println("(re-)computing gpx line styles, reason: CCIS=" + computeCacheInSync + " CCMLLU=" + (computeCacheMaxLineLengthUsed != maxLineLength) + " CCCU=" + (!neutralColor.equals(computeCacheColorUsed)) + " CCC=" + (computeCacheColored != colored)); 443 455 computeCacheMaxLineLengthUsed = maxLineLength; 444 456 computeCacheInSync = false; … … 468 480 469 481 switch(colored) { 470 case velocity: 471 double dtime = trkPnt.time - oldWp.time; 472 double vel = dist/dtime; 473 double velColor = vel/colorTracksTune*255; 474 // Bad case first 475 if (dtime <= 0 || vel < 0 || velColor > 255) 476 trkPnt.customColoring = colors[255]; 477 else 478 trkPnt.customColoring = colors[(int) (velColor)]; 479 break; 480 481 case dilution: 482 if(trkPnt.attr.get("hdop") != null) { 483 float hdop = ((Float)trkPnt.attr.get("hdop")).floatValue(); 484 if (hdop < 0) { 485 hdop = 0; 486 } 487 int hdoplvl = Math.round(hdop * Main.pref.getInteger("hdop.factor", 25)); 488 // High hdop is bad, but high values in colors are green. 489 // Therefore inverse the logic 490 int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl); 491 trkPnt.customColoring = colors[hdopcolor]; 482 case velocity: 483 double dtime = trkPnt.time - oldWp.time; 484 double vel = dist/dtime; 485 double velColor = vel/colorTracksTune*255; 486 // Bad case first 487 if (dtime <= 0 || vel < 0 || velColor > 255) { 488 trkPnt.customColoring = colors[255]; 489 } else { 490 trkPnt.customColoring = colors[(int) (velColor)]; 491 } 492 break; 493 494 case dilution: 495 if(trkPnt.attr.get("hdop") != null) { 496 float hdop = ((Float)trkPnt.attr.get("hdop")).floatValue(); 497 if (hdop < 0) { 498 hdop = 0; 492 499 } 493 break; 500 int hdoplvl = Math.round(hdop * Main.pref.getInteger("hdop.factor", 25)); 501 // High hdop is bad, but high values in colors are green. 502 // Therefore inverse the logic 503 int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl); 504 trkPnt.customColoring = colors[hdopcolor]; 505 } 506 break; 494 507 } 495 508 … … 514 527 ****************************************************************/ 515 528 if (lines) { 516 Point old = null; 517 for (GpxTrack trk : data.tracks) { 518 for (Collection<WayPoint> segment : trk.trackSegs) { 519 for (WayPoint trkPnt : segment) { 520 LatLon c = trkPnt.getCoor(); 521 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) 522 continue; 523 Point screen = mv.getPoint(trkPnt.getEastNorth()); 529 Point old = null; 530 for (GpxTrack trk : data.tracks) { 531 for (Collection<WayPoint> segment : trk.trackSegs) { 532 for (WayPoint trkPnt : segment) { 533 LatLon c = trkPnt.getCoor(); 534 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) { 535 continue; 536 } 537 Point screen = mv.getPoint(trkPnt.getEastNorth()); 524 538 if (trkPnt.drawLine) { 525 539 // skip points that are on the same screenposition … … 545 559 for (WayPoint trkPnt : segment) { 546 560 LatLon c = trkPnt.getCoor(); 547 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) 561 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) { 548 562 continue; 563 } 549 564 if (trkPnt.drawLine) { 550 565 Point screen = mv.getPoint(trkPnt.getEastNorth()); … … 554 569 double t = Math.atan2(screen.y-old.y, screen.x-old.x) + Math.PI; 555 570 g.drawLine(screen.x,screen.y, (int)(screen.x + 10*Math.cos(t-PHI)), (int)(screen.y 556 + 10*Math.sin(t-PHI)));571 + 10*Math.sin(t-PHI))); 557 572 g.drawLine(screen.x,screen.y, (int)(screen.x + 10*Math.cos(t+PHI)), (int)(screen.y 558 + 10*Math.sin(t+PHI)));573 + 10*Math.sin(t+PHI))); 559 574 oldA = screen; 560 575 } … … 576 591 for (WayPoint trkPnt : segment) { 577 592 LatLon c = trkPnt.getCoor(); 578 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) 593 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) { 579 594 continue; 595 } 580 596 if (trkPnt.drawLine) { 581 597 Point screen = mv.getPoint(trkPnt.getEastNorth()); … … 603 619 for (WayPoint trkPnt : segment) { 604 620 LatLon c = trkPnt.getCoor(); 605 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) 621 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) { 606 622 continue; 623 } 607 624 Point screen = mv.getPoint(trkPnt.getEastNorth()); 608 625 g.setColor(trkPnt.customColoring); … … 622 639 for (WayPoint trkPnt : segment) { 623 640 LatLon c = trkPnt.getCoor(); 624 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) 641 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) { 625 642 continue; 643 } 626 644 if (!trkPnt.drawLine) { 627 645 Point screen = mv.getPoint(trkPnt.getEastNorth()); 628 g.drawRect(screen.x, screen.y, 0, 0);629 }646 g.drawRect(screen.x, screen.y, 0, 0); 647 } 630 648 } // end for trkpnt 631 649 } // end for segment … … 642 660 for (WayPoint trkPnt : segment) { 643 661 LatLon c = trkPnt.getCoor(); 644 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) 662 if (Double.isNaN(c.lat()) || Double.isNaN(c.lon())) { 645 663 continue; 664 } 646 665 Point screen = mv.getPoint(trkPnt.getEastNorth()); 647 666 g.setColor(trkPnt.customColoring); … … 688 707 } 689 708 Main.main.addLayer(new OsmDataLayer(ds, tr("Converted from: {0}", GpxLayer.this.name), 690 709 getAssociatedFile())); 691 710 Main.main.removeLayer(GpxLayer.this); 692 711 } 693 712 } 694 713 714 @Override 695 715 public File getAssociatedFile() { return data.storageFile; } 716 @Override 696 717 public void setAssociatedFile(File file) { data.storageFile = file; } 697 718 … … 712 733 msg.add(new JLabel(tr("Download everything within:")), GBC.eol()); 713 734 String s[] = new String[dist.length]; 714 for(int i = 0; i < dist.length; ++i) 735 for(int i = 0; i < dist.length; ++i) { 715 736 s[i] = tr("{0} meters", dist[i]); 737 } 716 738 JList buffer = new JList(s); 717 739 msg.add(buffer, GBC.eol()); 718 740 msg.add(new JLabel(tr("Maximum area per request:")), GBC.eol()); 719 741 s = new String[area.length]; 720 for(int i = 0; i < area.length; ++i) 742 for(int i = 0; i < area.length; ++i) { 721 743 s[i] = tr("{0} sq km", area[i]); 744 } 722 745 JList maxRect = new JList(s); 723 746 msg.add(maxRect, GBC.eol()); 724 747 725 748 if (JOptionPane.showConfirmDialog(Main.parent, msg, 726 tr("Download from OSM along this track"),727 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {749 tr("Download from OSM along this track"), 750 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) 728 751 return; 729 }730 752 731 753 /* … … 813 835 814 836 msg.add(new JLabel(tr("<html>This action will require {0} individual<br>download requests. Do you wish<br>to continue?</html>", 815 toDownload.size())), GBC.eol());837 toDownload.size())), GBC.eol()); 816 838 817 839 if (toDownload.size() > 1 && JOptionPane.showConfirmDialog(Main.parent, msg, 818 tr("Download from OSM along this track"),819 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {840 tr("Download from OSM along this track"), 841 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) 820 842 return; 821 }822 843 823 844 new DownloadOsmTaskList().download(false, toDownload); … … 874 895 if (data.tracks != null && ! data.tracks.isEmpty()) { 875 896 for (GpxTrack track : data.tracks) { 876 if (track.trackSegs == null) continue; 897 if (track.trackSegs == null) { 898 continue; 899 } 877 900 for (Collection<WayPoint> seg : track.trackSegs) { 878 901 for (WayPoint w : seg) { … … 880 903 break; 881 904 } 882 if (firstTime >= 0.0) break; 883 } 884 if (firstTime >= 0.0) break; 905 if (firstTime >= 0.0) { 906 break; 907 } 908 } 909 if (firstTime >= 0.0) { 910 break; 911 } 885 912 } 886 913 } … … 892 919 // (a) try explicit timestamped waypoints - unless suppressed 893 920 if (Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true) && 894 data.waypoints != null && ! data.waypoints.isEmpty())921 data.waypoints != null && ! data.waypoints.isEmpty()) 895 922 { 896 923 for (WayPoint w : data.waypoints) { … … 905 932 // (b) try explicit waypoints without timestamps - unless suppressed 906 933 if (Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true) && 907 data.waypoints != null && ! data.waypoints.isEmpty())934 data.waypoints != null && ! data.waypoints.isEmpty()) 908 935 { 909 936 for (WayPoint w : data.waypoints) { … … 913 940 WayPoint wc = new WayPoint(w.getCoor()); 914 941 wc.time = wNear.time; 915 if (w.attr.containsKey("name")) wc.attr.put("name", w.getString("name")); 942 if (w.attr.containsKey("name")) { 943 wc.attr.put("name", w.getString("name")); 944 } 916 945 waypoints.add(wc); 917 946 } else { … … 923 952 // (c) use explicitly named track points, again unless suppressed 924 953 if ((Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false)) && 925 data.tracks != null && ! data.tracks.isEmpty())954 data.tracks != null && ! data.tracks.isEmpty()) 926 955 { 927 956 for (GpxTrack track : data.tracks) { 928 if (track.trackSegs == null) continue; 957 if (track.trackSegs == null) { 958 continue; 959 } 929 960 for (Collection<WayPoint> seg : track.trackSegs) { 930 961 for (WayPoint w : seg) { … … 945 976 double startTime = lastModified - duration; 946 977 startTime = firstStartTime + (startTime - firstStartTime) / 947 978 Main.pref.getDouble("audio.calibration", "1.0" /* default, ratio */); 948 979 WayPoint w1 = null; 949 980 WayPoint w2 = null; 950 981 951 982 for (GpxTrack track : data.tracks) { 952 if (track.trackSegs == null) continue; 983 if (track.trackSegs == null) { 984 continue; 985 } 953 986 for (Collection<WayPoint> seg : track.trackSegs) { 954 987 for (WayPoint w : seg) { … … 959 992 w1 = w; 960 993 } 961 if (w2 != null) break; 994 if (w2 != null) { 995 break; 996 } 962 997 } 963 998 } … … 967 1002 } else { 968 1003 wayPointFromTimeStamp = new WayPoint(w1.getCoor().interpolate( 969 w2.getCoor(), (startTime - w1.time)/(w2.time - w1.time)));1004 w2.getCoor(), (startTime - w1.time)/(w2.time - w1.time))); 970 1005 wayPointFromTimeStamp.time = startTime; 971 1006 String name = wavFile.getName(); … … 981 1016 // (f) simply add a single marker at the start of the track 982 1017 if ((Main.pref.getBoolean("marker.audiofromstart") || waypoints.isEmpty()) && 983 data.tracks != null && ! data.tracks.isEmpty())1018 data.tracks != null && ! data.tracks.isEmpty()) 984 1019 { 985 1020 boolean gotOne = false; 986 1021 for (GpxTrack track : data.tracks) { 987 if (track.trackSegs == null) continue; 1022 if (track.trackSegs == null) { 1023 continue; 1024 } 988 1025 for (Collection<WayPoint> seg : track.trackSegs) { 989 1026 for (WayPoint w : seg) { … … 995 1032 break; 996 1033 } 997 if (gotOne) break; 998 } 999 if (gotOne) break; 1034 if (gotOne) { 1035 break; 1036 } 1037 } 1038 if (gotOne) { 1039 break; 1040 } 1000 1041 } 1001 1042 } … … 1011 1052 firstTime = -1.0; /* this time of the first waypoint, not first trackpoint */ 1012 1053 for (WayPoint w : waypoints) { 1013 if (firstTime < 0.0) firstTime = w.time; 1054 if (firstTime < 0.0) { 1055 firstTime = w.time; 1056 } 1014 1057 double offset = w.time - firstTime; 1015 1058 String name; 1016 if (w.attr.containsKey("name")) 1059 if (w.attr.containsKey("name")) { 1017 1060 name = w.getString("name"); 1018 else if (w.attr.containsKey("desc"))1061 } else if (w.attr.containsKey("desc")) { 1019 1062 name = w.getString("desc"); 1020 else1063 } else { 1021 1064 name = AudioMarker.inventName(offset); 1065 } 1022 1066 AudioMarker am = AudioMarker.create(w.getCoor(), 1023 1067 name, uri, ml, w.time, offset); … … 1031 1075 if (timedMarkersOmitted) { 1032 1076 JOptionPane.showMessageDialog(Main.parent, 1033 tr("Some waypoints with timestamps from before the start of the track or after the end were omitted or moved to the start."));1077 tr("Some waypoints with timestamps from before the start of the track or after the end were omitted or moved to the start.")); 1034 1078 } 1035 1079 if (untimedMarkersOmitted) { 1036 1080 JOptionPane.showMessageDialog(Main.parent, 1037 tr("Some waypoints which were too far from the track to sensibly estimate their time were omitted."));1081 tr("Some waypoints which were too far from the track to sensibly estimate their time were omitted.")); 1038 1082 } 1039 1083 } … … 1089 1133 if (data.tracks == null) return null; 1090 1134 for (GpxTrack track : data.tracks) { 1091 if (track.trackSegs == null) continue; 1135 if (track.trackSegs == null) { 1136 continue; 1137 } 1092 1138 for (Collection<WayPoint> seg : track.trackSegs) { 1093 1139 WayPoint R = null; … … 1113 1159 double C = - A * rx - B * ry; 1114 1160 double RSsq = A * A + B * B; 1115 if (RSsq == 0.0) continue; 1161 if (RSsq == 0.0) { 1162 continue; 1163 } 1116 1164 double PNsq = A * px + B * py + C; 1117 1165 PNsq = PNsq * PNsq / RSsq; -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r1772 r1808 3 3 package org.openstreetmap.josm.gui.layer; 4 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 5 7 import java.awt.Component; 6 8 import java.awt.Graphics; 9 import java.awt.event.ActionEvent; 7 10 import java.io.File; 8 11 import java.util.Collection; 9 12 import java.util.concurrent.CopyOnWriteArrayList; 10 13 14 import javax.swing.AbstractAction; 11 15 import javax.swing.Icon; 12 16 17 import org.openstreetmap.josm.actions.GpxExportAction; 18 import org.openstreetmap.josm.actions.SaveAction; 19 import org.openstreetmap.josm.actions.SaveAsAction; 13 20 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 14 21 import org.openstreetmap.josm.gui.MapView; 15 22 import org.openstreetmap.josm.tools.Destroyable; 23 import org.openstreetmap.josm.tools.ImageProvider; 16 24 17 25 /** … … 133 141 return name; 134 142 } 143 144 145 public static class LayerSaveAction extends AbstractAction { 146 private Layer layer; 147 public LayerSaveAction(Layer layer) { 148 putValue(SMALL_ICON, ImageProvider.get("save")); 149 putValue(SHORT_DESCRIPTION, tr("Save the current data.")); 150 putValue(NAME, tr("Save")); 151 setEnabled(true); 152 this.layer = layer; 153 } 154 155 public void actionPerformed(ActionEvent e) { 156 new SaveAction().doSave(layer); 157 158 } 159 } 160 161 public static class LayerSaveAsAction extends AbstractAction { 162 private Layer layer; 163 public LayerSaveAsAction(Layer layer) { 164 putValue(SMALL_ICON, ImageProvider.get("save_as")); 165 putValue(SHORT_DESCRIPTION, tr("Save the current data to a new file.")); 166 putValue(NAME, tr("Save As...")); 167 setEnabled(true); 168 this.layer = layer; 169 } 170 171 public void actionPerformed(ActionEvent e) { 172 new SaveAsAction().doSave(layer); 173 } 174 } 175 176 public static class LayerGpxExportAction extends AbstractAction { 177 private Layer layer; 178 public LayerGpxExportAction(Layer layer) { 179 putValue(SMALL_ICON, ImageProvider.get("exportgpx")); 180 putValue(SHORT_DESCRIPTION, tr("Export the data to GPX file.")); 181 putValue(NAME, tr("Export to GPX...")); 182 setEnabled(true); 183 this.layer = layer; 184 } 185 186 public void actionPerformed(ActionEvent e) { 187 new GpxExportAction().export(layer); 188 } 189 } 190 135 191 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r1750 r1808 18 18 import java.awt.TexturePaint; 19 19 import java.awt.event.ActionEvent; 20 import java.awt.event.KeyEvent; 20 21 import java.awt.geom.Area; 21 22 import java.awt.image.BufferedImage; … … 66 67 import org.openstreetmap.josm.tools.GBC; 67 68 import org.openstreetmap.josm.tools.ImageProvider; 69 import org.openstreetmap.josm.tools.Shortcut; 68 70 69 71 /** … … 430 432 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 431 433 new JSeparator(), 432 new JMenuItem(new SaveAction(this)),433 new JMenuItem(new SaveAsAction(this)),434 new JMenuItem(new GpxExportAction(this)),434 new JMenuItem(new LayerSaveAction(this)), 435 new JMenuItem(new LayerSaveAsAction(this)), 436 new JMenuItem(new LayerGpxExportAction(this)), 435 437 new JMenuItem(new ConvertToGpxLayerAction()), 436 438 new JSeparator(), -
trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r1646 r1808 126 126 boolean lines = Main.pref.getBoolean("draw.rawgps.lines", true); 127 127 String linesKey = "draw.rawgps.lines.layer "+name; 128 if (Main.pref.hasKey(linesKey)) 128 if (Main.pref.hasKey(linesKey)) { 129 129 lines = Main.pref.getBoolean(linesKey); 130 } 130 131 boolean large = Main.pref.getBoolean("draw.rawgps.large"); 131 132 for (Collection<GpsPoint> c : data) { 132 if (!force) 133 if (!force) { 133 134 old = null; 135 } 134 136 for (GpsPoint p : c) { 135 137 Point screen = mv.getPoint(p.eastNorth); 136 if (lines && old != null) 138 if (lines && old != null) { 137 139 g.drawLine(old.x, old.y, screen.x, screen.y); 138 else if (!large)140 } else if (!large) { 139 141 g.drawRect(screen.x, screen.y, 0, 0); 140 if (large) 142 } 143 if (large) { 141 144 g.fillRect(screen.x-1, screen.y-1, 3, 3); 145 } 142 146 old = screen; 143 147 } … … 147 151 @Override public String getToolTipText() { 148 152 int points = 0; 149 for (Collection<GpsPoint> c : data) 153 for (Collection<GpsPoint> c : data) { 150 154 points += c.size(); 155 } 151 156 String tool = data.size()+" "+trn("track", "tracks", data.size()) 152 157 +" "+points+" "+trn("point", "points", points); 153 158 File f = getAssociatedFile(); 154 if (f != null) 159 if (f != null) { 155 160 tool = "<html>"+tool+"<br>"+f.getPath()+"</html>"; 161 } 156 162 return tool; 157 163 } … … 167 173 168 174 @Override public void visitBoundingBox(BoundingXYVisitor v) { 169 for (Collection<GpsPoint> c : data) 170 for (GpsPoint p : c) 175 for (Collection<GpsPoint> c : data) { 176 for (GpsPoint p : c) { 171 177 v.visit(p.eastNorth); 178 } 179 } 172 180 } 173 181 … … 198 206 } 199 207 String propName = "draw.rawgps.lines.layer "+name; 200 if (Main.pref.hasKey(propName)) 208 if (Main.pref.hasKey(propName)) { 201 209 group.setSelected(r[Main.pref.getBoolean(propName) ? 1:2].getModel(), true); 202 else210 } else { 203 211 group.setSelected(r[0].getModel(), true); 212 } 204 213 int answer = JOptionPane.showConfirmDialog(Main.parent, panel, tr("Select line drawing options"), JOptionPane.OK_CANCEL_OPTION); 205 214 if (answer == JOptionPane.CANCEL_OPTION) 206 215 return; 207 if (group.getSelection() == r[0].getModel()) 216 if (group.getSelection() == r[0].getModel()) { 208 217 Main.pref.put(propName, null); 209 else218 } else { 210 219 Main.pref.put(propName, group.getSelection() == r[1].getModel()); 220 } 211 221 Main.map.repaint(); 212 222 } … … 219 229 Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")}; 220 230 int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION, 221 JOptionPane.PLAIN_MESSAGE, null, options, options[0]);231 JOptionPane.PLAIN_MESSAGE, null, options, options[0]); 222 232 switch (answer) { 223 233 case 0: … … 250 260 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 251 261 new JSeparator(), 252 new JMenuItem(new GpxExportAction(this)),262 new JMenuItem(new LayerGpxExportAction(this)), 253 263 color, 254 264 line, … … 261 271 262 272 public void preferenceChanged(String key, String newValue) { 263 if (Main.map != null && (key.equals("draw.rawgps.lines") || key.equals("draw.rawgps.lines.force"))) 273 if (Main.map != null && (key.equals("draw.rawgps.lines") || key.equals("draw.rawgps.lines.force"))) { 264 274 Main.map.repaint(); 275 } 265 276 } 266 277
Note:
See TracChangeset
for help on using the changeset viewer.