From 666b0f1ef480e211d0ccf0a1a5689e4eaefd6a70 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2020 05:15:48 +0000 Subject: [PATCH 1/4] Bump rollup from 2.31.0 to 2.32.0 Bumps [rollup](https://github.com/rollup/rollup) from 2.31.0 to 2.32.0. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v2.31.0...v2.32.0) Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8bd2fefe..cc0672232 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "phantomjs-prebuilt": "~2.1.11", "postcss": "^8.1.1", "postcss-selector-prepend": "^0.5.0", - "rollup": "~2.31.0", + "rollup": "~2.32.0", "rollup-plugin-includepaths": "~0.2.3", "rollup-plugin-progress": "^1.1.1", "rollup-plugin-visualizer": "~4.1.1", From cfd1340a87b751707731cce8cf6abfb65ba90ce0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2020 05:35:06 +0000 Subject: [PATCH 2/4] Bump @ideditor/country-coder from 3.2.0 to 4.0.0 Bumps [@ideditor/country-coder](https://github.com/ideditor/country-coder) from 3.2.0 to 4.0.0. - [Release notes](https://github.com/ideditor/country-coder/releases) - [Commits](https://github.com/ideditor/country-coder/compare/v3.2.0...v4.0.0) Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8bd2fefe..162a95bc3 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "translations": "node scripts/update_locales.js" }, "dependencies": { - "@ideditor/country-coder": "^3.2.0", + "@ideditor/country-coder": "^4.0.0", "@ideditor/location-conflation": "~0.5.0", "@mapbox/sexagesimal": "1.2.0", "@mapbox/togeojson": "0.16.0", From 594932533a3da2b5ea811ac300214185a9dec77b Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Mon, 19 Oct 2020 10:29:54 -0400 Subject: [PATCH 3/4] Add man_made=windpump preset (close #7709) --- data/presets.yaml | 5 +++++ data/presets/presets.json | 1 + data/presets/presets/man_made/windpump.json | 24 +++++++++++++++++++++ data/taginfo.json | 1 + dist/locales/en.json | 4 ++++ 5 files changed, 35 insertions(+) create mode 100644 data/presets/presets/man_made/windpump.json diff --git a/data/presets.yaml b/data/presets.yaml index b22c9cf1d..2d9254d76 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -6726,6 +6726,11 @@ en: name: Windmill # 'terms: wind,wheel,mill' terms: '' + man_made/windpump: + # man_made=windpump + name: Windpump + # 'terms: aerorotor,water pump,windmill,wind pump' + terms: '' man_made/works: # man_made=works name: Factory diff --git a/data/presets/presets.json b/data/presets/presets.json index f6d770932..7a0bd479b 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -821,6 +821,7 @@ "man_made/water_works": {"icon": "temaki-powered_pump", "fields": ["name", "operator", "address"], "moreFields": ["gnis/feature_id"], "geometry": ["point", "area"], "tags": {"man_made": "water_works"}, "name": "Water Works"}, "man_made/watermill": {"icon": "maki-watermill", "fields": ["building_area"], "moreFields": ["gnis/feature_id"], "geometry": ["point", "area"], "terms": ["water", "wheel", "mill"], "tags": {"man_made": "watermill"}, "name": "Watermill"}, "man_made/windmill": {"icon": "maki-windmill", "fields": ["building_area"], "moreFields": ["gnis/feature_id"], "geometry": ["point", "area"], "terms": ["wind", "wheel", "mill"], "tags": {"man_made": "windmill"}, "name": "Windmill"}, + "man_made/windpump": {"icon": "temaki-windpump", "fields": ["ref", "operator", "height", "material", "manufacturer", "lit"], "geometry": ["point"], "terms": ["aerorotor", "water pump", "windmill", "wind pump"], "tags": {"man_made": "windpump"}, "name": "Windpump"}, "man_made/works": {"icon": "maki-industry", "fields": ["name", "operator", "address", "building_area", "product"], "moreFields": ["email", "fax", "gnis/feature_id", "phone", "website"], "geometry": ["point", "area"], "terms": ["assembly", "build", "brewery", "car", "plant", "plastic", "processing", "manufacture", "refinery"], "tags": {"man_made": "works"}, "name": "Factory"}, "marker": {"icon": "temaki-silo", "fields": ["ref", "operator", "marker", "utility", "inscription", "colour"], "moreFields": ["height", "location", "manufacturer", "material"], "geometry": ["point"], "terms": ["identifier", "marking", "plate", "pole", "post", "sign"], "tags": {"marker": "*"}, "name": "Marker"}, "marker/utility": {"icon": "temaki-silo", "fields": ["ref", "operator", "marker", "utility", "{marker}"], "geometry": ["point"], "terms": ["gas line marker", "identifier", "marking", "oil marker", "pipline marker", "plate", "pole", "post", "sign"], "tags": {"marker": "*", "utility": "*"}, "name": "Utility Marker"}, diff --git a/data/presets/presets/man_made/windpump.json b/data/presets/presets/man_made/windpump.json new file mode 100644 index 000000000..dd32b4acc --- /dev/null +++ b/data/presets/presets/man_made/windpump.json @@ -0,0 +1,24 @@ +{ + "icon": "temaki-windpump", + "fields": [ + "ref", + "operator", + "height", + "material", + "manufacturer", + "lit" + ], + "geometry": [ + "point" + ], + "terms": [ + "aerorotor", + "water pump", + "windmill", + "wind pump" + ], + "tags": { + "man_made": "windpump" + }, + "name": "Windpump" +} diff --git a/data/taginfo.json b/data/taginfo.json index e8270da77..dd08e8d0b 100644 --- a/data/taginfo.json +++ b/data/taginfo.json @@ -799,6 +799,7 @@ {"key": "man_made", "value": "water_works", "description": "🄿 Water Works", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/ideditor/temaki/icons/powered_pump.svg"}, {"key": "man_made", "value": "watermill", "description": "🄿 Watermill", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/watermill-15.svg"}, {"key": "man_made", "value": "windmill", "description": "🄿 Windmill", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/windmill-15.svg"}, + {"key": "man_made", "value": "windpump", "description": "🄿 Windpump", "object_types": ["node"], "icon_url": "https://cdn.jsdelivr.net/gh/ideditor/temaki/icons/windpump.svg"}, {"key": "man_made", "value": "works", "description": "🄿 Factory", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/industry-15.svg"}, {"key": "marker", "description": "🄿 Marker, 🄵 Type", "object_types": ["node"], "icon_url": "https://cdn.jsdelivr.net/gh/ideditor/temaki/icons/silo.svg"}, {"key": "utility", "description": "🄿 Utility Marker, 🄵 Utilities, 🄵 Utility", "object_types": ["node"], "icon_url": "https://cdn.jsdelivr.net/gh/ideditor/temaki/icons/silo.svg"}, diff --git a/dist/locales/en.json b/dist/locales/en.json index 5245b7c9a..cc576b64c 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -8617,6 +8617,10 @@ "name": "Windmill", "terms": "wind,wheel,mill" }, + "man_made/windpump": { + "name": "Windpump", + "terms": "aerorotor,water pump,windmill,wind pump" + }, "man_made/works": { "name": "Factory", "terms": "assembly,build,brewery,car,plant,plastic,processing,manufacture,refinery" From a3a9259859bdc0cd9eba134f79fbee6d4d559af1 Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Mon, 19 Oct 2020 13:12:05 -0400 Subject: [PATCH 4/4] Support territories in preset and field country limiters (re: #8102) --- modules/presets/collection.js | 14 +++++++++----- modules/ui/field.js | 13 ++++++------- modules/ui/preset_list.js | 4 ++-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/modules/presets/collection.js b/modules/presets/collection.js index dd1b56021..c2f419cb1 100644 --- a/modules/presets/collection.js +++ b/modules/presets/collection.js @@ -1,4 +1,5 @@ -import { utilArrayUniq, utilEditDistance } from '../util'; +import { utilArrayIntersection, utilArrayUniq } from '../util/array'; +import { utilEditDistance } from '../util'; // @@ -45,7 +46,7 @@ export function presetCollection(collection) { return _this.item(id); }; - _this.search = (value, geometry, countryCode) => { + _this.search = (value, geometry, countryCodes) => { if (!value) return _this; value = value.toLowerCase().trim(); @@ -83,10 +84,13 @@ export function presetCollection(collection) { } let pool = _this.collection; - if (countryCode) { + if (countryCodes) { + if (typeof countryCodes === 'string') countryCodes = [countryCodes]; + countryCodes = countryCodes.map(code => code.toLowerCase()); + pool = pool.filter(a => { - if (a.countryCodes && a.countryCodes.indexOf(countryCode) === -1) return false; - if (a.notCountryCodes && a.notCountryCodes.indexOf(countryCode) !== -1) return false; + if (a.countryCodes && !utilArrayIntersection(a.countryCodes, countryCodes).length) return false; + if (a.notCountryCodes && utilArrayIntersection(a.notCountryCodes, countryCodes).length) return false; return true; }); } diff --git a/modules/ui/field.js b/modules/ui/field.js index d26343bf1..bd92c1afd 100644 --- a/modules/ui/field.js +++ b/modules/ui/field.js @@ -9,6 +9,7 @@ import { geoExtent } from '../geo/extent'; import { uiFieldHelp } from './field_help'; import { uiFields } from './fields'; import { uiTagReference } from './tag_reference'; +import { utilArrayIntersection } from '../util/array'; import { utilRebind, utilUniqueDomId } from '../util'; @@ -306,16 +307,14 @@ export function uiField(context, presetField, entityIDs, options) { if (!extent) return true; var center = extent.center(); - var countryCode = countryCoder.iso1A2Code(center); + var codes = countryCoder.iso1A2Codes(center).map(function(code) { + return code.toLowerCase(); + }); - if (!countryCode) return false; - - countryCode = countryCode.toLowerCase(); - - if (field.countryCodes && field.countryCodes.indexOf(countryCode) === -1) { + if (field.countryCodes && !utilArrayIntersection(codes, field.countryCodes).length) { return false; } - if (field.notCountryCodes && field.notCountryCodes.indexOf(countryCode) !== -1) { + if (field.notCountryCodes && utilArrayIntersection(codes, field.notCountryCodes).length) { return false; } } diff --git a/modules/ui/preset_list.js b/modules/ui/preset_list.js index 3402918ff..aa92d508e 100644 --- a/modules/ui/preset_list.js +++ b/modules/ui/preset_list.js @@ -98,9 +98,9 @@ export function uiPresetList(context) { var results, messageText; if (value.length && extent) { var center = extent.center(); - var countryCode = countryCoder.iso1A2Code(center); + var countryCodes = countryCoder.iso1A2Codes(center); - results = presets.search(value, entityGeometries()[0], countryCode && countryCode.toLowerCase()); + results = presets.search(value, entityGeometries()[0], countryCodes); messageText = t('inspector.results', { n: results.collection.length, search: value