Skip to content

Commit

Permalink
poi: more triggers and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed Aug 24, 2024
1 parent 373560e commit 6d396ec
Show file tree
Hide file tree
Showing 11 changed files with 1,206 additions and 530 deletions.
67 changes: 40 additions & 27 deletions src/layers/UsePOIsLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,69 @@ import VectorSource from 'ol/source/Vector'
import { Icon, Style } from 'ol/style'
import { POI, POIsStoreState } from '@/stores/POIsStore'

import flight_takeoff_svg from '/src/pois/img/flight_takeoff.svg'
import hotel_svg from '/src/pois/img/hotel.svg'
import local_hospital_svg from '/src/pois/img/local_hospital.svg'
import local_parking_svg from '/src/pois/img/local_parking.svg'
import local_pharmacy_svg from '/src/pois/img/local_pharmacy.svg'
import luggage_svg from '/src/pois/img/luggage.svg'
import museum_svg from '/src/pois/img/museum.svg'
import restaurant_svg from '/src/pois/img/restaurant.svg'
import school_svg from '/src/pois/img/school.svg'
import sports_handball_svg from '/src/pois/img/sports_handball.svg'
import store_svg from '/src/pois/img/store.svg'
import train_svg from '/src/pois/img/train.svg'
import home_and_garden from '/src/pois/img/home_and_garden.svg'
import universal_currency_alt_svg from '/src/pois/img/universal_currency_alt.svg'
import local_atm from '/src/pois/img/local_atm.svg'
import local_gas_station from '/src/pois/img/local_gas_station.svg'
import local_post_office from '/src/pois/img/local_post_office.svg'
import police from '/src/pois/img/police.svg'
import charger from '/src/pois/img/charger.svg'
import charger from '../pois/img/charger.svg'
import cinematic_blur from '../pois/img/cinematic_blur.svg'
import car_repair from '../pois/img/car_repair.svg'
import car_rental from '../pois/img/car_rental.svg'
import flight_takeoff_svg from '../pois/img/flight_takeoff.svg'
import home_and_garden from '../pois/img/home_and_garden.svg'
import hotel_svg from '../pois/img/hotel.svg'
import local_hospital_svg from '../pois/img/local_hospital.svg'
import local_parking_svg from '../pois/img/local_parking.svg'
import local_pharmacy_svg from '../pois/img/local_pharmacy.svg'
import local_atm from '../pois/img/local_atm.svg'
import local_gas_station from '../pois/img/local_gas_station.svg'
import local_post_office from '../pois/img/local_post_office.svg'
import location_city from '../pois/img/location_city.svg'
import luggage_svg from '../pois/img/luggage.svg'
import museum_svg from '../pois/img/museum.svg'
import police from '../pois/img/police.svg'
import pedal_bike from '../pois/img/pedal_bike.svg'
import restaurant_svg from '../pois/img/restaurant.svg'
import school_svg from '../pois/img/school.svg'
import sports_handball_svg from '../pois/img/sports_handball.svg'
import store_svg from '../pois/img/store.svg'
import train_svg from '../pois/img/train.svg'
import universal_currency_alt_svg from '../pois/img/universal_currency_alt.svg'
import visibility from '../pois/img/visibility.svg'
import wifi from '../pois/img/wifi.svg'
import water_drop from '../pois/img/water_drop.svg'

import { createPOIMarker } from '@/layers/createMarkerSVG'
import { Select } from 'ol/interaction'
import Dispatcher from '@/stores/Dispatcher'
import { SelectPOI } from '@/actions/Actions'
import { ObjectEvent } from 'ol/Object'
import { getMap } from '@/map/map'

const svgStrings: { [id: string]: string } = {}

const svgObjects: { [id: string]: any } = {
car_rental: car_rental(),
car_repair: car_repair(),
charger: charger(),
cinematic_blur: cinematic_blur(),
flight_takeoff: flight_takeoff_svg(),
home_and_garden: home_and_garden(),
hotel: hotel_svg(),
local_atm: local_atm(),
local_gas_station: local_gas_station(),
local_hospital: local_hospital_svg(),
local_parking: local_parking_svg(),
local_pharmacy: local_pharmacy_svg(),
local_post_office: local_post_office(),
location_city: location_city(),
luggage: luggage_svg(),
museum: museum_svg(),
pedal_bike: pedal_bike(),
police: police(),
restaurant: restaurant_svg(),
school: school_svg(),
sports_handball: sports_handball_svg(),
store: store_svg(),
train: train_svg(),
universal_currency_alt: universal_currency_alt_svg(),
home_and_garden: home_and_garden(),
local_atm: local_atm(),
local_gas_station: local_gas_station(),
local_post_office: local_post_office(),
police: police(),
charger: charger(),
visibility: visibility(),
water_drop: water_drop(),
wifi: wifi(),
}

