Changeset 30407 in osm
- Timestamp:
- 2014-04-18T22:30:21+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/jtile/src/jtile/Jtile.java
r30405 r30407 17 17 import java.io.PrintWriter; 18 18 import java.util.ArrayList; 19 import java.util.HashMap; 19 20 20 21 import org.apache.batik.transcoder.TranscoderInput; … … 30 31 static int ytile; 31 32 static ArrayList<String> send; 33 static HashMap<String, Boolean> deletes; 32 34 33 publicstatic void tile(int zoom, int dxy, int xn, int yn) throws Exception {35 static void tile(int zoom, int dxy, int xn, int yn) throws Exception { 34 36 35 37 trans = new PNGTranscoder(); … … 47 49 int xdir = (scale * xtile) + xn; 48 50 int ynam = (scale * ytile) + yn; 49 send.add("put " + dstdir + zoom + "/" + xdir + "/" + ynam + ".png" + " cache/tiles-" + zoom + "-" + xdir + "-" + ynam + ".png"); 51 String dstnam = dstdir + zoom + "/" + xdir + "/" + ynam + ".png"; 52 deletes.remove(dstnam); 53 send.add("put " + dstnam + " cache/tiles-" + zoom + "-" + xdir + "-" + ynam + ".png"); 50 54 File ofile = new File(dstdir + "/" + zoom + "/" + xdir + "/"); 51 55 ofile.mkdirs(); … … 72 76 } 73 77 78 static void clean(int zoom, int xn, int yn) throws Exception { 79 80 int scale = (int) Math.pow(2, zoom - 12); 81 int xdir = (scale * xtile) + xn; 82 int ynam = (scale * ytile) + yn; 83 String delnam = dstdir + zoom + "/" + xdir + "/" + ynam + ".png"; 84 File delfile = new File(delnam); 85 if (delfile.exists()) { 86 deletes.put(delnam, true); 87 delfile.delete(); 88 } 89 if ((zoom < 18)) { 90 for (int x = 0; x < 2; x++) { 91 for (int y = 0; y < 2; y++) { 92 clean((zoom + 1), (xn * 2 + x), (yn * 2 + y)); 93 } 94 } 95 } 96 } 97 74 98 public static void main(String[] args) throws Exception { 75 99 srcdir = args[0]; … … 78 102 ytile = Integer.parseInt(args[3]); 79 103 send = new ArrayList<String>(); 104 deletes = new HashMap<String, Boolean>(); 105 clean(12, 0, 0); 80 106 tile(12, 256, 0, 0); 81 107 if (send.size() > 0) { … … 83 109 for (String str : send) { 84 110 writer.println(str); 111 } 112 for (String del : deletes.keySet()) { 113 writer.println("rm " + del); 85 114 } 86 115 writer.close();
Note:
See TracChangeset
for help on using the changeset viewer.