mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 17:14:04 +02:00
Properly export areaKeys, fix preset and maprules tests
This commit is contained in:
@@ -484,7 +484,7 @@ export function coreContext() {
|
||||
var maprules = utilStringQs(window.location.hash).maprules;
|
||||
d3_json(maprules, function (err, mapcss) {
|
||||
if (err) return;
|
||||
services.maprules.init(context.presets().areaKeys());
|
||||
services.maprules.init();
|
||||
_each(mapcss, function(mapcssSelector) {
|
||||
return services.maprules.addRule(mapcssSelector);
|
||||
});
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ export * from './validations/index';
|
||||
import { services } from './services/index';
|
||||
var Connection = services.osm;
|
||||
export { Connection };
|
||||
export { coreContext as Context, setAreaKeys } from './core/context';
|
||||
export { coreContext as Context, setAreaKeys, areaKeys } from './core/context';
|
||||
export { coreDifference as Difference } from './core/difference';
|
||||
export { coreGraph as Graph } from './core/graph';
|
||||
export { coreHistory as History } from './core/history';
|
||||
|
||||
@@ -4,7 +4,6 @@ export function osmIsInterestingTag(key) {
|
||||
key !== 'source' &&
|
||||
key !== 'odbl' &&
|
||||
key.indexOf('tiger:') !== 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ import _isMatch from 'lodash-es/isMatch';
|
||||
import _intersection from 'lodash-es/intersection';
|
||||
import _reduce from 'lodash-es/reduce';
|
||||
import _every from 'lodash-es/every';
|
||||
import { areaKeys } from '../core/context';
|
||||
|
||||
|
||||
var buildRuleChecks = function() {
|
||||
return {
|
||||
@@ -95,12 +97,13 @@ var buildLineKeys = function() {
|
||||
};
|
||||
|
||||
export default {
|
||||
init: function(areaKeys) {
|
||||
init: function() {
|
||||
this._ruleChecks = buildRuleChecks();
|
||||
this._validationRules = [];
|
||||
this._areaKeys = areaKeys;
|
||||
this._lineKeys = buildLineKeys();
|
||||
},
|
||||
|
||||
// list of rules only relevant to tag checks...
|
||||
filterRuleChecks: function(selector) {
|
||||
var _ruleChecks = this._ruleChecks;
|
||||
@@ -111,6 +114,7 @@ export default {
|
||||
return rules;
|
||||
}, []);
|
||||
},
|
||||
|
||||
// builds tagMap from mapcss-parse selector object...
|
||||
buildTagMap: function(selector) {
|
||||
var getRegexValues = function(regexes) {
|
||||
@@ -153,6 +157,7 @@ export default {
|
||||
|
||||
return tagMap;
|
||||
},
|
||||
|
||||
// inspired by osmWay#isArea()
|
||||
inferGeometry: function(tagMap) {
|
||||
var _lineKeys = this._lineKeys;
|
||||
@@ -185,6 +190,7 @@ export default {
|
||||
|
||||
return 'line';
|
||||
},
|
||||
|
||||
// adds from mapcss-parse selector check...
|
||||
addRule: function(selector) {
|
||||
var rule = {
|
||||
@@ -219,9 +225,12 @@ export default {
|
||||
};
|
||||
this._validationRules.push(rule);
|
||||
},
|
||||
|
||||
clearRules: function() { this._validationRules = []; },
|
||||
|
||||
// returns validationRules...
|
||||
validationRules: function() { return this._validationRules; },
|
||||
|
||||
// returns ruleChecks
|
||||
ruleChecks: function() { return this._ruleChecks; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user