Changeset 13426 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
- Timestamp:
- 2009-01-28T21:44:10+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
r13382 r13426 18 18 import javax.swing.JOptionPane; 19 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.data.coor.EastNorth;21 20 22 21 public class CacheControl implements Runnable { … … 112 111 FileInputStream fis = new FileInputStream(file); 113 112 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) 118 114 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 image141 img.withdraw(newImage);142 else143 // mask overlapping zone in new image only when144 // new image covers completely the existing image145 newImage.withdraw(img);146 }147 }148 wmsLayer.images.add(newImage);149 }150 } catch (EOFException e) {}151 115 ois.close(); 152 116 fis.close(); … … 155 119 JOptionPane 156 120 .showMessageDialog(Main.parent, tr("Error loading file"), tr("Error"), JOptionPane.ERROR_MESSAGE); 121 return false; 157 122 } 158 123 return true; … … 205 170 ObjectOutputStream oos = new ObjectOutputStream( 206 171 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); 218 173 oos.close(); 219 174 }
Note:
See TracChangeset
for help on using the changeset viewer.