Changeset 3574 in osm for applications/editors/josm/plugins/ywms/src
- Timestamp:
- 2007-07-12T21:15:19+02:00 (17 years ago)
- Location:
- applications/editors/josm/plugins/ywms/src/org/openstreetmap/josm/plugins/ywms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ywms/src/org/openstreetmap/josm/plugins/ywms/ImageLoader.java
r2283 r3574 51 51 public static final String GECKO_DEBUG_LINE = "GECKO: PAINT FORCED AFTER ONLOAD:"; 52 52 53 /** THe yahoo URL request */ 53 54 private URL yahooUrl; 55 /** Original bounding box */ 54 56 double[] orig_bbox = null; 57 /** Original width */ 55 58 int width = -1; 59 /** Original height */ 56 60 int height = -1; 61 /** Final image width */ 57 62 int final_width = -1; 63 /** Final image width */ 58 64 int final_height = -1; 65 /** The loaded image */ 59 66 Image image; 67 /** Files created by firefox, that can be deleted */ 60 68 List<String> firefoxFiles = new ArrayList<String>(); 61 69 … … 67 75 * 68 76 * @param wmsUrl The WMS request 69 * @param pluginDir The directory of the plugin70 77 * @throws ImageLoaderException When error loading the image 71 78 */ … … 76 83 URL request = new URL("file:///page" + wmsUrl); 77 84 String query = request.getQuery().toLowerCase(); 78 yahooUrl = new File( YWMSPlugin.getStaticPluginDir(), "ymap.html").toURI().toURL();85 yahooUrl = new File(Util.getPluginDir(), "ymap.html").toURI().toURL(); 79 86 yahooUrl = new URL( yahooUrl.toExternalForm() + "?" + query); 80 87 … … 260 267 * Saves the current image as a PNG file 261 268 * @param fileName The name of the new file 262 * @throws IOException When error saving the file263 269 */ 264 270 public void save(String fileName) -
applications/editors/josm/plugins/ywms/src/org/openstreetmap/josm/plugins/ywms/YWMSPlugin.java
r3508 r3574 6 6 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 7 7 import org.openstreetmap.josm.plugins.Plugin; 8 import org.openstreetmap.josm.plugins.PluginProxy;9 8 10 9 /** … … 77 76 public class YWMSPlugin extends Plugin 78 77 { 78 /** The HTTP server this plugin launches */ 79 79 static HTTPServer server; 80 80 … … 84 84 public YWMSPlugin() 85 85 { 86 WARNING. This compilation error is made on purpose.87 We are not allowed to use this plugin at present.88 Please, don not use it until all legal issues are resolved.89 90 86 try 91 87 { … … 136 132 } 137 133 } 138 139 /**140 * Returns the plugin's directory141 * <p>142 * Utility method for classes that can't acces the plugin object143 *144 * @return The directory of the plugin145 */146 public static String getStaticPluginDir()147 {148 YWMSPlugin plugin = getPlugin();149 return ( plugin != null ) ? plugin.getPluginDir() : null;150 }151 152 /**153 * Utility method to retrieve the plugin for classes that can't access to the plugin object directly.154 *155 * @return The YWMS plugin156 */157 public static YWMSPlugin getPlugin()158 {159 for (PluginProxy plugin : Main.plugins)160 {161 if( plugin.info.className.equals(YWMSPlugin.class.getName()) )162 {163 return (YWMSPlugin)plugin.plugin;164 }165 }166 167 return null;168 }169 134 } -
applications/editors/josm/plugins/ywms/src/org/openstreetmap/josm/plugins/ywms/YWMSPreferenceSetting.java
r2264 r3574 14 14 import org.openstreetmap.josm.gui.preferences.PreferenceDialog; 15 15 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 16 import org.openstreetmap.josm.plugins.ywms.Util.Version; 16 17 import org.openstreetmap.josm.tools.GBC; 17 18 import org.openstreetmap.josm.tools.I18n; … … 29 30 public static final String WMS_URL_PARAMS = "/ymap?request=GetMap&format=image/jpeg"; 30 31 32 /** Firefox path text field */ 31 33 private JTextField firefox = new JTextField(10); 34 /** Server port text field */ 32 35 private JTextField port = new JTextField(10); 36 /** Firefox profile text field */ 33 37 private JTextField profile = new JTextField(10); 34 38 … … 46 50 )); 47 51 48 JPanel ywms = gui.createPreferenceTab("yahoo.gif", I18n.tr("Yahoo! WMS server"), I18n.tr("Settings for the Yahoo! imagery server.")); 52 Version ver = Util.getVersion(); 53 String description = tr("A WMS server for Yahoo imagery based on Firefox."); 54 if( ver != null ) 55 description += "<br><br>" + tr("Version: {0}<br>Last change at {1}", ver.revision, ver.time); 56 JPanel ywms = gui.createPreferenceTab("yahoo.gif", I18n.tr("Yahoo! WMS server"), description + I18n.tr("Settings for the Yahoo! imagery server.")); 49 57 ywms.add(new JLabel(tr("YWMS options")), GBC.eol().insets(0,5,0,0)); 50 58 … … 79 87 if( !oldPort.equals(port.getText()) ) 80 88 { 81 YWMSPlugin plugin = YWMSPlugin.getPlugin();89 YWMSPlugin plugin = (YWMSPlugin)Util.getPlugin(YWMSPlugin.class); 82 90 plugin.restartServer(); 83 91 } … … 90 98 private final class WMSConfigurationActionListener implements ActionListener, FocusListener 91 99 { 100 /** If the action is already handled */ 92 101 boolean alreadyHandled = false; 93 102 public void actionPerformed(ActionEvent e) … … 145 154 } 146 155 147 String configFile = new File( YWMSPlugin.getStaticPluginDir(), "config.html").toURL().toString();156 String configFile = new File(Util.getPluginDir(), "config.html").toURL().toString(); 148 157 GeckoSupport.browse(firefox.getText(), profile.getText(), configFile, false); 149 158 configureWMSPluginPreferences(); … … 171 180 /** 172 181 * Configures WMSPlugin preferences with a server "Yahoo" pointing to YWMS 173 * @param gui174 182 */ 175 183 private void configureWMSPluginPreferences()
Note:
See TracChangeset
for help on using the changeset viewer.