Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-2.x' into layer-groups
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Oct 9, 2024
2 parents 6fea235 + 802d8ed commit b28d4b7
Show file tree
Hide file tree
Showing 124 changed files with 979 additions and 975 deletions.
9 changes: 8 additions & 1 deletion client/src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TripPattern, TripQuery, TripQueryVariables } from '../../gql/graphql.ts
import { NavigationMarkers } from './NavigationMarkers.tsx';
import { LegLines } from './LegLines.tsx';
import { useMapDoubleClick } from './useMapDoubleClick.ts';
import { useState } from 'react';
import { useState, useCallback } from 'react';
import { ContextMenuPopup } from './ContextMenuPopup.tsx';
import { GeometryPropertyPopup } from './GeometryPropertyPopup.tsx';
import DebugLayerControl from './LayerControl.tsx';
Expand All @@ -37,6 +37,9 @@ export function MapView({
const onMapDoubleClick = useMapDoubleClick({ tripQueryVariables, setTripQueryVariables });
const [showContextPopup, setShowContextPopup] = useState<LngLat | null>(null);
const [showPropsPopup, setShowPropsPopup] = useState<PopupData | null>(null);
const [cursor, setCursor] = useState<string>('auto');
const onMouseEnter = useCallback(() => setCursor('pointer'), []);
const onMouseLeave = useCallback(() => setCursor('auto'), []);
const showFeaturePropPopup = (
e: MapMouseEvent & {
features?: MapGeoJSONFeature[] | undefined;
Expand Down Expand Up @@ -76,6 +79,9 @@ export function MapView({
// it's unfortunate that you have to list these layers here.
// maybe there is a way around it: https://github.com/visgl/react-map-gl/discussions/2343
interactiveLayerIds={['regular-stop', 'area-stop', 'group-stop', 'parking-vertex', 'vertex', 'edge', 'link']}
cursor={cursor}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
onClick={showFeaturePropPopup}
// put lat/long in URL and pan to it on page reload
hash={true}
Expand All @@ -86,6 +92,7 @@ export function MapView({
>
<NavigationControl position="top-left" />
<NavigationMarkers
setCursor={setCursor}
tripQueryVariables={tripQueryVariables}
setTripQueryVariables={setTripQueryVariables}
loading={loading}
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/MapView/NavigationMarkers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import markerFlagStart from '../../static/img/marker-flag-start-shadowed.png';
import markerFlagEnd from '../../static/img/marker-flag-end-shadowed.png';

export function NavigationMarkers({
setCursor,
tripQueryVariables,
setTripQueryVariables,
loading,
}: {
setCursor: (cursor: string) => void;
tripQueryVariables: TripQueryVariables;
setTripQueryVariables: (variables: TripQueryVariables) => void;
loading: boolean;
Expand All @@ -19,7 +21,9 @@ export function NavigationMarkers({
draggable
latitude={tripQueryVariables.from.coordinates?.latitude}
longitude={tripQueryVariables.from.coordinates?.longitude}
onDragStart={() => setCursor('grabbing')}
onDragEnd={(e) => {
setCursor('auto');
if (!loading) {
setTripQueryVariables({
...tripQueryVariables,
Expand All @@ -37,7 +41,9 @@ export function NavigationMarkers({
draggable
latitude={tripQueryVariables.to.coordinates?.latitude}
longitude={tripQueryVariables.to.coordinates?.longitude}
onDragStart={() => setCursor('grabbing')}
onDragEnd={(e) => {
setCursor('auto');
if (!loading) {
setTripQueryVariables({
...tripQueryVariables,
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@


<properties>
<otp.serialization.version.id>160</otp.serialization.version.id>
<otp.serialization.version.id>161</otp.serialization.version.id>
<!-- Lib versions - keep list sorted on property name -->
<geotools.version>32.0</geotools.version>
<google.dagger.version>2.52</google.dagger.version>
Expand Down
4 changes: 2 additions & 2 deletions src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OTP Debug Client</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/09/2024-09-30T09:03/assets/index-Bk2IDYff.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/09/2024-09-30T09:03/assets/index-BcsxnGE8.css">
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-09T18:54/assets/index-C6b5LCY-.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-09T18:54/assets/index-BcsxnGE8.css">
</head>
<body>
<div id="root"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.opentripplanner.framework.tostring.ToStringBuilder;
import org.opentripplanner.model.calendar.openinghours.OHCalendar;
import org.opentripplanner.model.calendar.openinghours.OpeningHoursCalendarService;
import org.opentripplanner.openstreetmap.OSMOpeningHoursParser;
import org.opentripplanner.osm.OsmOpeningHoursParser;
import org.opentripplanner.routing.vehicle_parking.VehicleParking;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingState;
Expand All @@ -36,7 +36,7 @@ abstract class ParkAPIUpdater extends GenericJsonDataSource<VehicleParking> {
private final String feedId;
private final Collection<String> staticTags;

private final OSMOpeningHoursParser osmOpeningHoursParser;
private final OsmOpeningHoursParser osmOpeningHoursParser;
private final String url;

public ParkAPIUpdater(
Expand All @@ -47,7 +47,7 @@ public ParkAPIUpdater(
this.feedId = parameters.feedId();
this.staticTags = parameters.tags();
this.osmOpeningHoursParser =
new OSMOpeningHoursParser(openingHoursCalendarService, parameters.timeZone());
new OsmOpeningHoursParser(openingHoursCalendarService, parameters.timeZone());
this.url = parameters.url();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import org.locationtech.jts.geom.Geometry;
import org.opentripplanner.framework.geometry.GeometryUtils;
import org.opentripplanner.graph_builder.issue.api.DataImportIssue;
import org.opentripplanner.openstreetmap.model.OSMNode;
import org.opentripplanner.openstreetmap.model.OSMWithTags;
import org.opentripplanner.osm.model.OsmNode;
import org.opentripplanner.osm.model.OsmWithTags;

public record DisconnectedOsmNode(OSMNode node, OSMWithTags way, OSMWithTags area)
public record DisconnectedOsmNode(OsmNode node, OsmWithTags way, OsmWithTags area)
implements DataImportIssue {
private static final String FMT = "Node %s in way %s is coincident but disconnected with area %s";
private static final String HTMLFMT =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.issue.api.DataImportIssue;
import org.opentripplanner.openstreetmap.model.OSMWithTags;
import org.opentripplanner.osm.model.OsmWithTags;

public record InvalidOsmGeometry(OSMWithTags entity) implements DataImportIssue {
public record InvalidOsmGeometry(OsmWithTags entity) implements DataImportIssue {
private static final String FMT = "Invalid OSM geometry %s";
private static final String HTMLFMT = "Invalid OSM geometry <a href='%s'>'%s'</a>";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.issue.api.DataImportIssue;
import org.opentripplanner.openstreetmap.model.OSMWithTags;
import org.opentripplanner.osm.model.OsmWithTags;

public record InvalidVehicleParkingCapacity(OSMWithTags entity, String capacityValue)
public record InvalidVehicleParkingCapacity(OsmWithTags entity, String capacityValue)
implements DataImportIssue {
private static final String FMT =
"Capacity for osm node %d is not a number: '%s'; it's replaced with '-1' (unknown).";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.issue.api.DataImportIssue;
import org.opentripplanner.openstreetmap.model.OSMWithTags;
import org.opentripplanner.osm.model.OsmWithTags;

public record LevelAmbiguous(String layerName, OSMWithTags entity) implements DataImportIssue {
public record LevelAmbiguous(String layerName, OsmWithTags entity) implements DataImportIssue {
private static final String FMT =
"Could not infer floor number for layer called '%s' at %s. " +
"Vertical movement will still be possible, but elevator cost might be incorrect. " +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.issue.api.DataImportIssue;
import org.opentripplanner.openstreetmap.model.OSMWithTags;
import org.opentripplanner.osm.model.OsmWithTags;

public record ParkAndRideUnlinked(String name, OSMWithTags entity) implements DataImportIssue {
public record ParkAndRideUnlinked(String name, OsmWithTags entity) implements DataImportIssue {
private static final String FMT =
"Park and ride '%s' (%s) not linked to any streets in OSM; entrance might not be placed correctly.";
private static final String HTMLFMT =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.issue.api.DataImportIssue;
import org.opentripplanner.openstreetmap.model.OSMWithTags;
import org.opentripplanner.osm.model.OsmWithTags;

public record TurnRestrictionUnknown(OSMWithTags entity, String tagval) implements DataImportIssue {
public record TurnRestrictionUnknown(OsmWithTags entity, String tagval) implements DataImportIssue {
private static final String FMT = "Invalid turn restriction tag %s in turn restriction %d";
private static final String HTMLFMT = "Invalid turn restriction tag %s in <a href='%s'>'%s'</a>";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.opentripplanner.gtfs.graphbuilder.GtfsModule;
import org.opentripplanner.netex.NetexModule;
import org.opentripplanner.netex.configure.NetexConfigure;
import org.opentripplanner.openstreetmap.OsmProvider;
import org.opentripplanner.osm.OsmProvider;
import org.opentripplanner.routing.api.request.preference.WalkPreferences;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.standalone.config.BuildConfig;
Expand All @@ -55,7 +55,7 @@ public class GraphBuilderModules {

@Provides
@Singleton
static OsmModule provideOpenStreetMapModule(
static OsmModule provideOsmModule(
GraphBuilderDataSources dataSources,
BuildConfig config,
Graph graph,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.geom.TopologyException;
import org.opentripplanner.framework.geometry.GeometryUtils;
import org.opentripplanner.openstreetmap.model.OSMNode;
import org.opentripplanner.openstreetmap.model.OSMWay;
import org.opentripplanner.openstreetmap.model.OSMWithTags;
import org.opentripplanner.osm.model.OsmNode;
import org.opentripplanner.osm.model.OsmWay;
import org.opentripplanner.osm.model.OsmWithTags;

/**
* Stores information about an OSM area needed for visibility graph construction. Algorithm based on
Expand All @@ -25,14 +25,14 @@ class Area {

final List<Ring> outermostRings;
// This is the way or relation that has the relevant tags for the area
final OSMWithTags parent;
final OsmWithTags parent;
public MultiPolygon jtsMultiPolygon;

Area(
OSMWithTags parent,
List<OSMWay> outerRingWays,
List<OSMWay> innerRingWays,
TLongObjectMap<OSMNode> nodes
OsmWithTags parent,
List<OsmWay> outerRingWays,
List<OsmWay> innerRingWays,
TLongObjectMap<OsmNode> nodes
) {
this.parent = parent;
// ring assignment
Expand Down Expand Up @@ -84,16 +84,16 @@ class Area {
jtsMultiPolygon = calculateJTSMultiPolygon();
}

public List<TLongList> constructRings(List<OSMWay> ways) {
public List<TLongList> constructRings(List<OsmWay> ways) {
if (ways.size() == 0) {
// no rings is no rings
return Collections.emptyList();
}

List<TLongList> closedRings = new ArrayList<>();

ArrayListMultimap<Long, OSMWay> waysByEndpoint = ArrayListMultimap.create();
for (OSMWay way : ways) {
ArrayListMultimap<Long, OsmWay> waysByEndpoint = ArrayListMultimap.create();
for (OsmWay way : ways) {
TLongList refs = way.getNodeRefs();

long start = refs.get(0);
Expand All @@ -110,7 +110,7 @@ public List<TLongList> constructRings(List<OSMWay> ways) {
// Precheck for impossible situations, and remove those.
TLongList endpointsToRemove = new TLongArrayList();
for (Long endpoint : waysByEndpoint.keySet()) {
Collection<OSMWay> list = waysByEndpoint.get(endpoint);
Collection<OsmWay> list = waysByEndpoint.get(endpoint);
if (list.size() % 2 == 1) {
endpointsToRemove.add(endpoint);
}
Expand All @@ -126,9 +126,9 @@ public List<TLongList> constructRings(List<OSMWay> ways) {
}

long firstEndpoint = 0, otherEndpoint = 0;
OSMWay firstWay = null;
OsmWay firstWay = null;
for (Long endpoint : waysByEndpoint.keySet()) {
List<OSMWay> list = waysByEndpoint.get(endpoint);
List<OsmWay> list = waysByEndpoint.get(endpoint);
firstWay = list.get(0);
TLongList nodeRefs = firstWay.getNodeRefs();
partialRing.addAll(nodeRefs);
Expand Down Expand Up @@ -161,14 +161,14 @@ private MultiPolygon calculateJTSMultiPolygon() {
}

private boolean constructRingsRecursive(
ArrayListMultimap<Long, OSMWay> waysByEndpoint,
ArrayListMultimap<Long, OsmWay> waysByEndpoint,
TLongList ring,
List<TLongList> closedRings,
long endpoint
) {
List<OSMWay> ways = new ArrayList<>(waysByEndpoint.get(endpoint));
List<OsmWay> ways = new ArrayList<>(waysByEndpoint.get(endpoint));

for (OSMWay way : ways) {
for (OsmWay way : ways) {
// remove this way from the map
TLongList nodeRefs = way.getNodeRefs();
long firstEndpoint = nodeRefs.get(0);
Expand Down Expand Up @@ -200,9 +200,9 @@ private boolean constructRingsRecursive(

// otherwise, we need to start a new partial ring
newRing = new TLongArrayList();
OSMWay firstWay = null;
OsmWay firstWay = null;
for (Long entry : waysByEndpoint.keySet()) {
List<OSMWay> list = waysByEndpoint.get(entry);
List<OsmWay> list = waysByEndpoint.get(entry);
firstWay = list.get(0);
nodeRefs = firstWay.getNodeRefs();
newRing.addAll(nodeRefs);
Expand Down
Loading

0 comments on commit b28d4b7

Please sign in to comment.