test
1 parent 7b1bbba commit 901907eee2cdf7fc003e27cfac65ea9ec52a0b60
@hayashi hayashi authored on 14 Jan 2018
Showing 3 changed files
View
18
src/osm/jp/api/Osmdb.java
}
public static final int POINT_NO = 0; // 評価ポイント無し→ score=50
public static final int POINT_FIXME = 1; // 評価ポイント|!(fixme=null) → score=1
public static final int POINT_BRAND = 2; // 評価ポイント|brand=null → score=1
public static final int POINT_NAME = 4; // 評価ポイント|name=null → score=1
public static final int POINT_BUS = 8; // 評価ポイント|!(bus=yes) → score=0
public static final int POINT_NO_BRAND = 2; // 評価ポイント|brand=null → score=1
public static final int POINT_NO_NAME = 4; // 評価ポイント|name=null → score=1
public static final int POINT_BUS_NO = 8; // 評価ポイント|!(bus=yes) → score=0
 
public int importExistingNode(Connection hsqldb, Connection osmdb, ResultSet rset, int point) throws IOException, SQLException {
String nameStr = rset.getString("name");
String fixmeStr = "";
 
int score = 50;
if (((point & POINT_BRAND) != 0) && isNull(brandStr)) {
if (((point & POINT_NO_BRAND) != 0) && isNull(brandStr)) {
score = 1;
}
if (((point & POINT_NAME) != 0) && isNull(nameStr)) {
if (((point & POINT_NO_NAME) != 0) && isNull(nameStr)) {
score = 1;
}
boolean fixme = false;
boolean busYes = false;
if (((point & (POINT_FIXME | POINT_BUS)) != 0)) {
if (((point & (POINT_FIXME | POINT_BUS_NO)) != 0)) {
PreparedStatement ps8 = osmdb.prepareStatement("SELECT * FROM planet_osm_nodes where id='"+ osmidStr +"'");
try (ResultSet rset8 = ps8.executeQuery()) {
while (rset8.next()) {
String tags = rset8.getString("tags");
if (((point & POINT_FIXME) != 0) && fixme) {
score = 1;
}
if (((point & POINT_BUS) != 0) && !busYes) {
if (((point & POINT_BUS_NO) != 0) && !busYes) {
score = 0;
}
}
double lat = (maxlat + minlat) / 2;
double lon = (maxlon + minlon) / 2;
int score = 50;
 
if (((point & POINT_BRAND) != 0) && brandStr.equals("")) {
if (((point & POINT_NO_BRAND) != 0) && brandStr.equals("")) {
score = 1;
}
if (((point & POINT_NAME) != 0) && nameStr.equals("")) {
if (((point & POINT_NO_NAME) != 0) && nameStr.equals("")) {
score = 1;
}
if (((point & POINT_FIXME) != 0) && !fixmeStr.equals("")) {
score = 1;
View
4
src/osm/jp/coverage/busstop/DbExistBusstop.java
public void getJapanCapabilities(Connection conHsql) throws Exception {
// 通常 → 50ポイント
// NAMEなし → 1ポイント
// FIXMEあり → 1ポイント
readExisting(conHsql, null, POINT_NAME | POINT_FIXME);
readExisting(conHsql, null, POINT_NO_NAME | POINT_FIXME);
}
// ノード: 厚木ナイロン (1995040609) 場所: 35.4433312, 139.3932098 public_transport=stop_position,bus=yes
// ノード: 海老名高校前 (2043102034) 場所: 35.4435042, 139.3878934 highway=bus_stop
whereText.append(")");
PreparedStatement ps = osmdb.prepareStatement(sql + ",ST_Y(ST_Transform(way,4326)) as lat,ST_X(ST_Transform(way,4326)) as lon from planet_osm_point " + whereText.toString());
try (ResultSet rset1 = ps.executeQuery()) {
while (rset1.next()) {
counter += importExistingNode(hsqldb, osmdb, rset1, point | POINT_BUS);
counter += importExistingNode(hsqldb, osmdb, rset1, point | POINT_BUS_NO);
}
}
StringBuilder whereText2 = new StringBuilder();
View
src/osm/jp/coverage/fuel/DbExist.java