diff --git a/src/main/java/org/mtransit/commons/FeatureFlags.kt b/src/main/java/org/mtransit/commons/FeatureFlags.kt index dc6f1a9..7feace9 100644 --- a/src/main/java/org/mtransit/commons/FeatureFlags.kt +++ b/src/main/java/org/mtransit/commons/FeatureFlags.kt @@ -71,5 +71,8 @@ object FeatureFlags { // const val F_EXPORT_DIRECTION_STOP_LAST = false const val F_EXPORT_DIRECTION_STOP_LAST = true + const val F_EXPORT_STOP_TIMEZONE_ID = false + // const val F_EXPORT_STOP_TIMEZONE_ID = true + // @formatter:on } diff --git a/src/main/java/org/mtransit/commons/GTFSCommons.kt b/src/main/java/org/mtransit/commons/GTFSCommons.kt index 17b9480..374e4f9 100644 --- a/src/main/java/org/mtransit/commons/GTFSCommons.kt +++ b/src/main/java/org/mtransit/commons/GTFSCommons.kt @@ -174,6 +174,7 @@ object GTFSCommons { const val T_STOP_K_LNG = "lng" const val T_STOP_K_ACCESSIBLE = "a11y" const val T_STOP_K_ORIGINAL_ID_HASH = "o_id_hash" + const val T_STOP_K_TIMEZONE_ID = "tz" @JvmField val T_STOP_STRINGS_COLUMN_IDX = intArrayOf(2) @@ -187,6 +188,9 @@ object GTFSCommons { appendColumn(T_STOP_K_LNG, SQLUtils.REAL) appendColumn(T_STOP_K_ACCESSIBLE, SQLUtils.INT) appendColumn(T_STOP_K_ORIGINAL_ID_HASH, SQLUtils.INT) + if (FeatureFlags.F_EXPORT_STOP_TIMEZONE_ID) { + appendColumn(T_STOP_K_TIMEZONE_ID, SQLUtils.TXT) + } }.build() @JvmStatic @@ -198,6 +202,9 @@ object GTFSCommons { appendColumn(T_STOP_K_LNG) appendColumn(T_STOP_K_ACCESSIBLE) appendColumn(T_STOP_K_ORIGINAL_ID_HASH) + if (FeatureFlags.F_EXPORT_STOP_TIMEZONE_ID) { + appendColumn(T_STOP_K_TIMEZONE_ID) + } }.build() @JvmStatic diff --git a/src/main/java/org/mtransit/commons/gtfs/data/Stop.kt b/src/main/java/org/mtransit/commons/gtfs/data/Stop.kt index 692c636..6350c50 100644 --- a/src/main/java/org/mtransit/commons/gtfs/data/Stop.kt +++ b/src/main/java/org/mtransit/commons/gtfs/data/Stop.kt @@ -14,7 +14,7 @@ data class Stop( val stopUrl: Url?, val locationType: Int?, // TODO Enum val parentStationId: StopId?, - // stop_timezone + val stopTimezone: String?, val wheelchairBoarding: Int?, // TODO Enum 0 1 2 // level_id // val platformCode: Text?, // TODO useful! diff --git a/src/main/java/org/mtransit/commons/gtfs/sql/StopSQL.kt b/src/main/java/org/mtransit/commons/gtfs/sql/StopSQL.kt index a4dcaac..f997740 100644 --- a/src/main/java/org/mtransit/commons/gtfs/sql/StopSQL.kt +++ b/src/main/java/org/mtransit/commons/gtfs/sql/StopSQL.kt @@ -40,6 +40,7 @@ object StopSQL : CommonSQL(), TableSQL { const val T_STOP_K_STOP_URL = "stop_url" const val T_STOP_K_LOCATION_TYPE = "location_type" const val T_STOP_K_PARENT_STATION_ID_INT = "parent_station_id_int" + const val T_STOP_K_STOP_TIMEZONE = "stop_timezone" const val T_STOP_K_WHEELCHAIR_BOARDING = "wheelchair_boarding" override fun getMainTable() = SQLTableDef( @@ -53,6 +54,7 @@ object StopSQL : CommonSQL(), TableSQL { SQLColumDef(T_STOP_K_STOP_URL, SQLUtils.TXT), SQLColumDef(T_STOP_K_LOCATION_TYPE, SQLUtils.INT), SQLColumDef(T_STOP_K_PARENT_STATION_ID_INT, SQLUtils.INT, foreignKey = SQLForeignKey(T_STOP_IDS, T_STOP_IDS_K_ID_INT)), + SQLColumDef(T_STOP_K_STOP_TIMEZONE, SQLUtils.TXT), SQLColumDef(T_STOP_K_WHEELCHAIR_BOARDING, SQLUtils.INT), ), insertAllowReplace = false, @@ -68,6 +70,7 @@ object StopSQL : CommonSQL(), TableSQL { stopUrl?.quotesEscape(), locationType, parentStationId?.let { getOrInsertIdInt(statement, it) }, + stopTimezone?.quotesEscape(), wheelchairBoarding, ) } @@ -105,6 +108,7 @@ object StopSQL : CommonSQL(), TableSQL { stopUrl = getString(T_STOP_K_STOP_URL), locationType = getInt(T_STOP_K_LOCATION_TYPE), parentStationId = getString(getAlias(T_STOP_K_PARENT_STATION_ID_INT, T_STOP_IDS_K_ID)), + stopTimezone = getString(T_STOP_K_STOP_TIMEZONE), wheelchairBoarding = getInt(T_STOP_K_WHEELCHAIR_BOARDING), ) }