• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión54974451ef90b04d886701c5fa9d83bd43e45848 (tree)
Tiempo2012-05-24 20:23:00
Autorhayashi <hayashi.yuu@gmai...>
Commiterhayashi

Log Message

ConvAdmPt25000 を追加

Cambiar Resumen

Diferencia incremental

--- a/ConvCommPt.bat
+++ /dev/null
@@ -1,2 +0,0 @@
1-java -cp ".;classes" ConvCommPt
2-pause
\ No newline at end of file
--- a/dest/temp.xml
+++ b/dest/temp.xml
@@ -16,7 +16,6 @@
1616 <tag k="fixme" v="要確認:名称,道の右に"/>
1717 </node>
1818
19-
2019 <node gpxname="交番">
2120 <tag k='amenity' v='police' />
2221 <tag k="fixme" v="要確認:名称"/>
--- a/src/hayashi/kiban/ConvAdmPt25000.java
+++ b/src/hayashi/kiban/ConvAdmPt25000.java
@@ -8,13 +8,14 @@ public class ConvAdmPt25000 {
88 File inputFile;
99 String admCodeStr = "";
1010 int iCounter = 0;
11+ boolean link = true;
1112
1213 /**
1314 * メイン
14- *
15+ *
1516 * <GI>
1617 * <dataset>
17- *
18+ *
1819 * <AdmPt id="K6_1" uuid="fgoid:10-00150-11-1002-1530">
1920 <fid>fgoid:10-00150-11-1002-1530</fid>
2021 <lfSpanFr>
@@ -27,58 +28,66 @@ public class ConvAdmPt25000 {
2728 <jps:date8601>2999-12-31</jps:date8601>
2829 </jps:position>
2930 </lfSpanTo>
30-
31+
3132 <devDate>
3233 <jps:position>
3334 <jps:date8601>2011-01-31</jps:date8601>
3435 </jps:position>
3536 </devDate>
36-
37+
3738 <orgGILvl>25000</orgGILvl>
3839 <vis>表示</vis>
39-
40+
4041 <pos id="K6_2" uuid="fgoid:10-00150-11-1002-1530-g">
4142 <jps:CRS uuidref="fguuid:jgd2000.bl"/>
4243 <jps:position>
4344 <jps:coordinate>37.055674 139.338021</jps:coordinate>
4445 </jps:position>
4546 </pos>
46-
47+
4748 <type>その他</type>
4849 <name>福島県南会津郡檜枝岐村</name>
4950 <admCode>07364</admCode>
50-
51+
5152 </AdmPt>
52-
53+
5354 </dataset>
54-
55+
5556 </GI>
5657
5758 */
5859 public static void main(String[] argv)
5960 {
61+ boolean link = true;
62+ for (String arg : argv) {
63+ if (arg.equals("-nolink")) {
64+ link = false;
65+ }
66+ }
67+
6068 File dir = new File(".");
6169 File[] files = dir.listFiles();
6270 int counter = 0;
6371 for (File iFile : files) {
6472 if (checkFile(iFile)) {
6573 counter++;
66- ConvAdmPt25000 t = new ConvAdmPt25000(iFile);
74+ ConvAdmPt25000 t = new ConvAdmPt25000(iFile, link);
6775 t.runner();
6876 }
6977 }
7078 System.out.println("["+ counter +"]つのファイルを処理しました。");
7179 }
72-
73- public ConvAdmPt25000 (File iFile) {
80+
81+ public ConvAdmPt25000 (File iFile, boolean link) {
7482 this.inputFile = iFile;
83+ this.link = link;
7584 }
7685
7786 public void runner() {
7887 DocumentBuilderFactory factory;
7988 DocumentBuilder builder;
8089 Node root;
81-
90+
8291 this.iCounter = 0;
8392 String iStr = this.inputFile.getName();
8493 String[] nameAry = iStr.split("-");
@@ -92,18 +101,37 @@ public class ConvAdmPt25000 {
92101 this.admCodeStr = nameAry[2];
93102 }
94103 }
95-
104+
96105 File outputFile = new File(iStr.substring(0, iStr.length() - 4) +".gpx");
97106 BufferedWriter w = null;
98107 System.out.println(outputFile.getName() + " => ");
99108
109+ File htmlFile = new File(iStr.substring(0, iStr.length() - 4) +".html");
110+ BufferedWriter hw = null;
111+ System.out.println(htmlFile.getName() + " => ");
112+
100113 try {
101114 w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"));
102115 w.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
103116 w.newLine();
104117 w.write("<gpx xmlns=\"http://www.topografix.com/GPX/1/1\" version=\"1.1\" creator=\"osmtracker-android\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd \">");
105118 w.newLine();
106-
119+
120+ hw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFile), "UTF-8"));
121+ hw.write("<!DOCTYPE html>");
122+ hw.newLine();
123+ hw.write("<html><head><meta charset=\"utf-8\" /></head>");
124+ hw.newLine();
125+ hw.write("<body><table border='1'>");
126+ hw.newLine();
127+ hw.write("<tr>");
128+ hw.write("<td></td>");
129+ hw.write("<td>admCode</td>");
130+ hw.write("<td>name</td>");
131+ hw.write("<td></td>");
132+ hw.write("</tr>");
133+ hw.newLine();
134+
107135 factory = DocumentBuilderFactory.newInstance();
108136 builder = factory.newDocumentBuilder();
109137 factory.setIgnoringElementContentWhitespace(true);
@@ -111,10 +139,13 @@ public class ConvAdmPt25000 {
111139 factory.setValidating(true);
112140 root = builder.parse(inputFile.getName());
113141
114- showNodes(w, root, "");
115-
142+ showNodes(w, hw, root, "");
143+
116144 w.write("</gpx>");
117145 w.newLine();
146+
147+ hw.write("</table></body></html>");
148+ hw.newLine();
118149 } catch (ParserConfigurationException e0) {
119150 System.out.println(e0.getMessage());
120151 } catch (SAXException e1){
@@ -127,6 +158,7 @@ public class ConvAdmPt25000 {
127158 if (w != null) {
128159 try {
129160 w.close();
161+ hw.close();
130162 }
131163 catch (IOException e) {
132164 e.printStackTrace();
@@ -135,20 +167,20 @@ public class ConvAdmPt25000 {
135167 }
136168 }
137169
138- public void showNodes(BufferedWriter w, Node node, String space) throws IOException {
170+ public void showNodes(BufferedWriter w, BufferedWriter hw, Node node, String space) throws IOException {
139171 NodeList nodes = node.getChildNodes();
140172 for (int i=0; i<nodes.getLength(); i++) {
141173 Node node2 = nodes.item(i);
142174 if (node2.getNodeName().equals("AdmPt")) {
143- showAdmPt(w, node2);
175+ showAdmPt(w, hw, node2);
144176 }
145177 else {
146- showNodes(w, node2, space + " ");
178+ showNodes(w, hw, node2, space + " ");
147179 }
148180 }
149181 }
150182
151- public void showAdmPt(BufferedWriter w, Node node) throws IOException {
183+ public void showAdmPt(BufferedWriter w, BufferedWriter hw, Node node) throws IOException {
152184 String positionStr = "";
153185 String typeStr = "";
154186 String nameStr = "";
@@ -204,7 +236,7 @@ public class ConvAdmPt25000 {
204236 }
205237 else if (node2.getNodeName().equals("type")) {
206238 typeStr = node2.getTextContent();
207-
239+
208240 }
209241 else if (node2.getNodeName().equals("name")) {
210242 nameStr = node2.getTextContent();
@@ -215,37 +247,45 @@ public class ConvAdmPt25000 {
215247 }
216248
217249 String oName = "FG-JPS-"+ codeStr +"-AdmPt25000-"+ idStr +".txt";
218- this.iCounter++;
219- File o2File = new File(oName);
220- BufferedWriter w2 = null;
221- try {
222- w2 = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(o2File), "UTF-8"));
223- w2.write("name="+ nameStr +"");
224- w2.newLine();
225- w2.write("type:"+ typeStr);
226- w2.newLine();
227- w2.write("admCode:"+ codeStr);
228- w2.newLine();
229- w2.write("date:"+ dateStr);
230- w2.newLine();
231- w2.write("id:"+ idStr);
232- w2.newLine();
233- w2.write("source=GSI/KIBAN Block http://wiki.osm.org/wiki/GSI_KIBAN");
234- w2.newLine();
235- System.out.println(idStr +","+ codeStr +","+ nameStr +","+ typeStr);
236- }
237- finally {
238- if (w2 != null) {
239- try {
240- w2.close();
241- }
242- catch (IOException e) {
243- e.printStackTrace();
250+ if (link) {
251+ this.iCounter++;
252+ File o2File = new File(oName);
253+ BufferedWriter w2 = null;
254+ try {
255+ w2 = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(o2File), "UTF-8"));
256+ w2.write("name="+ nameStr +"");
257+ w2.newLine();
258+ w2.write("type:"+ typeStr);
259+ w2.newLine();
260+ w2.write("admCode:"+ codeStr);
261+ w2.newLine();
262+ w2.write("date:"+ dateStr);
263+ w2.newLine();
264+ w2.write("id:"+ idStr);
265+ w2.newLine();
266+ w2.write("source=GSI/KIBAN Block http://wiki.osm.org/wiki/GSI_KIBAN");
267+ w2.newLine();
268+ System.out.println(idStr +","+ codeStr +","+ nameStr +","+ typeStr);
269+ }
270+ finally {
271+ if (w2 != null) {
272+ try {
273+ w2.close();
274+ }
275+ catch (IOException e) {
276+ e.printStackTrace();
277+ }
244278 }
245279 }
246280 }
247281
248-
282+ hw.write("<td>"+ idStr +"</td>");
283+ hw.write("<td>"+ codeStr +"</td>");
284+ hw.write("<td>"+ nameStr +"</td>");
285+ hw.write("<td>"+ typeStr +"</td>");
286+ hw.write("</tr>");
287+ hw.newLine();
288+
249289 //System.out.println(admCodeStr +","+ typeStr +","+ nameStr +","+ latStr +","+ lonStr +","+ dateStr);
250290 w.write("<wpt lat=\""+ latStr +"\" lon=\""+ lonStr +"\">");
251291 w.newLine();
@@ -253,19 +293,20 @@ public class ConvAdmPt25000 {
253293 w.newLine();
254294 w.write(" <name><![CDATA["+ nameStr +"]]></name>");
255295 w.newLine();
256-
257- w.write(" <link href=\""+ oName +"\"><text>"+ nameStr +"</text></link>");
258- w.newLine();
259-
296+
297+ if (link) {
298+ w.write(" <link href=\""+ oName +"\"><text>"+ nameStr +"</text></link>");
299+ w.newLine();
300+ }
301+
260302 w.write("</wpt>");
261303 w.newLine();
262-
263304 }
264-
305+
265306 /**
266- *
307+ *
267308 * 例 [FG-JPS-07-AdmPt25000-20110131-0001.xml]
268- *
309+ *
269310 * @param f
270311 * @return
271312 */
--- a/src/hayashi/kiban/ConvBusstop.java
+++ b/src/hayashi/kiban/ConvBusstop.java
@@ -53,6 +53,18 @@ public class ConvBusstop {
5353 Gpx2osm.main(shiftArgs(args));
5454 return;
5555 }
56+ else if (args[0].equals("ConvCommPt")) {
57+ ConvCommPt.main(shiftArgs(args));
58+ return;
59+ }
60+ else if (args[0].equals("ConvAdmPt25000")) {
61+ ConvAdmPt25000.main(shiftArgs(args));
62+ return;
63+ }
64+ else if (args[0].equals("ConvRdComPt")) {
65+ ConvRdComPt.main(shiftArgs(args));
66+ return;
67+ }
5668 if (args[0].equals("-exp")) {
5769 updateDb = false;
5870 }