// -300 -1260 1560 1560
Expand Down
21 changes: 18 additions & 3 deletions src/pois/AddressParseResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class AddressParseResult {
query = query.toLowerCase()

const smallWords = AddressParseResult.REMOVE_VALUES // e.g. 'restaurants in this area' or 'restaurants in berlin'
const queryTokens: string[] = query.split(' ').filter(token => !smallWords.includes(token))
const queryTokens: string[] = query.split(' ').filter(token => token && !smallWords.includes(token))
const res = AddressParseResult.getGeneric(queryTokens)
if (res.hasPOIs()) return res

Expand Down Expand Up @@ -165,11 +165,19 @@ export class AddressParseResult {
AddressParseResult.REMOVE_VALUES = t('poi_removal_words')
AddressParseResult.TRIGGER_VALUES = [
{ k: 'poi_airports', q: ['aeroway=aerodrome and landuse!=military and military!~.*'], i: 'flight_takeoff' },
// poi_bureau_de_change must come before atm due to single word phrase 'money'
{ k: 'poi_bureau_de_change', q: ['amenity=bureau_de_change'], i: 'local_atm' },
{ k: 'poi_atm', q: ['amenity=atm', 'amenity=bank'], i: 'local_atm' },
{ k: 'poi_banks', q: ['amenity=bank'], i: 'universal_currency_alt' },
{ k: 'poi_bicycle', q: ['shop=bicycle'], i: 'pedal_bike' },
{ k: 'poi_bicycle_rental', q: ['amenity=bicycle_rental'], i: 'pedal_bike' },

{ k: 'poi_car_rental', q: ['amenity=car_rental', 'amenity=car_sharing'], i: 'car_rental' },
{ k: 'poi_car_repair', q: ['shop=car', 'shop=car_repair'], i: 'car_repair' },
{ k: 'poi_bus_stops', q: ['highway=bus_stop'], i: 'train' },
{ k: 'poi_cafe', q: ['amenity=cafe', 'amenity=restaurant and cuisine=coffee_shop'], i: 'restaurant' },
{ k: 'poi_cafe', q: ['amenity=cafe', 'amenity=restaurant and cuisine=coffee_shop', 'amenity=internet_cafe'], i: 'restaurant' },
{ k: 'poi_charging_station', q: ['amenity=charging_station'], i: 'charger' },
{ k: 'poi_cinema', q: ['amenity=cinema'], i: 'cinematic_blur' },

{ k: 'poi_cuisine_american', q: ['cuisine=american', 'origin=american'], i: 'restaurant' },
{ k: 'poi_cuisine_african', q: ['cuisine=african', 'origin=african'], i: 'restaurant' },
Expand All @@ -190,6 +198,7 @@ export class AddressParseResult {
{ k: 'poi_dentist', q: ['amenity=dentist', 'healthcare=dentist'], i: 'local_pharmacy' },
{ k: 'poi_education', q: ['amenity=school', 'building=school', 'building=university'], i: 'school' },

{ k: 'poi_fast_food', q: ['amenity=fast_food'], i: 'restaurant' },
{ k: 'poi_food_burger', q: ['cuisine=burger', 'name~burger'], i: 'restaurant' },
{ k: 'poi_food_kebab', q: ['cuisine=kebab', 'name~kebab'], i: 'restaurant' },
{ k: 'poi_food_pizza', q: ['cuisine=pizza', 'name~pizza'], i: 'restaurant' },
Expand All @@ -207,7 +216,7 @@ export class AddressParseResult {
{ k: 'poi_pharmacies', q: ['amenity=pharmacy'], i: 'local_pharmacy' },
{ k: 'poi_playgrounds', q: ['leisure=playground'], i: 'sports_handball' },
{ k: 'poi_police', q: ['amenity=police'], i: 'police' },
// important to have this before "post"
// poi_post_box must come before poi_post due to single word phrase 'post'
{
k: 'poi_post_box',
q: ['amenity=post_box', 'amenity=post_office', 'amenity=post_depot'],
Expand All @@ -223,10 +232,16 @@ export class AddressParseResult {
{ k: 'poi_restaurants', q: ['amenity=restaurant'], i: 'restaurant' },
{ k: 'poi_schools', q: ['amenity=school', 'building=school'], i: 'school' },
{ k: 'poi_shopping', q: ['shop=*'], i: 'store' },
{ k: 'poi_shop_bakery', q: ['shop=bakery'], i: 'store' },
{ k: 'poi_shop_butcher', q: ['shop=butcher'], i: 'store' },
{ k: 'poi_super_markets', q: ['shop=supermarket', 'building=supermarket'], i: 'store' },
{ k: 'poi_toilets', q: ['amenity=toilets'], i: 'home_and_garden' },
{ k: 'poi_tourism', q: ['tourism=*'], i: 'luggage' },
{ k: 'poi_townhall', q: ['amenity=townhall'], i: 'location_city' },
{ k: 'poi_viewpoint', q: ['tourism=viewpoint'], i: 'visibility' },
{ k: 'poi_water', q: ['amenity=drinking_water'], i: 'water_drop' },
{ k: 'poi_wifi', q: ['internet_access=* and internet_access!=no', 'amenity=internet_cafe'], i: 'wifi' },

].map(v => {
const queries = v.q.map(val => {
return new POIAndQuery(
Expand Down
1 change: 1 addition & 0 deletions src/pois/img/car_rental.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/pois/img/car_repair.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/pois/img/cinematic_blur.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/pois/img/location_city.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/pois/img/pedal_bike.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/pois/img/visibility.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/pois/img/wifi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6d396ec

Please sign in to comment.