Changeset 27925 in osm for applications/editors/josm/plugins/canvec_helper/src
- Timestamp:
- 2012-02-23T00:56:14+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/canvec_helper/src/org/openstreetmap/josm/plugins/canvec_helper/CanVecTile.java
r27924 r27925 152 152 else this.tileid = String.format("%03d%s%02d%s",corda,cordb,cordc,cordd); 153 153 valid = true; 154 debug(index.toString()); 154 155 debug("creating tileid: "+this.tileid); 155 156 } … … 230 231 } 231 232 private void make_sub_tiles(int layer) { 233 ArrayList<String> buffer = new ArrayList<String>(); 234 Pattern p; 232 235 if (sub_tiles_made) return; 233 236 switch (layer) { 234 237 case 1: 235 ArrayList<String> buffer = new ArrayList<String>(); 236 Pattern p = Pattern.compile("\\d\\d\\d([A-Z])(.*)"); 238 p = Pattern.compile("\\d\\d\\d([A-Z]).*"); 237 239 String last_cell = ""; 238 // for (int i = 1; i < 17; i++) { 240 for (int i = 0; i < index.size(); i++) { 241 Matcher m = p.matcher(index.get(i)); 242 m.matches(); 243 244 String cell = m.group(1); 245 if (cell.equals(last_cell)) { 246 buffer.add(m.group(0)); 247 } else if (last_cell == "") { 248 buffer.add(m.group(0)); 249 } else { 250 sub_tiles.add(new CanVecTile(corda,last_cell,0,"",plugin_self,buffer)); 251 buffer = new ArrayList<String>(); 252 buffer.add(m.group(0)); 253 } 254 last_cell = cell; 255 } 256 sub_tiles.add(new CanVecTile(corda,last_cell,0,"",plugin_self,buffer)); 257 break; 258 case 2: 259 debug("making layer2 tiles, index: "+index.toString()); 260 p = Pattern.compile("\\d\\d\\d[A-Z](\\d\\d).*"); 261 int last_cell2 = -1; 239 262 for (int i = 0; i < index.size(); i++) { 240 263 debug(index.get(i)); … … 242 265 m.matches(); 243 266 244 String cell = m.group(1);245 debug("a " + cell + last_cell);246 if (cell.equals(last_cell)) {247 buffer.add(m.group(0));248 } else if (last_cell == "") {267 int cell = Integer.parseInt(m.group(1)); 268 if (cell == last_cell2) { 269 buffer.add(m.group(0)); 270 } else if (last_cell2 == -1) { 271 buffer.add(m.group(0)); 249 272 } else { 250 //char temp[] = { (char) (64 + i) };251 debug("b "+corda+" "+last_cell);252 273 debug(buffer.toString()); 253 sub_tiles.add(new CanVecTile(corda,last_cell,0,"",plugin_self,buffer)); 274 debug(""+last_cell2); 275 sub_tiles.add(new CanVecTile(corda,cordb,last_cell2,"",plugin_self,buffer)); 254 276 buffer = new ArrayList<String>(); 255 277 buffer.add(m.group(0)); 256 278 } 257 last_cell = cell; 258 } 259 debug("c "+corda+" "+last_cell); 260 debug(buffer.toString()); 261 sub_tiles.add(new CanVecTile(corda,last_cell,0,"",plugin_self,buffer)); 262 break; 263 case 2: 264 for (int i = 1; i < 17; i++) { 265 sub_tiles.add(new CanVecTile(corda,cordb,i,"",plugin_self,new ArrayList<String>())); // FIXME 266 } 279 last_cell2 = cell; 280 } 281 if (last_cell2 != -1) sub_tiles.add(new CanVecTile(corda,cordb,last_cell2,"",plugin_self,buffer)); 267 282 break; 268 283 }
Note:
See TracChangeset
for help on using the changeset viewer.