Merge branch 'master' into validation

This commit is contained in:
Quincy Morgan
2019-01-30 16:44:14 -05:00
60 changed files with 1903 additions and 2002 deletions
+1 -1
View File
@@ -505,7 +505,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
View File
@@ -25,7 +25,7 @@ export { IssueManager } from './validations/issue_manager';
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';
-1
View File
@@ -4,7 +4,6 @@ export function osmIsInterestingTag(key) {
key !== 'source' &&
key !== 'odbl' &&
key.indexOf('tiger:') !== 0;
}
+10 -1
View File
@@ -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';
import {
ValidationIssueType,
@@ -101,12 +103,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;
@@ -117,6 +120,7 @@ export default {
return rules;
}, []);
},
// builds tagMap from mapcss-parse selector object...
buildTagMap: function(selector) {
var getRegexValues = function(regexes) {
@@ -159,6 +163,7 @@ export default {
return tagMap;
},
// inspired by osmWay#isArea()
inferGeometry: function(tagMap) {
var _lineKeys = this._lineKeys;
@@ -191,6 +196,7 @@ export default {
return 'line';
},
// adds from mapcss-parse selector check...
addRule: function(selector) {
var rule = {
@@ -228,9 +234,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; }
};