Changeset 6453 in josm for trunk


Ignore:
Timestamp:
2013-12-07T15:19:55+01:00 (11 years ago)
Author:
Don-vip
Message:

global use of osm website url and new url scheme

Location:
trunk/src/org/openstreetmap/josm
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r6443 r6453  
    105105    /**
    106106     * The JOSM website URL.
    107      * @since 6143 
     107     * @since 6143
    108108     */
    109109    public static final String JOSM_WEBSITE = "http://josm.openstreetmap.de";
    110    
     110
     111    /**
     112     * The OSM website URL.
     113     * @since 6453
     114     */
     115    public static final String OSM_WEBSITE = "http://www.openstreetmap.org";
     116
    111117    /**
    112118     * Replies true if JOSM currently displays a map view. False, if it doesn't, i.e. if
  • trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java

    r6316 r6453  
    4848        if (ret.startsWith("http://api.openstreetmap.org/")) {
    4949            ret = ret.substring("http://api.openstreetmap.org/".length());
    50             ret = "http://www.openstreetmap.org/" + ret;
     50            ret = Main.OSM_WEBSITE + "/" + ret;
    5151        }
    5252        return ret;
     
    6767        if (ret.startsWith("http://api.openstreetmap.org/")) {
    6868            ret = ret.substring("http://api.openstreetmap.org/".length());
    69             ret = "http://www.openstreetmap.org/" + ret;
     69            ret = Main.OSM_WEBSITE + "/" + ret;
    7070        }
    7171        return ret;
  • trunk/src/org/openstreetmap/josm/actions/JumpToAction.java

    r6398 r6453  
    174174                zoomLvl = (int)Math.round((-1) * Math.log(m/10000000)/Math.log(2));
    175175
    176             int decimals = (int) Math.pow(10, (zoomLvl / 3));
    177             dlat = Math.round(dlat * decimals);
    178             dlat /= decimals;
    179             dlon = Math.round(dlon * decimals);
    180             dlon /= decimals;
    181             url.setText("http://www.openstreetmap.org/#map="+zoomLvl+"/"+dlat+"/"+dlon);
    182         } catch (NumberFormatException x) {}
     176            url.setText(OsmUrlToBounds.getURL(dlat, dlon, zoomLvl));
     177        } catch (NumberFormatException x) {
     178            Main.debug(x.getMessage());
     179        }
    183180    }
    184181
  • trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java

    r6243 r6453  
    1010import oauth.signpost.basic.DefaultOAuthProvider;
    1111
     12import org.openstreetmap.josm.Main;
    1213import org.openstreetmap.josm.data.Preferences;
    1314import org.openstreetmap.josm.io.OsmApi;
     
    3132     * The default OSM OAuth request token URL.
    3233     */
    33     static public final String DEFAULT_REQUEST_TOKEN_URL = "http://www.openstreetmap.org/oauth/request_token";
     34    static public final String DEFAULT_REQUEST_TOKEN_URL = Main.OSM_WEBSITE + "/oauth/request_token";
    3435    /**
    3536     * The default OSM OAuth access token URL.
    3637     */
    37     static public final String DEFAULT_ACCESS_TOKEN_URL = "http://www.openstreetmap.org/oauth/access_token";
     38    static public final String DEFAULT_ACCESS_TOKEN_URL = Main.OSM_WEBSITE + "/oauth/access_token";
    3839    /**
    3940     * The default OSM OAuth authorize URL.
    4041     */
    41     static public final String DEFAULT_AUTHORISE_URL = "http://www.openstreetmap.org/oauth/authorize";
     42    static public final String DEFAULT_AUTHORISE_URL = Main.OSM_WEBSITE + "/oauth/authorize";
    4243
    4344
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6380 r6453  
    5151import org.openstreetmap.josm.tools.I18n;
    5252import org.openstreetmap.josm.tools.ImageProvider;
     53import org.openstreetmap.josm.tools.OsmUrlToBounds;
    5354import org.openstreetmap.josm.tools.Utils;
    5455
     
    122123                        tr("examples")+":\n"+
    123124                        "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+
    124                         "\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13\n"+
     125                        "\tjava -jar josm.jar "+OsmUrlToBounds.getURL(43.2, 11.1, 13)+"\n"+
    125126                        "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+
    126127                        "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+
    127128                        "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+
    128                         "\tjava -Xmx400m -jar josm.jar\n\n"+
     129                        "\tjava -Xmx1024m -jar josm.jar\n\n"+
    129130                        tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+"\n"+
    130131                        tr("Make sure you load some data if you use --selection.")+"\n"
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java

    r6087 r6453  
    2121import javax.swing.event.HyperlinkListener;
    2222
     23import org.openstreetmap.josm.Main;
    2324import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    2425import org.openstreetmap.josm.io.ChangesetQuery;
     
    7172                + "<p><strong>" + tr("Examples") + "</strong></p>"
    7273                + "<ul>"
    73                 + "<li><a href=\"http://www.openstreetmap.org/browse/changesets?open=true\">http://www.openstreetmap.org/browse/changesets?open=true</a></li>"
     74                + "<li><a href=\""+Main.OSM_WEBSITE+"/browse/changesets?open=true\">"+Main.OSM_WEBSITE+"/browse/changesets?open=true</a></li>"
    7475                + "<li><a href=\"http://api.openstreetmap.org/api/0.6/changesets?open=true\">http://api.openstreetmap.org/api/0.6/changesets?open=true</a></li>"
    7576                + "</ul>"
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java

    r6340 r6453  
    4343        JPanel msg = new JPanel(new GridBagLayout());
    4444        msg.add(new JLabel(tr("<html>Upload of unprocessed GPS data as map data is considered harmful.<br>If you want to upload traces, look here:</html>")), GBC.eol());
    45         msg.add(new UrlLabel(tr("http://www.openstreetmap.org/traces"), 2), GBC.eop());
     45        msg.add(new UrlLabel(Main.OSM_WEBSITE + "/traces", 2), GBC.eop());
    4646        if (!ConditionalOptionPaneUtil.showConfirmationDialog("convert_to_data", Main.parent, msg, tr("Warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_OPTION)) {
    4747            return;
  • trunk/src/org/openstreetmap/josm/io/MessageNotifier.java

    r6365 r6453  
    6767                            JPanel panel = new JPanel(new GridBagLayout());
    6868                            panel.add(new JLabel(trn("You have {0} unread message.", "You have {0} unread messages.", unread, unread)), GBC.eol());
    69                             panel.add(new UrlLabel("http://www.openstreetmap.org/user/"+userInfo.getDisplayName()+"/inbox", tr("Click here to see your inbox.")), GBC.eol());
     69                            panel.add(new UrlLabel(Main.OSM_WEBSITE + "/user/"+userInfo.getDisplayName()+"/inbox", tr("Click here to see your inbox.")), GBC.eol());
    7070                            panel.setOpaque(false);
    7171                            new Notification().setContent(panel)
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r6394 r6453  
    249249
    250250    /**
    251      * Return OSM URL for given area
     251     * Return OSM URL for given area.
    252252     *
    253253     * @param b bounds of the area
    254254     * @return link to display that area in OSM map
    255255     */
    256     static public String getURL(Bounds b) {
     256    public static String getURL(Bounds b) {
    257257        return getURL(b.getCenter(), getZoom(b));
    258258    }
    259259
    260260    /**
    261      * Return OSM URL for given position and zoom
     261     * Return OSM URL for given position and zoom.
    262262     *
    263263     * @param pos center position of area
     
    265265     * @return link to display that area in OSM map
    266266     */
    267     static public String getURL(LatLon pos, int zoom) {
     267    public static String getURL(LatLon pos, int zoom) {
     268        return getURL(pos.lat(), pos.lon(), zoom);
     269    }
     270
     271    /**
     272     * Return OSM URL for given lat/lon and zoom.
     273     *
     274     * @param dlat center latitude of area
     275     * @param dlon center longitude of area
     276     * @param zoom zoom depth of display
     277     * @return link to display that area in OSM map
     278     *
     279     * @since 6453
     280     */
     281    public static String getURL(double dlat, double dlon, int zoom) {
    268282        // Truncate lat and lon to something more sensible
    269283        int decimals = (int) Math.pow(10, (zoom / 3));
    270         double lat = (Math.round(pos.lat() * decimals));
     284        double lat = (Math.round(dlat * decimals));
    271285        lat /= decimals;
    272         double lon = (Math.round(pos.lon() * decimals));
     286        double lon = (Math.round(dlon * decimals));
    273287        lon /= decimals;
    274         return "http://www.openstreetmap.org/?lat="+lat+"&lon="+lon+"&zoom="+zoom;
     288        return Main.OSM_WEBSITE + "/#map="+zoom+"/"+lat+"/"+lon;
    275289    }
    276290}
Note: See TracChangeset for help on using the changeset viewer.