• R/O
  • HTTP
  • SSH
  • HTTPS

convbusstop: Commit


Commit MetaInfo

Revision0227d3a4f0d44dfb7844256b04aa0c99fcac5c93 (tree)
Time2017-01-10 18:55:15
Authoryuuhayashi <hayashi.yuu@gmai...>
Commiteryuuhayashi

Log Message

複数の都道府県別フォルダを一括して処理する

Change Summary

Incremental Difference

--- a/src/osm/jp/ConvBusstop.java
+++ b/src/osm/jp/ConvBusstop.java
@@ -216,7 +216,7 @@ public class ConvBusstop {
216216
217217
218218 // ローカルデータベース内の情報を出力する
219- outputDb(con, gmldir.getName());
219+ outputDb2html(con, gmldir);
220220
221221 // ローカルデータベース内の情報を「busstop.xml」に出力する
222222 int counter = outputDb(con, gmldir);
@@ -396,10 +396,9 @@ public class ConvBusstop {
396396 * @throws ParserConfigurationException
397397 * @throws SAXException
398398 */
399- public static void outputDb(Connection con, String iCode) throws IOException, SQLException, SAXException, ParserConfigurationException, TransformerException {
399+ public static void outputDb2html(Connection con, File dir) throws IOException, SQLException, SAXException, ParserConfigurationException, TransformerException {
400400 String timeStampStr = timeStampFmt.format(new Date(Calendar.getInstance().getTimeInMillis()));
401- File dir = new File(iCode);
402- dir.mkdir();
401+ String iCode = dir.getName();
403402
404403 BufferedWriter ow = null;
405404 BufferedWriter gw = null;
@@ -407,7 +406,7 @@ public class ConvBusstop {
407406 BufferedWriter ww = null;
408407
409408 // HTML header
410- File htmlFile = new File(iCode +".html");
409+ File htmlFile = new File(dir, iCode +".html");
411410 hw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFile), "UTF-8"));
412411 hw.write("<!DOCTYPE html>");
413412 hw.newLine();
@@ -428,7 +427,7 @@ public class ConvBusstop {
428427 hw.newLine();
429428
430429 // Wiki header
431- File wikiFile = new File(iCode +".wiki.txt");
430+ File wikiFile = new File(dir, iCode+".wiki.txt");
432431 ww = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(wikiFile), "UTF-8"));
433432 ww.write("= バス路線毎のマッピング状況 =");
434433 ww.newLine();
@@ -440,7 +439,7 @@ public class ConvBusstop {
440439 PreparedStatement ps7 = con.prepareStatement("SELECT code,type,corp,course,ifile FROM bus_course WHERE ifile=? ORDER BY type,corp,course");
441440 PreparedStatement ps9 = con.prepareStatement("SELECT idref FROM bus_ref WHERE code=?");
442441 PreparedStatement ps8 = con.prepareStatement("SELECT name,lat,lon,fixed FROM bus_stop WHERE idref=?");
443- ps7.setString(1, iCode);
442+ ps7.setString(1, dir.getName());
444443 ResultSet rset7 = ps7.executeQuery();
445444 while (rset7.next()) {
446445 int code = rset7.getInt(1);
@@ -462,9 +461,9 @@ public class ConvBusstop {
462461 hw.write("<tr>");
463462 hw.write("<td>"+ type +"</td>");
464463 hw.write("<td>"+ corp +"</td>");
465- hw.write("<td><a href='"+ dir.getName() +"/"+ osmFile.getName() +"'>"+ course +"</a></td>");
466- hw.write("<td><a href='"+ dir.getName() +"/"+ gpxFile.getName() +"'>"+ gpxFile.getName() +"</a></td>");
467- hw.write("<td><a href='"+ dir.getName() +"/"+ osmSample.getName() +"'>"+ osmSample.getName() +"</a></td>");
464+ hw.write("<td><a href='"+ iCode +"/"+ osmFile.getName() +"'>"+ course +"</a></td>");
465+ hw.write("<td><a href='"+ iCode +"/"+ gpxFile.getName() +"'>"+ gpxFile.getName() +"</a></td>");
466+ hw.write("<td><a href='"+ iCode +"/"+ osmSample.getName() +"'>"+ osmSample.getName() +"</a></td>");
468467 hw.newLine();
469468
470469 //--------------------------------------------
Show on old repository browser