import { createEffect, createResource, For, useContext, VoidComponent } from 'solid-js'; import { Circle, Fill, Stroke, Style } from 'ol/style'; import OlFeature from 'ol/Feature'; import OlPoint from 'ol/geom/Point'; import OlPolygon from 'ol/geom/Polygon'; import { Stop, StopShape } from '../types'; import { BusinessDataContext, BusinessDataStore } from "../businessData"; import { SearchContext, SearchStore } from "./searchStore"; // TODO: Use boolean to set MapStop selected export const MapStop: VoidComponent<{ stop: Stop, selected: Stop | undefined }> = (props) => { const businessDataStore: BusinessDataStore | undefined = useContext(BusinessDataContext); const searchStore: SearchStore | undefined = useContext(SearchContext); if (businessDataStore === undefined || searchStore === undefined) return
; const { getStopShape } = businessDataStore; const { setMapFeature } = searchStore; const stopStyle = new Style({ image: new Circle({ fill: undefined, stroke: new Stroke({ color: '#3399CC', width: 1.5 }), radius: 10, }), }); const selectedStopStyle = new Style({ image: new Circle({ fill: undefined, stroke: new Stroke({ color: 'purple', width: 2 }), radius: 10, }), }); const stopAreaStyle = new Style({ stroke: new Stroke({ color: 'red' }), fill: new Fill({ color: 'rgba(255,255,255,0.2)' }), }); const getShape = async (stopId: number): Promise