Changeset 3574 in osm for applications


Ignore:
Timestamp:
2007-07-12T21:15:19+02:00 (17 years ago)
Author:
frsantos
Message:

Javadoc
Imported class Util from validator plugin

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  
    5151        public static final String GECKO_DEBUG_LINE = "GECKO: PAINT FORCED AFTER ONLOAD:";
    5252
     53        /** THe yahoo URL request */
    5354        private URL yahooUrl;
     55        /** Original bounding box */
    5456        double[] orig_bbox = null;
     57        /** Original width */
    5558    int width = -1;
     59        /** Original height */
    5660    int height = -1;
     61        /** Final image width */
    5762    int final_width = -1;
     63        /** Final image width */
    5864    int final_height = -1;
     65    /** The loaded image */
    5966        Image image;
     67        /** Files created by firefox, that can be deleted */
    6068        List<String> firefoxFiles = new ArrayList<String>();
    6169
     
    6775         *
    6876         * @param wmsUrl The WMS request
    69          * @param pluginDir The directory of the plugin
    7077         * @throws ImageLoaderException When error loading the image
    7178         */
     
    7683                        URL request = new URL("file:///page" + wmsUrl);
    7784                        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();
    7986                        yahooUrl = new URL( yahooUrl.toExternalForm() + "?" + query);
    8087                       
     
    260267         * Saves the current image as a PNG file
    261268         * @param fileName The name of the new file
    262          * @throws IOException When error saving the file
    263269         */
    264270        public void save(String fileName)
  • applications/editors/josm/plugins/ywms/src/org/openstreetmap/josm/plugins/ywms/YWMSPlugin.java

    r3508 r3574  
    66import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    77import org.openstreetmap.josm.plugins.Plugin;
    8 import org.openstreetmap.josm.plugins.PluginProxy;
    98
    109/**
     
    7776public class YWMSPlugin extends Plugin
    7877{
     78        /** The HTTP server this plugin launches */
    7979        static HTTPServer server;
    8080   
     
    8484        public YWMSPlugin()
    8585        {
    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        
    9086                try
    9187                {
     
    136132                }
    137133        }
    138        
    139     /**
    140      * Returns the plugin's directory
    141      * <p>
    142      * Utility method for classes that can't acces the plugin object
    143      *
    144      * @return The directory of the plugin
    145      */
    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 plugin
    156      */
    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     }
    169134}
  • applications/editors/josm/plugins/ywms/src/org/openstreetmap/josm/plugins/ywms/YWMSPreferenceSetting.java

    r2264 r3574  
    1414import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
    1515import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     16import org.openstreetmap.josm.plugins.ywms.Util.Version;
    1617import org.openstreetmap.josm.tools.GBC;
    1718import org.openstreetmap.josm.tools.I18n;
     
    2930    public static final String WMS_URL_PARAMS = "/ymap?request=GetMap&format=image/jpeg";
    3031
     32    /** Firefox path text field */
    3133    private JTextField firefox = new JTextField(10);
     34    /** Server port text field */
    3235    private JTextField port    = new JTextField(10);
     36    /** Firefox profile text field */
    3337    private JTextField profile = new JTextField(10);
    3438   
     
    4650                                                         ));
    4751
    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."));
    4957        ywms.add(new JLabel(tr("YWMS options")), GBC.eol().insets(0,5,0,0));
    5058
     
    7987        if( !oldPort.equals(port.getText()) )
    8088        {
    81             YWMSPlugin plugin = YWMSPlugin.getPlugin();
     89            YWMSPlugin plugin = (YWMSPlugin)Util.getPlugin(YWMSPlugin.class);
    8290            plugin.restartServer();
    8391        }
     
    9098    private final class WMSConfigurationActionListener implements ActionListener, FocusListener
    9199    {
     100        /** If the action is already handled */
    92101        boolean alreadyHandled = false;
    93102        public void actionPerformed(ActionEvent e)
     
    145154                        }
    146155                       
    147                         String configFile = new File(YWMSPlugin.getStaticPluginDir(), "config.html").toURL().toString();
     156                        String configFile = new File(Util.getPluginDir(), "config.html").toURL().toString();
    148157                        GeckoSupport.browse(firefox.getText(), profile.getText(), configFile, false);
    149158                        configureWMSPluginPreferences();
     
    171180    /**
    172181     * Configures WMSPlugin preferences with a server "Yahoo" pointing to YWMS 
    173      * @param gui
    174182     */
    175183    private void configureWMSPluginPreferences()
Note: See TracChangeset for help on using the changeset viewer.