Moving stuff around so that helper.ts works again

This commit is contained in:
vdv committed 2023-06-09 18:15:02 +02:00
1 parent ba09d5ef50
commit 28271da640
7 files changed
+95 -82

No files matched your search

+5 -5
View File
@@ -20,12 +20,12 @@ import { createDefaultStyle } from 'ol/style/Style';
import osmIcons from './osm-icons';
import { getZoomInteger } from '../map/Map';
import {
getTagType,
isHighlightedTagType,
} from '../map-tile-provider/MapTileProvider';
import { isHighlightedTagType } from '../map-tile-provider/MapTileProvider';
import { getCenter } from 'ol/extent';
import { getVectorTileFeatureType } from '../overlays/overlay-definitions';
import {
getVectorTileFeatureType,
getTagType,
} from '../overlays/overlay-definitions';
import { Category } from '../wpt/WptEditDialog';
interface StyleParameters {
+2 -5
View File
@@ -13,14 +13,11 @@ import Dialog from '../dialog';
import Tree from '../tree';
import { GpxViewer } from '../gpx';
import { Browser } from '@capacitor/browser';
import { isHighlighted } from '../map-tile-provider';
import {
isHighlightedTagType,
getTagType,
} from '../map-tile-provider/MapTileProvider';
import { isHighlightedTagType } from '../map-tile-provider/MapTileProvider';
import style from '../gpx/styles';
import OsmFindAll from './OsmFindAll';
import { toLonLat } from 'ol/proj';
import { getTagType } from '../overlays/overlay-definitions';
const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2,
@@ -1,9 +1,7 @@
import OSM from 'ol/source/OSM';
import XYZ from 'ol/source/XYZ';
import { Component, createEffect, createSignal, For, Show } from 'solid-js';
import {
useI18n,
} from '@solid-primitives/i18n';
import { useI18n } from '@solid-primitives/i18n';
import style from './MapTileProvider.module.css';
import LayersIcon from '@suid/icons-material/Layers';
@@ -25,6 +23,7 @@ import {
overlayDefinitions,
osmTags,
OsmTag,
getTagType,
} from '../overlays/overlay-definitions';
import { cloneDeep } from 'lodash';
@@ -152,17 +151,6 @@ const currentOverlayHighlightedKey = () =>
? currentOverlay().highlighted
: 'none';
export const getTagType = (feature: Feature) => {
for (const tagType of Object.keys(osmTags)) {
const tag: OsmTag = osmTags[tagType];
const tagValue = feature.get(tag.name);
if (tagValue === tag.value) {
return tagType;
}
}
return false;
};
export const isHighlightedTagType = (tagType: string) => {
const currentOverlayHighlightedDefinition: string[] =
overlayDefinitions[currentOverlayKey()][currentOverlayHighlightedKey()];
+6 -1
View File
@@ -1 +1,6 @@
import { overlayDefinitions, OsmTag, osmTags } from './overlay-definitions';
import {
overlayDefinitions,
OsmTag,
osmTags,
getTagType,
} from './overlay-definitions';
+11 -1
View File
@@ -1,5 +1,4 @@
import { Feature } from 'ol';
import { getTagType } from '../map-tile-provider/MapTileProvider';
export interface OsmTag {
name: string;
@@ -270,6 +269,17 @@ export const overlayDefinitions = {
},
};
export const getTagType = (feature: Feature) => {
for (const tagType of Object.keys(osmTags)) {
const tag: OsmTag = osmTags[tagType];
const tagValue = feature.get(tag.name);
if (tagValue === tag.value) {
return tagType;
}
}
return false;
};
export const getVectorTileFeatureType = (feature: Feature) => {
if (
['hiking'].includes(feature.get('route')) ||
+14 -11
View File
@@ -49,27 +49,31 @@
"in",
"amenity",
"bar",
"pub",
"cafe",
"drinking_water",
"water_point",
"fast_food",
"food_court",
"pub",
"restaurant",
"cafe",
"atm",
"bank",
"atm",
"bank",
"waste_basket",
"waste_disposal",
"vending_machine",
"doctors",
"hospital",
"pharmacy",
"police",
"fire_station",
"drinking_water",
"water_point",
"waste_basket",
"waste_disposal",
"vending_machine"
"fire_station"
],
[
"in",
"shop",
"water",
"bakery",
"butcher",
"cheese",
@@ -82,13 +86,12 @@
"pasta",
"pastry",
"seafood",
"water",
"department_store",
"general",
"mall",
"supermarket",
"wholesale",
"outdoor",
"department_store",
"general",
"mall",
"laundry"
],
[