Changeset 13584 in osm


Ignore:
Timestamp:
2009-02-08T11:38:00+01:00 (16 years ago)
Author:
stoecker
Message:

apply #2127

Location:
applications/editors/josm/plugins/wmsplugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wmsplugin/build.xml

    r13332 r13584  
    3737                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    3838                <attribute name="Plugin-Description" value="Allows external WMS resources to be displayed." />
    39                 <attribute name="Plugin-Mainversion" value="1180" />
     39                <attribute name="Plugin-Mainversion" value="1379" />
    4040            </manifest>
    4141        </jar>
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSAdjustAction.java

    r13497 r13584  
    1717
    1818public class WMSAdjustAction extends MapMode implements
    19         MouseListener, MouseMotionListener{
     19    MouseListener, MouseMotionListener{
    2020
    2121    GeorefImage selectedImage;
     
    2626    public WMSAdjustAction(MapFrame mapFrame) {
    2727        super(tr("Adjust WMS"), "adjustwms",
    28                         tr("Adjust the position of the WMS layer"), mapFrame,
     28                        tr("Adjust the position of the selected WMS layer"), mapFrame,
    2929                        ImageProvider.getCursor("normal", "move"));
    3030    }
     
    4545        if (e.getButton() != MouseEvent.BUTTON1)
    4646            return;
    47 
    48          for(Layer layer:Main.map.mapView.getAllLayers()) {
    49             if (layer.visible && layer instanceof WMSLayer) {
    50                 prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
    51                 selectedLayer = ((WMSLayer)layer);
    52                 selectedImage = selectedLayer.findImage(prevEastNorth);
    53                 if(selectedImage!=null){
    54                     Main.map.mapView.setCursor
    55                         (Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
    56                 }
     47       
     48        Layer layer=Main.map.mapView.getActiveLayer();
     49        if (layer.visible && layer instanceof WMSLayer) {
     50            prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
     51            selectedLayer = ((WMSLayer)layer);
     52            selectedImage = selectedLayer.findImage(prevEastNorth);
     53            if(selectedImage!=null) {
     54                Main.map.mapView.setCursor
     55                    (Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
    5756            }
    5857        }
     
    6059
    6160    @Override public void mouseDragged(MouseEvent e) {
    62             /*
    63         if (e.getButton() != MouseEvent.BUTTON1)
    64             return;
    65             */
    66 
    6761        if(selectedImage!=null) {
    6862            EastNorth eastNorth=
    6963                    Main.map.mapView.getEastNorth(e.getX(),e.getY());
    70                 selectedLayer.displace(eastNorth.east()-prevEastNorth.east(),
    71                 eastNorth.north()-prevEastNorth.north());
     64            selectedLayer.displace(
     65                eastNorth.east()-prevEastNorth.east(),
     66                eastNorth.north()-prevEastNorth.north()
     67            );
    7268            prevEastNorth = eastNorth;
    7369            Main.map.mapView.repaint();
     
    9288    @Override public void mouseClicked(MouseEvent e) {
    9389    }
     90   
     91    // This only makes the buttons look disabled, but since no keyboard shortcut is
     92    // provided there aren't any other means to activate this tool
     93    @Override public boolean layerIsSupported(Layer l) {
     94        return (l instanceof WMSLayer) && l.visible;
     95    }
    9496}
Note: See TracChangeset for help on using the changeset viewer.