mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Move areaKeys and setAreaKeys to modules/osm/tags
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
export var areaKeys = {};
|
||||
|
||||
export function setAreaKeys(value) {
|
||||
areaKeys = value;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t, currentLocale, addTranslation, setLocale } from '../util/locale';
|
||||
|
||||
import { setAreaKeys } from './area_keys';
|
||||
import { osmSetAreaKeys } from '../osm/tags';
|
||||
|
||||
import { coreHistory } from './history';
|
||||
import { coreValidator } from './validator';
|
||||
@@ -549,11 +549,11 @@ export function coreContext() {
|
||||
var external = utilStringQs(window.location.hash).presets;
|
||||
presets.fromExternal(external, function(externalPresets) {
|
||||
context.presets = function() { return externalPresets; }; // default + external presets...
|
||||
setAreaKeys(presets.areaKeys());
|
||||
osmSetAreaKeys(presets.areaKeys());
|
||||
});
|
||||
} else {
|
||||
presets.init();
|
||||
setAreaKeys(presets.areaKeys());
|
||||
osmSetAreaKeys(presets.areaKeys());
|
||||
}
|
||||
|
||||
return context;
|
||||
|
||||
@@ -25,7 +25,7 @@ import { services } from './services/index';
|
||||
var Connection = services.osm;
|
||||
export { Connection };
|
||||
export { coreContext as Context } from './core/context';
|
||||
export { setAreaKeys, areaKeys } from './core/area_keys';
|
||||
export { osmSetAreaKeys as setAreaKeys, osmAreaKeys as areaKeys } from './osm/tags';
|
||||
export { coreDifference as Difference } from './core/difference';
|
||||
export { coreGraph as Graph } from './core/graph';
|
||||
export { coreHistory as History } from './core/history';
|
||||
|
||||
@@ -6,6 +6,11 @@ export function osmIsInterestingTag(key) {
|
||||
key.indexOf('tiger:') !== 0;
|
||||
}
|
||||
|
||||
export var osmAreaKeys = {};
|
||||
|
||||
export function osmSetAreaKeys(value) {
|
||||
osmAreaKeys = value;
|
||||
}
|
||||
|
||||
export var osmOneWayTags = {
|
||||
'aerialway': {
|
||||
|
||||
@@ -3,8 +3,7 @@ import { geoArea as d3_geoArea } from 'd3-geo';
|
||||
import { geoExtent, geoVecCross } from '../geo';
|
||||
import { osmEntity } from './entity';
|
||||
import { osmLanes } from './lanes';
|
||||
import { osmOneWayTags, osmRightSideIsInsideTags } from './tags';
|
||||
import { areaKeys } from '../core/area_keys';
|
||||
import { osmAreaKeys, osmOneWayTags, osmRightSideIsInsideTags } from './tags';
|
||||
import { utilArrayUniq } from '../util';
|
||||
|
||||
|
||||
@@ -214,7 +213,7 @@ Object.assign(osmWay.prototype, {
|
||||
};
|
||||
var returnTags = {};
|
||||
for (var key in this.tags) {
|
||||
if (key in areaKeys && !(this.tags[key] in areaKeys[key])) {
|
||||
if (key in osmAreaKeys && !(this.tags[key] in osmAreaKeys[key])) {
|
||||
returnTags[key] = this.tags[key];
|
||||
return returnTags;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { areaKeys } from '../core/area_keys';
|
||||
import { osmAreaKeys } from '../osm/tags';
|
||||
import { utilArrayUniq, utilObjectOmit } from '../util';
|
||||
|
||||
|
||||
@@ -235,14 +235,14 @@ export function presetPreset(id, preset, fields, visible, rawPresets) {
|
||||
// Add area=yes if necessary.
|
||||
// This is necessary if the geometry is already an area (e.g. user drew an area) AND any of:
|
||||
// 1. chosen preset could be either an area or a line (`barrier=city_wall`)
|
||||
// 2. chosen preset doesn't have a key in areaKeys (`railway=station`)
|
||||
// 2. chosen preset doesn't have a key in osmAreaKeys (`railway=station`)
|
||||
if (!addTags.hasOwnProperty('area')) {
|
||||
delete tags.area;
|
||||
if (geometry === 'area') {
|
||||
var needsAreaTag = true;
|
||||
if (preset.geometry.indexOf('line') === -1) {
|
||||
for (k in addTags) {
|
||||
if (k in areaKeys) {
|
||||
if (k in osmAreaKeys) {
|
||||
needsAreaTag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { areaKeys } from '../core/area_keys';
|
||||
import { osmAreaKeys as areaKeys } from '../osm/tags';
|
||||
import { utilArrayIntersection } from '../util';
|
||||
import { validationIssue } from '../core/validation';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user