Changeset 13703 in josm for trunk/test
- Timestamp:
- 2018-05-06T00:12:37+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r13629 r13703 33 33 import org.junit.Rule; 34 34 import org.junit.Test; 35 import org.openstreetmap.josm.Main; 35 36 import org.openstreetmap.josm.data.Bounds; 36 37 import org.openstreetmap.josm.data.coor.EastNorth; … … 82 83 83 84 static boolean debug; 85 static List<String> forcedCodes; 84 86 85 87 /** … … 92 94 /** 93 95 * Program entry point. 94 * @param args no argument is expected96 * @param args optional comma-separated list of projections to update. If set, only these projections will be updated 95 97 * @throws IOException in case of I/O error 96 98 */ 97 99 public static void main(String[] args) throws IOException { 98 debug = args.length > 0 && "debug".equals(args[0]); 100 if (args.length > 0) { 101 debug = "debug".equals(args[0]); 102 if (args[args.length - 1].startsWith("EPSG:")) { 103 forcedCodes = Arrays.asList(args[args.length - 1].split(",")); 104 } 105 } 106 Main.determinePlatformHook(); 99 107 Collection<RefEntry> refs = readData(); 100 108 refs = updateData(refs); … … 176 184 } 177 185 } 178 if (ref.data.size() < N_POINTS) { 186 boolean forced = forcedCodes != null && forcedCodes.contains(code); 187 if (forced || ref.data.size() < N_POINTS) { 179 188 System.out.print(code); 180 189 System.out.flush(); 181 190 Projection proj = Projections.getProjectionByCode(code); 182 191 Bounds b = proj.getWorldBoundsLatLon(); 183 for (int i = ref.data.size(); i < N_POINTS; i++) { 192 for (int i = forced ? 0 : ref.data.size(); i < N_POINTS; i++) { 184 193 System.out.print("."); 185 194 System.out.flush(); 186 LatLon ll = getRandom(b); 195 LatLon ll = forced ? ref.data.get(i).a : getRandom(b); 187 196 EastNorth en = latlon2eastNorthProj4(def, ll); 188 197 if (en != null) { 189 ref.data.add(Pair.create(ll, en)); 198 if (forced) { 199 ref.data.get(i).b = en; 200 } else { 201 ref.data.add(Pair.create(ll, en)); 202 } 190 203 } else { 191 204 System.err.println("Warning: cannot convert "+code+" at "+ll); … … 237 250 // see http://geodesie.ign.fr/contenu/fichiers/documentation/algorithmes/notice/NT111_V1_HARMEL_TransfoNTF-RGF93_FormatGrilleNTV2.pdf 238 251 def = def.replace("ntf_r93_b.gsb", "ntf_r93.gsb"); 252 if (Main.isPlatformWindows()) { 253 def = def.replace("'", "\\'").replace("\"", "\\\""); 254 } 239 255 args.addAll(Arrays.asList(def.split(" "))); 240 256 ProcessBuilder pb = new ProcessBuilder(args);
Note:
See TracChangeset
for help on using the changeset viewer.