Revisión | fa7630533b407e5e2d1c05c0cb8c0075c06f1355 (tree) |
---|---|
Tiempo | 2012-10-14 14:53:37 |
Autor | ![]() |
Commiter | yuu hayashi |
・JAR形式での実行
・変換対象GPXファイルを指定できるようにした
@@ -1,3 +1,3 @@ | ||
1 | -java -jar OsmConverter.jar Gpx2osm temp.xml | |
1 | +java -jar gpx2osm.jar temp.xml | |
2 | 2 | |
3 | 3 | pause |
\ No newline at end of file |
@@ -48,7 +48,7 @@ | ||
48 | 48 | </tstamp> |
49 | 49 | <jar destfile="${appname}.jar" > |
50 | 50 | <manifest> |
51 | - <attribute name="Main-Class" value="osm.jp.gpx.ImportPicture" /> | |
51 | + <attribute name="Main-Class" value="osm.jp.osmtracker.tool.Gpx2osm" /> | |
52 | 52 | <attribute name="Class-Path" value="${jar.runtime.classpath}" /> |
53 | 53 | <attribute name="Implementation-Title" value="${appname}" /> |
54 | 54 | <attribute name="Implementation-Version" value="${ts}" /> |
@@ -15,6 +15,15 @@ import java.io.*; | ||
15 | 15 | public class Gpx2osm { |
16 | 16 | |
17 | 17 | /** メイン |
18 | + * java -jar gpx2osm.jar | |
19 | + * 変換テンプレートファイルを"temp.xml"として、カレントディレクトリにあるすべてのGPXファイルを変換します。 | |
20 | + * | |
21 | + * java -jar gpx2osm.jar <temp.xml> | |
22 | + * 指定された変換テンプレートファイルを<temp.xml>を使って、カレントディレクトリにあるすべてのGPXファイルを変換します。 | |
23 | + * | |
24 | + * java -jar gpx2osm.jar <temp.xml> <GPXファイル1> <GPXファイル2> <GPXファイル3> ... | |
25 | + * 指定された変換テンプレートファイルを<temp.xml>を使って、指定されたGPXファイルを変換します。 | |
26 | + * | |
18 | 27 | * @throws TransformerException |
19 | 28 | * @throws IOException |
20 | 29 | * @throws SAXException |
@@ -26,13 +35,24 @@ public class Gpx2osm { | ||
26 | 35 | tempfile = new File(argv[0]); |
27 | 36 | } |
28 | 37 | |
29 | - File dir = new File("."); | |
30 | - File[] files = dir.listFiles(); | |
31 | 38 | int counter = 0; |
32 | - for (File iFile : files) { | |
33 | - if (checkFile(iFile)) { | |
34 | - counter++; | |
35 | - Gpx2osm.proc(iFile, tempfile); | |
39 | + if (argv.length > 1) { | |
40 | + for (int i=1; i < argv.length; i++) { | |
41 | + File iFile = new File(argv[i]); | |
42 | + if (checkFile(iFile)) { | |
43 | + counter++; | |
44 | + Gpx2osm.proc(iFile, tempfile); | |
45 | + } | |
46 | + } | |
47 | + } | |
48 | + else { | |
49 | + File dir = new File("."); | |
50 | + File[] files = dir.listFiles(); | |
51 | + for (File iFile : files) { | |
52 | + if (checkFile(iFile)) { | |
53 | + counter++; | |
54 | + Gpx2osm.proc(iFile, tempfile); | |
55 | + } | |
36 | 56 | } |
37 | 57 | } |
38 | 58 | System.out.println("["+ counter +"]つのファイルを処理しました。"); |