Skip to content

Commit

Permalink
Merge branch 'dev-2.x' into cleanup_filters
Browse files Browse the repository at this point in the history
  • Loading branch information
t2gran committed Jan 19, 2024
2 parents c52680e + af54699 commit 1198e26
Show file tree
Hide file tree
Showing 264 changed files with 2,770 additions and 2,015 deletions.
3 changes: 2 additions & 1 deletion client-next/.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_API_URL=/otp/routers/default/transmodel/index/graphql
VITE_API_URL=/otp/routers/default/transmodel/index/graphql
VITE_DEBUG_STYLE_URL=/otp/routers/default/inspector/vectortile/style.json
3 changes: 2 additions & 1 deletion client-next/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_API_URL=http://localhost:8080/otp/routers/default/transmodel/index/graphql
VITE_API_URL=http://localhost:8080/otp/routers/default/transmodel/index/graphql
VITE_DEBUG_STYLE_URL=http://localhost:8080/otp/routers/default/inspector/vectortile/style.json
1 change: 1 addition & 0 deletions client-next/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
50 changes: 25 additions & 25 deletions client-next/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions client-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@
"codegen": "graphql-codegen --config codegen.ts"
},
"dependencies": {
"@googlemaps/polyline-codec": "^1.0.28",
"bootstrap": "^5.3.1",
"graphql": "^16.8.0",
"graphql-request": "^6.1.0",
"maplibre-gl": "^3.3.0",
"react": "^18.2.0",
"react-bootstrap": "^2.8.0",
"react-dom": "^18.2.0",
"react-map-gl": "^7.1.5"
"@googlemaps/polyline-codec": "1.0.28",
"bootstrap": "5.3.1",
"graphql": "16.8.0",
"graphql-request": "6.1.0",
"maplibre-gl": "3.3.0",
"react": "18.2.0",
"react-bootstrap": "2.8.0",
"react-dom": "18.2.0",
"react-map-gl": "7.1.5"
},
"devDependencies": {
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"@graphql-codegen/introspection": "4.0.0",
"@parcel/watcher": "^2.3.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
"eslint": "^8.45.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vite": "^4.4.5"
"@parcel/watcher": "2.3.0",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
"@typescript-eslint/eslint-plugin": "6.5.0",
"@typescript-eslint/parser": "6.5.0",
"@vitejs/plugin-react": "4.0.4",
"eslint": "8.48.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"prettier": "3.0.3",
"typescript": "5.2.2",
"vite": "4.4.9"
}
}
27 changes: 27 additions & 0 deletions client-next/src/components/MapView/GeometryPropertyPopup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { LngLat, Popup } from 'react-map-gl';
import { Table } from 'react-bootstrap';

export function GeometryPropertyPopup({
coordinates,
properties,
onClose,
}: {
coordinates: LngLat;
properties: { [s: string]: string };
onClose: () => void;
}) {
return (
<Popup latitude={coordinates.lat} longitude={coordinates.lng} closeButton={true} onClose={() => onClose()}>
<Table bordered>
<tbody>
{Object.entries(properties).map(([key, value]) => (
<tr key={key}>
<th scope="row">{key}</th>
<td>{value}</td>
</tr>
))}
</tbody>
</Table>
</Popup>
);
}
48 changes: 40 additions & 8 deletions client-next/src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { LngLat, Map, NavigationControl } from 'react-map-gl';
import { LngLat, Map, MapboxGeoJSONFeature, NavigationControl } from 'react-map-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
import { TripPattern, TripQuery, TripQueryVariables } from '../../gql/graphql.ts';
import { NavigationMarkers } from './NavigationMarkers.tsx';
import { LegLines } from './LegLines.tsx';
import { useMapDoubleClick } from './useMapDoubleClick.ts';
import { mapStyle } from './mapStyle.ts';
import { useState } from 'react';
import { ContextMenuPopup } from './ContextMenuPopup.tsx';
import { GeometryPropertyPopup } from './GeometryPropertyPopup.tsx';

