2023-06-09 16:15:02 +00:00
|
|
|
import {
|
|
|
|
overlayDefinitions,
|
|
|
|
osmTags,
|
|
|
|
} from './src/components/overlays/overlay-definitions';
|
2023-01-31 10:56:40 +00:00
|
|
|
|
2023-06-09 16:15:02 +00:00
|
|
|
// One timer
|
2023-01-31 10:56:40 +00:00
|
|
|
|
2023-06-09 16:15:02 +00:00
|
|
|
// let tags = {};
|
|
|
|
// let overlays = {};
|
|
|
|
|
|
|
|
// for (const tagName of Object.keys(legacyOverlayDefinitions)) {
|
|
|
|
// for (const tagValue of Object.keys(legacyOverlayDefinitions[tagName])) {
|
|
|
|
// tags[tagValue] = { name: tagName, value: tagValue };
|
|
|
|
// for (const activity of Object.keys(
|
|
|
|
// legacyOverlayDefinitions[tagName][tagValue]
|
|
|
|
// )) {
|
|
|
|
// if (!overlays[activity]) {
|
|
|
|
// overlays[activity] = {};
|
|
|
|
// }
|
|
|
|
// for (const category of Object.keys(
|
|
|
|
// legacyOverlayDefinitions[tagName][tagValue][activity]
|
|
|
|
// )) {
|
|
|
|
// if (!overlays[activity][category]) {
|
|
|
|
// overlays[activity][category] = [];
|
|
|
|
// }
|
|
|
|
// overlays[activity][category].push(tagValue);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
2023-01-31 10:56:40 +00:00
|
|
|
|
2023-06-09 16:15:02 +00:00
|
|
|
// console.log({
|
|
|
|
// caller: 'onetimer / result',
|
|
|
|
// tags: JSON.stringify(tags),
|
|
|
|
// overlays: JSON.stringify(overlays),
|
|
|
|
// });
|
2023-06-05 09:17:01 +00:00
|
|
|
|
2023-06-09 16:15:02 +00:00
|
|
|
// End of one timer
|
2023-06-05 09:17:01 +00:00
|
|
|
|
2023-06-09 16:15:02 +00:00
|
|
|
for (const overlayCategory of Object.keys(overlayDefinitions)) {
|
|
|
|
let filters: any[] = ['any'];
|
|
|
|
const definitions = overlayDefinitions[overlayCategory];
|
|
|
|
let tags = {};
|
|
|
|
for (const category of Object.keys(definitions)) {
|
|
|
|
//console.log({ category });
|
|
|
|
for (const tagId of definitions[category]) {
|
|
|
|
//console.log({ tagId });
|
|
|
|
const tag = osmTags[tagId];
|
|
|
|
if (!tags[tag.name]) {
|
|
|
|
tags[tag.name] = [];
|
2023-06-05 09:17:01 +00:00
|
|
|
}
|
2023-06-09 16:15:02 +00:00
|
|
|
tags[tag.name].push(tag.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const tagName of Object.keys(tags)) {
|
|
|
|
let filter = ['in', tagName];
|
|
|
|
for (const tagValue of tags[tagName]) {
|
|
|
|
filter.push(tagValue);
|
2023-06-05 09:17:01 +00:00
|
|
|
}
|
2023-06-09 16:15:02 +00:00
|
|
|
filters.push(filter);
|
2023-06-05 09:17:01 +00:00
|
|
|
}
|
2023-06-09 16:15:02 +00:00
|
|
|
console.log({ overlayCategory, filters: JSON.stringify(filters) });
|
2023-06-05 09:17:01 +00:00
|
|
|
}
|