digitransit-ui/app/component/map/tile-layer/VectorTileLayerContainer.js
2025-07-03 14:25:08 +03:00

68 lines
2 KiB
JavaScript

import PropTypes from 'prop-types';
import React from 'react';
import { configShape } from '../../../util/shapes';
import TileLayerContainer from './TileLayerContainer';
import VehicleRentalStations from './VehicleRentalStations';
import Stops from './Stops';
import ParkAndRideForCars from './ParkAndRideForCars';
import ParkAndRideForBikes from './ParkAndRideForBikes';
import { mapLayerShape } from '../../../store/MapLayerStore';
import RentalVehicles from './RentalVehicles';
export default function VectorTileLayerContainer(props, { config }) {
const layers = [];
layers.push(Stops);
if (props.mapLayers.citybike) {
layers.push(VehicleRentalStations);
}
if (props.mapLayers.parkAndRide) {
layers.push(ParkAndRideForCars);
}
if (props.mapLayers.parkAndRideForBikes) {
layers.push(ParkAndRideForBikes);
}
if (props.mapLayers.scooter) {
layers.push(RentalVehicles);
}
return (
<TileLayerContainer
key="tileLayer"
pane="markerPane"
layers={layers}
mapLayers={props.mapLayers}
mergeStops={props.mergeStops}
highlightedStops={props.highlightedStops}
stopsToShow={props.stopsToShow}
objectsToHide={props.objectsToHide}
tileSize={config.map.tileSize || 256}
zoomOffset={config.map.zoomOffset || 0}
locationPopup={props.locationPopup}
onSelectLocation={props.onSelectLocation}
/>
);
}
VectorTileLayerContainer.propTypes = {
mapLayers: mapLayerShape.isRequired,
highlightedStops: PropTypes.arrayOf(PropTypes.string),
stopsToShow: PropTypes.arrayOf(PropTypes.string),
objectsToHide: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
mergeStops: PropTypes.bool,
locationPopup: PropTypes.string,
onSelectLocation: PropTypes.func,
};
VectorTileLayerContainer.defaultProps = {
objectsToHide: { vehicleRentalStations: [] },
highlightedStops: undefined,
stopsToShow: undefined,
mergeStops: false,
onSelectLocation: undefined,
locationPopup: undefined,
};
VectorTileLayerContainer.contextTypes = {
config: configShape.isRequired,
};