Ignore:
Timestamp:
2010-08-03T08:11:51+02:00 (14 years ago)
Author:
jttt
Message:

Adapt to latest josm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r22153 r22547  
    55
    66import java.awt.Color;
    7 import java.awt.Component;
    87import java.awt.Graphics;
    98import java.awt.Graphics2D;
     
    2221import java.util.Vector;
    2322
     23import javax.swing.Action;
    2424import javax.swing.Icon;
    2525import javax.swing.ImageIcon;
    26 import javax.swing.JMenuItem;
    2726import javax.swing.JOptionPane;
    2827
     
    4443public class WMSLayer extends Layer implements ImageObserver {
    4544
    46     Component[] component = null;
    47 
    4845    private int lambertZone = -1;
    4946
     
    5956     */
    6057    protected final int serializeFormatVersion = 4;
    61    
     58
    6259    public static int currentFormat;
    63    
     60
    6461    private static final int cBBoxForBuildings = 50; // hard coded size of grabbed boxes for building layers
    6562
     
    6966
    7067    private String location = "";
    71    
     68
    7269    private String departement = "";
    7370
     
    8885    private double rasterRatio;
    8986
    90     private JMenuItem saveAsPng;
    91    
     87    private Action saveAsPng;
     88
    9289    public boolean adjustModeEnabled;
    9390
     
    106103    }
    107104
    108     public void destroy() {
     105    @Override
     106        public void destroy() {
    109107        // if the layer is currently saving the images in the cache, wait until it's finished
    110108        if (cacheControl != null) {
     
    119117        System.out.println("Layer "+location+" destroyed");
    120118    }
    121    
     119
    122120    private static String buildName(String location, String codeCommune, boolean buildingOnly) {
    123         String ret = new String(location.toUpperCase());
     121        String ret = location.toUpperCase();
    124122        if (codeCommune != null && !codeCommune.equals(""))
    125123            ret += "(" + codeCommune + ")";
     
    136134        grab(grabber, b, true);
    137135    }
    138    
     136
    139137    public void grab(CadastreGrabber grabber, Bounds b, boolean useFactor) throws IOException {
    140138        cancelled = false;
     
    225223        } else {
    226224            // divide to fixed size squares
    227             int cSquare = factor == 4 ? Integer.parseInt(Main.pref.get("cadastrewms.squareSize", "100")) : optionalSize;   
     225            int cSquare = factor == 4 ? Integer.parseInt(Main.pref.get("cadastrewms.squareSize", "100")) : optionalSize;
    228226            minEast = minEast - minEast % cSquare;
    229227            minNorth = minNorth - minNorth % cSquare;
     
    286284        if (this.adjustModeEnabled) {
    287285            WMSAdjustAction.paintAdjustFrames(g, mv);
    288         }           
     286        }
    289287    }
    290288
     
    303301
    304302    @Override
    305     public Component[] getMenuEntries() {
    306         saveAsPng = new JMenuItem(new MenuActionSaveRasterAs(this));
     303    public Action[] getMenuEntries() {
     304        saveAsPng = new MenuActionSaveRasterAs(this);
    307305        saveAsPng.setEnabled(isRaster);
    308         component = new Component[] { new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)),
    309                 new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)),
    310                 new JMenuItem(new MenuActionLoadFromCache()),
     306        return new Action[] {
     307                        LayerListDialog.getInstance().createShowHideLayerAction(),
     308                LayerListDialog.getInstance().createDeleteLayerAction(),
     309                new MenuActionLoadFromCache(),
    311310                saveAsPng,
    312                 new JMenuItem(new LayerListPopup.InfoAction(this)),
     311                new LayerListPopup.InfoAction(this),
    313312
    314313        };
    315         return component;
    316314    }
    317315
     
    443441        double ratio = rasterSizeY/rasterSizeX;
    444442        // keep same ratio on screen as WMS bbox (stored in communeBBox)
    445         rasterMin = new EastNorth(eaMin.getX(), rasterCenter.getY()-(eaMax.getX()-eaMin.getX())*ratio/2); 
    446         rasterMax = new EastNorth(eaMax.getX(), rasterCenter.getY()+(eaMax.getX()-eaMin.getX())*ratio/2); 
     443        rasterMin = new EastNorth(eaMin.getX(), rasterCenter.getY()-(eaMax.getX()-eaMin.getX())*ratio/2);
     444        rasterMax = new EastNorth(eaMax.getX(), rasterCenter.getY()+(eaMax.getX()-eaMin.getX())*ratio/2);
    447445        rasterRatio = (rasterMax.getX()-rasterMin.getX())/rasterSizeX;
    448446    }
     
    598596        rasterRatio = (rasterMax.getX()-rasterMin.getX())/(communeBBox.max.getX() - communeBBox.min.getX());
    599597    }
    600    
     598
    601599    public EastNorthBound getCommuneBBox() {
    602600        return communeBBox;
     
    640638//        double proportion = dst1.distance(dst2)/org1.distance(org2);
    641639        images.get(0).rotate(rasterCenter, angle);
    642         this.angle += angle; 
     640        this.angle += angle;
    643641    }
    644642
Note: See TracChangeset for help on using the changeset viewer.