// TODO: this should be configurable
const initialViewState = {
Expand All @@ -15,6 +15,10 @@ const initialViewState = {
zoom: 4,
};

const styleUrl = import.meta.env.VITE_DEBUG_STYLE_URL;

type PopupData = { coordinates: LngLat; feature: MapboxGeoJSONFeature };

export function MapView({
tripQueryVariables,
setTripQueryVariables,
Expand All @@ -29,20 +33,41 @@ export function MapView({
loading: boolean;
}) {
const onMapDoubleClick = useMapDoubleClick({ tripQueryVariables, setTripQueryVariables });
const [showPopup, setShowPopup] = useState<LngLat | null>(null);
const [showContextPopup, setShowContextPopup] = useState<LngLat | null>(null);
const [showPropsPopup, setShowPropsPopup] = useState<PopupData | null>(null);
const showFeaturePropPopup = (
e: mapboxgl.MapMouseEvent & {
features?: mapboxgl.MapboxGeoJSONFeature[] | undefined;
},
) => {
if (e.features) {
// if you click on a cluster of map features it's possible that there are multiple
// to select from. we are using the first one instead of presenting a selection UI.
// you can always zoom in closer if you want to make a more specific click.
const feature = e.features[0];
setShowPropsPopup({ coordinates: e.lngLat, feature: feature });
}
};

return (
<div className="map-container below-content">
<Map
// @ts-ignore
mapLib={import('maplibre-gl')}
// @ts-ignore
mapStyle={mapStyle}
mapStyle={styleUrl}
initialViewState={initialViewState}
onDblClick={onMapDoubleClick}
onContextMenu={(e) => {
setShowPopup(e.lngLat);
setShowContextPopup(e.lngLat);
}}
interactiveLayerIds={['regular-stop']}
onClick={showFeaturePropPopup}
// put lat/long in URL and pan to it on page reload
hash={true}
// disable pitching and rotating the map
touchPitch={false}
dragRotate={false}
>
<NavigationControl position="top-left" />
<NavigationMarkers
Expand All @@ -53,12 +78,19 @@ export function MapView({
{tripQueryResult?.trip.tripPatterns.length && (
<LegLines tripPattern={tripQueryResult.trip.tripPatterns[selectedTripPatternIndex] as TripPattern} />
)}
{showPopup && (
{showContextPopup && (
<ContextMenuPopup
tripQueryVariables={tripQueryVariables}
setTripQueryVariables={setTripQueryVariables}
coordinates={showPopup}
onClose={() => setShowPopup(null)}
coordinates={showContextPopup}
onClose={() => setShowContextPopup(null)}
/>
)}
{showPropsPopup?.feature?.properties && (
<GeometryPropertyPopup
coordinates={showPropsPopup?.coordinates}
properties={showPropsPopup?.feature?.properties}
onClose={() => setShowPropsPopup(null)}
/>
)}
</Map>
Expand Down
19 changes: 0 additions & 19 deletions client-next/src/components/MapView/mapStyle.ts

This file was deleted.

19 changes: 8 additions & 11 deletions doc-templates/UpdaterConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# Updater configuration

This section covers all options that can be set in the *router-config.json* in the
[updaters](RouterConfiguration.md) section.
This section covers options that can be set in the updaters section of `router-config.json`.
See the parameter summary and examples in the router configuration documentation

Real-time data are those that are not added to OTP during the graph build phase but during runtime.

Expand Down Expand Up @@ -44,18 +44,15 @@ The information is downloaded in a single HTTP request and polled regularly.

<!-- INSERT: stop-time-updater -->

### Streaming TripUpdates via MQTT

### TripUpdates via WebSocket
This updater connects to an MQTT broker and processes TripUpdates in a streaming fashion. This means
that they will be applied individually in near-realtime rather than in batches at a certain interval.

This updater doesn't poll a data source but opens a persistent connection to the GTFS-RT provider,
which then sends incremental updates immediately as they become available.

The [OneBusAway GTFS-realtime exporter project](https://github.com/OneBusAway/onebusaway-gtfs-realtime-exporter)
provides this kind of streaming, incremental updates over a websocket rather than a single large
file.

<!-- INSERT: websocket-gtfs-rt-updater -->
This system powers the realtime updates in Helsinki and more information can be found
[on Github](https://github.com/HSLdevcom/transitdata).

<!-- INSERT: mqtt-gtfs-rt-updater -->

### Vehicle Positions

Expand Down
4 changes: 4 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle
- Consider escalator edges in island pruning [#5591](https://github.com/opentripplanner/OpenTripPlanner/pull/5591)
- Create own rental preferences for bike and car in the internal model [#5562](https://github.com/opentripplanner/OpenTripPlanner/pull/5562)
- Adding situation-version to TransmodelGraphQL API [#5592](https://github.com/opentripplanner/OpenTripPlanner/pull/5592)
- Move REST API into sandbox [#5580](https://github.com/opentripplanner/OpenTripPlanner/pull/5580)
- Fix high walk reluctance leading to zero egress results for rental searches [#5605](https://github.com/opentripplanner/OpenTripPlanner/pull/5605)
- Remove GTFS-RT websocket updater [#5604](https://github.com/opentripplanner/OpenTripPlanner/pull/5604)
- Add stop layer to new Debug UI [#5602](https://github.com/opentripplanner/OpenTripPlanner/pull/5602)
[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)

## 2.4.0 (2023-09-13)
Expand Down
Loading

0 comments on commit 1198e26

Please sign in to comment.