From 88b21e11c3fd6ca5ac3386acce0c1f172f63a21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Tue, 5 Nov 2024 23:27:05 +0100 Subject: [PATCH] car parking --- .pkg | 2 +- .pkg.lock | 4 ++-- openapi.yaml | 25 ++++++------------------- src/endpoints/graph.cc | 4 ++-- src/endpoints/routing.cc | 1 + src/journey_to_response.cc | 2 +- src/mode_to_profile.cc | 1 + src/street_routing.cc | 2 +- ui/src/lib/AddressTypeahead.svelte | 9 ++------- ui/src/lib/modeStyle.ts | 9 +-------- ui/src/lib/openapi/schemas.gen.ts | 18 ++++++------------ ui/src/lib/openapi/types.gen.ts | 20 +++++++------------- ui/src/routes/+page.svelte | 22 ++++++++++++++-------- ui/src/routes/SearchMask.svelte | 10 ++++++---- 14 files changed, 51 insertions(+), 78 deletions(-) diff --git a/.pkg b/.pkg index 99a413454..9b0a186f9 100644 --- a/.pkg +++ b/.pkg @@ -9,7 +9,7 @@ [osr] url=git@github.com:motis-project/osr.git branch=master - commit=60eb1ee32698fbe4c2dde2070acb9bceea621257 + commit=736ee98b1e4d40335eea901e7fbc1a31374e680c [utl] url=git@github.com:motis-project/utl.git branch=master diff --git a/.pkg.lock b/.pkg.lock index 6ecc6d4e0..08f4ab716 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,4 +1,4 @@ -14560197399935530260 +15114411606436118506 cista 950f96f4ded53a6b5753824b280550b722933e55 zlib-ng 68ab3e2d80253ec5dc3c83691d9ff70477b32cd3 boost 73549ebca677fe6214202a1ab580362b4f80e653 @@ -39,7 +39,7 @@ sol2 40c7cbc7c5cfed1e8c7f1bbe6fcbe23d7a67fc75 variant 5aa73631dc969087c77433a5cdef246303051f69 tiles 6b6dc45bc904966640c7207ab91950848a8b3f6c rtree.c 6ed73a7dc4f1184f2b5b2acd8ac1c2b28a273057 -osr 60eb1ee32698fbe4c2dde2070acb9bceea621257 +osr 736ee98b1e4d40335eea901e7fbc1a31374e680c yaml-cpp 1d8ca1f35eb3a9c9142462b28282a848e5d29a91 reflect-cpp c54fe66de4650b60c23aadd4a06d9db4ffeda22f FTXUI dd6a5d371fd7a3e2937bb579955003c54b727233 diff --git a/openapi.yaml b/openapi.yaml index fc32c2b5f..f8e067587 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -893,17 +893,11 @@ components: description: | # Street modes - - `WALK`: Walking some or all of the way of the route. - - `BIKE`: Cycling for the entirety of the route or taking a bicycle onto the public transport (if enabled) and cycling from the arrival station to the destination. - - `BIKE_RENTAL`: Taking a rented, shared-mobility bike for part or the entirety of the route. - - `BIKE_TO_PARK`: Leaving the bicycle at the departure station and walking from the arrival station to the destination. This mode needs to be combined with at least one transit mode otherwise it behaves like an ordinary bicycle journey. - - `CAR`: Driving your own car the entirety of the route. This can be combined with transit, where will return routes with a Kiss & Ride component. This means that the car is not parked in a permanent parking area but rather the passenger is dropped off (for example, at an airport) and the driver continues driving the car away from the drop off location. - - `CAR_PARK` | `CAR_TO_PARK`: Driving a car to the park-and-ride facilities near a station and taking publictransport. This mode needs to be combined with at least one transit mode otherwise, it behaves like an ordinary car journey. - - `CAR_HAILING`: Using a car hailing app like Uber or Lyft to get to a train station or all the way to the destination. - - `CAR_PICKUP`: Walking to a pickup point along the road, driving to a drop-off point along the road, and walking the rest of the way. This can include various taxi-services or kiss & ride. - - `CAR_RENTAL`: Walk to a car rental point, drive to a car rental drop-off point and walk the rest of the way. This can include car rental at fixed locations or free-floating services. - - `FLEXIBLE`: Encompasses all types of on-demand and flexible transportation for example GTFS Flex or NeTEx Flexible Stop Places. - - `SCOOTER_RENTAL`: Walking to a scooter rental point, riding a scooter to a scooter rental drop-off point, and walking the rest of the way. This can include scooter rental at fixed locations or free-floating services. + - `WALK` + - `BIKE` + - `BIKE_RENTAL` + - `CAR` + - `CAR_PARKING` # Transit modes @@ -928,14 +922,7 @@ components: - BIKE - CAR - BIKE_RENTAL - - BIKE_TO_PARK - - CAR_TO_PARK - - CAR_HAILING - - CAR_SHARING - - CAR_PICKUP - - CAR_RENTAL - - FLEXIBLE - - SCOOTER_RENTAL + - CAR_PARKING # === Transit === - TRANSIT - TRAM diff --git a/src/endpoints/graph.cc b/src/endpoints/graph.cc index 453284c08..150e7d0f4 100644 --- a/src/endpoints/graph.cc +++ b/src/endpoints/graph.cc @@ -1,7 +1,7 @@ #include "motis/endpoints/graph.h" #include "osr/geojson.h" -#include "osr/routing/profiles/bike_sharing.h" +#include "osr/routing/profiles/car_parking.h" #include "osr/routing/route.h" namespace json = boost::json; @@ -58,7 +58,7 @@ json::value graph::operator()(json::value const& query) const { } }); - gj.finish(&osr::get_dijkstra()); + gj.finish(&osr::get_dijkstra>()); return gj.json(); } diff --git a/src/endpoints/routing.cc b/src/endpoints/routing.cc index 0c51d14ec..b8ab4d1c8 100644 --- a/src/endpoints/routing.cc +++ b/src/endpoints/routing.cc @@ -277,6 +277,7 @@ std::pair, n::duration_t> routing::route_direct( auto itineraries = std::vector{}; for (auto const& m : modes) { if (m == api::ModeEnum::CAR || m == api::ModeEnum::BIKE || + m == api::ModeEnum::CAR_PARKING || (!omit_walk && m == api::ModeEnum::WALK)) { auto itinerary = route( *w_, *l_, gbfs, e, from, to, m, wheelchair, start_time, std::nullopt, diff --git a/src/journey_to_response.cc b/src/journey_to_response.cc index ca58e4777..a1950ecee 100644 --- a/src/journey_to_response.cc +++ b/src/journey_to_response.cc @@ -30,7 +30,7 @@ namespace motis { api::ModeEnum to_mode(osr::search_profile const m) { switch (m) { case osr::search_profile::kCarParkingWheelchair: [[fallthrough]]; - case osr::search_profile::kCarParking: return api::ModeEnum::CAR_TO_PARK; + case osr::search_profile::kCarParking: return api::ModeEnum::CAR_PARKING; case osr::search_profile::kFoot: [[fallthrough]]; case osr::search_profile::kWheelchair: return api::ModeEnum::WALK; case osr::search_profile::kCar: return api::ModeEnum::CAR; diff --git a/src/mode_to_profile.cc b/src/mode_to_profile.cc index 4a69454d5..88eeae477 100644 --- a/src/mode_to_profile.cc +++ b/src/mode_to_profile.cc @@ -21,6 +21,7 @@ osr::search_profile to_profile(api::ModeEnum const m, bool const wheelchair) { : osr::search_profile::kFoot; case api::ModeEnum::BIKE: return osr::search_profile::kBike; case api::ModeEnum::CAR: return osr::search_profile::kCar; + case api::ModeEnum::CAR_PARKING: return osr::search_profile::kCarParking; case api::ModeEnum::BIKE_RENTAL: return osr::search_profile::kBikeSharing; default: throw utl::fail("unsupported mode"); } diff --git a/src/street_routing.cc b/src/street_routing.cc index 8dedf3ff4..5f5583fb4 100644 --- a/src/street_routing.cc +++ b/src/street_routing.cc @@ -39,7 +39,7 @@ std::optional get_path(osr::ways const& w, it != end(cache) ? it->second : osr::route( - w, l, profile, from, to, max, osr::direction::kForward, + w, l, profile, to, from, max, osr::direction::kBackward, kMaxMatchingDistance, s ? &set_blocked(e_nodes, e_states, blocked_mem) : nullptr, sharing); diff --git a/ui/src/lib/AddressTypeahead.svelte b/ui/src/lib/AddressTypeahead.svelte index 79c921013..cc668b11f 100644 --- a/ui/src/lib/AddressTypeahead.svelte +++ b/ui/src/lib/AddressTypeahead.svelte @@ -17,15 +17,13 @@ selected = $bindable(), placeholder, class: className, - name, - theme + name }: { items?: Array; selected: Location; placeholder?: string; class?: string; name?: string; - theme?: 'light' | 'dark'; } = $props(); let inputValue = $state(''); @@ -115,10 +113,7 @@ {#if items.length !== 0} {#each items as item (item.value)} { switch (mode) { case 'WALK': - case 'FLEXIBLE': return ['walk', 'hsl(var(--foreground) / 1)', 'hsl(var(--background) / 1)']; case 'BIKE': - case 'BIKE_TO_PARK': case 'BIKE_RENTAL': - case 'SCOOTER_RENTAL': return ['bike', '#075985', 'white']; case 'CAR': - case 'CAR_TO_PARK': - case 'CAR_HAILING': - case 'CAR_SHARING': - case 'CAR_PICKUP': - case 'CAR_RENTAL': + case 'CAR_PARKING': return ['car', '#333', 'white']; case 'TRANSIT': diff --git a/ui/src/lib/openapi/schemas.gen.ts b/ui/src/lib/openapi/schemas.gen.ts index 6bd235a63..521a481aa 100644 --- a/ui/src/lib/openapi/schemas.gen.ts +++ b/ui/src/lib/openapi/schemas.gen.ts @@ -116,17 +116,11 @@ export const MatchSchema = { export const ModeSchema = { description: `# Street modes - - \`WALK\`: Walking some or all of the way of the route. - - \`BIKE\`: Cycling for the entirety of the route or taking a bicycle onto the public transport (if enabled) and cycling from the arrival station to the destination. - - \`BIKE_RENTAL\`: Taking a rented, shared-mobility bike for part or the entirety of the route. - - \`BIKE_TO_PARK\`: Leaving the bicycle at the departure station and walking from the arrival station to the destination. This mode needs to be combined with at least one transit mode otherwise it behaves like an ordinary bicycle journey. - - \`CAR\`: Driving your own car the entirety of the route. This can be combined with transit, where will return routes with a Kiss & Ride component. This means that the car is not parked in a permanent parking area but rather the passenger is dropped off (for example, at an airport) and the driver continues driving the car away from the drop off location. - - \`CAR_PARK\` | \`CAR_TO_PARK\`: Driving a car to the park-and-ride facilities near a station and taking publictransport. This mode needs to be combined with at least one transit mode otherwise, it behaves like an ordinary car journey. - - \`CAR_HAILING\`: Using a car hailing app like Uber or Lyft to get to a train station or all the way to the destination. - - \`CAR_PICKUP\`: Walking to a pickup point along the road, driving to a drop-off point along the road, and walking the rest of the way. This can include various taxi-services or kiss & ride. - - \`CAR_RENTAL\`: Walk to a car rental point, drive to a car rental drop-off point and walk the rest of the way. This can include car rental at fixed locations or free-floating services. - - \`FLEXIBLE\`: Encompasses all types of on-demand and flexible transportation for example GTFS Flex or NeTEx Flexible Stop Places. - - \`SCOOTER_RENTAL\`: Walking to a scooter rental point, riding a scooter to a scooter rental drop-off point, and walking the rest of the way. This can include scooter rental at fixed locations or free-floating services. + - \`WALK\` + - \`BIKE\` + - \`BIKE_RENTAL\` + - \`CAR\` + - \`CAR_PARKING\` # Transit modes @@ -146,7 +140,7 @@ export const ModeSchema = { - \`REGIONAL_RAIL\`: regional train `, type: 'string', - enum: ['WALK', 'BIKE', 'CAR', 'BIKE_RENTAL', 'BIKE_TO_PARK', 'CAR_TO_PARK', 'CAR_HAILING', 'CAR_SHARING', 'CAR_PICKUP', 'CAR_RENTAL', 'FLEXIBLE', 'SCOOTER_RENTAL', 'TRANSIT', 'TRAM', 'SUBWAY', 'FERRY', 'AIRPLANE', 'METRO', 'BUS', 'COACH', 'RAIL', 'HIGHSPEED_RAIL', 'LONG_DISTANCE', 'NIGHT_RAIL', 'REGIONAL_FAST_RAIL', 'REGIONAL_RAIL', 'OTHER'] + enum: ['WALK', 'BIKE', 'CAR', 'BIKE_RENTAL', 'CAR_PARKING', 'TRANSIT', 'TRAM', 'SUBWAY', 'FERRY', 'AIRPLANE', 'METRO', 'BUS', 'COACH', 'RAIL', 'HIGHSPEED_RAIL', 'LONG_DISTANCE', 'NIGHT_RAIL', 'REGIONAL_FAST_RAIL', 'REGIONAL_RAIL', 'OTHER'] } as const; export const VertexTypeSchema = { diff --git a/ui/src/lib/openapi/types.gen.ts b/ui/src/lib/openapi/types.gen.ts index cb35f90cd..42570df15 100644 --- a/ui/src/lib/openapi/types.gen.ts +++ b/ui/src/lib/openapi/types.gen.ts @@ -106,17 +106,11 @@ export type type = 'ADDRESS' | 'PLACE' | 'STOP'; /** * # Street modes * - * - `WALK`: Walking some or all of the way of the route. - * - `BIKE`: Cycling for the entirety of the route or taking a bicycle onto the public transport (if enabled) and cycling from the arrival station to the destination. - * - `BIKE_RENTAL`: Taking a rented, shared-mobility bike for part or the entirety of the route. - * - `BIKE_TO_PARK`: Leaving the bicycle at the departure station and walking from the arrival station to the destination. This mode needs to be combined with at least one transit mode otherwise it behaves like an ordinary bicycle journey. - * - `CAR`: Driving your own car the entirety of the route. This can be combined with transit, where will return routes with a Kiss & Ride component. This means that the car is not parked in a permanent parking area but rather the passenger is dropped off (for example, at an airport) and the driver continues driving the car away from the drop off location. - * - `CAR_PARK` | `CAR_TO_PARK`: Driving a car to the park-and-ride facilities near a station and taking publictransport. This mode needs to be combined with at least one transit mode otherwise, it behaves like an ordinary car journey. - * - `CAR_HAILING`: Using a car hailing app like Uber or Lyft to get to a train station or all the way to the destination. - * - `CAR_PICKUP`: Walking to a pickup point along the road, driving to a drop-off point along the road, and walking the rest of the way. This can include various taxi-services or kiss & ride. - * - `CAR_RENTAL`: Walk to a car rental point, drive to a car rental drop-off point and walk the rest of the way. This can include car rental at fixed locations or free-floating services. - * - `FLEXIBLE`: Encompasses all types of on-demand and flexible transportation for example GTFS Flex or NeTEx Flexible Stop Places. - * - `SCOOTER_RENTAL`: Walking to a scooter rental point, riding a scooter to a scooter rental drop-off point, and walking the rest of the way. This can include scooter rental at fixed locations or free-floating services. + * - `WALK` + * - `BIKE` + * - `BIKE_RENTAL` + * - `CAR` + * - `CAR_PARKING` * * # Transit modes * @@ -136,7 +130,7 @@ export type type = 'ADDRESS' | 'PLACE' | 'STOP'; * - `REGIONAL_RAIL`: regional train * */ -export type Mode = 'WALK' | 'BIKE' | 'CAR' | 'BIKE_RENTAL' | 'BIKE_TO_PARK' | 'CAR_TO_PARK' | 'CAR_HAILING' | 'CAR_SHARING' | 'CAR_PICKUP' | 'CAR_RENTAL' | 'FLEXIBLE' | 'SCOOTER_RENTAL' | 'TRANSIT' | 'TRAM' | 'SUBWAY' | 'FERRY' | 'AIRPLANE' | 'METRO' | 'BUS' | 'COACH' | 'RAIL' | 'HIGHSPEED_RAIL' | 'LONG_DISTANCE' | 'NIGHT_RAIL' | 'REGIONAL_FAST_RAIL' | 'REGIONAL_RAIL' | 'OTHER'; +export type Mode = 'WALK' | 'BIKE' | 'CAR' | 'BIKE_RENTAL' | 'CAR_PARKING' | 'TRANSIT' | 'TRAM' | 'SUBWAY' | 'FERRY' | 'AIRPLANE' | 'METRO' | 'BUS' | 'COACH' | 'RAIL' | 'HIGHSPEED_RAIL' | 'LONG_DISTANCE' | 'NIGHT_RAIL' | 'REGIONAL_FAST_RAIL' | 'REGIONAL_RAIL' | 'OTHER'; /** * - `NORMAL` - latitude / longitude coordinate or address @@ -669,7 +663,7 @@ export type PlanData = { * * Note: Direct connections will only be returned on the first call. For paging calls, they can be omitted. * - * Note: Transit connections that are slower than the fastest direct walking connection will not show up. + * Note: Transit connections that are slower than the fastest direct connection will not show up. * This is being used as a cut-off during transit routing to speed up the search. * To prevent this, it's possible to send two separate requests (one with only `transitModes` and one with only `directModes`). * diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte index 24f9cf87c..387810416 100644 --- a/ui/src/routes/+page.svelte +++ b/ui/src/routes/+page.svelte @@ -90,6 +90,7 @@ let timeType = $state('departure'); let wheelchair = $state(false); let bikeRental = $state(false); + let carParking = $state(false); const toPlaceString = (l: Location) => { if (l.value.match?.type === 'STOP') { @@ -100,7 +101,11 @@ return `${lngLatToStr(l.value.match!)},0`; } }; - let modes = $derived(['WALK', ...(bikeRental ? ['BIKE_RENTAL'] : [])] as Mode[]); + let modes = $derived([ + ...(bikeRental ? ['BIKE_RENTAL'] : []), + ...(carParking ? ['CAR_PARKING'] : []) + ] as Mode[]); + let postTransitModes = $derived([...(bikeRental ? ['BIKE_RENTAL'] : [])] as Mode[]); let baseQuery = $derived( from.value.match && to.value.match ? ({ @@ -112,8 +117,9 @@ timetableView: true, wheelchair, preTransitModes: modes, - postTransitModes: modes, - directModes: modes + postTransitModes, + directModes: modes, + maxPreTransitTime: 2200 } } as PlanData) : undefined @@ -219,7 +225,7 @@ {/if} - + @@ -237,7 +243,7 @@ {#if !selectedItinerary && routingResponses.length !== 0} @@ -246,7 +252,7 @@ {#if selectedItinerary && !selectedStop} - +

Journey Details