updated: some error colors; fixed: error 320, 220

This commit is contained in:
Thomas Hervey
2018-09-05 17:01:42 -06:00
committed by Bryan Housel
parent 1f7455fdad
commit ee00635cc4
8 changed files with 151 additions and 126 deletions
+7 -7
View File
@@ -2572,7 +2572,7 @@ input.key-trap {
.kr_error_type_41,
.kr_error_type_42,
.kr_error_type_43 {
color: #894668;
color: #fd007f;
}
.kr_error_type_50 {
@@ -2618,7 +2618,7 @@ input.key-trap {
}
.kr_error_type_180 {
color: #09ef12;
color: #01ff0a;
}
.kr_error_type_190,
@@ -2642,7 +2642,7 @@ input.key-trap {
.kr_error_type_206,
.kr_error_type_207,
.kr_error_type_208 {
color: #71f264;
color: #fdbf6f;
}
.kr_error_type_210,
@@ -2659,7 +2659,7 @@ input.key-trap {
.kr_error_type_230,
.kr_error_type_231,
.kr_error_type_232 {
color: #5f775c;
color: #b15928;
}
.kr_error_type_270 {
@@ -2684,7 +2684,7 @@ input.key-trap {
.kr_error_type_296,
.kr_error_type_297,
.kr_error_type_298 {
color: #d1dce7;
color: #a6cee3;
}
.kr_error_type_310,
@@ -2699,7 +2699,7 @@ input.key-trap {
}
.kr_error_type_350 {
color: #4d719c;
color: #ffff99;
}
.kr_error_type_370 {
@@ -2713,7 +2713,7 @@ input.key-trap {
.kr_error_type_400,
.kr_error_type_401,
.kr_error_type_402 {
color: #b20e36;
color: #b64f69;
}
.kr_error_type_410,
+2 -1
View File
@@ -1163,7 +1163,7 @@ en:
description: 'This bridge doesn''t have a tag in common with its surrounding ways that shows the purpose of this bridge. There should be one of these tags: {var1}.'
_370:
title: 'doubled places'
description: 'This node has tags in common with the surrounding way #{var1} {var2}and seems to be redundant'
description: 'This node has tags in common with the surrounding way #{var1} {var2}and seems to be redundant.'
_380:
title: 'non-physical use of sport-tag'
description: 'This way is tagged "sport"="{var1}" but has no physical tag like e.g. leisure, building, amenity or highway.'
@@ -1173,6 +1173,7 @@ en:
_401:
title: 'missing turn restriction'
description: 'ways {var1} and {var2} join in a very sharp angle here and there is no oneway tag or turn restriction that prevents turning from way {var3} to {var4}.'
addition: ' from way {var3} to {var4}.'
_402:
title: 'impossible angles'
description: 'this way bends in a very sharp angle here.'
+3 -2
View File
@@ -1440,7 +1440,7 @@
},
"_370": {
"title": "doubled places",
"description": "This node has tags in common with the surrounding way #{var1} {var2}and seems to be redundant"
"description": "This node has tags in common with the surrounding way #{var1} {var2}and seems to be redundant."
},
"_380": {
"title": "non-physical use of sport-tag",
@@ -1452,7 +1452,8 @@
},
"_401": {
"title": "missing turn restriction",
"description": "ways {var1} and {var2} join in a very sharp angle here and there is no oneway tag or turn restriction that prevents turning from way {var3} to {var4}."
"description": "ways {var1} and {var2} join in a very sharp angle here and there is no oneway tag or turn restriction that prevents turning from way {var3} to {var4}.",
"addition": " from way {var3} to {var4}."
},
"_402": {
"title": "impossible angles",
+14 -1
View File
@@ -8,7 +8,7 @@ import rbush from 'rbush';
import { dispatch as d3_dispatch } from 'd3-dispatch';
import { request as d3_request } from 'd3-request';
import { geoExtent } from '../geo';
import { geoExtent, geoVecAdd } from '../geo';
import { krError } from '../osm';
@@ -158,6 +158,19 @@ export default {
var features = data.features.map(function(feature) {
var loc = feature.geometry.coordinates;
var props = feature.properties;
// TODO: finish implementing overlapping error offset
// // if errors are coincident, move them apart slightly
// var coincident = false;
// var epsilon = 0.00001;
// do {
// if (coincident) {
// loc = geoVecAdd(loc, [epsilon, epsilon]);
// }
// var bbox = geoExtent(loc).bbox();
// coincident = cache.rtree.search(bbox).length;
// } while (coincident);
var d = new krError ({
loc: loc,
id: props.error_id,
+4 -4
View File
@@ -217,7 +217,7 @@
},
"_220": {
"title": "misspelled tags",
"description": "This (node|way|relation) is tagged '([\\w:]+)=(.+)' where "(\\2|\\3)" looks like "([\\w\\s]+)"",
"description": "This (node|way|relation) is tagged '([\\w]+)(:([\\w]+))?=(.+)' where "(\\2|\\3|\\4|\\5)" looks like "([\\w\\s]+)"",
"regex": true
},
"_221": {
@@ -340,7 +340,7 @@
},
"_320": {
"title": "*_link connections",
"description": "This way is tagged as highway=(\\w+)_link but doesn''t have a connection to any other \\1 or \\1_link",
"description": "This way is tagged as highway=(\\w+)_link but doesn't have a connection to any other \\1 or \\1_link",
"regex": true
},
"_350": {
@@ -362,11 +362,11 @@
},
"_400": {
"title": "geometry glitches",
"description": "Impossible sharp angles on highways and junctions. These may be caused by missing turn restrictions on junctions or glitches along the linestring of ways"
"description": ""
},
"_401": {
"title": "missing turn restriction",
"description": "ways (\\d+) and (\\d+) join in a very sharp angle here and there is no oneway tag or turn restriction that prevents turning from way (\\1|\\2) to (\\1|\\2)",
"description": "ways (\\d+) and (\\d+) join in a very sharp angle here and there is no oneway tag or turn restriction that prevents turning( from way (\\1|\\2) to (\\1|\\2))?",
"IDs": ["w", "w", "w", "w"],
"regex": true
},
+3 -2
View File
@@ -1,2 +1,3 @@
export { parseErrorDescriptions, clickLink } from './keepRight_error';
export { errorTypes } from './errorSchema.json';
export { errorTypes } from './errorSchema.json';
export { parseError } from './parse_error';
export { parseErrorDescriptions, clickLink } from './keepRight_error';
+5 -109
View File
@@ -4,8 +4,9 @@ import { t } from '../locale';
import { krError } from '../../osm';
import { errorTypes } from './errorSchema.json';
import { parseError } from './parse_error';
// TODO: remove these objects, here for reference
// TODO: for reference; remove
var keepRightSchema = {
'schema': '',
'id': 0,
@@ -38,7 +39,7 @@ var keepRightSchema = {
'txt4': '',
'txt5': ''
};
// TODO: for reference; remove
var keepRightSchemaFromWeb = {
'error_type': '192',
'object_type': 'way',
@@ -69,92 +70,6 @@ export function parseErrorDescriptions(entity) {
var errorRegex;
var errorMatch;
function fillPlaceholder(d) { return '<span><a class="kr_error_description-id">' + d + '</a></span>'; }
// arbitrary node list of form: #ID, #ID, #ID...
function parseError211(list) {
var newList = [];
var items = list.split(', ');
items.forEach(function(item) {
// ID has # at the front
var id = fillPlaceholder('n' + item.slice(1));
newList.push(id);
});
return newList.join(', ');
}
// arbitrary way list of form: #ID(layer),#ID(layer),#ID(layer)...
function parseError231(list) {
var newList = [];
var items = list.split(',');
items.forEach(function(item) {
var id;
var layer;
// item of form "#ID(layer)"
item = item.split('(');
// ID has # at the front
id = item[0].slice(1);
id = fillPlaceholder('w' + id);
// layer has trailing )
layer = item[1].slice(0,-1);
// TODO: translation
newList.push(id + ' (layer: ' + layer + ')');
});
return newList.join(', ');
}
// arbitrary node/relation list of form: from node #ID,to relation #ID,to node #ID...
function parseError294(list) {
var newList = [];
var items = list.split(',');
items.forEach(function(item) {
var role;
var idType;
var id;
// item of form "from/to node/relation #ID"
item = item.split(' ');
// to/from role is more clear in quotes
role = '"' + item[0] + '"';
// first letter of node/relation provides the type
idType = item[1].slice(0,1);
// ID has # at the front
id = item[2].slice(1);
id = fillPlaceholder(idType + id);
item = [role, item[1], id].join(' ');
newList.push(item);
});
return newList.join(', ');
}
// arbitrary node list of form: #ID,#ID,#ID...
function parseWarning20(list) {
var newList = [];
var items = list.split(',');
items.forEach(function(item) {
// ID has # at the front
var id = fillPlaceholder('n' + item.slice(1));
newList.push(id);
});
return newList.join(', ');
}
if (!(entity instanceof krError)) return;
// find the matching template from the error schema
@@ -183,27 +98,8 @@ export function parseErrorDescriptions(entity) {
// link IDs if present in the group
idType = 'IDs' in errorTemplate ? errorTemplate.IDs[index-1] : '';
if (idType) {
switch (idType) {
// simple case just needs a linking span
case 'n':
case 'w':
case 'r':
group = fillPlaceholder(idType + group);
break;
// some errors have more complex ID lists/variance
case '211':
group = parseError211(group);
break;
case '231':
group = parseError231(group);
break;
case '294':
group = parseError294(group);
break;
case '20':
group = parseWarning20(group);
}
if (idType && group) {
group = parseError(group, idType);
} else if (html_re.test(group)) {
// escape any html in non-IDs
group = '\\' + group + '\\';
+113
View File
@@ -0,0 +1,113 @@
export function parseError(group, idType) {
function fillPlaceholder(d) { return '<span><a class="kr_error_description-id">' + d + '</a></span>'; }
// arbitrary node list of form: #ID, #ID, #ID...
function parseError211(list) {
var newList = [];
var items = list.split(', ');
items.forEach(function(item) {
// ID has # at the front
var id = fillPlaceholder('n' + item.slice(1));
newList.push(id);
});
return newList.join(', ');
}
// arbitrary way list of form: #ID(layer),#ID(layer),#ID(layer)...
function parseError231(list) {
var newList = [];
var items = list.split(',');
items.forEach(function(item) {
var id;
var layer;
// item of form "#ID(layer)"
item = item.split('(');
// ID has # at the front
id = item[0].slice(1);
id = fillPlaceholder('w' + id);
// layer has trailing )
layer = item[1].slice(0,-1);
// TODO: translation
newList.push(id + ' (layer: ' + layer + ')');
});
return newList.join(', ');
}
// arbitrary node/relation list of form: from node #ID,to relation #ID,to node #ID...
function parseError294(list) {
var newList = [];
var items = list.split(',');
items.forEach(function(item) {
var role;
var idType;
var id;
// item of form "from/to node/relation #ID"
item = item.split(' ');
// to/from role is more clear in quotes
role = '"' + item[0] + '"';
// first letter of node/relation provides the type
idType = item[1].slice(0,1);
// ID has # at the front
id = item[2].slice(1);
id = fillPlaceholder(idType + id);
item = [role, item[1], id].join(' ');
newList.push(item);
});
return newList.join(', ');
}
// TODO: Handle error 401 template addition
// arbitrary node list of form: #ID,#ID,#ID...
function parseWarning20(list) {
var newList = [];
var items = list.split(',');
items.forEach(function(item) {
// ID has # at the front
var id = fillPlaceholder('n' + item.slice(1));
newList.push(id);
});
return newList.join(', ');
}
switch (idType) {
// simple case just needs a linking span
case 'n':
case 'w':
case 'r':
group = fillPlaceholder(idType + group);
break;
// some errors have more complex ID lists/variance
case '211':
group = parseError211(group);
break;
case '231':
group = parseError231(group);
break;
case '294':
group = parseError294(group);
break;
case '20':
group = parseWarning20(group);
}
return group;
}