Changeset 17703 in osm for applications/editors/josm
- Timestamp:
- 2009-09-20T10:10:18+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbPlugin.java
r17534 r17703 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 … … 51 51 52 52 /** 53 * Shows issues from OpenStreetBugs 53 * Shows issues from OpenStreetBugs 54 54 * 55 55 * @author Henrik Niehaus (henrik dot niehaus at gmx dot de) … … 58 58 59 59 private DataSet dataSet; 60 60 61 61 private UploadHook uploadHook; 62 62 63 63 private OsbDialog dialog; 64 64 65 65 private OsbLayer layer; 66 66 67 67 public static boolean active = false; 68 68 69 69 private DownloadAction download = new DownloadAction(); 70 70 71 71 public OsbPlugin() { 72 72 super(); … … 78 78 OsbLayer.listeners.add(this); 79 79 } 80 80 81 81 private void initConfig() { 82 82 String debug = Main.pref.get(ConfigKeys.OSB_API_DISABLED); … … 85 85 Main.pref.put(ConfigKeys.OSB_API_DISABLED, debug); 86 86 } 87 87 88 88 // check, which api is used 89 89 String uriNew = Main.pref.get(ConfigKeys.OSB_API_URI_NEW); … … 91 91 boolean switchApi = true; 92 92 if(oldApi) { 93 int choice = JOptionPane.showConfirmDialog(Main.parent, 94 tr("<html>The openstreetbu s plugin is using the old server at appspot.com.<br>" +95 96 "Do you want to switch to the new server? (Strongly recommended)</html>"),93 int choice = JOptionPane.showConfirmDialog(Main.parent, 94 tr("<html>The openstreetbugs plugin is using the old server at appspot.com.<br>" + 95 "A new server is available at schokokeks.org.<br>" + 96 "Do you want to switch to the new server? (Strongly recommended)</html>"), 97 97 tr("Switch to new openstreetbugs server?"), 98 98 JOptionPane.YES_NO_OPTION); 99 99 switchApi = choice == JOptionPane.YES_OPTION; 100 100 } 101 101 102 102 String uri = Main.pref.get(ConfigKeys.OSB_API_URI_EDIT); 103 103 if(uri == null || uri.length() == 0 || switchApi) { … … 105 105 Main.pref.put(ConfigKeys.OSB_API_URI_EDIT, uri); 106 106 } 107 107 108 108 uri = Main.pref.get(ConfigKeys.OSB_API_URI_CLOSE); 109 109 if(uri == null || uri.length() == 0 || switchApi) { … … 111 111 Main.pref.put(ConfigKeys.OSB_API_URI_CLOSE, uri); 112 112 } 113 113 114 114 uri = Main.pref.get(ConfigKeys.OSB_API_URI_DOWNLOAD); 115 115 if(uri == null || uri.length() == 0 || switchApi) { … … 117 117 Main.pref.put(ConfigKeys.OSB_API_URI_DOWNLOAD, uri); 118 118 } 119 119 120 120 uri = Main.pref.get(ConfigKeys.OSB_API_URI_NEW); 121 121 if(uri == null || uri.length() == 0 || switchApi) { … … 123 123 Main.pref.put(ConfigKeys.OSB_API_URI_NEW, uri); 124 124 } 125 125 126 126 String auto_download = Main.pref.get(ConfigKeys.OSB_AUTO_DOWNLOAD); 127 127 if(auto_download == null || auto_download.length() == 0) { … … 129 129 Main.pref.put(ConfigKeys.OSB_AUTO_DOWNLOAD, auto_download); 130 130 } 131 131 132 132 String include_date = Main.pref.get(ConfigKeys.OSB_INCLUDE_DATE); 133 133 if(include_date == null || include_date.length() == 0) { … … 147 147 mv.getLatLon(mv.getWidth(), 0)); 148 148 } 149 149 150 150 public void updateData() { 151 151 // determine the bounds of the currently visible area … … 158 158 return; 159 159 } 160 160 161 161 try { 162 162 // download the data … … 177 177 } 178 178 } 179 179 180 180 public void updateGui() { 181 181 // update dialog 182 182 dialog.update(dataSet); 183 183 184 184 // create a new layer if necessary 185 185 updateLayer(dataSet); 186 186 187 187 // repaint view, so that changes get visible 188 188 Main.map.mapView.repaint(); 189 189 } 190 190 191 191 private void updateLayer(DataSet osbData) { 192 192 if(layer == null) { … … 201 201 // add the dialog 202 202 newFrame.addToggleDialog(dialog); 203 203 204 204 // add the upload hook 205 UploadAction.registerUploadHook(uploadHook); 205 UploadAction.registerUploadHook(uploadHook); 206 206 } else if (oldFrame!=null && newFrame==null ) { // map frame removed 207 208 } 209 } 210 207 208 } 209 } 210 211 211 public static ImageIcon loadIcon(String name) { 212 212 URL url = OsbPlugin.class.getResource("/images/".concat(name)); … … 219 219 if(newLayer instanceof OsmDataLayer) { 220 220 active = dialog.isDialogShowing(); 221 221 222 222 // start the auto download loop 223 223 OsbDownloadLoop.getInstance().setPlugin(this);
Note:
See TracChangeset
for help on using the changeset viewer.