Changeset 24733 in osm for applications/editors/josm/plugins/mapdust
- Timestamp:
- 2010-12-13T12:27:04+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/mapdust
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapdust/conf/mapdust.properties
r24514 r24733 7 7 #the Mapdust api key 8 8 mapdust.key=20a2790c8c8ba273ff7baa619b2cf638 9 10 #the Mapdust wiki page 11 mapdust.wiki=http://wiki.openstreetmap.org/wiki/JOSM/Plugins/MapDust -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java
r24514 r24733 42 42 import org.openstreetmap.josm.gui.MapView; 43 43 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 44 import org.openstreetmap.josm.gui.NavigatableComponent;45 44 import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener; 46 45 import org.openstreetmap.josm.gui.layer.Layer; … … 68 67 */ 69 68 public class MapdustPlugin extends Plugin implements LayerChangeListener, 70 MouseListener, MapdustRefresh Observer, MapdustBugObserver,71 MapdustInitialUpdateObserver { 69 ZoomChangeListener, MouseListener, MapdustRefreshObserver, 70 MapdustBugObserver, MapdustInitialUpdateObserver { 72 71 73 72 /** The graphical user interface of the plugin */ … … 92 91 Main.pref.put("mapdust.nickname", null); 93 92 Main.pref.put("mapdust.modify", false); 94 MapView.addLayerChangeListener(this);95 if (Main.map != null && Main.map.mapView != null) {96 Main.map.mapView.addMouseListener(this);97 MapView.addLayerChangeListener(this);98 }99 93 } 100 94 … … 122 116 mapdustGUI.addObserver(this); 123 117 newMapFrame.addToggleDialog(mapdustGUI); 124 NavigatableComponent125 .addZoomChangeListener(new ZoomChangeListener() {126 127 @Override128 public void zoomChanged() {129 updateData();130 }131 });132 118 MapView.addLayerChangeListener(this); 119 MapView.addZoomChangeListener(this); 133 120 Main.map.mapView.addMouseListener(this); 134 121 } … … 152 139 if (this.mapdustBugList == null 153 140 || this.mapdustBugList.size() == 0) { 154 String waringMessage = "There is no MapDust bug in";155 waringMessage += "your visible area."; 156 JOptionPane.showMessageDialog(Main.parent, 141 String waringMessage = "There is no MapDust bug "; 142 waringMessage += "in your visible area."; 143 JOptionPane.showMessageDialog(Main.parent, 157 144 tr(waringMessage), tr("Warning"), 158 145 JOptionPane.WARNING_MESSAGE); … … 221 208 /* remove the layer */ 222 209 MapView.removeLayerChangeListener(this); 210 MapView.removeZoomChangeListener(this); 223 211 Main.map.mapView.removeLayer(layer); 224 212 Main.map.remove(mapdustGUI); … … 294 282 if (mapdustLayer == null) { 295 283 /* create and add the layer */ 296 Main.map.mapView.removeAll(); 297 mapdustLayer = 298 new MapdustLayer("MapDust", mapdustGUI, mapdustBugList); 284 mapdustLayer = new MapdustLayer("MapDust", mapdustGUI, mapdustBugList); 299 285 Main.main.addLayer(mapdustLayer); 300 286 Main.map.mapView.moveLayer(mapdustLayer, 0); 301 287 MapView.addLayerChangeListener(this); 288 MapView.addZoomChangeListener(this); 302 289 } else { 303 290 /* re-set the properties */ … … 311 298 Main.map.repaint(); 312 299 Main.map.mapView.repaint(); 300 } 301 302 /** 303 * Returns the bounds of the current map view. 304 * 305 * @return A <code>Bounds</code> object 306 */ 307 private Bounds getBounds() { 308 MapView mapView = Main.map.mapView; 309 Bounds bounds = 310 new Bounds(mapView.getLatLon(0, mapView.getHeight()), 311 mapView.getLatLon(mapView.getWidth(), 0)); 312 return bounds; 313 313 } 314 314 … … 331 331 } 332 332 333 @Override 334 public void zoomChanged() { 335 updateData(); 336 } 337 333 338 /** 334 339 * Verifies if the <code>OsmDataLayer</code> layer has been added to the … … 383 388 throws MapdustServiceHandlerException { 384 389 /* get the bounding box */ 385 MapView mapView = Main.map.mapView; 386 Bounds bounds = 387 new Bounds(mapView.getLatLon(0, mapView.getHeight()), 388 mapView.getLatLon(mapView.getWidth(), 0)); 390 Bounds bounds = getBounds(); 389 391 Double minLon = bounds.getMin().lon(); 390 392 Double minLat = bounds.getMin().lat(); … … 471 473 472 474 /** 473 * Returns the list of MapDust bugs474 *475 475 * @return the mapdustBugList 476 476 */ … … 480 480 481 481 /** 482 * Sets the list of MapDust bugs483 *484 482 * @param mapdustBugList the mapdustBugList to set 485 483 */ … … 487 485 this.mapdustBugList = mapdustBugList; 488 486 } 487 489 488 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java
r24514 r24733 225 225 add(mainPanel, BorderLayout.CENTER); 226 226 } 227 /* invalidate and repaint */228 invalidate();229 repaint();230 227 } 231 228 -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugDetailsPanel.java
r24514 r24733 34 34 import java.awt.Font; 35 35 import java.awt.GridLayout; 36 import java.net.URI; 36 37 import java.text.DateFormat; 37 38 import java.util.Locale; … … 46 47 import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBug; 47 48 import org.openstreetmap.josm.plugins.mapdust.util.Configuration; 49 import org.openstreetmap.josm.tools.OpenBrowser; 48 50 49 51 … … 136 138 public void hyperlinkUpdate(HyperlinkEvent event) { 137 139 if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 138 java.awt.Desktop desktop = java.awt.Desktop.getDesktop();139 java.net.URI uri;140 140 String bugDetailsUrl = null; 141 141 if (bug != null) { … … 146 146 if (bugDetailsUrl != null) { 147 147 try { 148 uri = new java.net.URI(bugDetailsUrl); 149 desktop.browse(uri); 148 OpenBrowser.displayUrl(new URI(bugDetailsUrl)); 150 149 } catch (Exception e) { 151 String errorMessage = "Error opening the MapDust wiki page"; 150 String errorMessage = "Error opening the MapDust bug "; 151 errorMessage += "details page"; 152 152 JOptionPane.showMessageDialog(Main.parent, 153 153 tr(errorMessage), tr("Error"), -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustHelpPanel.java
r24514 r24733 33 33 import java.awt.Color; 34 34 import java.awt.Dimension; 35 import java.net.URI; 35 36 import javax.swing.JEditorPane; 36 37 import javax.swing.JOptionPane; … … 42 43 import org.openstreetmap.josm.Main; 43 44 import org.openstreetmap.josm.plugins.mapdust.gui.component.util.ComponentUtil; 45 import org.openstreetmap.josm.tools.OpenBrowser; 46 import org.openstreetmap.josm.plugins.mapdust.util.Configuration; 44 47 45 48 46 49 /** 47 50 * Defines the JPanel which displays the Help. 48 * 51 * 49 52 * @author Bea 50 53 */ 51 54 public class MapdustHelpPanel extends JPanel implements HyperlinkListener { 52 55 53 56 /** The serial version UID */ 54 57 private static final long serialVersionUID = 1L; 55 58 56 59 /** 57 60 * Builds a <code>MapdustDescriptionPanel</code> object … … 78 81 add(cmpDescription, BorderLayout.CENTER); 79 82 } 80 83 81 84 @Override 82 85 public void hyperlinkUpdate(HyperlinkEvent event) { 83 86 if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 84 java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); 85 String url = 86 "http://wiki.openstreetmap.org/wiki/JOSM/Plugins/MapDust"; 87 java.net.URI uri; 87 String url = Configuration.getInstance().getMapdustWiki(); 88 88 try { 89 uri = new java.net.URI(url); 90 desktop.browse(uri); 89 OpenBrowser.displayUrl(new URI(url)); 91 90 } catch (Exception e) { 92 91 String errorMessage = "Error opening the MapDust wiki page"; … … 94 93 tr("Error"), JOptionPane.ERROR_MESSAGE); 95 94 } 96 97 95 } 98 96 } 99 97 100 98 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/Configuration.java
r24514 r24733 56 56 private String mapdustBugDetailsUrl; 57 57 58 /** The MapDust wiki url */ 59 private String mapdustWiki; 60 58 61 /** 59 62 * Returns the only instance of this singleton object type. … … 93 96 "", "mapdust"); 94 97 } 98 99 try { 100 mapdustWiki = properties.getString("mapdust.wiki"); 101 } catch (RuntimeException e) { 102 throw new MissingResourceException("Could not read mapdust.wikis ", 103 "", "mapdust"); 104 } 95 105 } 96 106 … … 122 132 } 123 133 134 /** 135 * Returns the MapDust wiki URL 136 * 137 * @return the mapdustWiki 138 */ 139 public String getMapdustWiki() { 140 return mapdustWiki; 141 } 124 142 }
Note:
See TracChangeset
for help on using the changeset viewer.