mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
This also includes a bunch of tweaks to make the tests work in both PhantomJS and modern browsers like Chrome. Basically - introduce some more async into the test code so that the coreData.get promise is guaranteed to settle. Because in PhantomJS the promise is polyfilled, and Chrome it's native, they work slightly differently.
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
export { dataLocales } from './locales.json';
|
|
export { en as dataEn } from '../dist/locales/en.json';
|
|
|
|
import {
|
|
features as ociCustomFeatures,
|
|
resources as ociResources
|
|
} from 'osm-community-index';
|
|
|
|
import { dataImagery } from './imagery.json';
|
|
import { presets } from './presets/presets.json';
|
|
import { defaults } from './presets/defaults.json';
|
|
import { categories } from './presets/categories.json';
|
|
import { fields } from './presets/fields.json';
|
|
|
|
import LocationConflation from '@ideditor/location-conflation';
|
|
import whichPolygon from 'which-polygon';
|
|
|
|
|
|
// index the osm-community-index
|
|
let ociFeatures = {};
|
|
const loco = new LocationConflation({ type: 'FeatureCollection', features: ociCustomFeatures });
|
|
|
|
Object.values(ociResources).forEach(resource => {
|
|
const feature = loco.resolveLocationSet(resource.locationSet);
|
|
let ociFeature = ociFeatures[feature.id];
|
|
if (!ociFeature) {
|
|
ociFeature = JSON.parse(JSON.stringify(feature)); // deep clone
|
|
ociFeature.properties.resourceIDs = new Set();
|
|
ociFeatures[feature.id] = ociFeature;
|
|
}
|
|
ociFeature.properties.resourceIDs.add(resource.id);
|
|
});
|
|
|
|
|
|
export let data = {
|
|
community: {
|
|
features: ociFeatures,
|
|
resources: ociResources,
|
|
query: whichPolygon({ type: 'FeatureCollection', features: Object.values(ociFeatures) })
|
|
},
|
|
imagery: dataImagery, //legacy
|
|
presets: {
|
|
presets: presets,
|
|
defaults: defaults,
|
|
categories: categories,
|
|
fields: fields
|
|
}
|
|
};
|