Ignore:
Timestamp:
2010-01-10T15:46:08+01:00 (15 years ago)
Author:
pieren
Message:

Various minor improvements. More bboxes data in the cache. New cache format v3.

File:
1 edited

Legend:

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

    r19267 r19371  
    5151    protected Vector<GeorefImage> images = new Vector<GeorefImage>();
    5252
    53     protected final int serializeFormatVersion = 2;
     53    /**
     54     * v1 to v2 = not supported
     55     * v2 to v3 = add 4 more EastNorth coordinates in GeorefImages
     56     */
     57    protected final int serializeFormatVersion = 3;
     58   
     59    public static int currentFormat;
    5460
    5561    private ArrayList<EastNorthBound> dividedBbox = new ArrayList<EastNorthBound>();
     
    6975    public double X0, Y0, angle, fX, fY;
    7076
     77    // bbox of the georeferenced raster image (the nice horizontal and vertical box)
    7178    private EastNorth rasterMin;
    7279    private EastNorth rasterMax;
     
    8996
    9097    public void destroy() {
     98        // if the layer is currently saving the images in the cache, wait until it's finished
     99        while (!cacheControl.isCachePipeEmpty()) {
     100            System.out.println("Try to close a WMSLayer which is currently saving in cache : wait 1 sec.");
     101            CadastrePlugin.safeSleep(1000);
     102        }
    91103        super.destroy();
    92104        images = null;
     
    364376        double ratio = rasterSizeY/rasterSizeX;
    365377        // keep same ratio on screen as WMS bbox (stored in communeBBox)
    366         rasterMin = new EastNorth(eaMin.getX(), rasterCenter.getY()-(eaMax.getX()-eaMin.getX())*ratio/2);
    367         rasterMax = new EastNorth(eaMax.getX(), rasterCenter.getY()+(eaMax.getX()-eaMin.getX())*ratio/2);
     378        rasterMin = new EastNorth(eaMin.getX(), rasterCenter.getY()-(eaMax.getX()-eaMin.getX())*ratio/2); 
     379        rasterMax = new EastNorth(eaMax.getX(), rasterCenter.getY()+(eaMax.getX()-eaMin.getX())*ratio/2); 
    368380        rasterRatio = (rasterMax.getX()-rasterMin.getX())/rasterSizeX;
    369381    }
     
    402414     */
    403415    public boolean read(ObjectInputStream ois, int currentLambertZone) throws IOException, ClassNotFoundException {
    404         int sfv = ois.readInt();
    405         if (sfv != this.serializeFormatVersion) {
     416        currentFormat = ois.readInt();;
     417        if (currentFormat < 2) {
    406418            JOptionPane.showMessageDialog(Main.parent, tr("Unsupported cache file version; found {0}, expected {1}\nCreate a new one.",
    407                     sfv, this.serializeFormatVersion), tr("Cache Format Error"), JOptionPane.ERROR_MESSAGE);
     419                    currentFormat, this.serializeFormatVersion), tr("Cache Format Error"), JOptionPane.ERROR_MESSAGE);
    408420            return false;
    409421        }
     
    531543    public void setCommuneBBox(EastNorthBound entireCommune) {
    532544        this.communeBBox = entireCommune;
    533 //        if (Main.proj instanceof LambertCC9Zones)
    534 //            setLambertCC9Zone(communeBBox.min.north());
    535545    }
    536546
     
    545555        return lambertZone;
    546556    }
    547 
    548 //    public void setLambertCC9Zone(double north) {
    549 //        int lambertZone = LambertCC9Zones.north2ZoneNumber(north);
    550 //        this.lambertZone = lambertZone;
    551 //        if (((LambertCC9Zones)Main.proj).getLayoutZone() != lambertZone) {
    552 //            String currentZone = MenuActionLambertZone.lambert9zones[((LambertCC9Zones)Main.proj).getLayoutZone()+1];
    553 //            String destZone = MenuActionLambertZone.lambert9zones[lambertZone+1];
    554 //            if (Main.map.mapView.getAllLayers().size() == 1) {
    555 //                /* Enable this code below when JOSM will have a proper support of dynamic projection change
    556 //                 *
    557 //                System.out.println("close all layers and change current Lambert zone from "+LambertCC9Zones.layoutZone+" to "+lambertZone);
    558 //                Bounds b = null;
    559 //                if (Main.map != null && Main.map.mapView != null)
    560 //                    b = Main.map.mapView.getRealBounds();
    561 //                LambertCC9Zones.layoutZone = lambertZone;
    562 //                Main.map.mapView.zoomTo(b);
    563 //                */
    564 //            } else {
    565 //                JOptionPane.showMessageDialog(Main.parent, tr("Current layer is in Lambert CC9 Zone \"{0}\"\n"+
    566 //                        "where the commune is in Lambert CC9 Zone \"{1}\".\n"+
    567 //                        "Upload your changes, close all layers and change\n"+
    568 //                        "manually the Lambert zone from the Cadastre menu"
    569 //                        , currentZone, destZone));
    570 //            }
    571 //        }
    572 //    }
    573557
    574558    public EastNorth getRasterCenter() {
Note: See TracChangeset for help on using the changeset viewer.