Changeset 17719 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
- Timestamp:
- 2009-09-20T13:52:03+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
r17215 r17719 167 167 ObjectOutputStream oos = new ObjectOutputStream( 168 168 new BufferedOutputStream(new FileOutputStream(file))); 169 wmsLayer.write(oos, images); 169 wmsLayer.write(oos); 170 for (GeorefImage img : images) { 171 oos.writeObject(img); 172 } 170 173 oos.close(); 171 174 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java
r17089 r17719 28 28 nextFile: 29 29 for (File file : files) { 30 String filename = file.getName(); 31 String ext = (filename.lastIndexOf(".")==-1)?"":filename.substring(filename.lastIndexOf(".")+1,filename.length()); 32 String location = filename.substring(0, filename.lastIndexOf(".")); 33 // check the extension and its Lambert zone consistency 34 try { 35 int cacheZone = Integer.parseInt(ext) - 1; 36 if (cacheZone >=0 && cacheZone <= 3) { 37 if (Lambert.layoutZone == -1) { 38 Lambert.layoutZone = cacheZone; 39 System.out.println("Load cache \"" + filename + "\" in Lambert Zone " + (Lambert.layoutZone+1)); 40 } else if (cacheZone != Lambert.layoutZone) { 41 System.out.println("Cannot load cache \"" + filename + "\" which is not in current Lambert Zone " 42 + Lambert.layoutZone); 43 continue nextFile; 44 } else 45 System.out.println("Load cache " + filename); 30 if (file.exists()) { 31 String filename = file.getName(); 32 String ext = (filename.lastIndexOf(".")==-1)?"":filename.substring(filename.lastIndexOf(".")+1,filename.length()); 33 String location = filename.substring(0, filename.lastIndexOf(".")); 34 // check the extension and its Lambert zone consistency 35 try { 36 int cacheZone = Integer.parseInt(ext) - 1; 37 if (cacheZone >=0 && cacheZone <= 3) { 38 if (Lambert.layoutZone == -1) { 39 Lambert.layoutZone = cacheZone; 40 System.out.println("Load cache \"" + filename + "\" in Lambert Zone " + (Lambert.layoutZone+1)); 41 } else if (cacheZone != Lambert.layoutZone) { 42 System.out.println("Cannot load cache \"" + filename + "\" which is not in current Lambert Zone " 43 + Lambert.layoutZone); 44 continue nextFile; 45 } else 46 System.out.println("Load cache " + filename); 47 } 48 } catch (NumberFormatException ex) { 49 System.out.println("Selected file \"" + filename + "\" is not a WMS cache file (invalid extension)"); 50 continue; 46 51 } 47 } catch (NumberFormatException ex) { 48 System.out.println("Selected file \"" + filename + "\" is not a WMS cache file (invalid extension)"); 49 continue; 50 } 51 // check if the selected cache is not already displayed 52 if (Main.map != null) { 53 for (Layer l : Main.map.mapView.getAllLayers()) { 54 if (l instanceof WMSLayer && l.getName().equals(location)) { 55 System.out.println("The location " + filename + " is already on screen. Cache not loaded."); 56 continue nextFile; 52 // check if the selected cache is not already displayed 53 if (Main.map != null) { 54 for (Layer l : Main.map.mapView.getAllLayers()) { 55 if (l instanceof WMSLayer && l.getName().equals(location)) { 56 System.out.println("The location " + filename + " is already on screen. Cache not loaded."); 57 continue nextFile; 58 } 57 59 } 58 60 } 61 // create layer and load cache 62 WMSLayer wmsLayer = new WMSLayer("", "", Integer.parseInt(ext)-1); 63 if (wmsLayer.getCacheControl().loadCache(file, Lambert.layoutZone)) 64 Main.main.addLayer(wmsLayer); 59 65 } 60 // create layer and load cache61 WMSLayer wmsLayer = new WMSLayer("", "", Integer.parseInt(ext)-1);62 if (wmsLayer.getCacheControl().loadCache(file, Lambert.layoutZone))63 Main.main.addLayer(wmsLayer);64 66 } 65 67 -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r17089 r17719 130 130 saveToCache(newImage); 131 131 Main.map.mapView.repaint(); 132 /*133 try { if (dividedBbox.size() > 1) Thread.sleep(1000);134 } catch (InterruptedException e) {};*/135 132 } 136 133 } … … 346 343 * @throws IOException 347 344 */ 348 public void write(ObjectOutputStream oos , ArrayList<GeorefImage> imgs) throws IOException {345 public void write(ObjectOutputStream oos) throws IOException { 349 346 oos.writeInt(this.serializeFormatVersion); 350 347 oos.writeObject(this.location); … … 358 355 } 359 356 oos.writeObject(this.communeBBox); 360 synchronized(this){361 for (GeorefImage img : imgs) {362 oos.writeObject(img);363 }364 }365 357 } 366 358
Note:
See TracChangeset
for help on using the changeset viewer.