Ignore:
Timestamp:
2009-01-28T21:44:10+01:00 (16 years ago)
Author:
pieren
Message:

add municipality bbox in grab and cache

File:
1 edited

Legend:

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

    r13382 r13426  
    1818import javax.swing.JOptionPane;
    1919import org.openstreetmap.josm.Main;
    20 import org.openstreetmap.josm.data.coor.EastNorth;
    2120
    2221public class CacheControl implements Runnable {
     
    112111            FileInputStream fis = new FileInputStream(file);
    113112            ObjectInputStream ois = new ObjectInputStream(fis);
    114             int sfv = ois.readInt();
    115             if (sfv != wmsLayer.serializeFormatVersion) {
    116                 JOptionPane.showMessageDialog(Main.parent, tr("Unsupported WMS file version; found {0}, expected {1}",
    117                         sfv, wmsLayer.serializeFormatVersion), tr("Cache Format Error"), JOptionPane.ERROR_MESSAGE);
     113            if (wmsLayer.read(ois, currentLambertZone) == false)
    118114                return false;
    119             }
    120             wmsLayer.setLocation((String) ois.readObject());
    121             wmsLayer.setCodeCommune((String) ois.readObject());
    122             wmsLayer.lambertZone = ois.readInt();
    123             wmsLayer.setRaster(ois.readBoolean());
    124             wmsLayer.setRasterMin((EastNorth) ois.readObject());
    125             wmsLayer.setRasterCenter((EastNorth) ois.readObject());
    126             wmsLayer.setRasterRatio(ois.readDouble());
    127             if (wmsLayer.lambertZone != currentLambertZone) {
    128                 JOptionPane.showMessageDialog(Main.parent, tr("Lambert zone {0} in cache "+
    129                         " incompatible with current Lambert zone {1}",
    130                         wmsLayer.lambertZone+1, currentLambertZone), tr("Cache Lambert Zone Error"), JOptionPane.ERROR_MESSAGE);
    131                 return false;
    132             }
    133             boolean EOF = false;
    134             try {
    135                 while (!EOF) {
    136                     GeorefImage newImage = (GeorefImage) ois.readObject();
    137                     for (GeorefImage img : wmsLayer.images) {
    138                         if (CadastrePlugin.backgroundTransparent) {
    139                             if (img.overlap(newImage))
    140                                 // mask overlapping zone in already grabbed image
    141                                 img.withdraw(newImage);
    142                             else
    143                                 // mask overlapping zone in new image only when
    144                                 // new image covers completely the existing image
    145                                 newImage.withdraw(img);
    146                         }
    147                     }
    148                     wmsLayer.images.add(newImage);
    149                 }
    150             } catch (EOFException e) {}
    151115            ois.close();
    152116            fis.close();
     
    155119            JOptionPane
    156120                    .showMessageDialog(Main.parent, tr("Error loading file"), tr("Error"), JOptionPane.ERROR_MESSAGE);
     121            return false;
    157122        }
    158123        return true;
     
    205170                        ObjectOutputStream oos = new ObjectOutputStream(
    206171                                new BufferedOutputStream(new FileOutputStream(file)));
    207                         oos.writeInt(wmsLayer.serializeFormatVersion);
    208                         oos.writeObject(wmsLayer.getLocation());
    209                         oos.writeObject(wmsLayer.getCodeCommune());
    210                         oos.writeInt(wmsLayer.lambertZone);
    211                         oos.writeBoolean(wmsLayer.isRaster());
    212                         oos.writeObject(wmsLayer.getRasterMin());
    213                         oos.writeObject(wmsLayer.getRasterCenter());
    214                         oos.writeDouble(wmsLayer.getRasterRatio());
    215                         for (GeorefImage img : images) {
    216                             oos.writeObject(img);
    217                         }
     172                        wmsLayer.write(oos, images);
    218173                        oos.close();
    219174                    }
Note: See TracChangeset for help on using the changeset viewer.