Ignore:
Timestamp:
2009-10-18T18:11:09+02:00 (16 years ago)
Author:
pieren
Message:

Use the new cadastre projection LambertCC9Zones

File:
1 edited

Legend:

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

    r17719 r18207  
    1919import javax.swing.Icon;
    2020import javax.swing.ImageIcon;
     21import javax.swing.JDialog;
    2122import javax.swing.JMenuItem;
    2223import javax.swing.JOptionPane;
     
    2526import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    2627import org.openstreetmap.josm.data.projection.Lambert;
     28import org.openstreetmap.josm.data.projection.LambertCC9Zones;
    2729import org.openstreetmap.josm.data.Bounds;
    2830import org.openstreetmap.josm.gui.MapView;
     
    4244    Component[] component = null;
    4345
    44     public int lambertZone = -1;
     46    private int lambertZone = -1;
    4547
    4648    protected static final Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(
     
    7779        this.location = location;
    7880        this.codeCommune = codeCommune;
    79         this.lambertZone = Lambert.layoutZone;
     81        this.lambertZone = lambertZone;
    8082        // enable auto-sourcing option
    8183        CadastrePlugin.pluginUsed = true;
     
    380382        }
    381383        this.communeBBox = (EastNorthBound) ois.readObject();
    382         if (this.lambertZone != currentLambertZone) {
     384        if (this.lambertZone != currentLambertZone && currentLambertZone != -1) {
    383385            JOptionPane.showMessageDialog(Main.parent, tr("Lambert zone {0} in cache "+
    384386                    "incompatible with current Lambert zone {1}",
     
    484486    public void setCommuneBBox(EastNorthBound entireCommune) {
    485487        this.communeBBox = entireCommune;
     488        if (Main.proj instanceof LambertCC9Zones)
     489            setLambertCC9Zone(communeBBox.min.north());
    486490    }
    487491
     
    493497    }
    494498
     499    public int getLambertZone() {
     500        return lambertZone;
     501    }
     502
     503    public void setLambertCC9Zone(double north) {
     504        int lambertZone = LambertCC9Zones.north2ZoneNumber(north);
     505        this.lambertZone = lambertZone;
     506        if (LambertCC9Zones.layoutZone != lambertZone) {
     507            String currentZone = MenuActionLambertZone.lambert9zones[LambertCC9Zones.layoutZone+1];
     508            String destZone = MenuActionLambertZone.lambert9zones[lambertZone+1];
     509            if (Main.map.mapView.getAllLayers().size() == 1) {
     510                /* Enable this code below when JOSM will have a proper support of dynamic projection change
     511                 *
     512                System.out.println("close all layers and change current Lambert zone from "+LambertCC9Zones.layoutZone+" to "+lambertZone);
     513                Bounds b = null;
     514                if (Main.map != null && Main.map.mapView != null)
     515                    b = Main.map.mapView.getRealBounds();
     516                LambertCC9Zones.layoutZone = lambertZone;
     517                Main.map.mapView.zoomTo(b);
     518                */
     519            } else {
     520                JOptionPane.showMessageDialog(Main.parent, tr("Current layer is in Lambert CC9 Zone \"{0}\"\n"+
     521                        "where the commune is in Lambert CC9 Zone \"{1}\".\n"+
     522                        "Upload your changes, close all layers and change\n"+
     523                        "manually the Lambert zone from the Cadastre menu"
     524                        , currentZone, destZone));
     525            }
     526        }
     527    }
     528
    495529}
Note: See TracChangeset for help on using the changeset viewer.