mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-10 03:47:34 +02:00
Moved area-keys to data, and process it during runtime
This commit is contained in:
committed by
John Firebaugh
parent
90b0f1c5bf
commit
dffeedffc9
@@ -1,92 +0,0 @@
|
||||
/* jshint -W109 */
|
||||
iD.areaKeys = {
|
||||
"aeroway": {
|
||||
"gate": true,
|
||||
"taxiway": true
|
||||
},
|
||||
"amenity": {
|
||||
"atm": true,
|
||||
"bbq": true,
|
||||
"bench": true,
|
||||
"bureau_de_change": true,
|
||||
"clock": true,
|
||||
"drinking_water": true,
|
||||
"parking_entrance": true,
|
||||
"post_box": true,
|
||||
"telephone": true,
|
||||
"vending_machine": true,
|
||||
"waste_basket": true
|
||||
},
|
||||
"area": {},
|
||||
"barrier": {
|
||||
"block": true,
|
||||
"bollard": true,
|
||||
"cattle_grid": true,
|
||||
"cycle_barrier": true,
|
||||
"entrance": true,
|
||||
"fence": true,
|
||||
"gate": true,
|
||||
"kissing_gate": true,
|
||||
"lift_gate": true,
|
||||
"stile": true,
|
||||
"toll_booth": true
|
||||
},
|
||||
"building": {
|
||||
"entrance": true
|
||||
},
|
||||
"craft": {},
|
||||
"emergency": {
|
||||
"fire_hydrant": true,
|
||||
"phone": true
|
||||
},
|
||||
"golf": {
|
||||
"hole": true
|
||||
},
|
||||
"historic": {
|
||||
"boundary_stone": true
|
||||
},
|
||||
"landuse": {},
|
||||
"leisure": {
|
||||
"picnic_table": true,
|
||||
"track": true,
|
||||
"slipway": true
|
||||
},
|
||||
"man_made": {
|
||||
"cutline": true,
|
||||
"embankment": true,
|
||||
"flagpole": true,
|
||||
"pipeline": true,
|
||||
"survey_point": true
|
||||
},
|
||||
"military": {},
|
||||
"natural": {
|
||||
"coastline": true,
|
||||
"peak": true,
|
||||
"spring": true,
|
||||
"tree": true
|
||||
},
|
||||
"office": {},
|
||||
"piste:type": {},
|
||||
"place": {},
|
||||
"power": {
|
||||
"line": true,
|
||||
"minor_line": true,
|
||||
"pole": true,
|
||||
"tower": true
|
||||
},
|
||||
"public_transport": {
|
||||
"stop_position": true
|
||||
},
|
||||
"shop": {},
|
||||
"tourism": {
|
||||
"viewpoint": true
|
||||
},
|
||||
"waterway": {
|
||||
"canal": true,
|
||||
"ditch": true,
|
||||
"drain": true,
|
||||
"river": true,
|
||||
"stream": true,
|
||||
"weir": true
|
||||
}
|
||||
};
|
||||
@@ -227,6 +227,7 @@ window.iD = function () {
|
||||
context.presets = function(_) {
|
||||
if (!arguments.length) return presets;
|
||||
presets.load(_);
|
||||
iD.areaKeys = presets.areaKeys();
|
||||
return context;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,32 @@ iD.presets = function() {
|
||||
return match || all.item(geometry);
|
||||
};
|
||||
|
||||
all.areaKeys = function() {
|
||||
|
||||
// A closed way is considered to be an area if it has a tag with one
|
||||
// of the following keys, and the value is _not_ one of the associated
|
||||
// values for the respective key.
|
||||
|
||||
var areaKeys = {};
|
||||
|
||||
all.collection.forEach(function(d) {
|
||||
if (d.tags) {
|
||||
for (var key in d.tags) break;
|
||||
var value = d.tags[key];
|
||||
|
||||
if (['highway', 'footway', 'railway', 'type'].indexOf(key) === -1) {
|
||||
if (d.geometry.indexOf('area') >= 0) {
|
||||
areaKeys[key] = areaKeys[key] || {};
|
||||
} else if (key in areaKeys && value !== '*') {
|
||||
areaKeys[key][value] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return areaKeys;
|
||||
};
|
||||
|
||||
all.load = function(d) {
|
||||
|
||||
if (d.fields) {
|
||||
|
||||
Reference in New Issue
Block a user