Changeset 24501 in osm for applications/editors


Ignore:
Timestamp:
2010-12-01T18:51:48+01:00 (14 years ago)
Author:
upliner
Message:

add imagery plugin: the union of the wmsplugin and the slippymap plugin

Location:
applications/editors/josm/plugins/imagery
Files:
10 added
12 deleted
13 edited
24 copied

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery

    • Property svn:ignore set to
      bin
      build
      dist
  • applications/editors/josm/plugins/imagery/README

    r23263 r24501  
    1 README
    2 ======
     1This plugin is an union of slippymap plugin and wmsplugin.
     2Combined by Upliner, licensed under the GNU GPL v2 or later.
    33
    4 Readme for your plugin
     4WMSPlugin authors:
     5==========================================================================
     6This plugin has been created by tim <chippy2005@gmail.com>
     7and has received major contributions from Frederik Ramm
     8<frederik@remote.org>. It is based on the "Landsat" plugin
     9by Nick Whitelegg <Nick.Whitelegg@solent.ac.uk> and includes
     10some code from Jonathan Stott <jonathan@jstott.me.uk>, Gabriel Ebner
     11<ge@gabrielebner.at> and Ulf Lamping <ulf.lamping@web.de>.
     12The automatic tiles downloading and Yahoo downloader made by Petr Dlouhý <petr.dlouhy@email.cz>
    513
    6     * Plugin author and contact email address.
    7    
    8     * The license for your plugin source code. If you have no special preferences,
    9       you can pick the license that is used for JOSM ("GPL v2 or later").
    10      
    11     * Notes for future developers, if needed.
     14This plugin is licensed under the GNU GPL v2 or later.
     15==========================================================================
     16
     17Slippymap plugin authors:
     18==========================================================================
     19A plugin for displaying a slippy map grid, with various server interaction
     20options (download tiles, request tile updates etc.)
     21
     22Author: Frederik Ramm <frederik@remote.org>
     23        Lubomir Varga <lubomir.varga@freemap.sk> or <luvar@plaintext.sk>
     24Public Domain.
     25
     26Software with a little bit of customisation, fade background feature, autozoom, autoload tiles e.t.c. Just a begining of the best plugin for josm ;-)
     27==========================================================================
  • applications/editors/josm/plugins/imagery/build.xml

    r23263 r24501  
    2828**
    2929-->
    30 <project name="myPluginName" default="dist" basedir=".">
     30<project name="imagery" default="dist" basedir=".">
    3131
    3232    <!-- enter the SVN commit message -->
    3333    <property name="commit.message" value="Commit message" />
    3434    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    35     <property name="plugin.main.version" value="" />
     35    <property name="plugin.main.version" value="3687" />
    3636
    3737
     
    4141     -->
    4242    <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
     43    <property name="remotecontrol" location="../../dist/remotecontrol.jar" />
    4344    <property name="plugin.build.dir"       value="build"/>
    4445    <property name="plugin.src.dir"         value="src"/>
     
    6566    <target name="compile" depends="init">
    6667        <echo message="compiling sources for  ${plugin.jar} ... "/>
    67         <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
     68        <javac srcdir="src" classpath="${josm};${remotecontrol}" debug="true" destdir="${plugin.build.dir}">
    6869            <compilerarg value="-Xlint:deprecation"/>
    6970            <compilerarg value="-Xlint:unchecked"/>
     
    100101    -->
    101102            <manifest>
    102                 <attribute name="Author" value="..."/>
    103                 <attribute name="Plugin-Class" value="..."/>
     103                <attribute name="Author" value="Tim Waters, Petr Dlouhý, Frederik Ramm, Upliner and others"/>
     104                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.imagery.ImageryPlugin"/>
    104105                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    105                 <attribute name="Plugin-Description" value="..."/>
    106                 <attribute name="Plugin-Icon" value="..."/>
    107                 <attribute name="Plugin-Link" value="..."/>
     106                <attribute name="Plugin-Description" value="Experimental union of SlippyMap plugin and WMSPlugin"/>
     107                <attribute name="Plugin-Icon" value="images/wms.png"/>
     108                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WMSPlugin" />
    108109                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    109110                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
  • applications/editors/josm/plugins/imagery/sources.cfg

    r24493 r24501  
    66# NOTE: default items should be common and worldwide
    77#
    8 true;Landsat;http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&styles=&format=image/jpeg&
    9 true;Landsat (mirror);http://irs.gis-lab.info/?layers=landsat&
    10 false;Open Aerial Map;http://openaerialmap.org/wms/?VERSION=1.0&request=GetMap&layers=world&styles=&format=image/jpeg&
     8true;Landsat;wms:http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&styles=&format=image/jpeg&
     9true;Landsat (mirror);wms:http://irs.gis-lab.info/?layers=landsat&
     10false;Open Aerial Map;wms:http://openaerialmap.org/wms/?VERSION=1.0&request=GetMap&layers=world&styles=&format=image/jpeg&
    1111#
    12 # different forms for web access
    13 # must be html:<url>
     12# different forms of imagery
     13true;Bing sat;bing:bing
    1414true;Yahoo Sat;html:http://josm.openstreetmap.de/wmsplugin/YahooDirect.html?
    15 false;OpenStreetMap;html:http://josm.openstreetmap.de/wmsplugin/OpenStreetMap.html?
    16 false;OpenCycleMap;html:http://josm.openstreetmap.de/wmsplugin/OpenCycleMap.html?
    17 false;TilesAtHome;html:http://josm.openstreetmap.de/wmsplugin/TilesAtHome.html?
     15true;OpenStreetMap;tms:http://tile.openstreetmap.org/
     16false;OpenCycleMap;tms:http://tile.opencyclemap.org/cycle/
     17false;TilesAtHome;tms:http://tah.openstreetmap.org/Tiles/tile/
    1818#
    1919#
    2020# only for Germany
    21 false;Streets NRW Geofabrik.de;http://tools.geofabrik.de/osmi/view/strassennrw/josmwms?
     21false;Streets NRW Geofabrik.de;wms:http://tools.geofabrik.de/osmi/view/strassennrw/josmwms?
    2222#
    2323#
    2424# only for North America
    2525# Terraserver USCG - High resolution maps
    26 false;Terraserver Topo;http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=drg&styles=&format=image/jpeg&
    27 false;Terraserver Urban;http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=urbanarea&styles=&format=image/jpeg&
     26false;Terraserver Topo;wms:http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=drg&styles=&format=image/jpeg&
     27false;Terraserver Urban;wms:http://terraservice.net/ogcmap.ashx?version=1.1.1&request=GetMap&Layers=urbanarea&styles=&format=image/jpeg&
    2828#
    2929#
    3030# only for Czech Republic
    31 false;Czech CUZK:KM;http://wms.cuzk.cz/wms.asp?service=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&LAYERS=parcelni_cisla_i,obrazy_parcel_i,RST_KMD_I,hranice_parcel_i,DEF_BUDOVY,RST_KN_I,dalsi_p_mapy_i,prehledka_kat_prac,prehledka_kat_uz,prehledka_kraju-linie&FORMAT=image/png&transparent=TRUE&
    32 false;Czech UHUL:ORTOFOTO;http://geoportal2.uhul.cz/cgi-bin/oprl.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&LAYERS=Ortofoto_cb&STYLES=default&FORMAT=image/jpeg&TRANSPARENT=TRUE&
     31false;Czech CUZK:KM;wms:http://wms.cuzk.cz/wms.asp?service=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&LAYERS=parcelni_cisla_i,obrazy_parcel_i,RST_KMD_I,hranice_parcel_i,DEF_BUDOVY,RST_KN_I,dalsi_p_mapy_i,prehledka_kat_prac,prehledka_kat_uz,prehledka_kraju-linie&FORMAT=image/png&transparent=TRUE&
     32false;Czech UHUL:ORTOFOTO;wms:http://geoportal2.uhul.cz/cgi-bin/oprl.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&LAYERS=Ortofoto_cb&STYLES=default&FORMAT=image/jpeg&TRANSPARENT=TRUE&
    3333#
    3434#
    3535# only for GB
    3636# fails with division by zero error
    37 false;NPE Maps;http://nick.dev.openstreetmap.org/openpaths/freemap.php?layers=npe&
    38 false;NPE Maps (Tim);http://dev.openstreetmap.org/~timsc/wms2/map.php?
    39 false;7th Series (OS7);http://ooc.openstreetmap.org/wms/map.php?source=os7&
     37false;NPE Maps;wms:http://nick.dev.openstreetmap.org/openpaths/freemap.php?layers=npe&
     38false;NPE Maps (Tim);wms:http://dev.openstreetmap.org/~timsc/wms2/map.php?
     39false;7th Series (OS7);wms:http://ooc.openstreetmap.org/wms/map.php?source=os7&
    4040#
    4141#
    4242# only for Japan
    43 false;MLIT Japan (ORTHO);http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
    44 false;MLIT Japan (ORTHO01);http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO01&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
    45 false;MLIT Japan (ORTHO02);http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO02&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
    46 false;MLIT Japan (ORTHO03);http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO03&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
     43false;MLIT Japan (ORTHO);wms:http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
     44false;MLIT Japan (ORTHO01);wms:http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO01&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
     45false;MLIT Japan (ORTHO02);wms:http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO02&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
     46false;MLIT Japan (ORTHO03);wms:http://orthophoto.mlit.go.jp:8888/wms/service/wmsRasterTileMap?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ORTHO03&STYLES=Default&CRS=EPSG:4612&BBOX={s},{w},{n},{e}&WIDTH={width}&HEIGHT={height}&FORMAT=image/png&BGCOLOR=OxFFFFFF
    4747#
    4848#
    4949# only for Italy
    50 false;Lodi - Italy;http://sit.provincia.lodi.it/mapserver/mapserv.exe?map=ortofoto_wgs84.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&LAYERS=Terraitaly%20Ortofoto%202007&STYLES=%2C%2C&FORMAT=image/png&TRANSPARENT=TRUE&
    51 false;Sicily - Italy;http://88.53.214.52/sitr/services/WGS84_F33/Ortofoto_ATA20072008_f33/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS=CRS:84&LAYERS=0&STYLES=default&FORMAT=image/jpeg&
    52 false;PCN 2006 - Italy;http://wms.pcn.minambiente.it/cgi-bin/mapserv.exe?map=/ms_ogc/service/ortofoto_colore_06.map&LAYERS=ortofoto_colore_06_32,ortofoto_colore_06_33&REQUEST=GetMap&VERSION=1.1.1&FORMAT=image%2Fjpeg&
     50false;Lodi - Italy;wms:http://sit.provincia.lodi.it/mapserver/mapserv.exe?map=ortofoto_wgs84.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&LAYERS=Terraitaly%20Ortofoto%202007&STYLES=%2C%2C&FORMAT=image/png&TRANSPARENT=TRUE&
     51false;Sicily - Italy;wms:http://88.53.214.52/sitr/services/WGS84_F33/Ortofoto_ATA20072008_f33/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS=CRS:84&LAYERS=0&STYLES=default&FORMAT=image/jpeg&
     52false;PCN 2006 - Italy;wms:http://wms.pcn.minambiente.it/cgi-bin/mapserv.exe?map=/ms_ogc/service/ortofoto_colore_06.map&LAYERS=ortofoto_colore_06_32,ortofoto_colore_06_33&REQUEST=GetMap&VERSION=1.1.1&FORMAT=image%2Fjpeg&
    5353#
    5454# only for France
    55 false;SPOTMaps (France);http://spotmaps.youmapps.org/cgi-bin/mapserv?map=/home/ortho/ortho.map&service=wms&version=1.1.1&srs=EPSG:4326&request=GetMap&layers=spotmaps4osm&format=image/jpeg&FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=demo&;http://www.youmapps.org/licenses/EULA-OSM-J-{lang}.html
     55false;SPOTMaps (France);wms:http://spotmaps.youmapps.org/cgi-bin/mapserv?map=/home/ortho/ortho.map&service=wms&version=1.1.1&srs=EPSG:4326&request=GetMap&layers=spotmaps4osm&format=image/jpeg&FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=demo&;http://www.youmapps.org/licenses/EULA-OSM-J-{lang}.html
    5656#
    5757#
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/AddImageryLayerAction.java

    r24493 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    88import org.openstreetmap.josm.actions.JosmAction;
    99
    10 public class WMSDownloadAction extends JosmAction {
     10public class AddImageryLayerAction extends JosmAction {
    1111
    12     private final WMSInfo info;
     12    private final ImageryInfo info;
    1313
    14     public WMSDownloadAction(WMSInfo info) {
    15         super(info.getMenuName(), "wmsmenu", tr("Download WMS tile from {0}",info.name), null, false);
    16         putValue("toolbar", "wms_" + info.getToolbarName());
     14    public AddImageryLayerAction(ImageryInfo info) {
     15        super(info.getMenuName(), "wmsmenu", tr("Add imagery layer {0}",info.getName()), null, false);
     16        putValue("toolbar", "imagery_" + info.getToolbarName());
    1717        this.info = info;
    1818    }
    1919
     20    @Override
    2021    public void actionPerformed(ActionEvent e) {
    21         WMSLayer wmsLayer = new WMSLayer(info);
     22        ImageryLayer wmsLayer = ImageryLayer.create(info);
    2223        Main.main.addLayer(wmsLayer);
    2324    }
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryAdjustAction.java

    r24493 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    3030
    3131
    32 public class WMSAdjustAction extends MapMode implements MouseListener, MouseMotionListener{
    33     //static private final Logger logger = Logger.getLogger(WMSAdjustAction.class.getName());
    34 
    35     GeorefImage selectedImage;
     32public class ImageryAdjustAction extends MapMode implements MouseListener, MouseMotionListener{
     33
    3634    boolean mouseDown;
    3735    EastNorth prevEastNorth;
    38     private WMSLayer adjustingLayer;
    39 
    40     public WMSAdjustAction(MapFrame mapFrame) {
    41         super(tr("Adjust WMS"), "adjustwms",
    42                 tr("Adjust the position of the selected WMS layer"), mapFrame,
     36    private ImageryLayer adjustingLayer;
     37
     38    public ImageryAdjustAction(MapFrame mapFrame) {
     39        super(tr("Adjust imagery"), "adjustwms",
     40                tr("Adjust the position of the selected imagery layer"), mapFrame,
    4341                ImageProvider.getCursor("normal", "move"));
    4442    }
    45 
    46 
    4743
    4844    @Override public void enterMode() {
    4945        super.enterMode();
    50         if (!hasWMSLayersToAdjust()) {
    51             warnNoWMSLayers();
     46        if (!hasLayersToAdjust()) {
     47            warnNoImageryLayers();
    5248            return;
    5349        }
    54         List<WMSLayer> wmsLayers = Main.map.mapView.getLayersOfType(WMSLayer.class);
    55         if (wmsLayers.size() == 1) {
    56             adjustingLayer = wmsLayers.get(0);
     50        List<ImageryLayer> imageryLayers = Main.map.mapView.getLayersOfType(ImageryLayer.class);
     51        if (imageryLayers.size() == 1) {
     52            adjustingLayer = imageryLayers.get(0);
    5753        } else {
    58             adjustingLayer = (WMSLayer)askAdjustLayer(Main.map.mapView.getLayersOfType(WMSLayer.class));
     54            adjustingLayer = (ImageryLayer)askAdjustLayer(Main.map.mapView.getLayersOfType(ImageryLayer.class));
    5955        }
    6056        if (adjustingLayer == null)
     
    8076        if (adjustingLayer.isVisible()) {
    8177            prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
    82             selectedImage = adjustingLayer.findImage(prevEastNorth);
    83             if(selectedImage!=null) {
    8478                Main.map.mapView.setCursor
    8579                (Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
    86             }
    8780        }
    8881    }
    8982
    9083    @Override public void mouseDragged(MouseEvent e) {
    91         if(selectedImage!=null) {
    92             EastNorth eastNorth=
    93                 Main.map.mapView.getEastNorth(e.getX(),e.getY());
    94             adjustingLayer.displace(
    95                     eastNorth.east()-prevEastNorth.east(),
    96                     eastNorth.north()-prevEastNorth.north()
    97             );
    98             prevEastNorth = eastNorth;
    99             Main.map.mapView.repaint();
    100         }
     84        EastNorth eastNorth =
     85            Main.map.mapView.getEastNorth(e.getX(),e.getY());
     86        adjustingLayer.displace(
     87                eastNorth.east()-prevEastNorth.east(),
     88                eastNorth.north()-prevEastNorth.north()
     89        );
     90        prevEastNorth = eastNorth;
     91        Main.map.mapView.repaint();
    10192    }
    10293
     
    10495        Main.map.mapView.repaint();
    10596        Main.map.mapView.setCursor(Cursor.getDefaultCursor());
    106         selectedImage = null;
    10797        prevEastNorth = null;
    10898    }
     
    124114
    125115    @Override public boolean layerIsSupported(Layer l) {
    126         return hasWMSLayersToAdjust();
     116        return hasLayersToAdjust();
    127117    }
    128118
     
    155145
    156146    /**
    157      * Prompts the user with a list of WMS layers which can be adjusted
     147     * Prompts the user with a list of imagery layers which can be adjusted
    158148     *
    159149     * @param adjustableLayers the list of adjustable layers
     
    168158        JPanel pnl = new JPanel();
    169159        pnl.setLayout(new GridBagLayout());
    170         pnl.add(new JLabel(tr("Please select the WMS layer to adjust.")), GBC.eol());
     160        pnl.add(new JLabel(tr("Please select the imagery layer to adjust.")), GBC.eol());
    171161        pnl.add(layerList, GBC.eol());
    172162
    173163        ExtendedDialog diag = new ExtendedDialog(
    174164                Main.parent,
    175                 tr("Select WMS layer"),
     165                tr("Select imagery layer"),
    176166                new String[] { tr("Start adjusting"),tr("Cancel") }
    177167        );
     
    187177
    188178    /**
    189      * Displays a warning message if there are no WMS layers to adjust
    190      *
    191      */
    192     protected void warnNoWMSLayers() {
     179     * Displays a warning message if there are no imagery layers to adjust
     180     *
     181     */
     182    protected void warnNoImageryLayers() {
    193183        JOptionPane.showMessageDialog(
    194184                Main.parent,
    195                 tr("There are currently no WMS layer to adjust."),
     185                tr("There are currently no imagery layer to adjust."),
    196186                tr("No layers to adjust"),
    197187                JOptionPane.WARNING_MESSAGE
     
    204194     * @return true if there is at least one WMS layer
    205195     */
    206     protected boolean hasWMSLayersToAdjust() {
     196    protected boolean hasLayersToAdjust() {
    207197        if (Main.map == null) return false;
    208198        if (Main.map.mapView == null) return false;
    209         return ! Main.map.mapView.getLayersOfType(WMSLayer.class).isEmpty();
     199        return ! Main.map.mapView.getLayersOfType(ImageryLayer.class).isEmpty();
    210200    }
    211201
    212202    @Override
    213203    protected void updateEnabledState() {
    214         setEnabled(hasWMSLayersToAdjust());
     204        setEnabled(hasLayersToAdjust());
    215205    }
    216206}
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryInfo.java

    r24493 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery;
    22
    33import java.util.ArrayList;
     
    99 * @author Frederik Ramm <frederik@remote.org>
    1010 */
    11 public class WMSInfo implements Comparable<WMSInfo> {
     11public class ImageryInfo implements Comparable<ImageryInfo> {
     12    public enum ImageryType {
     13        WMS("wms"),
     14        TMS("tms"),
     15        HTML("html"),
     16        BING("bing");
     17
     18        private String urlString;
     19        ImageryType(String urlString) {
     20            this.urlString = urlString;
     21        }
     22        public String getUrlString() {
     23            return urlString;
     24        }
     25    }
    1226
    1327    String name;
     
    1529    String cookies = null;
    1630    String eulaAcceptanceRequired = null;
    17     boolean html = false;
     31    ImageryType imageryType = ImageryType.WMS;
    1832    double pixelPerDegree = 0.0;
    1933
    20     public WMSInfo(String name) {
     34    public ImageryInfo(String name) {
    2135        this.name=name;
    2236    }
    2337
    24     public WMSInfo(String name, String url) {
     38    public ImageryInfo(String name, String url) {
    2539        this.name=name;
    2640        setURL(url);
    2741    }
    2842
    29     public WMSInfo(String name, String url, String eulaAcceptanceRequired) {
     43    public ImageryInfo(String name, String url, String eulaAcceptanceRequired) {
    3044        this.name=name;
    3145        setURL(url);
     
    3347    }
    3448
    35     public WMSInfo(String name, String url, String eulaAcceptanceRequired, String cookies) {
     49    public ImageryInfo(String name, String url, String eulaAcceptanceRequired, String cookies) {
    3650        this.name=name;
    3751        setURL(url);
     
    3953    }
    4054
    41     public WMSInfo(String name, String url, String cookies, double pixelPerDegree) {
     55    public ImageryInfo(String name, String url, String cookies, double pixelPerDegree) {
    4256        this.name=name;
    4357        setURL(url);
     
    6478    }
    6579
    66     public WMSInfo(Collection<String> list) {
     80    public ImageryInfo(Collection<String> list) {
    6781        ArrayList<String> array = new ArrayList<String>(list);
    6882        this.name=array.get(0);
     
    7286    }
    7387
    74     public WMSInfo(WMSInfo i) {
     88    public ImageryInfo(ImageryInfo i) {
    7589        this.name=i.name;
    7690        this.url=i.url;
    7791        this.cookies=i.cookies;
    78         this.html=i.html;
     92        this.imageryType=i.imageryType;
    7993        this.pixelPerDegree=i.pixelPerDegree;
    8094    }
    8195
    82     public int compareTo(WMSInfo in)
     96    @Override
     97    public int compareTo(ImageryInfo in)
    8398    {
    8499        int i = name.compareTo(in.name);
     
    90105    }
    91106
    92     public boolean equalsBaseValues(WMSInfo in)
     107    public boolean equalsBaseValues(ImageryInfo in)
    93108    {
    94109        return url.equals(in.url);
     
    100115
    101116    public void setURL(String url) {
    102         if(url.startsWith("html:")) {
    103             this.url = url.substring(5);
    104             html = true;
    105         } else {
    106             this.url = url;
     117        for (ImageryType type : ImageryType.values()) {
     118            if (url.startsWith(type.getUrlString() + ":")) {
     119                this.url = url.substring(type.getUrlString().length() + 1);
     120                this.imageryType = type;
     121                return;
     122            }
    107123        }
     124
     125        // Default imagery type is WMS
     126        this.url = url;
     127        this.imageryType = ImageryType.WMS;
     128    }
     129
     130    public String getName() {
     131        return this.name;
     132    }
     133
     134    public void setName(String name) {
     135        this.name = name;
     136    }
     137
     138    public String getURL() {
     139        return this.url;
     140    }
     141
     142    public String getCookies() {
     143        return this.cookies;
     144    }
     145
     146    public double getPixelPerDegree() {
     147        return this.pixelPerDegree;
    108148    }
    109149
    110150    public String getFullURL() {
    111         return html ? "html:" + url : url;
     151        return imageryType.getUrlString() + ":" + url;
    112152    }
    113153
     
    127167        return res;
    128168    }
     169
     170    public ImageryType getImageryType() {
     171        return imageryType;
     172    }
    129173}
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryLayerInfo.java

    r24493 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    1818import org.openstreetmap.josm.io.MirroredInputStream;
    1919
    20 public class WMSLayerInfo {
    21     ArrayList<WMSInfo> layers = new ArrayList<WMSInfo>();
    22     ArrayList<WMSInfo> defaultLayers = new ArrayList<WMSInfo>();
    23     private final static String[] DEFAULT_LAYER_SITES = { "http://josm.openstreetmap.de/maps"};
     20public class ImageryLayerInfo {
     21    ArrayList<ImageryInfo> layers = new ArrayList<ImageryInfo>();
     22    ArrayList<ImageryInfo> defaultLayers = new ArrayList<ImageryInfo>();
     23    private final static String[] DEFAULT_LAYER_SITES
     24        = { "http://svn.openstreetmap.org/applications/editors/josm/plugins/imagery/sources.cfg"};
    2425
    2526    public void load() {
    2627        layers.clear();
    2728        Collection<String> defaults = Main.pref.getCollection(
    28             "wmslayers.default", Collections.<String>emptySet());
    29         for(Collection<String> c : Main.pref.getArray("wmslayers",
     29            "imagery.layers.default", Collections.<String>emptySet());
     30        for(Collection<String> c : Main.pref.getArray("imagery.layers",
    3031        Collections.<Collection<String>>emptySet())) {
    31             layers.add(new WMSInfo(c));
     32            layers.add(new ImageryInfo(c));
    3233        }
    3334
    3435        { /* REMOVE following old block in spring 2011 */
    3536            defaults = new LinkedList<String>(defaults);
    36             Map<String,String> prefs = Main.pref.getAllPrefix("wmsplugin.default.");
     37            Map<String,String> prefs = Main.pref.getAllPrefix("imagery.layers.default.");
    3738            for(String s : prefs.keySet()) {
    3839                Main.pref.put(s, null);
    3940                defaults.add(s.substring(18));
    4041            }
    41             prefs = Main.pref.getAllPrefix("wmsplugin.url.");
     42            prefs = Main.pref.getAllPrefix("imagery.layers.url.");
    4243            for(String s : prefs.keySet()) {
    4344                Main.pref.put(s, null);
     
    4546            TreeSet<String> keys = new TreeSet<String>(prefs.keySet());
    4647
    47             // And then the names+urls of WMS servers
     48            // And then the names+urls of imagery layers
    4849            int prefid = 0;
    4950            String name = null;
     
    7879                    cookies = prefs.get(key);
    7980                if (name != null && url != null)
    80                     layers.add(new WMSInfo(name, url, cookies, pixelPerDegree));
     81                    layers.add(new ImageryInfo(name, url, cookies, pixelPerDegree));
    8182            }
    8283        }
    8384        ArrayList<String> defaultsSave = new ArrayList<String>();
    84         for(String source : Main.pref.getCollection("wmslayers.sites", Arrays.asList(DEFAULT_LAYER_SITES)))
     85        for(String source : Main.pref.getCollection("imagery.layers.sites", Arrays.asList(DEFAULT_LAYER_SITES)))
    8586        {
    8687            try
    8788            {
    88                 MirroredInputStream s = new MirroredInputStream(source, WMSPlugin.instance.getPluginDir(), -1);
     89                MirroredInputStream s = new MirroredInputStream(source, ImageryPlugin.instance.getPluginDir(), -1);
    8990                InputStreamReader r;
    9091                try
     
    110111                            eulaAcceptanceRequired = val[3];
    111112                        }
    112                         defaultLayers.add(new WMSInfo(name, url, eulaAcceptanceRequired));
     113                        defaultLayers.add(new ImageryInfo(name, url, eulaAcceptanceRequired));
    113114
    114115                        if(force) {
    115116                            defaultsSave.add(url);
    116117                            if(!defaults.contains(url)) {
    117                                 int id = -1;
    118                                 for(WMSInfo i : layers) {
     118                                for(ImageryInfo i : layers) {
    119119                                    if(url.equals(i.url))
    120120                                        force = false;
    121121                                }
    122122                                if(force)
    123                                     layers.add(new WMSInfo(name, url));
     123                                    layers.add(new ImageryInfo(name, url));
    124124                            }
    125125                        }
     
    132132        }
    133133
    134         Main.pref.putCollection("wmslayers.default", defaultsSave.size() > 0
     134        Main.pref.putCollection("imagery.layers.default", defaultsSave.size() > 0
    135135            ? defaultsSave : defaults);
    136136        Collections.sort(layers);
     
    138138    }
    139139
    140     public void add(WMSInfo info) {
     140    public void add(ImageryInfo info) {
    141141        layers.add(info);
    142142    }
    143143
    144     public void remove(WMSInfo info) {
     144    public void remove(ImageryInfo info) {
    145145        layers.remove(info);
    146146    }
     
    148148    public void save() {
    149149        LinkedList<Collection<String>> coll = new LinkedList<Collection<String>>();
    150         for (WMSInfo info : layers) {
     150        for (ImageryInfo info : layers) {
    151151            coll.add(info.getInfoArray());
    152152        }
    153         Main.pref.putArray("wmslayers", coll);
     153        Main.pref.putArray("imagery.layers", coll);
    154154    }
    155155}
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPlugin.java

    r24493 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery;
    22
    33import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
     
    1818import org.openstreetmap.josm.actions.ExtensionFileFilter;
    1919import org.openstreetmap.josm.actions.JosmAction;
    20 import org.openstreetmap.josm.data.preferences.BooleanProperty;
    21 import org.openstreetmap.josm.data.preferences.IntegerProperty;
    2220import org.openstreetmap.josm.gui.IconToggleButton;
    2321import org.openstreetmap.josm.gui.MainMenu;
    2422import org.openstreetmap.josm.gui.MapFrame;
    25 import org.openstreetmap.josm.gui.MapView;
    2623import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    27 import org.openstreetmap.josm.io.CacheFiles;
    2824import org.openstreetmap.josm.plugins.Plugin;
    2925import org.openstreetmap.josm.plugins.PluginHandler;
    3026import org.openstreetmap.josm.plugins.PluginInformation;
    3127import org.openstreetmap.josm.plugins.PluginProxy;
    32 
    33 import wmsplugin.io.WMSLayerExporter;
    34 import wmsplugin.io.WMSLayerImporter;
    35 
    36 public class WMSPlugin extends Plugin {
    37     CacheFiles cache = new CacheFiles("wmsplugin");
    38 
    39     public final IntegerProperty PROP_SIMULTANEOUS_CONNECTIONS = new IntegerProperty("wmsplugin.simultaneousConnections", 3);
    40     public final BooleanProperty PROP_OVERLAP = new BooleanProperty("wmsplugin.url.overlap", false);
    41     public final IntegerProperty PROP_OVERLAP_EAST = new IntegerProperty("wmsplugin.url.overlapEast", 14);
    42     public final IntegerProperty PROP_OVERLAP_NORTH = new IntegerProperty("wmsplugin.url.overlapNorth", 4);
    43 
    44     JMenu wmsJMenu;
    45     static WMSPlugin instance;
    46 
    47     public WMSLayerInfo info = new WMSLayerInfo();
     28import org.openstreetmap.josm.plugins.imagery.wms.Map_Rectifier_WMSmenuAction;
     29import org.openstreetmap.josm.plugins.imagery.wms.WMSAdapter;
     30import org.openstreetmap.josm.plugins.imagery.wms.WMSLayer;
     31import org.openstreetmap.josm.plugins.imagery.wms.WMSRemoteHandler;
     32import org.openstreetmap.josm.plugins.imagery.wms.io.WMSLayerExporter;
     33import org.openstreetmap.josm.plugins.imagery.wms.io.WMSLayerImporter;
     34
     35public class ImageryPlugin extends Plugin {
     36
     37    JMenu imageryJMenu;
     38
     39    public static ImageryPlugin instance;
     40    public static WMSAdapter wmsAdapter = new WMSAdapter();
     41
     42    public ImageryLayerInfo info = new ImageryLayerInfo();
    4843
    4944    // remember state of menu item to restore on changed preferences
     
    207202    }
    208203
    209     public WMSPlugin(PluginInformation info) {
     204    public ImageryPlugin(PluginInformation info) {
    210205        super(info);
    211206        instance = this;
    212207        this.info.load();
    213208        refreshMenu();
    214         cache.setExpire(CacheFiles.EXPIRE_MONTHLY, false);
    215         cache.setMaxSize(70, false);
    216         initExporterAndImporter();
    217209        initRemoteControl();
    218210    }
    219211
    220     public void addLayer(WMSInfo info) {
     212    public void addLayer(ImageryInfo info) {
    221213        this.info.add(info);
    222214        this.info.save();
     
    227219        MainMenu menu = Main.main.menu;
    228220
    229         if (wmsJMenu == null)
    230             wmsJMenu = menu.addMenu(marktr("WMS"), KeyEvent.VK_W, menu.defaultMenuPos, ht("/Plugin/WMS"));
     221        if (imageryJMenu == null)
     222            imageryJMenu = menu.addMenu(marktr("Imagery"), KeyEvent.VK_W, menu.defaultMenuPos, ht("/Plugin/Imagery"));
    231223        else
    232             wmsJMenu.removeAll();
     224            imageryJMenu.removeAll();
    233225
    234226        // for each configured WMSInfo, add a menu entry.
    235         for (final WMSInfo u : info.layers) {
    236             wmsJMenu.add(new JMenuItem(new WMSDownloadAction(u)));
    237         }
    238         wmsJMenu.addSeparator();
    239         wmsJMenu.add(new JMenuItem(new Map_Rectifier_WMSmenuAction()));
    240 
    241         wmsJMenu.addSeparator();
    242         wmsJMenu.add(new JMenuItem(new
     227        for (final ImageryInfo u : info.layers) {
     228            imageryJMenu.add(new JMenuItem(new AddImageryLayerAction(u)));
     229        }
     230        imageryJMenu.addSeparator();
     231        imageryJMenu.add(new JMenuItem(new Map_Rectifier_WMSmenuAction()));
     232
     233        imageryJMenu.addSeparator();
     234        imageryJMenu.add(new JMenuItem(new
    243235                JosmAction(tr("Blank Layer"), "blankmenu", tr("Open a blank WMS layer to load data from a file"), null, false) {
     236            @Override
    244237            public void actionPerformed(ActionEvent ev) {
    245238                Main.main.addLayer(new WMSLayer());
     
    249242    }
    250243
    251     public Grabber getGrabber(MapView mv, WMSLayer layer){
    252         if(layer.info.html)
    253             return new HTMLGrabber(mv, layer, cache);
    254         else
    255             return new WMSGrabber(mv, layer, cache);
    256     }
    257 
    258244    private void setEnabledAll(boolean isEnabled) {
    259         for(int i=0; i < wmsJMenu.getItemCount(); i++) {
    260             JMenuItem item = wmsJMenu.getItem(i);
     245        for(int i=0; i < imageryJMenu.getItemCount(); i++) {
     246            JMenuItem item = imageryJMenu.getItem(i);
    261247
    262248            if(item != null) item.setEnabled(isEnabled);
     
    270256            setEnabledAll(true);
    271257            Main.map.addMapMode(new IconToggleButton
    272                     (new WMSAdjustAction(Main.map)));
     258                    (new ImageryAdjustAction(Main.map)));
    273259        } else if (oldFrame!=null && newFrame==null ) {
    274260            setEnabledAll(false);
     
    278264    @Override
    279265    public PreferenceSetting getPreferenceSetting() {
    280         return new WMSPreferenceEditor();
     266        return new ImageryPreferenceEditor();
    281267    }
    282268
     
    284270    public String getPluginDir()
    285271    {
    286         return new File(Main.pref.getPluginsDirectory(), "wmsplugin").getPath();
     272        return new File(Main.pref.getPluginsDirectory(), "imagery").getPath();
    287273    }
    288274}
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPreferenceEditor.java

    r24493 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    3333import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    3434import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
     35import org.openstreetmap.josm.plugins.imagery.wms.AddWMSLayerPanel;
     36import org.openstreetmap.josm.plugins.imagery.wms.WMSAdapter;
    3537import org.openstreetmap.josm.tools.GBC;
    3638
    37 public class WMSPreferenceEditor implements PreferenceSetting {
    38     private WMSLayerTableModel model;
     39public class ImageryPreferenceEditor implements PreferenceSetting {
     40    private ImageryLayerTableModel model;
    3941    private JComboBox browser;
    4042
     
    4547    JCheckBox remoteCheckBox;
    4648    boolean allowRemoteControl = true;
    47     WMSPlugin plugin = WMSPlugin.instance;
    48 
     49    WMSAdapter wmsAdapter = ImageryPlugin.wmsAdapter;
     50    ImageryPlugin plugin = ImageryPlugin.instance;
     51
     52    @Override
    4953    public void addGui(final PreferenceTabbedPane gui) {
    50         JPanel p = gui.createPreferenceTab("wms", tr("WMS Plugin Preferences"), tr("Modify list of WMS servers displayed in the WMS plugin menu"));
    51 
    52         model = new WMSLayerTableModel();
     54        JPanel p = gui.createPreferenceTab("wms", tr("Imagery Preferences"), tr("Modify list of imagery layers displayed in the Imagery menu"));
     55
     56        model = new ImageryLayerTableModel();
    5357        final JTable list = new JTable(model) {
    5458            @Override
     
    6266        scroll.setPreferredSize(new Dimension(200, 200));
    6367
    64         final WMSDefaultLayerTableModel modeldef = new WMSDefaultLayerTableModel();
     68        final ImageryDefaultLayerTableModel modeldef = new ImageryDefaultLayerTableModel();
    6569        final JTable listdef = new JTable(modeldef) {
    6670            @Override
     
    8892        buttonPanel.add(add, GBC.std().insets(0, 5, 0, 0));
    8993        add.addActionListener(new ActionListener() {
     94            @Override
    9095            public void actionPerformed(ActionEvent e) {
    9196                AddWMSLayerPanel p = new AddWMSLayerPanel();
    9297                int answer = JOptionPane.showConfirmDialog(
    9398                        gui, p,
    94                         tr("Add WMS URL"),
     99                        tr("Add Imagery URL"),
    95100                        JOptionPane.OK_CANCEL_OPTION);
    96101                if (answer == JOptionPane.OK_OPTION) {
    97                     model.addRow(new WMSInfo(p.getUrlName(), p.getUrl()));
     102                    model.addRow(new ImageryInfo(p.getUrlName(), p.getUrl()));
    98103                }
    99104            }
     
    103108        buttonPanel.add(delete, GBC.std().insets(0, 5, 0, 0));
    104109        delete.addActionListener(new ActionListener() {
     110            @Override
    105111            public void actionPerformed(ActionEvent e) {
    106112                if (list.getSelectedRow() == -1)
     
    117123        buttonPanel.add(copy, GBC.std().insets(0, 5, 0, 0));
    118124        copy.addActionListener(new ActionListener() {
     125            @Override
    119126            public void actionPerformed(ActionEvent e) {
    120127                int[] lines = listdef.getSelectedRows();
     
    129136
    130137                outer: for (int i = 0; i < lines.length; i++) {
    131                     WMSInfo info = modeldef.getRow(lines[i]);
     138                    ImageryInfo info = modeldef.getRow(lines[i]);
    132139
    133140                    // Check if an entry with exactly the same values already
     
    148155                    }
    149156
    150                     model.addRow(new WMSInfo(info));
     157                    model.addRow(new ImageryInfo(info));
    151158                    int lastLine = model.getRowCount() - 1;
    152159                    list.getSelectionModel().setSelectionInterval(lastLine, lastLine);
     
    174181        p.add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    175182
    176         overlapCheckBox = new JCheckBox(tr("Overlap tiles"), plugin.PROP_OVERLAP.get());
     183        overlapCheckBox = new JCheckBox(tr("Overlap tiles"), wmsAdapter.PROP_OVERLAP.get());
    177184        JLabel labelEast = new JLabel(tr("% of east:"));
    178185        JLabel labelNorth = new JLabel(tr("% of north:"));
    179         spinEast = new JSpinner(new SpinnerNumberModel(plugin.PROP_OVERLAP_EAST.get(), 1, 50, 1));
    180         spinNorth = new JSpinner(new SpinnerNumberModel(plugin.PROP_OVERLAP_NORTH.get(), 1, 50, 1));
     186        spinEast = new JSpinner(new SpinnerNumberModel(wmsAdapter.PROP_OVERLAP_EAST.get(), 1, 50, 1));
     187        spinNorth = new JSpinner(new SpinnerNumberModel(wmsAdapter.PROP_OVERLAP_NORTH.get(), 1, 50, 1));
    181188
    182189        JPanel overlapPanel = new JPanel(new FlowLayout());
     
    192199        p.add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    193200        JLabel labelSimConn = new JLabel(tr("Simultaneous connections"));
    194         spinSimConn = new JSpinner(new SpinnerNumberModel(plugin.PROP_SIMULTANEOUS_CONNECTIONS.get(), 1, 30, 1));
     201        spinSimConn = new JSpinner(new SpinnerNumberModel(wmsAdapter.PROP_SIMULTANEOUS_CONNECTIONS.get(), 1, 30, 1));
    195202        JPanel overlapPanelSimConn = new JPanel(new FlowLayout());
    196203        overlapPanelSimConn.add(labelSimConn);
     
    206213    }
    207214
     215    @Override
    208216    public boolean ok() {
    209217        plugin.info.save();
    210218        plugin.refreshMenu();
    211219
    212         plugin.PROP_OVERLAP.put(overlapCheckBox.getModel().isSelected());
    213         plugin.PROP_OVERLAP_EAST.put((Integer) spinEast.getModel().getValue());
    214         plugin.PROP_OVERLAP_NORTH.put((Integer) spinNorth.getModel().getValue());
    215         plugin.PROP_SIMULTANEOUS_CONNECTIONS.put((Integer) spinSimConn.getModel().getValue());
     220        wmsAdapter.PROP_OVERLAP.put(overlapCheckBox.getModel().isSelected());
     221        wmsAdapter.PROP_OVERLAP_EAST.put((Integer) spinEast.getModel().getValue());
     222        wmsAdapter.PROP_OVERLAP_NORTH.put((Integer) spinNorth.getModel().getValue());
     223        wmsAdapter.PROP_SIMULTANEOUS_CONNECTIONS.put((Integer) spinSimConn.getModel().getValue());
    216224        allowRemoteControl = remoteCheckBox.getModel().isSelected();
    217225
     
    260268     *
    261269     */
    262     class WMSLayerTableModel extends DefaultTableModel {
    263         public WMSLayerTableModel() {
    264             setColumnIdentifiers(new String[] { tr("Menu Name"), tr("WMS URL"), trc("layer", "Zoom") });
    265         }
    266 
    267         public WMSInfo getRow(int row) {
     270    class ImageryLayerTableModel extends DefaultTableModel {
     271        public ImageryLayerTableModel() {
     272            setColumnIdentifiers(new String[] { tr("Menu Name"), tr("Imagery URL"), trc("layer", "Zoom") });
     273        }
     274
     275        public ImageryInfo getRow(int row) {
    268276            return plugin.info.layers.get(row);
    269277        }
    270278
    271         public void addRow(WMSInfo i) {
     279        public void addRow(ImageryInfo i) {
    272280            plugin.info.add(i);
    273281            int p = getRowCount() - 1;
     
    288296        @Override
    289297        public Object getValueAt(int row, int column) {
    290             WMSInfo info = plugin.info.layers.get(row);
     298            ImageryInfo info = plugin.info.layers.get(row);
    291299            switch (column) {
    292300            case 0:
     
    302310        @Override
    303311        public void setValueAt(Object o, int row, int column) {
    304             WMSInfo info = plugin.info.layers.get(row);
     312            ImageryInfo info = plugin.info.layers.get(row);
    305313            switch (column) {
    306314            case 0:
     
    321329     *
    322330     */
    323     class WMSDefaultLayerTableModel extends DefaultTableModel {
    324         public WMSDefaultLayerTableModel() {
    325             setColumnIdentifiers(new String[] { tr("Menu Name (Default)"), tr("WMS URL (Default)") });
    326         }
    327 
    328         public WMSInfo getRow(int row) {
     331    class ImageryDefaultLayerTableModel extends DefaultTableModel {
     332        public ImageryDefaultLayerTableModel() {
     333            setColumnIdentifiers(new String[] { tr("Menu Name (Default)"), tr("Imagery URL (Default)") });
     334        }
     335
     336        public ImageryInfo getRow(int row) {
    329337            return plugin.info.defaultLayers.get(row);
    330338        }
     
    337345        @Override
    338346        public Object getValueAt(int row, int column) {
    339             WMSInfo info = plugin.info.defaultLayers.get(row);
     347            ImageryInfo info = plugin.info.defaultLayers.get(row);
    340348            switch (column) {
    341349            case 0:
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSKey.java

    r24493 r24501  
    22 *
    33 */
    4 package org.openstreetmap.josm.plugins.slippymap;
     4package org.openstreetmap.josm.plugins.imagery.tms;
    55
    66/**
     
    1414 *
    1515 */
    16 public class SlippyMapKey {
     16public class TMSKey {
    1717    private final int x;
    1818    private final int y;
     
    2929     */
    3030    public final boolean valid;
    31     public SlippyMapKey(int x, int y, int level) {
     31    public TMSKey(int x, int y, int level) {
    3232        this.x = x;
    3333        this.y = y;
     
    3535        if (level <= 0 || x < 0 || y < 0) {
    3636            this.valid = false;
    37             System.err.println("invalid SlippyMapKey("+level+", "+x+", "+y+")");
     37            System.err.println("invalid TMSKey("+level+", "+x+", "+y+")");
    3838        } else {
    3939            this.valid = true;
     
    5050    @Override
    5151    public boolean equals(Object obj) {
    52         if (obj instanceof SlippyMapKey) {
    53             SlippyMapKey smk = (SlippyMapKey) obj;
     52        if (obj instanceof TMSKey) {
     53            TMSKey smk = (TMSKey) obj;
    5454            if((smk.x == this.x) && (smk.y == this.y) && (smk.level == this.level)) {
    5555                return true;
     
    7373    @Override
    7474    public String toString() {
    75         return "SlippyMapKey(x=" + this.x + ",y=" + this.y + ",level=" + level + ")";
     75        return "TMSKey(x=" + this.x + ",y=" + this.y + ",level=" + level + ")";
    7676    }
    7777
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java

    r24493 r24501  
    1 package org.openstreetmap.josm.plugins.slippymap;
     1package org.openstreetmap.josm.plugins.imagery.tms;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    2626import javax.swing.AbstractAction;
    2727import javax.swing.Action;
    28 import javax.swing.Icon;
    2928import javax.swing.JCheckBoxMenuItem;
    3029import javax.swing.JMenuItem;
     
    5049import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    5150import org.openstreetmap.josm.gui.layer.Layer;
    52 import org.openstreetmap.josm.tools.ImageProvider;
     51import org.openstreetmap.josm.plugins.imagery.ImageryInfo;
     52import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType;
     53import org.openstreetmap.josm.plugins.imagery.ImageryLayer;
    5354
    5455/**
     
    6061 *
    6162 */
    62 public class SlippyMapLayer extends Layer implements ImageObserver,
    63     TileLoaderListener {
     63public class TMSLayer extends ImageryLayer implements ImageObserver, TileLoaderListener {
    6464    boolean debug = false;
    6565    void out(String s)
     
    7474
    7575    HashSet<Tile> tileRequestsOutstanding = new HashSet<Tile>();
     76    @Override
    7677    public synchronized void tileLoadingFinished(Tile tile, boolean success)
    7778    {
     
    8384            out("tileLoadingFinished() tile: " + tile + " success: " + success);
    8485    }
     86    @Override
    8587    public TileCache getTileCache()
    8688    {
     
    9799    /**
    98100     * Actual zoom lvl. Initial zoom lvl is set to
    99      * {@link SlippyMapPreferences#getMinZoomLvl()}.
    100101     */
    101102    public int currentZoomLevel;
     
    115116    private static Font ATTR_LINK_FONT = Font.decode("Arial Underline 10");
    116117
     118    protected boolean autoZoom = true;
     119    protected boolean autoLoad = true;
     120
    117121    void redraw()
    118122    {
     
    121125    }
    122126
    123     void newTileStorage()
     127    private void setTileStorage(TileSource tileSource)
    124128    {
    125129        int origZoom = currentZoomLevel;
    126         tileSource = SlippyMapPreferences.getMapSource();
     130        this.tileSource = tileSource;
    127131        boolean requireAttr = tileSource.requiresAttribution();
    128132        if(requireAttr) {
     
    133137                System.out.println("Got an attribution image " + attrImage.getHeight(this) + "x" + attrImage.getWidth(this));
    134138            }
    135            
     139
    136140            attrTermsUrl = tileSource.getTermsOfUseURL();
    137141        }
    138        
     142
    139143        // The minimum should also take care of integer parsing
    140144        // errors which would leave us with a zoom of -1 otherwise
     
    147151            out("tileSource.getMinZoom(): " + tileSource.getMinZoom());
    148152            out("tileSource.getMaxZoom(): " + tileSource.getMaxZoom());
    149             SlippyMapPreferences.setLastZoom(currentZoomLevel);
    150153        }
    151154        clearTileCache();
    152         //tileLoader = new OsmTileLoader(this);
     155        //tileloader = new OsmTileLoader(this);
    153156        tileLoader = new OsmFileCacheTileLoader(this);
    154157    }
    155158
     159    @Override
     160    public void displace(double dx, double dy) {
     161        super.displace(dx, dy);
     162        needRedraw = true;
     163    }
     164
    156165    @SuppressWarnings("serial")
    157     public SlippyMapLayer() {
    158         super(tr("Slippy Map"));
     166    public TMSLayer(ImageryInfo info) {
     167        super(info.getName());
    159168
    160169        setBackgroundLayer(true);
    161170        this.setVisible(true);
    162171
    163         currentZoomLevel = SlippyMapPreferences.getLastZoom();
    164         newTileStorage();
     172        currentZoomLevel = 0; //FIXME: detect current zoom level
     173        if (info.getImageryType() == ImageryType.TMS) {
     174            setTileStorage(new TMSTileSource(info.getName(),info.getURL()));
     175        } else if (info.getImageryType() == ImageryType.BING) {
     176            setTileStorage(new BingAerialTileSource());
     177        } else throw new AssertionError();
    165178
    166179        tileOptionMenu = new JPopupMenu();
     
    168181        autoZoomPopup = new JCheckBoxMenuItem();
    169182        autoZoomPopup.setAction(new AbstractAction(tr("Auto Zoom")) {
     183            @Override
    170184            public void actionPerformed(ActionEvent ae) {
    171                 boolean new_state = !SlippyMapPreferences.getAutozoom();
    172                 SlippyMapPreferences.setAutozoom(new_state);
     185                autoZoom = !autoZoom;
    173186            }
    174187        });
    175         autoZoomPopup.setSelected(SlippyMapPreferences.getAutozoom());
     188        autoZoomPopup.setSelected(autoZoom);
    176189        tileOptionMenu.add(autoZoomPopup);
    177190
    178191        tileOptionMenu.add(new JMenuItem(new AbstractAction(tr("Load Tile")) {
     192            @Override
    179193            public void actionPerformed(ActionEvent ae) {
    180194                if (clickedTile != null) {
     
    187201        tileOptionMenu.add(new JMenuItem(new AbstractAction(
    188202                tr("Show Tile Info")) {
     203            @Override
    189204            public void actionPerformed(ActionEvent ae) {
    190205                out("info tile: " + clickedTile);
     
    209224        tileOptionMenu.add(new JMenuItem(new AbstractAction(
    210225                tr("Load All Tiles")) {
     226            @Override
    211227            public void actionPerformed(ActionEvent ae) {
    212228                loadAllTiles(true);
     
    218234        tileOptionMenu.add(new JMenuItem(
    219235                new AbstractAction(tr("Increase zoom")) {
     236                    @Override
    220237                    public void actionPerformed(ActionEvent ae) {
    221238                        increaseZoomLevel();
     
    226243        tileOptionMenu.add(new JMenuItem(
    227244                new AbstractAction(tr("Decrease zoom")) {
     245                    @Override
    228246                    public void actionPerformed(ActionEvent ae) {
    229247                        decreaseZoomLevel();
     
    236254        tileOptionMenu.add(new JMenuItem(
    237255                new AbstractAction(tr("Snap to tile size")) {
     256                    @Override
    238257                    public void actionPerformed(ActionEvent ae) {
    239258                        if (lastImageScale == null) {
     
    252271        tileOptionMenu.add(new JMenuItem(
    253272                new AbstractAction(tr("Flush Tile Cache")) {
     273                    @Override
    254274                    public void actionPerformed(ActionEvent ae) {
    255275                        System.out.print("flushing all tiles...");
     
    261281
    262282        SwingUtilities.invokeLater(new Runnable() {
     283            @Override
    263284            public void run() {
    264285                Main.map.mapView.addMouseListener(new MouseAdapter() {
     
    272293                                return;
    273294                            }
    274                            
     295
    275296                            if(attrImageBounds.contains(e.getPoint())) {
    276297                                try {
     
    297318
    298319                MapView.addLayerChangeListener(new LayerChangeListener() {
     320                    @Override
    299321                    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    300322                        //
    301323                    }
    302324
     325                    @Override
    303326                    public void layerAdded(Layer newLayer) {
    304327                        //
    305328                    }
    306329
     330                    @Override
    307331                    public void layerRemoved(Layer oldLayer) {
    308332                        MapView.removeLayerChangeListener(this);
     
    320344        jobDispatcher.cancelOutstandingJobs();
    321345        tileRequestsOutstanding.clear();
    322         SlippyMapPreferences.setLastZoom(currentZoomLevel);
    323346    }
    324347
    325348    int getMaxZoomLvl()
    326349    {
    327         int ret = SlippyMapPreferences.getMaxZoomLvl();
    328         if (tileSource.getMaxZoom() < ret)
    329             ret = tileSource.getMaxZoom();
    330         return ret;
     350        return tileSource.getMaxZoom();
    331351    }
    332352
    333353    int getMinZoomLvl()
    334354    {
    335         int ret = SlippyMapPreferences.getMinZoomLvl();
    336         if (tileSource.getMinZoom() > ret)
    337             ret = tileSource.getMinZoom();
    338         return ret;
     355        return tileSource.getMinZoom();
    339356    }
    340357
     
    466483     */
    467484    Image lastScaledImage = null;
     485    @Override
    468486    public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
    469487        boolean done = ((infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0);
     
    641659                        img_x_end, img_y_end,
    642660                        this);
    643         float fadeBackground = SlippyMapPreferences.getFadeBackground();
    644         if (fadeBackground != 0f) {
    645             // dimm by painting opaque rect...
    646             g.setColor(new Color(1f, 1f, 1f, fadeBackground));
    647             g.fillRect(target.x, target.y,
    648                        target.width, target.height);
    649         }
    650661    }
    651662    Double lastImageScale = null;
     
    692703        int texty = p.y + 2 + fontHeight;
    693704
    694         if (SlippyMapPreferences.getDrawDebug()) {
    695             g.drawString("x=" + t.getXtile() + " y=" + t.getYtile() + " z=" + zoom + "", p.x + 2, texty);
    696             texty += 1 + fontHeight;
    697             if ((t.getXtile() % 32 == 0) && (t.getYtile() % 32 == 0)) {
    698                 g.drawString("x=" + t.getXtile() / 32 + " y=" + t.getYtile() / 32 + " z=7", p.x + 2, texty);
    699                 texty += 1 + fontHeight;
    700             }
    701         }// end of if draw debug
    702 
    703705        if (tile == showMetadataTile) {
    704706            String md = tile.toString();
     
    714716            texty += 1 + fontHeight;
    715717        }
    716 
    717         int xCursor = -1;
    718         int yCursor = -1;
    719         if (SlippyMapPreferences.getDrawDebug()) {
    720             if (yCursor < t.getYtile()) {
    721                 if (t.getYtile() % 32 == 31) {
    722                     g.fillRect(0, p.y - 1, mv.getWidth(), 3);
    723                 } else {
    724                     g.drawLine(0, p.y, mv.getWidth(), p.y);
    725                 }
    726                 yCursor = t.getYtile();
    727             }
    728             // This draws the vertical lines for the entire
    729             // column. Only draw them for the top tile in
    730             // the column.
    731             if (xCursor < t.getXtile()) {
    732                 if (SlippyMapPreferences.getDrawDebug()) {
    733                     if (t.getXtile() % 32 == 0) {
    734                         // level 7 tile boundary
    735                         g.fillRect(p.x - 1, 0, 3, mv.getHeight());
    736                     } else {
    737                         g.drawLine(p.x, 0, p.x, mv.getHeight());
    738                     }
    739                 }
    740                 xCursor = t.getXtile();
    741             }
    742         }
    743718    }
    744719
    745720    public Point pixelPos(LatLon ll) {
    746         return Main.map.mapView.getPoint(ll);
     721        return Main.map.mapView.getPoint(Main.proj.latlon2eastNorth(ll).add(getDx(), getDy()));
    747722    }
    748723    public Point pixelPos(Tile t) {
     
    828803        {
    829804            List<Tile> tiles = this.allTiles(true);
    830             boolean autoload = SlippyMapPreferences.getAutoloadTiles();
     805            boolean autoload = TMSLayer.this.autoLoad;
    831806            if (!autoload && !force)
    832807               return;
     
    847822        if (az_disable)
    848823            return false;
    849         return autoZoomPopup.isSelected();
     824        return autoZoom;
    850825    }
    851826    /**
     
    928903            if (!autoZoomEnabled())
    929904                break;
    930             if (!SlippyMapPreferences.getAutoloadTiles())
     905            if (!autoLoad)
    931906                break;
    932907            int newzoom = currentZoomLevel + zoomOffset;
     
    961936            Font font = g.getFont();
    962937            g.setFont(ATTR_LINK_FONT);
    963            
     938
    964939            // Draw terms of use text
    965940            Rectangle2D termsStringBounds = g.getFontMetrics().getStringBounds("Background Terms of Use", g);
     
    973948                g.drawString("Background Terms of Use", x, y);
    974949            }
    975            
     950
    976951            // Draw attribution logo
    977952            int imgWidth = attrImage.getWidth(this);
     
    983958                g.drawImage(attrImage, x, y, this);
    984959            }
    985            
     960
    986961            String attributionText = tileSource.getAttributionText(currentZoomLevel, topLeft, botRight);
    987962            Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(attributionText, g);
    988963            g.drawString(attributionText, mv.getWidth() - (int) stringBounds.getWidth(), mv.getHeight() - textHeight);
    989            
     964
    990965            g.setFont(font);
    991966        }
     
    10571032
    10581033    @Override
    1059     public Icon getIcon() {
    1060         return ImageProvider.get("slippymap");
    1061     }
    1062 
    1063     @Override
    1064     public Object getInfoComponent() {
    1065         return null;
    1066     }
    1067 
    1068     @Override
    10691034    public Action[] getMenuEntries() {
    10701035        return new Action[] {
     
    10841049
    10851050    @Override
    1086     public boolean isMergable(Layer other) {
    1087         return false;
    1088     }
    1089 
    1090     @Override
    1091     public void mergeFrom(Layer from) {
    1092     }
    1093 
    1094     @Override
    10951051    public void visitBoundingBox(BoundingXYVisitor v) {
    10961052    }
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/AddWMSLayerPanel.java

    r23904 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    8888        JButton getLayersButton = new JButton(tr("Get Layers"));
    8989        getLayersButton.addActionListener(new ActionListener() {
     90            @Override
    9091            public void actionPerformed(ActionEvent e) {
    9192                Cursor beforeCursor = getCursor();
     
    106107        layerTree.addTreeSelectionListener(new TreeSelectionListener() {
    107108
     109            @Override
    108110            public void valueChanged(TreeSelectionEvent e) {
    109111                TreePath[] selectionRows = layerTree.getSelectionPaths();
     
    152154        showBoundsButton.setEnabled(false);
    153155        showBoundsButton.addActionListener(new ActionListener() {
     156            @Override
    154157            public void actionPerformed(ActionEvent e) {
    155158                if(selectedLayer.bounds != null) {
     
    271274            DocumentBuilder builder = builderFactory.newDocumentBuilder();
    272275            builder.setEntityResolver(new EntityResolver() {
     276                @Override
    273277                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
    274278                    System.out.println("Ignoring DTD " + publicId + ", " + systemId);
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/GeorefImage.java

    r23207 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/Grabber.java

    r23207 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import org.openstreetmap.josm.Main;
     
    77import org.openstreetmap.josm.gui.MapView;
    88import org.openstreetmap.josm.io.CacheFiles;
    9 
    10 import wmsplugin.GeorefImage.State;
     9import org.openstreetmap.josm.plugins.imagery.ImageryPlugin;
     10import org.openstreetmap.josm.plugins.imagery.wms.GeorefImage.State;
    1111
    1212abstract public class Grabber implements Runnable {
     
    3131                layer.getEastNorth(request.getXIndex(), request.getYIndex()),
    3232                layer.getEastNorth(request.getXIndex() + 1, request.getYIndex() + 1));
    33         if (b.min != null && b.max != null && WMSPlugin.instance.PROP_OVERLAP.get()) {
     33        if (b.min != null && b.max != null && ImageryPlugin.wmsAdapter.PROP_OVERLAP.get()) {
    3434            double eastSize =  b.max.east() - b.min.east();
    3535            double northSize =  b.max.north() - b.min.north();
    3636
    37             double eastCoef = WMSPlugin.instance.PROP_OVERLAP_EAST.get() / 100.0;
    38             double northCoef = WMSPlugin.instance.PROP_OVERLAP_NORTH.get() / 100.0;
     37            double eastCoef = ImageryPlugin.wmsAdapter.PROP_OVERLAP_EAST.get() / 100.0;
     38            double northCoef = ImageryPlugin.wmsAdapter.PROP_OVERLAP_NORTH.get() / 100.0;
    3939
    4040            this.b = new ProjectionBounds( new EastNorth(b.min.east(),
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/HTMLGrabber.java

    r23207 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import java.awt.image.BufferedImage;
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/Map_Rectifier_WMSmenuAction.java

    r23207 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    2424import org.openstreetmap.josm.actions.JosmAction;
    2525import org.openstreetmap.josm.gui.ExtendedDialog;
     26import org.openstreetmap.josm.plugins.imagery.ImageryInfo;
    2627import org.openstreetmap.josm.tools.GBC;
    2728import org.openstreetmap.josm.tools.Shortcut;
     
    108109    }
    109110
     111    @Override
    110112    public void actionPerformed(ActionEvent e) {
    111113        JPanel panel = new JPanel(new GridBagLayout());
     
    212214     */
    213215    private void addWMSLayer(String title, String url) {
    214         Main.main.addLayer(new WMSLayer(new WMSInfo(title, url)));
     216        Main.main.addLayer(new WMSLayer(new ImageryInfo(title, url)));
    215217    }
    216218
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSAdapter.java

    r24493 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    3 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    4 import static org.openstreetmap.josm.tools.I18n.marktr;
    5 import static org.openstreetmap.josm.tools.I18n.tr;
    6 
    7 import java.awt.event.ActionEvent;
    8 import java.awt.event.KeyEvent;
    9 import java.io.File;
    10 import java.lang.reflect.InvocationTargetException;
    11 import java.lang.reflect.Method;
    12 
    13 import javax.swing.JMenu;
    14 import javax.swing.JMenuItem;
    15 import javax.swing.JOptionPane;
    16 
    17 import org.openstreetmap.josm.Main;
    183import org.openstreetmap.josm.actions.ExtensionFileFilter;
    19 import org.openstreetmap.josm.actions.JosmAction;
    204import org.openstreetmap.josm.data.preferences.BooleanProperty;
    215import org.openstreetmap.josm.data.preferences.IntegerProperty;
    22 import org.openstreetmap.josm.gui.IconToggleButton;
    23 import org.openstreetmap.josm.gui.MainMenu;
    24 import org.openstreetmap.josm.gui.MapFrame;
    256import org.openstreetmap.josm.gui.MapView;
    26 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    277import org.openstreetmap.josm.io.CacheFiles;
    28 import org.openstreetmap.josm.plugins.Plugin;
    29 import org.openstreetmap.josm.plugins.PluginHandler;
    30 import org.openstreetmap.josm.plugins.PluginInformation;
    31 import org.openstreetmap.josm.plugins.PluginProxy;
     8import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType;
     9import org.openstreetmap.josm.plugins.imagery.wms.io.WMSLayerExporter;
     10import org.openstreetmap.josm.plugins.imagery.wms.io.WMSLayerImporter;
    3211
    33 import wmsplugin.io.WMSLayerExporter;
    34 import wmsplugin.io.WMSLayerImporter;
    35 
    36 public class WMSPlugin extends Plugin {
     12// WMSPlugin-specific functions
     13public class WMSAdapter {
    3714    CacheFiles cache = new CacheFiles("wmsplugin");
    3815
     
    4219    public final IntegerProperty PROP_OVERLAP_NORTH = new IntegerProperty("wmsplugin.url.overlapNorth", 4);
    4320
    44     JMenu wmsJMenu;
    45     static WMSPlugin instance;
    46 
    47     public WMSLayerInfo info = new WMSLayerInfo();
    48 
    49     // remember state of menu item to restore on changed preferences
    50     private boolean menuEnabled = false;
    51 
    52     /***************************************************************
    53      * Remote control initialization:
    54      * If you need remote control in some other plug-in
    55      * copy this stuff and the call to initRemoteControl below
    56      * and replace the RequestHandler subclass in initRemoteControl
    57      ***************************************************************/
    58 
    59     /** name of remote control plugin */
    60     private final String REMOTECONTROL_NAME = "remotecontrol";
    61 
    62     /* if necessary change these version numbers to ensure compatibility */
    63 
    64     /** RemoteControlPlugin older than this SVN revision is not compatible */
    65     final int REMOTECONTROL_MIN_REVISION = 22734;
    66     /** WMSPlugin needs this specific API major version of RemoteControlPlugin */
    67     final int REMOTECONTROL_NEED_API_MAJOR = 1;
    68     /** All API minor versions starting from this should be compatible */
    69     final int REMOTECONTROL_MIN_API_MINOR = 0;
    70 
    71     /* these fields will contain state and version of remote control plug-in */
    72     boolean remoteControlAvailable = false;
    73     boolean remoteControlCompatible = true;
    74     boolean remoteControlInitialized = false;
    75     int remoteControlRevision = 0;
    76     int remoteControlApiMajor = 0;
    77     int remoteControlApiMinor = 0;
    78     int remoteControlProtocolMajor = 0;
    79     int remoteControlProtocolMinor = 0;
    80 
    81     /**
    82      * Check if remote control plug-in is available and if its version is
    83      * high enough and register remote control command for this plug-in.
    84      */
    85     private void initRemoteControl() {
    86         for(PluginProxy pp: PluginHandler.pluginList)
    87         {
    88             PluginInformation info = pp.getPluginInformation();
    89             if(REMOTECONTROL_NAME.equals(info.name))
    90             {
    91                 remoteControlAvailable = true;
    92                 remoteControlRevision = Integer.parseInt(info.version);
    93                 if(REMOTECONTROL_MIN_REVISION > remoteControlRevision)
    94                 {
    95                     remoteControlCompatible = false;
    96                 }
    97             }
    98         }
    99 
    100         if(remoteControlAvailable && remoteControlCompatible)
    101         {
    102             Plugin plugin =
    103                 (Plugin) PluginHandler.getPlugin(REMOTECONTROL_NAME);
    104             try {
    105                 Method method;
    106                 method = plugin.getClass().getMethod("getVersion");
    107                 Object obj = method.invoke(plugin);
    108                 if((obj != null ) && (obj instanceof int[]))
    109                 {
    110                     int[] versions = (int[]) obj;
    111                     if(versions.length >= 4)
    112                     {
    113                         remoteControlApiMajor = versions[0];
    114                         remoteControlApiMinor = versions[1];
    115                         remoteControlProtocolMajor = versions[2];
    116                         remoteControlProtocolMinor = versions[3];
    117                     }
    118                 }
    119 
    120                 if((remoteControlApiMajor != REMOTECONTROL_NEED_API_MAJOR) ||
    121                         (remoteControlApiMinor < REMOTECONTROL_MIN_API_MINOR))
    122                 {
    123                     remoteControlCompatible = false;
    124                 }
    125                 if(remoteControlCompatible)
    126                 {
    127                     System.out.println(this.getClass().getSimpleName() + ": initializing remote control");
    128                     method = plugin.getClass().getMethod("addRequestHandler", String.class, Class.class);
    129                     // replace command and class when you copy this to some other plug-in
    130                     // for compatibility with old remotecontrol add leading "/"
    131                     method.invoke(plugin, "/" + WMSRemoteHandler.command, WMSRemoteHandler.class);
    132                     remoteControlInitialized = true;
    133                 }
    134             } catch (SecurityException e) {
    135                 e.printStackTrace();
    136             } catch (NoSuchMethodException e) {
    137                 e.printStackTrace();
    138             } catch (IllegalArgumentException e) {
    139                 e.printStackTrace();
    140             } catch (IllegalAccessException e) {
    141                 e.printStackTrace();
    142             } catch (InvocationTargetException e) {
    143                 e.printStackTrace();
    144             }
    145         }
    146         if(remoteControlAvailable)
    147         {
    148             String msg = null;
    149 
    150             if(remoteControlCompatible)
    151             {
    152                 if(!remoteControlInitialized)
    153                 {
    154                     msg  = tr("Could not initialize remote control.");
    155                 }
    156             }
    157             else
    158             {
    159                 msg  = tr("Remote control plugin is not compatible with {0}.",
    160                         this.getClass().getSimpleName());
    161             }
    162 
    163             if(msg != null)
    164             {
    165                 String additionalMessage = tr("{0} will work but remote control for this plugin is disabled.\n"
    166                         + "You should update the plugins.",
    167                         this.getClass().getSimpleName());
    168                 String versionMessage = tr("Current version of \"{1}\": {2}, internal version {3}. "
    169                         + "Need version {4}, internal version {5}.\n"
    170                         + "If updating the plugins does not help report a bug for \"{0}\".",
    171                         this.getClass().getSimpleName(),
    172                         REMOTECONTROL_NAME,
    173                         ""+remoteControlRevision,
    174                         (remoteControlApiMajor != 0) ?
    175                                 ""+remoteControlApiMajor+"."+remoteControlApiMinor :
    176                                     tr("unknown"),
    177                                     ""+REMOTECONTROL_MIN_REVISION,
    178                                     ""+REMOTECONTROL_NEED_API_MAJOR+"."+REMOTECONTROL_MIN_API_MINOR );
    179 
    180                 String title = tr("{0}: Problem with remote control",
    181                         this.getClass().getSimpleName());
    182 
    183                 System.out.println(this.getClass().getSimpleName() + ": " +
    184                         msg + "\n" + versionMessage);
    185 
    186                 JOptionPane.showMessageDialog(
    187                         Main.parent,
    188                         msg + "\n" + additionalMessage,
    189                         title,
    190                         JOptionPane.WARNING_MESSAGE
    191                 );
    192             }
    193         }
    194 
    195         if(!remoteControlAvailable) {
    196             System.out.println(this.getClass().getSimpleName() + ": remote control not available");
    197         }
    198     }
    199 
    200     /***************************************
    201      * end of remote control initialization
    202      ***************************************/
    203 
    20421    protected void initExporterAndImporter() {
    20522        ExtensionFileFilter.exporters.add(new WMSLayerExporter());
     
    20724    }
    20825
    209     public WMSPlugin(PluginInformation info) {
    210         super(info);
    211         instance = this;
    212         this.info.load();
    213         refreshMenu();
     26    public WMSAdapter() {
    21427        cache.setExpire(CacheFiles.EXPIRE_MONTHLY, false);
    21528        cache.setMaxSize(70, false);
    21629        initExporterAndImporter();
    217         initRemoteControl();
    218     }
    219 
    220     public void addLayer(WMSInfo info) {
    221         this.info.add(info);
    222         this.info.save();
    223         refreshMenu();
    224     }
    225 
    226     public void refreshMenu() {
    227         MainMenu menu = Main.main.menu;
    228 
    229         if (wmsJMenu == null)
    230             wmsJMenu = menu.addMenu(marktr("WMS"), KeyEvent.VK_W, menu.defaultMenuPos, ht("/Plugin/WMS"));
    231         else
    232             wmsJMenu.removeAll();
    233 
    234         // for each configured WMSInfo, add a menu entry.
    235         for (final WMSInfo u : info.layers) {
    236             wmsJMenu.add(new JMenuItem(new WMSDownloadAction(u)));
    237         }
    238         wmsJMenu.addSeparator();
    239         wmsJMenu.add(new JMenuItem(new Map_Rectifier_WMSmenuAction()));
    240 
    241         wmsJMenu.addSeparator();
    242         wmsJMenu.add(new JMenuItem(new
    243                 JosmAction(tr("Blank Layer"), "blankmenu", tr("Open a blank WMS layer to load data from a file"), null, false) {
    244             public void actionPerformed(ActionEvent ev) {
    245                 Main.main.addLayer(new WMSLayer());
    246             }
    247         }));
    248         setEnabledAll(menuEnabled);
    24930    }
    25031
    25132    public Grabber getGrabber(MapView mv, WMSLayer layer){
    252         if(layer.info.html)
     33        if(layer.info.getImageryType() == ImageryType.HTML)
    25334            return new HTMLGrabber(mv, layer, cache);
    254         else
     35        else if(layer.info.getImageryType() == ImageryType.WMS)
    25536            return new WMSGrabber(mv, layer, cache);
     37        else throw new AssertionError();
    25638    }
    25739
    258     private void setEnabledAll(boolean isEnabled) {
    259         for(int i=0; i < wmsJMenu.getItemCount(); i++) {
    260             JMenuItem item = wmsJMenu.getItem(i);
    261 
    262             if(item != null) item.setEnabled(isEnabled);
    263         }
    264         menuEnabled = isEnabled;
    265     }
    266 
    267     @Override
    268     public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    269         if (oldFrame==null && newFrame!=null) {
    270             setEnabledAll(true);
    271             Main.map.addMapMode(new IconToggleButton
    272                     (new WMSAdjustAction(Main.map)));
    273         } else if (oldFrame!=null && newFrame==null ) {
    274             setEnabledAll(false);
    275         }
    276     }
    277 
    278     @Override
    279     public PreferenceSetting getPreferenceSetting() {
    280         return new WMSPreferenceEditor();
    281     }
    282 
    283     @Override
    284     public String getPluginDir()
    285     {
    286         return new File(Main.pref.getPluginsDirectory(), "wmsplugin").getPath();
    287     }
    28840}
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSGrabber.java

    r23207 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    3131import org.openstreetmap.josm.io.OsmTransferException;
    3232import org.openstreetmap.josm.io.ProgressInputStream;
    33 
    34 import wmsplugin.GeorefImage.State;
     33import org.openstreetmap.josm.plugins.imagery.wms.GeorefImage.State;
    3534
    3635
     
    4544    WMSGrabber(MapView mv, WMSLayer layer, CacheFiles cache) {
    4645        super(mv, layer, cache);
    47         this.baseURL = layer.info.url;
     46        this.baseURL = layer.info.getURL();
    4847        /* URL containing placeholders? */
    4948        urlWithPatterns = isUrlWithPatterns(baseURL);
     
    169168
    170169        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    171         if(layer.info.cookies != null && !layer.info.cookies.equals(""))
    172             conn.setRequestProperty("Cookie", layer.info.cookies);
     170        if(layer.info.getCookies() != null && !layer.info.getCookies().equals(""))
     171            conn.setRequestProperty("Cookie", layer.info.getCookies());
    173172        conn.setRequestProperty("User-Agent", Main.pref.get("wmsplugin.user_agent", Version.getInstance().getAgentString()));
    174173        conn.setConnectTimeout(Main.pref.getInteger("wmsplugin.timeout.connect", 30) * 1000);
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSLayer.java

    r24221 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    66import java.awt.Graphics;
    77import java.awt.Graphics2D;
    8 import java.awt.Toolkit;
    98import java.awt.event.ActionEvent;
    109import java.io.File;
     
    2322import javax.swing.AbstractAction;
    2423import javax.swing.Action;
    25 import javax.swing.Icon;
    26 import javax.swing.ImageIcon;
    2724import javax.swing.JCheckBoxMenuItem;
    2825import javax.swing.JFileChooser;
     
    4441import org.openstreetmap.josm.gui.layer.Layer;
    4542import org.openstreetmap.josm.io.CacheFiles;
     43import org.openstreetmap.josm.plugins.imagery.ImageryInfo;
     44import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType;
     45import org.openstreetmap.josm.plugins.imagery.ImageryLayer;
     46import org.openstreetmap.josm.plugins.imagery.ImageryPlugin;
     47import org.openstreetmap.josm.plugins.imagery.wms.GeorefImage.State;
    4648import org.openstreetmap.josm.tools.ImageProvider;
    47 
    48 import wmsplugin.GeorefImage.State;
    4949
    5050/**
     
    5252 * fetched this way is tiled and managed to the disc to reduce server load.
    5353 */
    54 public class WMSLayer extends Layer implements PreferenceChangedListener {
    55 
    56     protected static final Icon icon =
    57         new ImageIcon(Toolkit.getDefaultToolkit().createImage(WMSPlugin.class.getResource("/images/wms_small.png")));
     54public class WMSLayer extends ImageryLayer implements PreferenceChangedListener {
    5855
    5956    public static final BooleanProperty PROP_ALPHA_CHANNEL = new BooleanProperty("wmsplugin.alpha_channel", true);
    60     WMSPlugin plugin = WMSPlugin.instance;
     57    WMSAdapter plugin = ImageryPlugin.wmsAdapter;
    6158
    6259    public int messageNum = 5; //limit for messages per layer
    63     protected MapView mv;
    6460    protected String resolution;
    6561    protected int imageSize = 500;
     
    6965    protected int minZoom = 3;
    7066
    71     protected double dx = 0.0;
    72     protected double dy = 0.0;
    73 
    7467    protected GeorefImage[][] images;
    7568    protected final int serializeFormatVersion = 5;
    7669    protected boolean autoDownloadEnabled = true;
    7770    protected boolean settingsChanged;
    78     protected WMSInfo info;
     71    protected ImageryInfo info;
    7972
    8073    // Image index boundary for current view
     
    10497
    10598    public WMSLayer() {
    106         this(new WMSInfo(tr("Blank Layer")));
    107     }
    108 
    109     public WMSLayer(WMSInfo info) {
    110         super(info.name);
     99        this(new ImageryInfo(tr("Blank Layer")));
     100    }
     101
     102    public WMSLayer(ImageryInfo info) {
     103        super(info.getName());
    111104        setBackgroundLayer(true); /* set global background variable */
    112105        initializeImages();
    113         this.info = new WMSInfo(info);
     106        this.info = new ImageryInfo(info);
    114107        mv = Main.map.mapView;
    115         if(this.info.pixelPerDegree == 0.0)
     108        if(this.info.getPixelPerDegree() == 0.0)
    116109            this.info.setPixelPerDegree(getPPD());
    117110        resolution = mv.getDist100PixelText();
    118111
    119         if(info.url != null) {
    120             WMSGrabber.getProjection(info.url, true);
     112        if(info.getURL() != null) {
     113            WMSGrabber.getProjection(info.getURL(), true);
    121114            startGrabberThreads();
    122             if(!info.url.startsWith("html:") && !WMSGrabber.isUrlWithPatterns(info.url)) {
    123                 if (!(info.url.endsWith("&") || info.url.endsWith("?"))) {
    124                     if (!confirmMalformedUrl(info.url)) {
    125                         System.out.println(tr("Warning: WMS layer deactivated because of malformed base url ''{0}''", info.url));
     115            if(info.getImageryType() == ImageryType.WMS && !WMSGrabber.isUrlWithPatterns(info.getURL())) {
     116                if (!(info.getURL().endsWith("&") || info.getURL().endsWith("?"))) {
     117                    if (!confirmMalformedUrl(info.getURL())) {
     118                        System.out.println(tr("Warning: WMS layer deactivated because of malformed base url ''{0}''", info.getURL()));
    126119                        usesInvalidUrl = true;
    127120                        setName(getName() + tr("(deactivated)"));
     
    139132    public void doSetName(String name) {
    140133        setName(name);
    141         info.name = name;
     134        info.setName(name);
    142135    }
    143136
     
    173166    }
    174167
    175     @Override public Icon getIcon() {
    176         return icon;
    177     }
    178 
    179168    @Override public String getToolTipText() {
    180169        if(autoDownloadEnabled)
     
    197186    private boolean zoomIsTooBig() {
    198187        //don't download when it's too outzoomed
    199         return info.pixelPerDegree / getPPD() > minZoom;
     188        return info.getPixelPerDegree() / getPPD() > minZoom;
    200189    }
    201190
    202191    @Override public void paint(Graphics2D g, final MapView mv, Bounds b) {
    203         if(info.url == null || (usesInvalidUrl && !isInvalidUrlConfirmed)) return;
     192        if(info.getURL() == null || (usesInvalidUrl && !isInvalidUrlConfirmed)) return;
    204193
    205194        settingsChanged = false;
     
    254243    }
    255244
    256     public double getPPD(){
    257         ProjectionBounds bounds = mv.getProjectionBounds();
    258         return mv.getWidth() / (bounds.max.east() - bounds.min.east());
    259     }
    260 
     245    @Override
    261246    public void displace(double dx, double dy) {
     247        super.displace(dx, dy);
    262248        settingsChanged = true;
    263         this.dx += dx;
    264         this.dy += dy;
    265     }
    266 
    267     public double getDx() {
    268         return dx;
    269     }
    270 
    271     public double getDy() {
    272         return dy;
    273249    }
    274250
    275251    public int getImageXIndex(double coord) {
    276         return (int)Math.floor( ((coord - dx) * info.pixelPerDegree) / imageSize);
     252        return (int)Math.floor( ((coord - dx) * info.getPixelPerDegree()) / imageSize);
    277253    }
    278254
    279255    public int getImageYIndex(double coord) {
    280         return (int)Math.floor( ((coord - dy) * info.pixelPerDegree) / imageSize);
     256        return (int)Math.floor( ((coord - dy) * info.getPixelPerDegree()) / imageSize);
    281257    }
    282258
    283259    public int getImageX(int imageIndex) {
    284         return (int)(imageIndex * imageSize * (getPPD() / info.pixelPerDegree) + dx * getPPD());
     260        return (int)(imageIndex * imageSize * (getPPD() / info.getPixelPerDegree()) + dx * getPPD());
    285261    }
    286262
    287263    public int getImageY(int imageIndex) {
    288         return (int)(imageIndex * imageSize * (getPPD() / info.pixelPerDegree) + dy * getPPD());
     264        return (int)(imageIndex * imageSize * (getPPD() / info.getPixelPerDegree()) + dy * getPPD());
    289265    }
    290266
    291267    public int getImageWidth(int xIndex) {
    292         int overlap = (int)(plugin.PROP_OVERLAP.get()?plugin.PROP_OVERLAP_EAST.get() * imageSize * getPPD() / info.pixelPerDegree / 100:0);
     268        int overlap = (int)(plugin.PROP_OVERLAP.get()?plugin.PROP_OVERLAP_EAST.get() * imageSize * getPPD() / info.getPixelPerDegree() / 100:0);
    293269        return getImageX(xIndex + 1) - getImageX(xIndex) + overlap;
    294270    }
    295271
    296272    public int getImageHeight(int yIndex) {
    297         int overlap = (int)(plugin.PROP_OVERLAP.get()?plugin.PROP_OVERLAP_NORTH.get() * imageSize * getPPD() / info.pixelPerDegree / 100:0);
     273        int overlap = (int)(plugin.PROP_OVERLAP.get()?plugin.PROP_OVERLAP_NORTH.get() * imageSize * getPPD() / info.getPixelPerDegree() / 100:0);
    298274        return getImageY(yIndex + 1) - getImageY(yIndex) + overlap;
    299275    }
     
    325301     */
    326302    public EastNorth getEastNorth(int xIndex, int yIndex) {
    327         return new EastNorth((xIndex * imageSize) / info.pixelPerDegree, (yIndex * imageSize) / info.pixelPerDegree);
     303        return new EastNorth((xIndex * imageSize) / info.getPixelPerDegree(), (yIndex * imageSize) / info.getPixelPerDegree());
    328304    }
    329305
     
    360336                GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
    361337                if (!img.paint(g, mv, x, y, leftEdge, bottomEdge)) {
    362                     WMSRequest request = new WMSRequest(x, y, info.pixelPerDegree, real);
     338                    WMSRequest request = new WMSRequest(x, y, info.getPixelPerDegree(), real);
    363339                    addRequest(request);
    364340                }
     
    375351                }
    376352        }
    377     }
    378 
    379     @Override public Object getInfoComponent() {
    380         return getToolTipText();
    381353    }
    382354
     
    418390     */
    419391    private int getRequestPriority(WMSRequest request) {
    420         if (request.getPixelPerDegree() != info.pixelPerDegree) {
     392        if (request.getPixelPerDegree() != info.getPixelPerDegree()) {
    421393            return -1;
    422394        }
     
    528500            super(tr("Download visible tiles"));
    529501        }
     502        @Override
    530503        public void actionPerformed(ActionEvent ev) {
    531504            if (zoomIsTooBig()) {
     
    546519            super(tr("Change resolution"));
    547520        }
     521        @Override
    548522        public void actionPerformed(ActionEvent ev) {
    549523            initializeImages();
     
    559533            super(tr("Reload erroneous tiles"));
    560534        }
     535        @Override
    561536        public void actionPerformed(ActionEvent ev) {
    562537            // Delete small files, because they're probably blank tiles.
     
    568543                    GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
    569544                    if(img.getState() == State.FAILED){
    570                         addRequest(new WMSRequest(img.getXIndex(), img.getYIndex(), info.pixelPerDegree, true));
     545                        addRequest(new WMSRequest(img.getXIndex(), img.getYIndex(), info.getPixelPerDegree(), true));
    571546                        mv.repaint();
    572547                    }
     
    580555            super(tr("Alpha channel"));
    581556        }
     557        @Override
    582558        public void actionPerformed(ActionEvent ev) {
    583559            JCheckBoxMenuItem checkbox = (JCheckBoxMenuItem) ev.getSource();
     
    594570            mv.repaint();
    595571        }
     572        @Override
    596573        public Component createMenuComponent() {
    597574            JCheckBoxMenuItem item = new JCheckBoxMenuItem(this);
     
    599576            return item;
    600577        }
     578        @Override
    601579        public boolean supportLayers(List<Layer> layers) {
    602580            return layers.size() == 1 && layers.get(0) instanceof WMSLayer;
     
    608586            super(tr("Save WMS layer to file"), ImageProvider.get("save"));
    609587        }
     588        @Override
    610589        public void actionPerformed(ActionEvent ev) {
    611590            File f = SaveActionBase.createAndOpenSaveFileChooser(
     
    620599                    oos.writeInt(day);
    621600                    oos.writeInt(imageSize);
    622                     oos.writeDouble(info.pixelPerDegree);
    623                     oos.writeObject(info.name);
     601                    oos.writeDouble(info.getPixelPerDegree());
     602                    oos.writeObject(info.getName());
    624603                    oos.writeObject(info.getFullURL());
    625604                    oos.writeObject(images);
     
    636615            super(tr("Load WMS layer from file"), ImageProvider.get("load"));
    637616        }
     617        @Override
    638618        public void actionPerformed(ActionEvent ev) {
    639619            JFileChooser fc = DiskAccessAction.createAndOpenFileChooser(true,
     
    673653                settingsChanged = true;
    674654                mv.repaint();
    675                 if(info.url != null)
     655                if(info.getURL() != null)
    676656                {
    677657                    startGrabberThreads();
     
    698678            super(tr("Set WMS Bookmark"));
    699679        }
     680        @Override
    700681        public void actionPerformed(ActionEvent ev) {
    701             plugin.addLayer(new WMSInfo(info));
     682            ImageryPlugin.instance.addLayer(new ImageryInfo(info));
    702683        }
    703684    }
     
    709690        }
    710691
     692        @Override
    711693        public Component createMenuComponent() {
    712694            JCheckBoxMenuItem item = new JCheckBoxMenuItem(this);
     
    715697        }
    716698
     699        @Override
    717700        public boolean supportLayers(List<Layer> layers) {
    718701            return layers.size() == 1 && layers.get(0) instanceof WMSLayer;
    719702        }
    720703
     704        @Override
    721705        public void actionPerformed(ActionEvent e) {
    722706            autoDownloadEnabled = !autoDownloadEnabled;
     
    782766    }
    783767
     768    @Override
    784769    public void preferenceChanged(PreferenceChangeEvent event) {
    785770        if (event.getKey().equals(plugin.PROP_SIMULTANEOUS_CONNECTIONS.getKey())) {
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSRemoteHandler.java

    r23207 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    99
    1010import org.openstreetmap.josm.Main;
     11import org.openstreetmap.josm.plugins.imagery.ImageryInfo;
    1112import org.openstreetmap.josm.plugins.remotecontrol.PermissionPrefWithDefault;
    1213import org.openstreetmap.josm.plugins.remotecontrol.RequestHandler;
     
    4748        }
    4849        String cookies = args.get("cookies");
    49         WMSLayer wmsLayer = new WMSLayer(new WMSInfo(title, url, cookies));
     50        WMSLayer wmsLayer = new WMSLayer(new ImageryInfo(title, url, cookies));
    5051        Main.main.addLayer(wmsLayer);
    5152
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSRequest.java

    r23207 r24501  
    1 package wmsplugin;
     1package org.openstreetmap.josm.plugins.imagery.wms;
    22
    33import java.awt.image.BufferedImage;
    44
    5 import wmsplugin.GeorefImage.State;
     5import org.openstreetmap.josm.plugins.imagery.wms.GeorefImage.State;
    66
    77public class WMSRequest implements Comparable<WMSRequest> {
     
    7878    }
    7979
     80    @Override
    8081    public int compareTo(WMSRequest o) {
    8182        return priority - o.priority;
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/io/WMSLayerExporter.java

    r23207 r24501  
    1 package wmsplugin.io;
     1package org.openstreetmap.josm.plugins.imagery.wms.io;
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
     
    77
    88public class WMSLayerExporter extends FileExporter{
    9    
     9
    1010    public WMSLayerExporter() {
    1111        super(new ExtensionFileFilter("wms", "wms", tr("WMS Files (*.wms)")));
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/io/WMSLayerImporter.java

    r23207 r24501  
    1 package wmsplugin.io;
     1package org.openstreetmap.josm.plugins.imagery.wms.io;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import org.openstreetmap.josm.actions.ExtensionFileFilter;
    46import org.openstreetmap.josm.io.FileImporter;
    5 import static org.openstreetmap.josm.tools.I18n.tr;
    67
    78public class WMSLayerImporter extends FileImporter{
     
    1011        super(new ExtensionFileFilter("wms", "wms", tr("WMS Files (*.wms)")));
    1112    }
    12    
     13
    1314}
Note: See TracChangeset for help on using the changeset viewer.