Merge master

This commit is contained in:
Tom MacWright
2016-07-05 18:03:54 -04:00
31 changed files with 1233 additions and 13677 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ MODULE_TARGETS = \
js/lib/id/services.js \
js/lib/id/svg.js
js/lib/id/index.js: $(shell find modules/index.js -type f)
js/lib/id/index.js: $(shell find modules -type f)
@rm -f $@
node_modules/.bin/rollup -c rollup.config.js -f umd -n iD modules/index.js --no-strict -o $@
+8
View File
@@ -2056,6 +2056,10 @@ en:
name: Ambulance Station
# 'terms: EMS,EMT,rescue'
terms: '<translate with synonyms or related terms for ''Ambulance Station'', separated by commas>'
emergency/defibrillator:
# emergency=defibrillator
name: Defibrillator
terms: '<translate with synonyms or related terms for ''Defibrillator'', separated by commas>'
emergency/fire_hydrant:
# emergency=fire_hydrant
name: Fire Hydrant
@@ -2609,6 +2613,10 @@ en:
# man_made=breakwater
name: Breakwater
terms: '<translate with synonyms or related terms for ''Breakwater'', separated by commas>'
man_made/bridge:
# man_made=bridge
name: Bridge
terms: '<translate with synonyms or related terms for ''Bridge'', separated by commas>'
man_made/chimney:
# man_made=chimney
name: Chimney
+104 -104
View File
@@ -1,27 +1,4 @@
{
"access_simple": {
"key": "access",
"type": "combo",
"label": "Allowed Access",
"placeholder": "yes",
"options": [
"permissive",
"private",
"customers",
"no"
]
},
"access_toilets": {
"key": "access",
"type": "combo",
"label": "Access",
"options": [
"yes",
"permissive",
"private",
"customers"
]
},
"access": {
"keys": [
"access",
@@ -76,6 +53,29 @@
}
}
},
"access_simple": {
"key": "access",
"type": "combo",
"label": "Allowed Access",
"placeholder": "yes",
"options": [
"permissive",
"private",
"customers",
"no"
]
},
"access_toilets": {
"key": "access",
"type": "combo",
"label": "Access",
"options": [
"yes",
"permissive",
"private",
"customers"
]
},
"address": {
"type": "address",
"keys": [
@@ -246,6 +246,11 @@
"type": "text",
"label": "Brand"
},
"building": {
"key": "building",
"type": "combo",
"label": "Building"
},
"building_area": {
"key": "building",
"type": "combo",
@@ -253,11 +258,6 @@
"geometry": "area",
"label": "Building"
},
"building": {
"key": "building",
"type": "combo",
"label": "Building"
},
"capacity": {
"key": "capacity",
"type": "number",
@@ -510,16 +510,16 @@
"label": "Fix Me",
"universal": true
},
"fuel_multi": {
"key": "fuel:",
"type": "multiCombo",
"label": "Fuel Types"
},
"fuel": {
"key": "fuel",
"type": "combo",
"label": "Fuel"
},
"fuel_multi": {
"key": "fuel:",
"type": "multiCombo",
"label": "Fuel Types"
},
"gauge": {
"key": "gauge",
"type": "combo",
@@ -600,6 +600,11 @@
"type": "text",
"label": "ICAO"
},
"incline": {
"key": "incline",
"type": "combo",
"label": "Incline"
},
"incline_steps": {
"key": "incline",
"type": "combo",
@@ -611,11 +616,6 @@
}
}
},
"incline": {
"key": "incline",
"type": "combo",
"label": "Incline"
},
"information": {
"key": "information",
"type": "typeCombo",
@@ -666,19 +666,6 @@
"type": "combo",
"label": "Layer"
},
"leaf_cycle_singular": {
"key": "leaf_cycle",
"type": "combo",
"label": "Leaf Cycle",
"strings": {
"options": {
"evergreen": "Evergreen",
"deciduous": "Deciduous",
"semi_evergreen": "Semi-Evergreen",
"semi_deciduous": "Semi-Deciduous"
}
}
},
"leaf_cycle": {
"key": "leaf_cycle",
"type": "combo",
@@ -693,15 +680,16 @@
}
}
},
"leaf_type_singular": {
"key": "leaf_type",
"leaf_cycle_singular": {
"key": "leaf_cycle",
"type": "combo",
"label": "Leaf Type",
"label": "Leaf Cycle",
"strings": {
"options": {
"broadleaved": "Broadleaved",
"needleleaved": "Needleleaved",
"leafless": "Leafless"
"evergreen": "Evergreen",
"deciduous": "Deciduous",
"semi_evergreen": "Semi-Evergreen",
"semi_deciduous": "Semi-Deciduous"
}
}
},
@@ -718,6 +706,18 @@
}
}
},
"leaf_type_singular": {
"key": "leaf_type",
"type": "combo",
"label": "Leaf Type",
"strings": {
"options": {
"broadleaved": "Broadleaved",
"needleleaved": "Needleleaved",
"leafless": "Leafless"
}
}
},
"leisure": {
"key": "leisure",
"type": "typeCombo",
@@ -856,18 +856,6 @@
"type": "typeCombo",
"label": "Type"
},
"oneway_yes": {
"key": "oneway",
"type": "check",
"label": "One Way",
"strings": {
"options": {
"undefined": "Assumed to be Yes",
"yes": "Yes",
"no": "No"
}
}
},
"oneway": {
"key": "oneway",
"type": "check",
@@ -880,6 +868,18 @@
}
}
},
"oneway_yes": {
"key": "oneway",
"type": "check",
"label": "One Way",
"strings": {
"options": {
"undefined": "Assumed to be Yes",
"yes": "Yes",
"no": "No"
}
}
},
"opening_hours": {
"key": "opening_hours",
"type": "text",
@@ -1001,16 +1001,16 @@
"type": "text",
"label": "Population"
},
"power_supply": {
"key": "power_supply",
"type": "check",
"label": "Power Supply"
},
"power": {
"key": "power",
"type": "typeCombo",
"label": "Type"
},
"power_supply": {
"key": "power_supply",
"type": "check",
"label": "Power Supply"
},
"railway": {
"key": "railway",
"type": "typeCombo",
@@ -1055,13 +1055,13 @@
"type": "number",
"label": "Rooms"
},
"route_master": {
"key": "route_master",
"route": {
"key": "route",
"type": "combo",
"label": "Type"
},
"route": {
"key": "route",
"route_master": {
"key": "route_master",
"type": "combo",
"label": "Type"
},
@@ -1091,19 +1091,6 @@
"type": "check",
"label": "Seasonal"
},
"service_rail": {
"key": "service",
"type": "combo",
"label": "Service Type",
"strings": {
"options": {
"spur": "Spur",
"yard": "Yard",
"siding": "Siding",
"crossover": "Crossover"
}
}
},
"service": {
"key": "service",
"type": "combo",
@@ -1140,16 +1127,29 @@
}
}
},
"shelter_type": {
"key": "shelter_type",
"service_rail": {
"key": "service",
"type": "combo",
"label": "Type"
"label": "Service Type",
"strings": {
"options": {
"spur": "Spur",
"yard": "Yard",
"siding": "Siding",
"crossover": "Crossover"
}
}
},
"shelter": {
"key": "shelter",
"type": "check",
"label": "Shelter"
},
"shelter_type": {
"key": "shelter_type",
"type": "combo",
"label": "Type"
},
"shop": {
"key": "shop",
"type": "typeCombo",
@@ -1223,6 +1223,11 @@
"universal": true,
"label": "Source"
},
"sport": {
"key": "sport",
"type": "combo",
"label": "Sport"
},
"sport_ice": {
"key": "sport",
"type": "combo",
@@ -1249,11 +1254,6 @@
"running"
]
},
"sport": {
"key": "sport",
"type": "combo",
"label": "Sport"
},
"stars": {
"key": "stars",
"type": "number",
@@ -1404,16 +1404,16 @@
"type": "combo",
"label": "Type of Goods"
},
"water_point": {
"key": "water_point",
"type": "check",
"label": "Water Point"
},
"water": {
"key": "water",
"type": "combo",
"label": "Type"
},
"water_point": {
"key": "water_point",
"type": "check",
"label": "Water Point"
},
"waterway": {
"key": "waterway",
"type": "typeCombo",
+231 -208
View File
@@ -1218,6 +1218,31 @@
],
"name": "Nightclub"
},
"amenity/parking": {
"icon": "parking",
"fields": [
"operator",
"parking",
"capacity",
"fee",
"access_simple",
"supervised",
"park_ride",
"surface",
"maxstay",
"address"
],
"geometry": [
"point",
"vertex",
"area"
],
"tags": {
"amenity": "parking"
},
"terms": [],
"name": "Car Parking"
},
"amenity/parking_entrance": {
"icon": "entrance",
"fields": [
@@ -1247,31 +1272,6 @@
},
"name": "Parking Space"
},
"amenity/parking": {
"icon": "parking",
"fields": [
"operator",
"parking",
"capacity",
"fee",
"access_simple",
"supervised",
"park_ride",
"surface",
"maxstay",
"address"
],
"geometry": [
"point",
"vertex",
"area"
],
"tags": {
"amenity": "parking"
},
"terms": [],
"name": "Car Parking"
},
"amenity/pharmacy": {
"icon": "pharmacy",
"fields": [
@@ -3994,6 +3994,20 @@
},
"name": "Ambulance Station"
},
"emergency/defibrillator": {
"fields": [
"access",
"opening_hours",
"phone"
],
"geometry": [
"point"
],
"tags": {
"emergency": "defibrillator"
},
"name": "Defibrillator"
},
"emergency/fire_hydrant": {
"fields": [
"fire_hydrant/type"
@@ -4412,6 +4426,26 @@
],
"name": "Mini-Roundabout"
},
"highway/motorway": {
"icon": "highway-motorway",
"fields": [
"oneway_yes",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref"
],
"geometry": [
"line"
],
"tags": {
"highway": "motorway"
},
"terms": [],
"name": "Motorway"
},
"highway/motorway_junction": {
"geometry": [
"vertex"
@@ -4455,26 +4489,6 @@
],
"name": "Motorway Link"
},
"highway/motorway": {
"icon": "highway-motorway",
"fields": [
"oneway_yes",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref"
],
"geometry": [
"line"
],
"tags": {
"highway": "motorway"
},
"terms": [],
"name": "Motorway"
},
"highway/path": {
"icon": "highway-path",
"fields": [
@@ -4525,6 +4539,27 @@
"terms": [],
"name": "Pedestrian Street"
},
"highway/primary": {
"icon": "highway-primary",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref",
"cycleway"
],
"geometry": [
"line"
],
"tags": {
"highway": "primary"
},
"terms": [],
"name": "Primary Road"
},
"highway/primary_link": {
"icon": "highway-primary-link",
"fields": [
@@ -4549,27 +4584,6 @@
],
"name": "Primary Link"
},
"highway/primary": {
"icon": "highway-primary",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref",
"cycleway"
],
"geometry": [
"line"
],
"tags": {
"highway": "primary"
},
"terms": [],
"name": "Primary Road"
},
"highway/raceway": {
"icon": "highway-unclassified",
"fields": [
@@ -4646,6 +4660,27 @@
"terms": [],
"name": "Unknown Road"
},
"highway/secondary": {
"icon": "highway-secondary",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref",
"cycleway"
],
"geometry": [
"line"
],
"tags": {
"highway": "secondary"
},
"terms": [],
"name": "Secondary Road"
},
"highway/secondary_link": {
"icon": "highway-secondary-link",
"fields": [
@@ -4670,27 +4705,6 @@
],
"name": "Secondary Link"
},
"highway/secondary": {
"icon": "highway-secondary",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref",
"cycleway"
],
"geometry": [
"line"
],
"tags": {
"highway": "secondary"
},
"terms": [],
"name": "Secondary Road"
},
"highway/service": {
"icon": "highway-service",
"fields": [
@@ -4867,6 +4881,27 @@
],
"name": "Street Lamp"
},
"highway/tertiary": {
"icon": "highway-tertiary",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref",
"cycleway"
],
"geometry": [
"line"
],
"tags": {
"highway": "tertiary"
},
"terms": [],
"name": "Tertiary Road"
},
"highway/tertiary_link": {
"icon": "highway-tertiary-link",
"fields": [
@@ -4891,27 +4926,6 @@
],
"name": "Tertiary Link"
},
"highway/tertiary": {
"icon": "highway-tertiary",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref",
"cycleway"
],
"geometry": [
"line"
],
"tags": {
"highway": "tertiary"
},
"terms": [],
"name": "Tertiary Road"
},
"highway/track": {
"icon": "highway-track",
"fields": [
@@ -4973,6 +4987,26 @@
],
"name": "Traffic Signals"
},
"highway/trunk": {
"icon": "highway-trunk",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref"
],
"geometry": [
"line"
],
"tags": {
"highway": "trunk"
},
"terms": [],
"name": "Trunk Road"
},
"highway/trunk_link": {
"icon": "highway-trunk-link",
"fields": [
@@ -4996,26 +5030,6 @@
],
"name": "Trunk Link"
},
"highway/trunk": {
"icon": "highway-trunk",
"fields": [
"oneway",
"maxspeed",
"structure",
"access",
"lanes",
"surface",
"ref"
],
"geometry": [
"line"
],
"tags": {
"highway": "trunk"
},
"terms": [],
"name": "Trunk Road"
},
"highway/turning_circle": {
"icon": "circle",
"geometry": [
@@ -6080,6 +6094,15 @@
},
"name": "Breakwater"
},
"man_made/bridge": {
"geometry": [
"area"
],
"tags": {
"man_made": "bridge"
},
"name": "Bridge"
},
"man_made/chimney": {
"geometry": [
"point",
@@ -6713,22 +6736,6 @@
},
"name": "Spring"
},
"natural/tree_row": {
"fields": [
"leaf_type",
"leaf_cycle",
"denotation"
],
"icon": "park",
"geometry": [
"line"
],
"terms": [],
"tags": {
"natural": "tree_row"
},
"name": "Tree row"
},
"natural/tree": {
"fields": [
"leaf_type_singular",
@@ -6746,6 +6753,22 @@
},
"name": "Tree"
},
"natural/tree_row": {
"fields": [
"leaf_type",
"leaf_cycle",
"denotation"
],
"icon": "park",
"geometry": [
"line"
],
"terms": [],
"tags": {
"natural": "tree_row"
},
"name": "Tree row"
},
"natural/volcano": {
"icon": "triangle",
"fields": [
@@ -7774,17 +7797,6 @@
],
"name": "Railway Station"
},
"railway/subway_entrance": {
"icon": "rail-metro",
"geometry": [
"point"
],
"tags": {
"railway": "subway_entrance"
},
"terms": [],
"name": "Subway Entrance"
},
"railway/subway": {
"icon": "railway-subway",
"geometry": [
@@ -7802,6 +7814,17 @@
"terms": [],
"name": "Subway"
},
"railway/subway_entrance": {
"icon": "rail-metro",
"geometry": [
"point"
],
"tags": {
"railway": "subway_entrance"
},
"terms": [],
"name": "Subway Entrance"
},
"railway/tram": {
"icon": "railway-light-rail",
"geometry": [
@@ -8191,6 +8214,26 @@
},
"name": "Candle Shop"
},
"shop/car": {
"icon": "car",
"fields": [
"operator",
"address",
"building_area",
"opening_hours"
],
"geometry": [
"point",
"area"
],
"terms": [
"auto"
],
"tags": {
"shop": "car"
},
"name": "Car Dealership"
},
"shop/car_parts": {
"icon": "car",
"fields": [
@@ -8231,26 +8274,6 @@
},
"name": "Car Repair Shop"
},
"shop/car": {
"icon": "car",
"fields": [
"operator",
"address",
"building_area",
"opening_hours"
],
"geometry": [
"point",
"area"
],
"terms": [
"auto"
],
"tags": {
"shop": "car"
},
"name": "Car Dealership"
},
"shop/carpet": {
"icon": "shop",
"fields": [
@@ -9839,23 +9862,6 @@
},
"name": "Variety Store"
},
"shop/video_games": {
"icon": "shop",
"fields": [
"operator",
"address",
"building_area",
"opening_hours"
],
"geometry": [
"point",
"area"
],
"tags": {
"shop": "video_games"
},
"name": "Video Game Store"
},
"shop/video": {
"icon": "shop",
"fields": [
@@ -9876,6 +9882,23 @@
},
"name": "Video Store"
},
"shop/video_games": {
"icon": "shop",
"fields": [
"operator",
"address",
"building_area",
"opening_hours"
],
"geometry": [
"point",
"area"
],
"tags": {
"shop": "video_games"
},
"name": "Video Game Store"
},
"shop/water_sports": {
"icon": "shop",
"fields": [
@@ -10510,22 +10533,6 @@
],
"icon": "restriction-only-straight-on"
},
"type/route_master": {
"geometry": [
"relation"
],
"tags": {
"type": "route_master"
},
"name": "Route Master",
"icon": "route-master",
"fields": [
"route_master",
"ref",
"operator",
"network"
]
},
"type/route": {
"geometry": [
"relation"
@@ -10723,6 +10730,22 @@
"operator"
]
},
"type/route_master": {
"geometry": [
"relation"
],
"tags": {
"type": "route_master"
},
"name": "Route Master",
"icon": "route-master",
"fields": [
"route_master",
"ref",
"operator",
"network"
]
},
"type/site": {
"geometry": [
"relation"
@@ -0,0 +1,15 @@
{
"fields": [
"access",
"opening_hours",
"phone"
],
"geometry": [
"point"
],
"tags": {
"emergency": "defibrillator"
},
"name": "Defibrillator"
}
@@ -0,0 +1,9 @@
{
"geometry": [
"area"
],
"tags": {
"man_made": "bridge"
},
"name": "Bridge"
}
+38 -30
View File
@@ -276,6 +276,10 @@
"key": "amenity",
"value": "nightclub"
},
{
"key": "amenity",
"value": "parking"
},
{
"key": "amenity",
"value": "parking_entrance"
@@ -284,10 +288,6 @@
"key": "amenity",
"value": "parking_space"
},
{
"key": "amenity",
"value": "parking"
},
{
"key": "amenity",
"value": "pharmacy"
@@ -884,6 +884,10 @@
"key": "emergency",
"value": "ambulance_station"
},
{
"key": "emergency",
"value": "defibrillator"
},
{
"key": "emergency",
"value": "fire_hydrant"
@@ -986,6 +990,10 @@
"key": "highway",
"value": "mini_roundabout"
},
{
"key": "highway",
"value": "motorway"
},
{
"key": "highway",
"value": "motorway_junction"
@@ -994,10 +1002,6 @@
"key": "highway",
"value": "motorway_link"
},
{
"key": "highway",
"value": "motorway"
},
{
"key": "highway",
"value": "path"
@@ -1008,11 +1012,11 @@
},
{
"key": "highway",
"value": "primary_link"
"value": "primary"
},
{
"key": "highway",
"value": "primary"
"value": "primary_link"
},
{
"key": "highway",
@@ -1032,11 +1036,11 @@
},
{
"key": "highway",
"value": "secondary_link"
"value": "secondary"
},
{
"key": "highway",
"value": "secondary"
"value": "secondary_link"
},
{
"key": "highway",
@@ -1080,11 +1084,11 @@
},
{
"key": "highway",
"value": "tertiary_link"
"value": "tertiary"
},
{
"key": "highway",
"value": "tertiary"
"value": "tertiary_link"
},
{
"key": "highway",
@@ -1096,11 +1100,11 @@
},
{
"key": "highway",
"value": "trunk_link"
"value": "trunk"
},
{
"key": "highway",
"value": "trunk"
"value": "trunk_link"
},
{
"key": "highway",
@@ -1382,6 +1386,10 @@
"key": "man_made",
"value": "breakwater"
},
{
"key": "man_made",
"value": "bridge"
},
{
"key": "man_made",
"value": "chimney"
@@ -1567,11 +1575,11 @@
},
{
"key": "natural",
"value": "tree_row"
"value": "tree"
},
{
"key": "natural",
"value": "tree"
"value": "tree_row"
},
{
"key": "natural",
@@ -1818,11 +1826,11 @@
},
{
"key": "railway",
"value": "subway_entrance"
"value": "subway"
},
{
"key": "railway",
"value": "subway"
"value": "subway_entrance"
},
{
"key": "railway",
@@ -1907,6 +1915,10 @@
"key": "shop",
"value": "candles"
},
{
"key": "shop",
"value": "car"
},
{
"key": "shop",
"value": "car_parts"
@@ -1915,10 +1927,6 @@
"key": "shop",
"value": "car_repair"
},
{
"key": "shop",
"value": "car"
},
{
"key": "shop",
"value": "carpet"
@@ -2261,11 +2269,11 @@
},
{
"key": "shop",
"value": "video_games"
"value": "video"
},
{
"key": "shop",
"value": "video"
"value": "video_games"
},
{
"key": "shop",
@@ -2414,10 +2422,6 @@
"key": "restriction",
"value": "only_straight_on"
},
{
"key": "type",
"value": "route_master"
},
{
"key": "type",
"value": "route"
@@ -2470,6 +2474,10 @@
"key": "route",
"value": "tram"
},
{
"key": "type",
"value": "route_master"
},
{
"key": "type",
"value": "site"
+111 -103
View File
@@ -648,13 +648,6 @@
}
},
"fields": {
"access_simple": {
"label": "Allowed Access",
"placeholder": "yes"
},
"access_toilets": {
"label": "Access"
},
"access": {
"label": "Allowed Access",
"placeholder": "Not Specified",
@@ -696,6 +689,13 @@
}
}
},
"access_simple": {
"label": "Allowed Access",
"placeholder": "yes"
},
"access_toilets": {
"label": "Access"
},
"address": {
"label": "Address",
"placeholders": {
@@ -794,10 +794,10 @@
"brand": {
"label": "Brand"
},
"building_area": {
"building": {
"label": "Building"
},
"building": {
"building_area": {
"label": "Building"
},
"capacity": {
@@ -962,12 +962,12 @@
"fixme": {
"label": "Fix Me"
},
"fuel_multi": {
"label": "Fuel Types"
},
"fuel": {
"label": "Fuel"
},
"fuel_multi": {
"label": "Fuel Types"
},
"gauge": {
"label": "Gauge"
},
@@ -1016,6 +1016,9 @@
"icao": {
"label": "ICAO"
},
"incline": {
"label": "Incline"
},
"incline_steps": {
"label": "Incline",
"options": {
@@ -1023,9 +1026,6 @@
"down": "Down"
}
},
"incline": {
"label": "Incline"
},
"information": {
"label": "Type"
},
@@ -1058,15 +1058,6 @@
"layer": {
"label": "Layer"
},
"leaf_cycle_singular": {
"label": "Leaf Cycle",
"options": {
"evergreen": "Evergreen",
"deciduous": "Deciduous",
"semi_evergreen": "Semi-Evergreen",
"semi_deciduous": "Semi-Deciduous"
}
},
"leaf_cycle": {
"label": "Leaf Cycle",
"options": {
@@ -1077,12 +1068,13 @@
"mixed": "Mixed"
}
},
"leaf_type_singular": {
"label": "Leaf Type",
"leaf_cycle_singular": {
"label": "Leaf Cycle",
"options": {
"broadleaved": "Broadleaved",
"needleleaved": "Needleleaved",
"leafless": "Leafless"
"evergreen": "Evergreen",
"deciduous": "Deciduous",
"semi_evergreen": "Semi-Evergreen",
"semi_deciduous": "Semi-Deciduous"
}
},
"leaf_type": {
@@ -1094,6 +1086,14 @@
"leafless": "Leafless"
}
},
"leaf_type_singular": {
"label": "Leaf Type",
"options": {
"broadleaved": "Broadleaved",
"needleleaved": "Needleleaved",
"leafless": "Leafless"
}
},
"leisure": {
"label": "Type"
},
@@ -1175,14 +1175,6 @@
"office": {
"label": "Type"
},
"oneway_yes": {
"label": "One Way",
"options": {
"undefined": "Assumed to be Yes",
"yes": "Yes",
"no": "No"
}
},
"oneway": {
"label": "One Way",
"options": {
@@ -1191,6 +1183,14 @@
"no": "No"
}
},
"oneway_yes": {
"label": "One Way",
"options": {
"undefined": "Assumed to be Yes",
"yes": "Yes",
"no": "No"
}
},
"opening_hours": {
"label": "Hours"
},
@@ -1274,12 +1274,12 @@
"population": {
"label": "Population"
},
"power_supply": {
"label": "Power Supply"
},
"power": {
"label": "Type"
},
"power_supply": {
"label": "Power Supply"
},
"railway": {
"label": "Type"
},
@@ -1304,10 +1304,10 @@
"rooms": {
"label": "Rooms"
},
"route_master": {
"route": {
"label": "Type"
},
"route": {
"route_master": {
"label": "Type"
},
"sac_scale": {
@@ -1328,15 +1328,6 @@
"seasonal": {
"label": "Seasonal"
},
"service_rail": {
"label": "Service Type",
"options": {
"spur": "Spur",
"yard": "Yard",
"siding": "Siding",
"crossover": "Crossover"
}
},
"service": {
"label": "Type"
},
@@ -1356,12 +1347,21 @@
"no": "No"
}
},
"shelter_type": {
"label": "Type"
"service_rail": {
"label": "Service Type",
"options": {
"spur": "Spur",
"yard": "Yard",
"siding": "Siding",
"crossover": "Crossover"
}
},
"shelter": {
"label": "Shelter"
},
"shelter_type": {
"label": "Type"
},
"shop": {
"label": "Type"
},
@@ -1401,15 +1401,15 @@
"source": {
"label": "Source"
},
"sport": {
"label": "Sport"
},
"sport_ice": {
"label": "Sport"
},
"sport_racing": {
"label": "Sport"
},
"sport": {
"label": "Sport"
},
"stars": {
"label": "Stars"
},
@@ -1505,12 +1505,12 @@
"vending": {
"label": "Type of Goods"
},
"water_point": {
"label": "Water Point"
},
"water": {
"label": "Type"
},
"water_point": {
"label": "Water Point"
},
"waterway": {
"label": "Type"
},
@@ -1800,6 +1800,10 @@
"name": "Nightclub",
"terms": "disco*,night club,dancing,dance club"
},
"amenity/parking": {
"name": "Car Parking",
"terms": ""
},
"amenity/parking_entrance": {
"name": "Parking Garage Entrance/Exit",
"terms": ""
@@ -1808,10 +1812,6 @@
"name": "Parking Space",
"terms": ""
},
"amenity/parking": {
"name": "Car Parking",
"terms": ""
},
"amenity/pharmacy": {
"name": "Pharmacy",
"terms": "drug*,med*,prescription"
@@ -2412,6 +2412,10 @@
"name": "Ambulance Station",
"terms": "EMS,EMT,rescue"
},
"emergency/defibrillator": {
"name": "Defibrillator",
"terms": ""
},
"emergency/fire_hydrant": {
"name": "Fire Hydrant",
"terms": ""
@@ -2516,6 +2520,10 @@
"name": "Mini-Roundabout",
"terms": ""
},
"highway/motorway": {
"name": "Motorway",
"terms": ""
},
"highway/motorway_junction": {
"name": "Motorway Junction / Exit",
"terms": ""
@@ -2524,10 +2532,6 @@
"name": "Motorway Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/motorway": {
"name": "Motorway",
"terms": ""
},
"highway/path": {
"name": "Path",
"terms": "hike,hiking,trackway,trail,walk"
@@ -2536,14 +2540,14 @@
"name": "Pedestrian Street",
"terms": ""
},
"highway/primary_link": {
"name": "Primary Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/primary": {
"name": "Primary Road",
"terms": ""
},
"highway/primary_link": {
"name": "Primary Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/raceway": {
"name": "Motor Raceway",
"terms": "auto*,race*,nascar"
@@ -2560,14 +2564,14 @@
"name": "Unknown Road",
"terms": ""
},
"highway/secondary_link": {
"name": "Secondary Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/secondary": {
"name": "Secondary Road",
"terms": ""
},
"highway/secondary_link": {
"name": "Secondary Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/service": {
"name": "Service Road",
"terms": ""
@@ -2608,14 +2612,14 @@
"name": "Street Lamp",
"terms": "streetlight,street light,lamp,light,gaslight"
},
"highway/tertiary_link": {
"name": "Tertiary Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/tertiary": {
"name": "Tertiary Road",
"terms": ""
},
"highway/tertiary_link": {
"name": "Tertiary Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/track": {
"name": "Unmaintained Track Road",
"terms": "woods road,forest road,logging road,fire road,farm road,agricultural road,ranch road,carriage road,primitive,unmaintained,rut,offroad,4wd,4x4,four wheel drive,atv,quad,jeep,double track,two track"
@@ -2624,14 +2628,14 @@
"name": "Traffic Signals",
"terms": "light,stoplight,traffic light"
},
"highway/trunk_link": {
"name": "Trunk Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/trunk": {
"name": "Trunk Road",
"terms": ""
},
"highway/trunk_link": {
"name": "Trunk Link",
"terms": "ramp,on ramp,off ramp"
},
"highway/turning_circle": {
"name": "Turning Circle",
"terms": "cul-de-sac"
@@ -2920,6 +2924,10 @@
"name": "Breakwater",
"terms": ""
},
"man_made/bridge": {
"name": "Bridge",
"terms": ""
},
"man_made/chimney": {
"name": "Chimney",
"terms": ""
@@ -3104,14 +3112,14 @@
"name": "Spring",
"terms": ""
},
"natural/tree_row": {
"name": "Tree row",
"terms": ""
},
"natural/tree": {
"name": "Tree",
"terms": ""
},
"natural/tree_row": {
"name": "Tree row",
"terms": ""
},
"natural/volcano": {
"name": "Volcano",
"terms": "mountain,crater"
@@ -3364,14 +3372,14 @@
"name": "Railway Station",
"terms": "train station,station"
},
"railway/subway_entrance": {
"name": "Subway Entrance",
"terms": ""
},
"railway/subway": {
"name": "Subway",
"terms": ""
},
"railway/subway_entrance": {
"name": "Subway Entrance",
"terms": ""
},
"railway/tram": {
"name": "Tram",
"terms": "streetcar"
@@ -3460,6 +3468,10 @@
"name": "Candle Shop",
"terms": ""
},
"shop/car": {
"name": "Car Dealership",
"terms": "auto"
},
"shop/car_parts": {
"name": "Car Parts Store",
"terms": "auto"
@@ -3468,10 +3480,6 @@
"name": "Car Repair Shop",
"terms": "auto"
},
"shop/car": {
"name": "Car Dealership",
"terms": "auto"
},
"shop/carpet": {
"name": "Carpet Store",
"terms": "rug"
@@ -3812,14 +3820,14 @@
"name": "Variety Store",
"terms": ""
},
"shop/video_games": {
"name": "Video Game Store",
"terms": ""
},
"shop/video": {
"name": "Video Store",
"terms": "DVD"
},
"shop/video_games": {
"name": "Video Game Store",
"terms": ""
},
"shop/water_sports": {
"name": "Watersport/Swim Shop",
"terms": ""
@@ -3968,10 +3976,6 @@
"name": "No Turns",
"terms": ""
},
"type/route_master": {
"name": "Route Master",
"terms": ""
},
"type/route": {
"name": "Route",
"terms": ""
@@ -4024,6 +4028,10 @@
"name": "Tram Route",
"terms": ""
},
"type/route_master": {
"name": "Route Master",
"terms": ""
},
"type/site": {
"name": "Site",
"terms": ""
-494
View File
@@ -1,494 +0,0 @@
{
"modes": {
"add_area": {
"title": "Area o poligon",
"description": "Magdagdag ng mga parke, mga gusali, lawa o iba pang mga \"area\" sa mapa.",
"tail": "Mag-click sa mapa upang simulan ang pagguhit ng isang lugar, tulad ng isang parke, lawa, o gusali."
},
"add_line": {
"title": "Linya o guhit",
"description": "Magdagdag ng mga kalsada o kalye, mga daanang pantao, kanal o iba pang mga linya sa mapa.",
"tail": "Mag-click sa mapa upang simulan ang pagguhit ng isang linya tulad ng kalsada, daanang pantao, o ruta."
},
"add_point": {
"title": "Punto o tuldok",
"description": "Magdagdag ng kainan, monumento, \"postbox\" o iba pang mga punto o tuldok sa mapa.",
"tail": "Mag-click sa mapa upang magdagdag ng isang punto o tuldok."
},
"browse": {
"title": "Mag-browse",
"description": "I-pan at i-zoom ang mapa."
},
"draw_area": {
"tail": "I-click upang magdagdag ng mga node sa iyong polygon o area. I-click ang unang node upang isarado ang polygon o area."
},
"draw_line": {
"tail": "I-click upang magdagdag ng higit pang mga node sa linya. Mag-click sa iba pang mga linya upang kumonekta sa kanila, at i-double click upang tapusin ang linya."
}
},
"operations": {
"add": {
"annotation": {
"point": "Idinagdag ng isang punto o tuldok.",
"vertex": "Nagdagdag ng node sa isang way.",
"relation": "Nagdagdag ng relation."
}
},
"start": {
"annotation": {
"line": "Nagsimula ng isang linya.",
"area": "Nagsimula sa isang area o polygon."
}
},
"continue": {
"key": "S",
"title": "Ipagpatuloy",
"description": "Ipagpatuloy ang linyang ito.",
"not_eligible": "Walang linyang maaring ipagpatuloy dito.",
"annotation": {
"line": "Karugtong ng isang linya.",
"area": "Nagpatuloy sa pagguhit ng area o poligon."
}
},
"cancel_draw": {
"annotation": "Kinansela ang pagguhit."
},
"change_tags": {
"annotation": "Pinalitan ang mga tag."
},
"circularize": {
"title": "Pina-bilog",
"description": {
"line": "Gawin pabilog ang linyang ito.",
"area": "Gawin pabilog ang area o poligong ito."
},
"key": "O",
"annotation": {
"line": "Ginawang pabilog and isang linya.",
"area": "Ginawang pabilog and isang area o poligon."
},
"not_closed": "Hindi ito maaaring gawing pabilog dahil hindi ito isang \"loop\".",
"too_large": "Hindi na ito maaaring gawing pabilog dahil hindi sapat ang kasalukuyang nakikita sa mapa."
},
"orthogonalize": {
"title": "Iskawalado",
"description": {
"line": "Gawing iskwalado ang mga kanto ng linyang ito.",
"area": "Gawing iskwalado ang mga kanto ng area o poligong ito."
},
"key": "S",
"annotation": {
"line": "Ginawang iskawalado ang bawat kanto ng linya.",
"area": "Ginawang iskawalado ang bawat kanto ng area o poligon."
},
"not_squarish": "Hindi maaring gawing iskwalado.",
"too_large": "Hindi ito maaaring gawing iskuwalado dahil hindi sapat ang kasalukuyang nakikita sa mapa."
},
"straighten": {
"title": "Ituwid",
"description": "Ituwid ang linyang ito.",
"key": "S",
"annotation": "Naituwid ang linya.",
"too_bendy": "Hindi naituwid dahil masyadong kurbado."
},
"delete": {
"title": "Burahin",
"description": "Burahin ito sa mapa.",
"annotation": {
"point": "Binura ang isang point o tuldok.",
"vertex": "Binura ang isang node mula sa way o linya.",
"line": "Binura ang isang linya.",
"area": "Binura ang isang area o poligon.",
"relation": "Binura ang isang \"relation\".",
"multiple": "Binura ang {n} bagay sa mapa."
}
},
"add_member": {
"annotation": "Dinagdag ang kasapi o miyembro ng relation."
},
"delete_member": {
"annotation": "Inalis ang kasapi o miyembro ng relation."
},
"connect": {
"annotation": {
"point": "Dinugtong ang isang \"way\" sa isang punto o tuldok.",
"vertex": "Dinugtong ang isang \"way\" sa isa pang \"way\".",
"line": "Dinugtong ang isang \"way\" sa isang linya.",
"area": "Dinugtong ang isang \"way\" sa isang area o poligon."
}
},
"disconnect": {
"title": "Alisin ang pagkakadugtong",
"description": "Alisin sa pagkakadugtong ang mga linya / poligon.",
"key": "D",
"annotation": "Naalis sa pagkakadugtong ang mga linya / poligon."
},
"merge": {
"title": "Pagsamahin",
"description": "Pagdugtungin ang mga linyang ito.",
"key": "C",
"annotation": "Dinugtung ang {n} linya.",
"not_eligible": "Ang mga bagay na ito ay hindi maaaring pagsamahin.",
"not_adjacent": "Hindi mapagsama ang linyang ito dahil sila ay hindi konektado.",
"incomplete_relation": "Hindi maaaring ipagsama o i-merge dahil ang isa sa mga ito ay hindi pa ganap na nai-download."
},
"move": {
"title": "Ilipat ng posisyon",
"description": "Ilipat ang posisyon.",
"key": "M",
"annotation": {
"point": "Inilipat ang posisyon ng isang punto o tuldok.",
"vertex": "Inilipat ang posisyon ng isang \"node\" na sa isang \"way\".",
"line": "Inilipat ang posisyon ng isang linya.",
"area": "Inilipat ang posisyon ng isang area o poligon.",
"multiple": "Inilipat ang posisyon ang maraming bagay."
}
},
"rotate": {
"title": "Paikutin",
"description": "Paikutin ang bagay na ito mula sa kanyang \"center point\".",
"key": "R",
"annotation": {
"line": "Pinaikot ang linya.",
"area": "Pinaikot ang area o poligon."
}
},
"reverse": {
"title": "Baliktarin",
"description": "Baliktarin ang direksyon ng linyang ito.",
"key": "V",
"annotation": "Binaliktad ang direksyon ng linya."
},
"split": {
"title": "Hatiin",
"description": {
"line": "Hatiin sa dalawa ang linya mula sa node na ito.",
"area": "Hatiin ang hangganan ng lugar na ito sa dalawa."
},
"key": "X",
"annotation": {
"line": "Hattin ang linya.",
"area": "Hatiin ang hangganan ng area o poligon.",
"multiple": "Hattin ang {n} linya/area o poligon."
},
"not_eligible": "Hindi maaaring hatiin ang linya mula sa umpisa o dulong \"node\" nito."
}
},
"undo": {
"tooltip": "I-undo:{action}",
"nothing": "Walang ma-undo"
},
"redo": {
"tooltip": "i-redo: {action}",
"nothing": "Walang ma-redo."
},
"browser_notice": "Ang editor na ito ay suportado sa Firefox, Chrome, Safari, Opera, at Internet Explorer 9 at sa mas mataas pang bersion. I-upgrade ang inyong browser o gamitin Potlatch 2 upang i-edit ng mapa.",
"translate": {
"localized_translation_language": "Pumili ng wika",
"localized_translation_name": "Pangalan"
},
"zoom_in_edit": "Mag-zoom in para makapag-edit",
"logout": "Mag-logout",
"loading_auth": "Kumokonekta sa OpenStreetMap ...",
"report_a_bug": "I-ulat ang bug",
"status": {
"error": "Hindi maka-konekta sa API."
},
"commit": {
"title": "I-save ang mga binago.",
"description_placeholder": "Maikling paglalarawan ng iyong mga ambag o edits",
"message_label": "Mag-commit mensahe",
"upload_explanation": "Ang mga pagbabagong na-upload ay makikita sa lahat ng mapang gumagamit ng datos ng OpenStreetMap.",
"save": "I-save",
"cancel": "Kanselahin",
"warnings": "Mga babala",
"modified": "Binago",
"deleted": "Binura",
"created": "Nilikha"
},
"contributors": {
"list": "Edits nina {users}",
"truncated_list": "Edits nina {users} at {count} iba pa"
},
"geocoder": {
"search": "Maghanap sa buong mundo ...",
"no_results_visible": "Walang mga resulta sa kasalukuyang lugar sa mapa",
"no_results_worldwide": "Walang mga resultang natagpuan"
},
"geolocate": {
"title": "Ipakita ang kasalukuyang lokasyon."
},
"inspector": {
"no_documentation_combination": "Walang documentation para sa kumbinasyon ng mga tag na ginamit",
"no_documentation_key": "Walang \"documentation\" na magagamit para sa \"key\" na ito.",
"show_more": "Higit pang detalye",
"view_on_osm": "Tingnan sa openstreetmap.org",
"all_tags": "Lahat ng tags",
"all_members": "Lahat ng kasapi",
"all_relations": "Lahat ng \"relation\"",
"new_relation": "Bagong relation ...",
"choose": "Pumili ng uri ng \"features\"",
"results": "{n} mga resulta para sa {search}",
"reference": "Tingnan sa OpenStreetMap Wiki",
"back_tooltip": "Baguhin ang \"feature\"",
"remove": "Alisin",
"search": "Mag-search",
"feature_list": "Mag-hanap ng \"feature\"",
"edit": "I-edit ang \"feature\"",
"none": "Wala",
"node": "Node",
"way": "Way",
"relation": "Relation",
"location": "Lokasyon"
},
"background": {
"title": "\"Background\" o \"imagery\"",
"description": "Mga setting ng \"background\" o \"imagery\"",
"percent_brightness": "{opacity}% Pagkalinaw",
"none": "Wala",
"custom": "Custom",
"fix_misalignment": "Ayusin ang pagkakahanay ng \"imagery\"",
"reset": "I-reset"
},
"restore": {
"heading": "Mayroon kang hindi na-save ng mga pagbabago",
"description": "Ibig mo bang ibalik ang mga hindi na-save na pagbabago mula sa isang nakaraang session sa pag-edit?",
"restore": "Ibalik",
"reset": "I-reset"
},
"save": {
"title": "I-save",
"help": "I-save ang mga pagbabago sa OpenStreetMap upang makita ng ibang gumagamit ng datos.",
"no_changes": "Walang mga pagbabago upang i-save.",
"error": "May error habang sinusubukang i-save",
"uploading": "Ina-upload ang mga pagbabago sa OpenStreetMap.",
"unsaved_changes": "Mayroon kang hindi na-save ng mga pagbabago"
},
"success": {
"edited_osm": "Nag-edit sa OSM!",
"view_on_osm": "Tingnan sa OSM",
"facebook": "I-share sa Facebook",
"twitter": "I-share sa Twitter",
"google": "I-share sa Google+"
},
"confirm": {
"okay": "Okay"
},
"splash": {
"welcome": "Maligayang pagdating sa iD OpenStreetMap editor",
"text": "Ang iD ay isang simple ngunit magandang editor para sa pag-edit ng libreng mapa ng buong mundo. Ito ay bersyon {version}. Para sa karagdagang impormasyon tingnan ang {website} at i-ulat ang mga bugs sa {github}.",
"walkthrough": "Simulan ang \"Walkthrough\"",
"start": "Simulan ang pag-edit"
},
"source_switch": {
"live": "live",
"lose_changes": "Mayroon kang hindi na-save ang mga pagbabago. Mawawala ang pagbabagong ito kung lilipat sa ibang map server. Sigurado ka bang gusto mong lumipat ng server?",
"dev": "dev"
},
"tag_reference": {
"description": "Paglalarawan",
"on_wiki": "{tag} sa wiki.osm.org",
"used_with": "Kabilang sa gingamait ang {type}"
},
"validations": {
"untagged_point": "Walang tag na punto o tuldok",
"untagged_line": "Walang tag na linya",
"untagged_area": "Walang tag na area o poligon",
"many_deletions": "Nagbura ka ng {n} bagay sa mapa. Sigurado ka bang gusto mong gawin ito? Ito ay tatanggalin sa mapa na nakikita sa openstreetmap.org.",
"tag_suggests_area": "Ang tag na {tag} ay kalimitang para sa mga area o poligon sublait ito ay nasa linya lamang.",
"untagged_tooltip": "Pumili ng uri ng \"feature\" na naglalarawan kung ano ang {geometry} na ito.",
"deprecated_tags": "Hindi na ginagamit na \"tag\": {tags}"
},
"zoom": {
"in": "i-zoom in",
"out": "I-zoom out"
},
"cannot_zoom": "Hindi na pwedeng mag-zoom out sa kasalukuyang \"mode\".",
"gpx": {
"local_layer": "Lokal na GPX file",
"drag_drop": "I-drag at i-drop ang .gpx file mula sa inyong \"computer\" sa pahinang ito, o i-click ang button sa kanan upang mag-browse",
"zoom": "I-zoom sa GPX track",
"browse": "Mag-browse ng .gpx file"
},
"intro": {
"navigation": {
"header": "Ang \"header\" ay nagpapakita kung anong uri ng \"feature\" ito."
},
"points": {
"title": "Mga Punto o tuldok",
"choose": "**Pumili ng Cafe mula sa talaan.**",
"describe": "Ang punto o tuldok na ito ay minarkahan bilang \"cafe\". Gamit ang \"feature editor\", maari tayong magdagdag ng iba pang impormasyon. **Magdagdag ng pangalan**"
},
"areas": {
"title": "Mga area o poligon",
"search": "**Hanapin ang '{name}'.**",
"choose": "**Pliin ang \"Playground\" mula sa talaan.**",
"describe": "**Magdagdag ng pangalan at isara ang \"feature editor\"**"
},
"lines": {
"title": "Mga linya",
"add": "Ang mga linya ay ginagamit para kumatawan sa mga \"feature\" na gaya ng mga kalsada, riles ng tren at ilog. **I-click ang button para sa \"Linya\" upang magdagdag ng bagong linya. **",
"start": "**Simulan ang linya sa pamamagitan ng pag-click sa dulo ng kalsada.**",
"road": "**Piliin ang \"Road\" mula sa talaan**"
},
"startediting": {
"title": "Umpisahan ang pag-edit",
"save": "Huwag kalimutan na regular na i-save ang iyong mga binago!",
"start": "Simulan ang pagma-mapa!"
}
},
"presets": {
"fields": {
"address": {
"label": "Address",
"placeholders": {
"number": "123",
"street": "Kalsada",
"city": "Siyudad"
}
},
"aerialway": {
"label": "Uri"
},
"aeroway": {
"label": "Uri"
},
"amenity": {
"label": "Uri"
},
"artwork_type": {
"label": "Uri"
},
"atm": {
"label": "ATM"
},
"barrier": {
"label": "Uri"
},
"bicycle_parking": {
"label": "Uri"
},
"boundary": {
"label": "Uri"
},
"building": {
"label": "Gusali"
},
"building_area": {
"label": "Gusali"
},
"capacity": {
"label": "Kapasidad"
},
"construction": {
"label": "Uri"
},
"crossing": {
"label": "Uri"
},
"entrance": {
"label": "Uri"
},
"fire_hydrant/type": {
"label": "Uri"
},
"generator/type": {
"label": "Uri"
},
"highway": {
"label": "Uri"
},
"historic": {
"label": "Uri"
},
"information": {
"label": "Uri"
},
"internet_access": {
"options": {
"wlan": "Wifi"
}
},
"landuse": {
"label": "Uri"
},
"leisure": {
"label": "Uri"
},
"man_made": {
"label": "Uri"
},
"name": {
"label": "Pangalan"
},
"office": {
"label": "Uri"
},
"parking": {
"label": "Uri"
},
"piste/type": {
"label": "Uri"
},
"place": {
"label": "Uri"
},
"power": {
"label": "Uri"
},
"railway": {
"label": "Uri"
},
"relation": {
"label": "Uri"
},
"restriction": {
"label": "Uri"
},
"route": {
"label": "Uri"
},
"route_master": {
"label": "Uri"
},
"service": {
"label": "Uri"
},
"shelter_type": {
"label": "Uri"
},
"shop": {
"label": "Uri"
},
"studio_type": {
"label": "Uri"
},
"tourism": {
"label": "Uri"
},
"tracktype": {
"label": "Uri"
},
"tree_type": {
"label": "Uri"
},
"water": {
"label": "Uri"
},
"waterway": {
"label": "Uri"
},
"wetland": {
"label": "Uri"
},
"wood": {
"label": "Uri"
}
},
"presets": {
"building": {
"name": "Gusali"
}
}
}
}
-280
View File
@@ -1,280 +0,0 @@
{
"presets": {
"fields": {
"address": {
"label": "주소",
"placeholders": {
"city": "도시",
"street": "길"
}
},
"aeroway": {
"label": "종류"
},
"amenity": {
"label": "종류"
},
"atm": {
"label": "ATM"
},
"bicycle_parking": {
"label": "종류"
},
"building": {
"label": "건물"
},
"building_area": {
"label": "건물"
},
"construction": {
"label": "종류"
},
"crossing": {
"label": "종류"
},
"entrance": {
"label": "종류"
},
"fax": {
"label": "Fax"
},
"highway": {
"label": "종류"
},
"historic": {
"label": "종류"
},
"internet_access": {
"label": "인터넷 이용 가능 여부",
"options": {
"terminal": "터미널",
"wlan": "Wifi"
}
},
"landuse": {
"label": "종류"
},
"leisure": {
"label": "종류"
},
"maxspeed": {
"label": "속도 제한"
},
"office": {
"label": "종류"
},
"oneway": {
"label": "일방통행"
},
"opening_hours": {
"label": "말"
},
"place": {
"label": "종류"
},
"railway": {
"label": "종류"
},
"religion": {
"label": "종교"
},
"service": {
"label": "종류"
},
"shop": {
"label": "종류"
},
"sport": {
"label": "운동"
},
"tourism": {
"label": "종류"
},
"water": {
"label": "종류"
},
"waterway": {
"label": "종류"
},
"website": {
"label": "웹사이트"
},
"wetland": {
"label": "종류"
},
"wikipedia": {
"label": "위키페디아"
}
},
"presets": {
"aeroway/helipad": {
"name": "헬기 이착륙장"
},
"amenity/bank": {
"name": "은행"
},
"amenity/bar": {
"name": "바"
},
"amenity/bicycle_parking": {
"name": "자전거 보관소"
},
"amenity/bicycle_rental": {
"name": "자전거 대여소"
},
"amenity/cafe": {
"name": "카페"
},
"amenity/cinema": {
"name": "극장"
},
"amenity/fast_food": {
"name": "패스트 푸드"
},
"amenity/fire_station": {
"name": "소방소"
},
"amenity/library": {
"name": "도서관"
},
"amenity/pharmacy": {
"name": "약국"
},
"amenity/place_of_worship/christian": {
"name": "성당"
},
"amenity/police": {
"name": "경찰서"
},
"amenity/post_box": {
"name": "사서함"
},
"amenity/post_office": {
"name": "우체국"
},
"amenity/pub": {
"name": "술집"
},
"amenity/restaurant": {
"name": "식당"
},
"amenity/toilets": {
"name": "화장실"
},
"building": {
"name": "건물"
},
"highway/bus_stop": {
"name": "버스정류장"
},
"highway/cycleway": {
"name": "자전거 도로"
},
"highway/footway": {
"name": "산책로"
},
"highway/motorway": {
"name": "고속도로"
},
"highway/path": {
"name": "경로"
},
"highway/primary": {
"name": "큰도시를 연결하는 국도"
},
"highway/residential": {
"name": "주택가 도로.골목길"
},
"highway/secondary": {
"name": "작은 도시와 마을을 연결하는 도로"
},
"highway/service": {
"name": "주요 서비스-주차장,공원 등과 연계된 도로"
},
"highway/steps": {
"name": "계단"
},
"highway/tertiary": {
"name": "폭 4미터 이상의 넓은 도로.영국의 \"C\"도로."
},
"highway/track": {
"name": "농업/임업용 도로"
},
"highway/traffic_signals": {
"name": "신호등"
},
"highway/trunk": {
"name": "고속도로가 아닌 도로"
},
"highway/unclassified": {
"name": "미분류 도로"
},
"historic/monument": {
"name": "산"
},
"landuse/basin": {
"name": "온천"
},
"landuse/construction": {
"name": "개발중"
},
"landuse/forest": {
"name": "숲"
},
"landuse/grass": {
"name": "목초지"
},
"landuse/quarry": {
"name": "채석장"
},
"landuse/vineyard": {
"name": "포도농장"
},
"leisure": {
"name": "레저"
},
"leisure/golf_course": {
"name": "골프장"
},
"leisure/park": {
"name": "공원"
},
"leisure/pitch": {
"name": "축구,야구,스케이트 등 경기장"
},
"leisure/pitch/american_football": {
"name": "미식 축구장"
},
"leisure/pitch/baseball": {
"name": "야구장"
},
"leisure/pitch/basketball": {
"name": "농구장"
},
"leisure/pitch/soccer": {
"name": "축구장"
},
"leisure/pitch/tennis": {
"name": "테니스장"
},
"man_made/lighthouse": {
"name": "Q"
},
"man_made/pier": {
"name": "방파제"
},
"natural/bay": {
"name": "만"
},
"natural/beach": {
"name": "해변"
},
"natural/cliff": {
"name": "절벽"
},
"natural/glacier": {
"name": "빙하"
}
}
}
}
-2209
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-2259
View File
File diff suppressed because it is too large Load Diff
-1569
View File
File diff suppressed because it is too large Load Diff
+213 -201
View File
@@ -61,6 +61,10 @@
return [this[0][0], this[0][1], this[1][0], this[1][1]];
},
bbox: function() {
return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
},
polygon: function() {
return [
[this[0][0], this[0][1]],
@@ -2168,16 +2172,78 @@
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var rbush = createCommonjsModule(function (module) {
/*
(c) 2015, Vladimir Agafonkin
RBush, a JavaScript library for high-performance 2D spatial indexing of points and rectangles.
https://github.com/mourner/rbush
*/
(function () {
var index$1 = createCommonjsModule(function (module) {
'use strict';
module.exports = partialSort;
// Floyd-Rivest selection algorithm:
// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right];
// The k-th element will have the (k - left + 1)th smallest value in [left, right]
function partialSort(arr, k, left, right, compare) {
left = left || 0;
right = right || (arr.length - 1);
compare = compare || defaultCompare;
while (right > left) {
if (right - left > 600) {
var n = right - left + 1;
var m = k - left + 1;
var z = Math.log(n);
var s = 0.5 * Math.exp(2 * z / 3);
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
partialSort(arr, k, newLeft, newRight, compare);
}
var t = arr[k];
var i = left;
var j = right;
swap(arr, left, k);
if (compare(arr[right], t) > 0) swap(arr, left, right);
while (i < j) {
swap(arr, i, j);
i++;
j--;
while (compare(arr[i], t) < 0) i++;
while (compare(arr[j], t) > 0) j--;
}
if (compare(arr[left], t) === 0) swap(arr, left, j);
else {
j++;
swap(arr, j, right);
}
if (j <= k) left = j + 1;
if (k <= j) right = j - 1;
}
}
function swap(arr, i, j) {
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
});
var require$$0 = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
var index = createCommonjsModule(function (module) {
'use strict';
module.exports = rbush;
var quickselect = require$$0;
function rbush(maxEntries, format) {
if (!(this instanceof rbush)) return new rbush(maxEntries, format);
@@ -2204,7 +2270,7 @@
result = [],
toBBox = this.toBBox;
if (!intersects(bbox, node.bbox)) return result;
if (!intersects(bbox, node)) return result;
var nodesToSearch = [],
i, len, child, childBBox;
@@ -2213,7 +2279,7 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child.bbox;
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf) result.push(child);
@@ -2232,7 +2298,7 @@
var node = this.data,
toBBox = this.toBBox;
if (!intersects(bbox, node.bbox)) return false;
if (!intersects(bbox, node)) return false;
var nodesToSearch = [],
i, len, child, childBBox;
@@ -2241,7 +2307,7 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child.bbox;
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf || contains(bbox, childBBox)) return true;
@@ -2296,16 +2362,11 @@
},
clear: function () {
this.data = {
children: [],
height: 1,
bbox: empty(),
leaf: true
};
this.data = createNode([]);
return this;
},
remove: function (item) {
remove: function (item, equalsFn) {
if (!item) return this;
var node = this.data,
@@ -2325,7 +2386,7 @@
}
if (node.leaf) { // check current node
index = node.children.indexOf(item);
index = findItem(item, node.children, equalsFn);
if (index !== -1) {
// item found, remove the item and condense tree upwards
@@ -2336,7 +2397,7 @@
}
}
if (!goingUp && !node.leaf && contains(node.bbox, bbox)) { // go down
if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
path.push(node);
indexes.push(i);
i = 0;
@@ -2356,8 +2417,8 @@
toBBox: function (item) { return item; },
compareMinX: function (a, b) { return a[0] - b[0]; },
compareMinY: function (a, b) { return a[1] - b[1]; },
compareMinX: compareNodeMinX,
compareMinY: compareNodeMinY,
toJSON: function () { return this.data; },
@@ -2385,12 +2446,7 @@
if (N <= M) {
// reached leaf level; return leaf
node = {
children: items.slice(left, right + 1),
height: 1,
bbox: null,
leaf: true
};
node = createNode(items.slice(left, right + 1));
calcBBox(node, this.toBBox);
return node;
}
@@ -2403,12 +2459,9 @@
M = Math.ceil(N / Math.pow(M, height - 1));
}
node = {
children: [],
height: height,
bbox: null,
leaf: false
};
node = createNode([]);
node.leaf = false;
node.height = height;
// split the items into M mostly square tiles
@@ -2451,8 +2504,8 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
area = bboxArea(child.bbox);
enlargement = enlargedArea(bbox, child.bbox) - area;
area = bboxArea(child);
enlargement = enlargedArea(bbox, child) - area;
// choose entry with the least area enlargement
if (enlargement < minEnlargement) {
@@ -2478,7 +2531,7 @@
_insert: function (item, level, isNode) {
var toBBox = this.toBBox,
bbox = isNode ? item.bbox : toBBox(item),
bbox = isNode ? item : toBBox(item),
insertPath = [];
// find the best node for accommodating the item, saving all nodes along the path too
@@ -2486,7 +2539,7 @@
// put the item into the node
node.children.push(item);
extend(node.bbox, bbox);
extend(node, bbox);
// split on node overflow; propagate upwards if necessary
while (level >= 0) {
@@ -2511,14 +2564,9 @@
var splitIndex = this._chooseSplitIndex(node, m, M);
var newNode = {
children: node.children.splice(splitIndex, node.children.length - splitIndex),
height: node.height,
bbox: null,
leaf: false
};
if (node.leaf) newNode.leaf = true;
var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
newNode.height = node.height;
newNode.leaf = node.leaf;
calcBBox(node, this.toBBox);
calcBBox(newNode, this.toBBox);
@@ -2529,12 +2577,9 @@
_splitRoot: function (node, newNode) {
// split root node
this.data = {
children: [node, newNode],
height: node.height + 1,
bbox: null,
leaf: false
};
this.data = createNode([node, newNode]);
this.data.height = node.height + 1;
this.data.leaf = false;
calcBBox(this.data, this.toBBox);
},
@@ -2596,13 +2641,13 @@
for (i = m; i < M - m; i++) {
child = node.children[i];
extend(leftBBox, node.leaf ? toBBox(child) : child.bbox);
extend(leftBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(leftBBox);
}
for (i = M - m - 1; i >= m; i--) {
child = node.children[i];
extend(rightBBox, node.leaf ? toBBox(child) : child.bbox);
extend(rightBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(rightBBox);
}
@@ -2612,7 +2657,7 @@
_adjustParentBBoxes: function (bbox, path, level) {
// adjust bboxes along the given tree path
for (var i = level; i >= 0; i--) {
extend(path[i].bbox, bbox);
extend(path[i], bbox);
}
},
@@ -2642,71 +2687,97 @@
this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
this.toBBox = new Function('a', 'return [a' + format.join(', a') + '];');
this.toBBox = new Function('a',
'return {minX: a' + format[0] +
', minY: a' + format[1] +
', maxX: a' + format[2] +
', maxY: a' + format[3] + '};');
}
};
function findItem(item, items, equalsFn) {
if (!equalsFn) return items.indexOf(item);
for (var i = 0; i < items.length; i++) {
if (equalsFn(item, items[i])) return i;
}
return -1;
}
// calculate node's bbox from bboxes of its children
function calcBBox(node, toBBox) {
node.bbox = distBBox(node, 0, node.children.length, toBBox);
distBBox(node, 0, node.children.length, toBBox, node);
}
// min bounding rectangle of node children from k to p-1
function distBBox(node, k, p, toBBox) {
var bbox = empty();
function distBBox(node, k, p, toBBox, destNode) {
if (!destNode) destNode = createNode(null);
destNode.minX = Infinity;
destNode.minY = Infinity;
destNode.maxX = -Infinity;
destNode.maxY = -Infinity;
for (var i = k, child; i < p; i++) {
child = node.children[i];
extend(bbox, node.leaf ? toBBox(child) : child.bbox);
extend(destNode, node.leaf ? toBBox(child) : child);
}
return bbox;
return destNode;
}
function empty() { return [Infinity, Infinity, -Infinity, -Infinity]; }
function extend(a, b) {
a[0] = Math.min(a[0], b[0]);
a[1] = Math.min(a[1], b[1]);
a[2] = Math.max(a[2], b[2]);
a[3] = Math.max(a[3], b[3]);
a.minX = Math.min(a.minX, b.minX);
a.minY = Math.min(a.minY, b.minY);
a.maxX = Math.max(a.maxX, b.maxX);
a.maxY = Math.max(a.maxY, b.maxY);
return a;
}
function compareNodeMinX(a, b) { return a.bbox[0] - b.bbox[0]; }
function compareNodeMinY(a, b) { return a.bbox[1] - b.bbox[1]; }
function compareNodeMinX(a, b) { return a.minX - b.minX; }
function compareNodeMinY(a, b) { return a.minY - b.minY; }
function bboxArea(a) { return (a[2] - a[0]) * (a[3] - a[1]); }
function bboxMargin(a) { return (a[2] - a[0]) + (a[3] - a[1]); }
function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
function enlargedArea(a, b) {
return (Math.max(b[2], a[2]) - Math.min(b[0], a[0])) *
(Math.max(b[3], a[3]) - Math.min(b[1], a[1]));
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
(Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
}
function intersectionArea(a, b) {
var minX = Math.max(a[0], b[0]),
minY = Math.max(a[1], b[1]),
maxX = Math.min(a[2], b[2]),
maxY = Math.min(a[3], b[3]);
var minX = Math.max(a.minX, b.minX),
minY = Math.max(a.minY, b.minY),
maxX = Math.min(a.maxX, b.maxX),
maxY = Math.min(a.maxY, b.maxY);
return Math.max(0, maxX - minX) *
Math.max(0, maxY - minY);
}
function contains(a, b) {
return a[0] <= b[0] &&
a[1] <= b[1] &&
b[2] <= a[2] &&
b[3] <= a[3];
return a.minX <= b.minX &&
a.minY <= b.minY &&
b.maxX <= a.maxX &&
b.maxY <= a.maxY;
}
function intersects(a, b) {
return b[0] <= a[2] &&
b[1] <= a[3] &&
b[2] >= a[0] &&
b[3] >= a[1];
return b.minX <= a.maxX &&
b.minY <= a.maxY &&
b.maxX >= a.minX &&
b.maxY >= a.minY;
}
function createNode(children) {
return {
children: children,
height: 1,
leaf: true,
minX: Infinity,
minY: Infinity,
maxX: -Infinity,
maxY: -Infinity
};
}
// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
@@ -2723,88 +2794,30 @@
if (right - left <= n) continue;
mid = left + Math.ceil((right - left) / n / 2) * n;
select(arr, left, right, mid, compare);
quickselect(arr, mid, left, right, compare);
stack.push(left, mid, mid, right);
}
}
// Floyd-Rivest selection algorithm:
// sort an array between left and right (inclusive) so that the smallest k elements come first (unordered)
function select(arr, left, right, k, compare) {
var n, i, z, s, sd, newLeft, newRight, t, j;
while (right > left) {
if (right - left > 600) {
n = right - left + 1;
i = k - left + 1;
z = Math.log(n);
s = 0.5 * Math.exp(2 * z / 3);
sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (i - n / 2 < 0 ? -1 : 1);
newLeft = Math.max(left, Math.floor(k - i * s / n + sd));
newRight = Math.min(right, Math.floor(k + (n - i) * s / n + sd));
select(arr, newLeft, newRight, k, compare);
}
t = arr[k];
i = left;
j = right;
swap(arr, left, k);
if (compare(arr[right], t) > 0) swap(arr, left, right);
while (i < j) {
swap(arr, i, j);
i++;
j--;
while (compare(arr[i], t) < 0) i++;
while (compare(arr[j], t) > 0) j--;
}
if (compare(arr[left], t) === 0) swap(arr, left, j);
else {
j++;
swap(arr, j, right);
}
if (j <= k) left = j + 1;
if (k <= j) right = j - 1;
}
}
function swap(arr, i, j) {
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
// export as AMD/CommonJS module or global variable
if (typeof define === 'function' && define.amd) define('rbush', function () { return rbush; });
else if (typeof module !== 'undefined') module.exports = rbush;
else if (typeof self !== 'undefined') self.rbush = rbush;
else window.rbush = rbush;
})();
});
var rbush$1 = (rbush && typeof rbush === 'object' && 'default' in rbush ? rbush['default'] : rbush);
var rbush = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);
function Tree(head) {
var rtree = rbush$1(),
rectangles = {};
var rtree = rbush(),
bboxes = {};
function entityRectangle(entity) {
var rect = entity.extent(head).rectangle();
rect.id = entity.id;
rectangles[entity.id] = rect;
return rect;
function entityBBox(entity) {
var bbox = entity.extent(head).bbox();
bbox.id = entity.id;
bboxes[entity.id] = bbox;
return bbox;
}
function updateParents(entity, insertions, memo) {
head.parentWays(entity).forEach(function(way) {
if (rectangles[way.id]) {
rtree.remove(rectangles[way.id]);
if (bboxes[way.id]) {
rtree.remove(bboxes[way.id]);
insertions[way.id] = way;
}
updateParents(way, insertions, memo);
@@ -2813,8 +2826,8 @@
head.parentRelations(entity).forEach(function(relation) {
if (memo[entity.id]) return;
memo[entity.id] = true;
if (rectangles[relation.id]) {
rtree.remove(rectangles[relation.id]);
if (bboxes[relation.id]) {
rtree.remove(bboxes[relation.id]);
insertions[relation.id] = relation;
}
updateParents(relation, insertions, memo);
@@ -2832,11 +2845,11 @@
if (!entity.visible)
continue;
if (head.entities.hasOwnProperty(entity.id) || rectangles[entity.id]) {
if (head.entities.hasOwnProperty(entity.id) || bboxes[entity.id]) {
if (!force) {
continue;
} else if (rectangles[entity.id]) {
rtree.remove(rectangles[entity.id]);
} else if (bboxes[entity.id]) {
rtree.remove(bboxes[entity.id]);
}
}
@@ -2844,7 +2857,7 @@
updateParents(entity, insertions, {});
}
rtree.load(_.map(insertions, entityRectangle));
rtree.load(_.map(insertions, entityBBox));
return tree;
};
@@ -2857,12 +2870,12 @@
head = graph;
diff.deleted().forEach(function(entity) {
rtree.remove(rectangles[entity.id]);
delete rectangles[entity.id];
rtree.remove(bboxes[entity.id]);
delete bboxes[entity.id];
});
diff.modified().forEach(function(entity) {
rtree.remove(rectangles[entity.id]);
rtree.remove(bboxes[entity.id]);
insertions[entity.id] = entity;
updateParents(entity, insertions, {});
});
@@ -2871,11 +2884,11 @@
insertions[entity.id] = entity;
});
rtree.load(_.map(insertions, entityRectangle));
rtree.load(_.map(insertions, entityBBox));
}
return rtree.search(extent.rectangle()).map(function(rect) {
return head.entity(rect.id);
return rtree.search(extent.bbox()).map(function(bbox) {
return head.entity(bbox.id);
});
};
@@ -4672,16 +4685,16 @@
var mouse = context.mouse(),
pad = 50,
rect = [mouse[0] - pad, mouse[1] - pad, mouse[0] + pad, mouse[1] + pad],
ids = _.map(rtree.search(rect), 'id');
bbox = { minX: mouse[0] - pad, minY: mouse[1] - pad, maxX: mouse[0] + pad, maxY: mouse[1] + pad },
ids = _.map(rtree.search(bbox), 'id');
if (!ids.length) return;
layers.selectAll('.' + ids.join(', .'))
.classed('proximate', true);
}
var rtree = rbush$1(),
rectangles = {};
var rtree = rbush(),
bboxes = {};
function drawLabels(surface, graph, entities, filter, dimensions, fullRedraw) {
var hidePoints = !surface.selectAll('.node.point').node();
@@ -4691,10 +4704,10 @@
if (fullRedraw) {
rtree.clear();
rectangles = {};
bboxes = {};
} else {
for (i = 0; i < entities.length; i++) {
rtree.remove(rectangles[entities[i].id]);
rtree.remove(bboxes[entities[i].id]);
}
}
@@ -4768,8 +4781,8 @@
y: coord[1] + offset[1],
textAnchor: offset[2]
};
var rect = [p.x - m, p.y - m, p.x + width + m, p.y + height + m];
if (tryInsert(rect, entity.id)) return p;
var bbox = { minX: p.x - m, minY: p.y - m, maxX: p.x + width + m, maxY: p.y + height + m };
if (tryInsert(bbox, entity.id)) return p;
}
@@ -4785,14 +4798,14 @@
if (start < 0 || start + width > length) continue;
var sub = subpath(nodes, start, start + width),
rev = reverse(sub),
rect = [
Math.min(sub[0][0], sub[sub.length - 1][0]) - 10,
Math.min(sub[0][1], sub[sub.length - 1][1]) - 10,
Math.max(sub[0][0], sub[sub.length - 1][0]) + 20,
Math.max(sub[0][1], sub[sub.length - 1][1]) + 30
];
bbox = {
minX: Math.min(sub[0][0], sub[sub.length - 1][0]) - 10,
minY: Math.min(sub[0][1], sub[sub.length - 1][1]) - 10,
maxX: Math.max(sub[0][0], sub[sub.length - 1][0]) + 20,
maxY: Math.max(sub[0][1], sub[sub.length - 1][1]) + 30
};
if (rev) sub = sub.reverse();
if (tryInsert(rect, entity.id)) return {
if (tryInsert(bbox, entity.id)) return {
'font-size': height + 2,
lineString: lineString(sub),
startOffset: offset + '%'
@@ -4804,7 +4817,7 @@
var centroid = path.centroid(entity.asGeoJSON(graph, true)),
extent = entity.extent(graph),
entitywidth = projection(extent[1])[0] - projection(extent[0])[0],
rect;
bbox;
if (isNaN(centroid[0]) || entitywidth < 20) return;
@@ -4821,24 +4834,23 @@
p.y = centroid[1] + textOffset;
p.textAnchor = 'middle';
p.height = height;
rect = [p.x - width/2, p.y, p.x + width/2, p.y + height + textOffset];
bbox = { minX: p.x - width/2, minY: p.y, maxX: p.x + width/2, maxY: p.y + height + textOffset };
} else {
rect = [iconX, iconY, iconX + iconSize, iconY + iconSize];
bbox = { minX: iconX, minY: iconY, maxX: iconX + iconSize, maxY: iconY + iconSize };
}
if (tryInsert(rect, entity.id)) return p;
if (tryInsert(bbox, entity.id)) return p;
}
function tryInsert(rect, id) {
function tryInsert(bbox, id) {
// Check that label is visible
if (rect[0] < 0 || rect[1] < 0 || rect[2] > dimensions[0] ||
rect[3] > dimensions[1]) return false;
var v = rtree.search(rect).length === 0;
if (bbox.minX < 0 || bbox.minY < 0 || bbox.maxX > dimensions[0] || bbox.maxY > dimensions[1]) return false;
var v = rtree.search(bbox).length === 0;
if (v) {
rect.id = id;
rtree.insert(rect);
rectangles[id] = rect;
bbox.id = id;
rtree.insert(bbox);
bboxes[id] = bbox;
}
return v;
}
@@ -4875,11 +4887,11 @@
if (showDebug) {
var gj = rtree.all().map(function(d) {
return { type: 'Polygon', coordinates: [[
[d[0], d[1]],
[d[2], d[1]],
[d[2], d[3]],
[d[0], d[3]],
[d[0], d[1]]
[d.minX, d.minY],
[d.maxX, d.minY],
[d.maxX, d.maxY],
[d.minX, d.maxY],
[d.minX, d.minY]
]]};
});
@@ -14417,7 +14429,7 @@
};
}
var index = createCommonjsModule(function (module) {
var index$2 = createCommonjsModule(function (module) {
module.exports = element;
module.exports.pair = pair;
module.exports.format = format;
@@ -14500,7 +14512,7 @@
}
});
var pair = index.pair;
var pair = index$2.pair;
function FeatureList(context) {
var geocodeResults;
@@ -15502,7 +15514,7 @@
step.enter = function() {
reveal('.map-control.help-control',
t('intro.startediting.help', { button: intro.icon('#icon-help', 'pre-text') }));
t('intro.startediting.help', { button: icon('#icon-help', 'pre-text') }));
timeout(function() {
reveal('#bar button.save', t('intro.startediting.save'));
-1340
View File
File diff suppressed because it is too large Load Diff
-540
View File
@@ -1,540 +0,0 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.iD = global.iD || {}, global.iD.operations = global.iD.operations || {})));
}(this, function (exports) { 'use strict';
function Circularize(selectedIDs, context) {
var entityId = selectedIDs[0],
entity = context.entity(entityId),
extent = entity.extent(context.graph()),
geometry = context.geometry(entityId),
action = iD.actions.Circularize(entityId, context.projection);
var operation = function() {
var annotation = t('operations.circularize.annotation.' + geometry);
context.perform(action, annotation);
};
operation.available = function() {
return selectedIDs.length === 1 &&
entity.type === 'way' &&
_.uniq(entity.nodes).length > 1;
};
operation.disabled = function() {
var reason;
if (extent.percentContainedIn(context.extent()) < 0.8) {
reason = 'too_large';
} else if (context.hasHiddenConnections(entityId)) {
reason = 'connected_to_hidden';
}
return action.disabled(context.graph()) || reason;
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.circularize.' + disable) :
t('operations.circularize.description.' + geometry);
};
operation.id = 'circularize';
operation.keys = [t('operations.circularize.key')];
operation.title = t('operations.circularize.title');
return operation;
}
function Continue(selectedIDs, context) {
var graph = context.graph(),
entities = selectedIDs.map(function(id) { return graph.entity(id); }),
geometries = _.extend({line: [], vertex: []},
_.groupBy(entities, function(entity) { return entity.geometry(graph); })),
vertex = geometries.vertex[0];
function candidateWays() {
return graph.parentWays(vertex).filter(function(parent) {
return parent.geometry(graph) === 'line' &&
parent.affix(vertex.id) &&
(geometries.line.length === 0 || geometries.line[0] === parent);
});
}
var operation = function() {
var candidate = candidateWays()[0];
context.enter(iD.modes.DrawLine(
context,
candidate.id,
context.graph(),
candidate.affix(vertex.id)));
};
operation.available = function() {
return geometries.vertex.length === 1 && geometries.line.length <= 1 &&
!context.features().hasHiddenConnections(vertex, context.graph());
};
operation.disabled = function() {
var candidates = candidateWays();
if (candidates.length === 0)
return 'not_eligible';
if (candidates.length > 1)
return 'multiple';
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.continue.' + disable) :
t('operations.continue.description');
};
operation.id = 'continue';
operation.keys = [t('operations.continue.key')];
operation.title = t('operations.continue.title');
return operation;
}
function Delete(selectedIDs, context) {
var action = iD.actions.DeleteMultiple(selectedIDs);
var operation = function() {
var annotation,
nextSelectedID;
if (selectedIDs.length > 1) {
annotation = t('operations.delete.annotation.multiple', {n: selectedIDs.length});
} else {
var id = selectedIDs[0],
entity = context.entity(id),
geometry = context.geometry(id),
parents = context.graph().parentWays(entity),
parent = parents[0];
annotation = t('operations.delete.annotation.' + geometry);
// Select the next closest node in the way.
if (geometry === 'vertex' && parents.length === 1 && parent.nodes.length > 2) {
var nodes = parent.nodes,
i = nodes.indexOf(id);
if (i === 0) {
i++;
} else if (i === nodes.length - 1) {
i--;
} else {
var a = iD.geo.sphericalDistance(entity.loc, context.entity(nodes[i - 1]).loc),
b = iD.geo.sphericalDistance(entity.loc, context.entity(nodes[i + 1]).loc);
i = a < b ? i - 1 : i + 1;
}
nextSelectedID = nodes[i];
}
}
if (nextSelectedID && context.hasEntity(nextSelectedID)) {
context.enter(iD.modes.Select(context, [nextSelectedID]));
} else {
context.enter(iD.modes.Browse(context));
}
context.perform(
action,
annotation);
};
operation.available = function() {
return true;
};
operation.disabled = function() {
var reason;
if (_.some(selectedIDs, context.hasHiddenConnections)) {
reason = 'connected_to_hidden';
}
return action.disabled(context.graph()) || reason;
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.delete.' + disable) :
t('operations.delete.description');
};
operation.id = 'delete';
operation.keys = [iD.ui.cmd('⌘⌫'), iD.ui.cmd('⌘⌦')];
operation.title = t('operations.delete.title');
return operation;
}
function Disconnect(selectedIDs, context) {
var vertices = _.filter(selectedIDs, function vertex(entityId) {
return context.geometry(entityId) === 'vertex';
});
var entityId = vertices[0],
action = iD.actions.Disconnect(entityId);
if (selectedIDs.length > 1) {
action.limitWays(_.without(selectedIDs, entityId));
}
var operation = function() {
context.perform(action, t('operations.disconnect.annotation'));
};
operation.available = function() {
return vertices.length === 1;
};
operation.disabled = function() {
var reason;
if (_.some(selectedIDs, context.hasHiddenConnections)) {
reason = 'connected_to_hidden';
}
return action.disabled(context.graph()) || reason;
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.disconnect.' + disable) :
t('operations.disconnect.description');
};
operation.id = 'disconnect';
operation.keys = [t('operations.disconnect.key')];
operation.title = t('operations.disconnect.title');
return operation;
}
function Merge(selectedIDs, context) {
var join = iD.actions.Join(selectedIDs),
merge = iD.actions.Merge(selectedIDs),
mergePolygon = iD.actions.MergePolygon(selectedIDs);
var operation = function() {
var annotation = t('operations.merge.annotation', {n: selectedIDs.length}),
action;
if (!join.disabled(context.graph())) {
action = join;
} else if (!merge.disabled(context.graph())) {
action = merge;
} else {
action = mergePolygon;
}
context.perform(action, annotation);
context.enter(iD.modes.Select(context, selectedIDs.filter(function(id) { return context.hasEntity(id); }))
.suppressMenu(true));
};
operation.available = function() {
return selectedIDs.length >= 2;
};
operation.disabled = function() {
return join.disabled(context.graph()) &&
merge.disabled(context.graph()) &&
mergePolygon.disabled(context.graph());
};
operation.tooltip = function() {
var j = join.disabled(context.graph()),
m = merge.disabled(context.graph()),
p = mergePolygon.disabled(context.graph());
if (j === 'restriction' && m && p)
return t('operations.merge.restriction', {relation: context.presets().item('type/restriction').name()});
if (p === 'incomplete_relation' && j && m)
return t('operations.merge.incomplete_relation');
if (j && m && p)
return t('operations.merge.' + j);
return t('operations.merge.description');
};
operation.id = 'merge';
operation.keys = [t('operations.merge.key')];
operation.title = t('operations.merge.title');
return operation;
}
function Move(selectedIDs, context) {
var extent = selectedIDs.reduce(function(extent, id) {
return extent.extend(context.entity(id).extent(context.graph()));
}, iD.geo.Extent());
var operation = function() {
context.enter(iD.modes.Move(context, selectedIDs));
};
operation.available = function() {
return selectedIDs.length > 1 ||
context.entity(selectedIDs[0]).type !== 'node';
};
operation.disabled = function() {
var reason;
if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) {
reason = 'too_large';
} else if (_.some(selectedIDs, context.hasHiddenConnections)) {
reason = 'connected_to_hidden';
}
return iD.actions.Move(selectedIDs).disabled(context.graph()) || reason;
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.move.' + disable) :
t('operations.move.description');
};
operation.id = 'move';
operation.keys = [t('operations.move.key')];
operation.title = t('operations.move.title');
return operation;
}
function Orthogonalize(selectedIDs, context) {
var entityId = selectedIDs[0],
entity = context.entity(entityId),
extent = entity.extent(context.graph()),
geometry = context.geometry(entityId),
action = iD.actions.Orthogonalize(entityId, context.projection);
var operation = function() {
var annotation = t('operations.orthogonalize.annotation.' + geometry);
context.perform(action, annotation);
};
operation.available = function() {
return selectedIDs.length === 1 &&
entity.type === 'way' &&
entity.isClosed() &&
_.uniq(entity.nodes).length > 2;
};
operation.disabled = function() {
var reason;
if (extent.percentContainedIn(context.extent()) < 0.8) {
reason = 'too_large';
} else if (context.hasHiddenConnections(entityId)) {
reason = 'connected_to_hidden';
}
return action.disabled(context.graph()) || reason;
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.orthogonalize.' + disable) :
t('operations.orthogonalize.description.' + geometry);
};
operation.id = 'orthogonalize';
operation.keys = [t('operations.orthogonalize.key')];
operation.title = t('operations.orthogonalize.title');
return operation;
}
function Reverse(selectedIDs, context) {
var entityId = selectedIDs[0];
var operation = function() {
context.perform(
iD.actions.Reverse(entityId),
t('operations.reverse.annotation'));
};
operation.available = function() {
return selectedIDs.length === 1 &&
context.geometry(entityId) === 'line';
};
operation.disabled = function() {
return false;
};
operation.tooltip = function() {
return t('operations.reverse.description');
};
operation.id = 'reverse';
operation.keys = [t('operations.reverse.key')];
operation.title = t('operations.reverse.title');
return operation;
}
function Rotate(selectedIDs, context) {
var entityId = selectedIDs[0],
entity = context.entity(entityId),
extent = entity.extent(context.graph()),
geometry = context.geometry(entityId);
var operation = function() {
context.enter(iD.modes.RotateWay(context, entityId));
};
operation.available = function() {
if (selectedIDs.length !== 1 || entity.type !== 'way')
return false;
if (geometry === 'area')
return true;
if (entity.isClosed() &&
context.graph().parentRelations(entity).some(function(r) { return r.isMultipolygon(); }))
return true;
return false;
};
operation.disabled = function() {
if (extent.percentContainedIn(context.extent()) < 0.8) {
return 'too_large';
} else if (context.hasHiddenConnections(entityId)) {
return 'connected_to_hidden';
} else {
return false;
}
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.rotate.' + disable) :
t('operations.rotate.description');
};
operation.id = 'rotate';
operation.keys = [t('operations.rotate.key')];
operation.title = t('operations.rotate.title');
return operation;
}
function Split(selectedIDs, context) {
var vertices = _.filter(selectedIDs, function vertex(entityId) {
return context.geometry(entityId) === 'vertex';
});
var entityId = vertices[0],
action = iD.actions.Split(entityId);
if (selectedIDs.length > 1) {
action.limitWays(_.without(selectedIDs, entityId));
}
var operation = function() {
var annotation;
var ways = action.ways(context.graph());
if (ways.length === 1) {
annotation = t('operations.split.annotation.' + context.geometry(ways[0].id));
} else {
annotation = t('operations.split.annotation.multiple', {n: ways.length});
}
var difference = context.perform(action, annotation);
context.enter(iD.modes.Select(context, difference.extantIDs()));
};
operation.available = function() {
return vertices.length === 1;
};
operation.disabled = function() {
var reason;
if (_.some(selectedIDs, context.hasHiddenConnections)) {
reason = 'connected_to_hidden';
}
return action.disabled(context.graph()) || reason;
};
operation.tooltip = function() {
var disable = operation.disabled();
if (disable) {
return t('operations.split.' + disable);
}
var ways = action.ways(context.graph());
if (ways.length === 1) {
return t('operations.split.description.' + context.geometry(ways[0].id));
} else {
return t('operations.split.description.multiple');
}
};
operation.id = 'split';
operation.keys = [t('operations.split.key')];
operation.title = t('operations.split.title');
return operation;
}
function Straighten(selectedIDs, context) {
var entityId = selectedIDs[0],
action = iD.actions.Straighten(entityId, context.projection);
function operation() {
var annotation = t('operations.straighten.annotation');
context.perform(action, annotation);
}
operation.available = function() {
var entity = context.entity(entityId);
return selectedIDs.length === 1 &&
entity.type === 'way' &&
!entity.isClosed() &&
_.uniq(entity.nodes).length > 2;
};
operation.disabled = function() {
var reason;
if (context.hasHiddenConnections(entityId)) {
reason = 'connected_to_hidden';
}
return action.disabled(context.graph()) || reason;
};
operation.tooltip = function() {
var disable = operation.disabled();
return disable ?
t('operations.straighten.' + disable) :
t('operations.straighten.description');
};
operation.id = 'straighten';
operation.keys = [t('operations.straighten.key')];
operation.title = t('operations.straighten.title');
return operation;
}
exports.Circularize = Circularize;
exports.Continue = Continue;
exports.Delete = Delete;
exports.Disconnect = Disconnect;
exports.Merge = Merge;
exports.Move = Move;
exports.Orthogonalize = Orthogonalize;
exports.Reverse = Reverse;
exports.Rotate = Rotate;
exports.Split = Split;
exports.Straighten = Straighten;
Object.defineProperty(exports, '__esModule', { value: true });
}));
-481
View File
@@ -1,481 +0,0 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.iD = global.iD || {}, global.iD.presets = global.iD.presets || {})));
}(this, function (exports) { 'use strict';
function Collection(collection) {
var maxSearchResults = 50,
maxSuggestionResults = 10;
var presets = {
collection: collection,
item: function(id) {
return _.find(collection, function(d) {
return d.id === id;
});
},
matchGeometry: function(geometry) {
return Collection(collection.filter(function(d) {
return d.matchGeometry(geometry);
}));
},
search: function(value, geometry) {
if (!value) return this;
value = value.toLowerCase();
var searchable = _.filter(collection, function(a) {
return a.searchable !== false && a.suggestion !== true;
}),
suggestions = _.filter(collection, function(a) {
return a.suggestion === true;
});
function leading(a) {
var index = a.indexOf(value);
return index === 0 || a[index - 1] === ' ';
}
// matches value to preset.name
var leading_name = _.filter(searchable, function(a) {
return leading(a.name().toLowerCase());
}).sort(function(a, b) {
var i = a.name().toLowerCase().indexOf(value) - b.name().toLowerCase().indexOf(value);
if (i === 0) return a.name().length - b.name().length;
else return i;
});
// matches value to preset.terms values
var leading_terms = _.filter(searchable, function(a) {
return _.some(a.terms() || [], leading);
});
// matches value to preset.tags values
var leading_tag_values = _.filter(searchable, function(a) {
return _.some(_.without(_.values(a.tags || {}), '*'), leading);
});
// finds close matches to value in preset.name
var levenstein_name = searchable.map(function(a) {
return {
preset: a,
dist: iD.util.editDistance(value, a.name().toLowerCase())
};
}).filter(function(a) {
return a.dist + Math.min(value.length - a.preset.name().length, 0) < 3;
}).sort(function(a, b) {
return a.dist - b.dist;
}).map(function(a) {
return a.preset;
});
// finds close matches to value in preset.terms
var leventstein_terms = _.filter(searchable, function(a) {
return _.some(a.terms() || [], function(b) {
return iD.util.editDistance(value, b) + Math.min(value.length - b.length, 0) < 3;
});
});
function suggestionName(name) {
var nameArray = name.split(' - ');
if (nameArray.length > 1) {
name = nameArray.slice(0, nameArray.length-1).join(' - ');
}
return name.toLowerCase();
}
var leading_suggestions = _.filter(suggestions, function(a) {
return leading(suggestionName(a.name()));
}).sort(function(a, b) {
a = suggestionName(a.name());
b = suggestionName(b.name());
var i = a.indexOf(value) - b.indexOf(value);
if (i === 0) return a.length - b.length;
else return i;
});
var leven_suggestions = suggestions.map(function(a) {
return {
preset: a,
dist: iD.util.editDistance(value, suggestionName(a.name()))
};
}).filter(function(a) {
return a.dist + Math.min(value.length - suggestionName(a.preset.name()).length, 0) < 1;
}).sort(function(a, b) {
return a.dist - b.dist;
}).map(function(a) {
return a.preset;
});
var other = presets.item(geometry);
var results = leading_name.concat(
leading_terms,
leading_tag_values,
leading_suggestions.slice(0, maxSuggestionResults+5),
levenstein_name,
leventstein_terms,
leven_suggestions.slice(0, maxSuggestionResults)
).slice(0, maxSearchResults-1);
return Collection(_.uniq(
results.concat(other)
));
}
};
return presets;
}
function Category(id, category, all) {
category = _.clone(category);
category.id = id;
category.members = Collection(category.members.map(function(id) {
return all.item(id);
}));
category.matchGeometry = function(geometry) {
return category.geometry.indexOf(geometry) >= 0;
};
category.matchScore = function() { return -1; };
category.name = function() {
return t('presets.categories.' + id + '.name', {'default': id});
};
category.terms = function() {
return [];
};
return category;
}
function Field(id, field) {
field = _.clone(field);
field.id = id;
field.matchGeometry = function(geometry) {
return !field.geometry || field.geometry === geometry;
};
field.t = function(scope, options) {
return t('presets.fields.' + id + '.' + scope, options);
};
field.label = function() {
return field.t('label', {'default': id});
};
var placeholder = field.placeholder;
field.placeholder = function() {
return field.t('placeholder', {'default': placeholder});
};
return field;
}
function Preset(id, preset, fields) {
preset = _.clone(preset);
preset.id = id;
preset.fields = (preset.fields || []).map(getFields);
preset.geometry = (preset.geometry || []);
function getFields(f) {
return fields[f];
}
preset.matchGeometry = function(geometry) {
return preset.geometry.indexOf(geometry) >= 0;
};
var matchScore = preset.matchScore || 1;
preset.matchScore = function(entity) {
var tags = preset.tags,
score = 0;
for (var t in tags) {
if (entity.tags[t] === tags[t]) {
score += matchScore;
} else if (tags[t] === '*' && t in entity.tags) {
score += matchScore / 2;
} else {
return -1;
}
}
return score;
};
preset.t = function(scope, options) {
return t('presets.presets.' + id + '.' + scope, options);
};
var name = preset.name;
preset.name = function() {
if (preset.suggestion) {
id = id.split('/');
id = id[0] + '/' + id[1];
return name + ' - ' + t('presets.presets.' + id + '.name');
}
return preset.t('name', {'default': name});
};
preset.terms = function() {
return preset.t('terms', {'default': ''}).toLowerCase().trim().split(/\s*,+\s*/);
};
preset.isFallback = function() {
var tagCount = Object.keys(preset.tags).length;
return tagCount === 0 || (tagCount === 1 && preset.tags.hasOwnProperty('area'));
};
preset.reference = function(geometry) {
var key = Object.keys(preset.tags)[0],
value = preset.tags[key];
if (geometry === 'relation' && key === 'type') {
return { rtype: value };
} else if (value === '*') {
return { key: key };
} else {
return { key: key, value: value };
}
};
var removeTags = preset.removeTags || preset.tags;
preset.removeTags = function(tags, geometry) {
tags = _.omit(tags, _.keys(removeTags));
for (var f in preset.fields) {
var field = preset.fields[f];
if (field.matchGeometry(geometry) && field.default === tags[field.key]) {
delete tags[field.key];
}
}
delete tags.area;
return tags;
};
var applyTags = preset.addTags || preset.tags;
preset.applyTags = function(tags, geometry) {
var k;
tags = _.clone(tags);
for (k in applyTags) {
if (applyTags[k] === '*') {
tags[k] = 'yes';
} else {
tags[k] = applyTags[k];
}
}
// 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`)
if (geometry === 'area') {
var needsAreaTag = true;
if (preset.geometry.indexOf('line') === -1) {
for (k in applyTags) {
if (k in iD.areaKeys) {
needsAreaTag = false;
break;
}
}
}
if (needsAreaTag) {
tags.area = 'yes';
}
}
for (var f in preset.fields) {
var field = preset.fields[f];
if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
tags[field.key] = field.default;
}
}
return tags;
};
return preset;
}
function presets() {
// an iD.presets.Collection with methods for
// loading new data and returning defaults
var all = Collection([]),
defaults = { area: all, line: all, point: all, vertex: all, relation: all },
fields = {},
universal = [],
recent = Collection([]);
// Index of presets by (geometry, tag key).
var index = {
point: {},
vertex: {},
line: {},
area: {},
relation: {}
};
all.match = function(entity, resolver) {
var geometry = entity.geometry(resolver),
geometryMatches = index[geometry],
best = -1,
match;
for (var k in entity.tags) {
var keyMatches = geometryMatches[k];
if (!keyMatches) continue;
for (var i = 0; i < keyMatches.length; i++) {
var score = keyMatches[i].matchScore(entity);
if (score > best) {
best = score;
match = keyMatches[i];
}
}
}
return match || all.item(geometry);
};
// Because of the open nature of tagging, iD will never have a complete
// list of tags used in OSM, so we want it to have logic like "assume
// that a closed way with an amenity tag is an area, unless the amenity
// is one of these specific types". This function computes a structure
// that allows testing of such conditions, based on the presets designated
// as as supporting (or not supporting) the area geometry.
//
// The returned object L is a whitelist/blacklist of tags. A closed way
// with a tag (k, v) is considered to be an area if `k in L && !(v in L[k])`
// (see `iD.Way#isArea()`). In other words, the keys of L form the whitelist,
// and the subkeys form the blacklist.
all.areaKeys = function() {
var areaKeys = {},
ignore = ['barrier', 'highway', 'footway', 'railway', 'type'],
presets = _.reject(all.collection, 'suggestion');
// whitelist
presets.forEach(function(d) {
for (var key in d.tags) break;
if (!key) return;
if (ignore.indexOf(key) !== -1) return;
if (d.geometry.indexOf('area') !== -1) {
areaKeys[key] = areaKeys[key] || {};
}
});
// blacklist
presets.forEach(function(d) {
for (var key in d.tags) break;
if (!key) return;
if (ignore.indexOf(key) !== -1) return;
var value = d.tags[key];
if (d.geometry.indexOf('area') === -1 &&
d.geometry.indexOf('line') !== -1 &&
key in areaKeys && value !== '*') {
areaKeys[key][value] = true;
}
});
return areaKeys;
};
all.load = function(d) {
if (d.fields) {
_.forEach(d.fields, function(d, id) {
fields[id] = Field(id, d);
if (d.universal) universal.push(fields[id]);
});
}
if (d.presets) {
_.forEach(d.presets, function(d, id) {
all.collection.push(Preset(id, d, fields));
});
}
if (d.categories) {
_.forEach(d.categories, function(d, id) {
all.collection.push(Category(id, d, all));
});
}
if (d.defaults) {
var getItem = _.bind(all.item, all);
defaults = {
area: Collection(d.defaults.area.map(getItem)),
line: Collection(d.defaults.line.map(getItem)),
point: Collection(d.defaults.point.map(getItem)),
vertex: Collection(d.defaults.vertex.map(getItem)),
relation: Collection(d.defaults.relation.map(getItem))
};
}
for (var i = 0; i < all.collection.length; i++) {
var preset = all.collection[i],
geometry = preset.geometry;
for (var j = 0; j < geometry.length; j++) {
var g = index[geometry[j]];
for (var k in preset.tags) {
(g[k] = g[k] || []).push(preset);
}
}
}
return all;
};
all.field = function(id) {
return fields[id];
};
all.universal = function() {
return universal;
};
all.defaults = function(geometry, n) {
var rec = recent.matchGeometry(geometry).collection.slice(0, 4),
def = _.uniq(rec.concat(defaults[geometry].collection)).slice(0, n - 1);
return Collection(_.uniq(rec.concat(def).concat(all.item(geometry))));
};
all.choose = function(preset) {
if (!preset.isFallback()) {
recent = Collection(_.uniq([preset].concat(recent.collection)));
}
return all;
};
return all;
}
exports.Category = Category;
exports.Collection = Collection;
exports.Field = Field;
exports.Preset = Preset;
exports.presets = presets;
Object.defineProperty(exports, '__esModule', { value: true });
}));
File diff suppressed because it is too large Load Diff
+164 -155
View File
@@ -8,16 +8,78 @@
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var rbush = createCommonjsModule(function (module) {
/*
(c) 2015, Vladimir Agafonkin
RBush, a JavaScript library for high-performance 2D spatial indexing of points and rectangles.
https://github.com/mourner/rbush
*/
(function () {
var index$1 = createCommonjsModule(function (module) {
'use strict';
module.exports = partialSort;
// Floyd-Rivest selection algorithm:
// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right];
// The k-th element will have the (k - left + 1)th smallest value in [left, right]
function partialSort(arr, k, left, right, compare) {
left = left || 0;
right = right || (arr.length - 1);
compare = compare || defaultCompare;
while (right > left) {
if (right - left > 600) {
var n = right - left + 1;
var m = k - left + 1;
var z = Math.log(n);
var s = 0.5 * Math.exp(2 * z / 3);
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
partialSort(arr, k, newLeft, newRight, compare);
}
var t = arr[k];
var i = left;
var j = right;
swap(arr, left, k);
if (compare(arr[right], t) > 0) swap(arr, left, right);
while (i < j) {
swap(arr, i, j);
i++;
j--;
while (compare(arr[i], t) < 0) i++;
while (compare(arr[j], t) > 0) j--;
}
if (compare(arr[left], t) === 0) swap(arr, left, j);
else {
j++;
swap(arr, j, right);
}
if (j <= k) left = j + 1;
if (k <= j) right = j - 1;
}
}
function swap(arr, i, j) {
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
});
var require$$0 = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
var index = createCommonjsModule(function (module) {
'use strict';
module.exports = rbush;
var quickselect = require$$0;
function rbush(maxEntries, format) {
if (!(this instanceof rbush)) return new rbush(maxEntries, format);
@@ -44,7 +106,7 @@
result = [],
toBBox = this.toBBox;
if (!intersects(bbox, node.bbox)) return result;
if (!intersects(bbox, node)) return result;
var nodesToSearch = [],
i, len, child, childBBox;
@@ -53,7 +115,7 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child.bbox;
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf) result.push(child);
@@ -72,7 +134,7 @@
var node = this.data,
toBBox = this.toBBox;
if (!intersects(bbox, node.bbox)) return false;
if (!intersects(bbox, node)) return false;
var nodesToSearch = [],
i, len, child, childBBox;
@@ -81,7 +143,7 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child.bbox;
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf || contains(bbox, childBBox)) return true;
@@ -136,16 +198,11 @@
},
clear: function () {
this.data = {
children: [],
height: 1,
bbox: empty(),
leaf: true
};
this.data = createNode([]);
return this;
},
remove: function (item) {
remove: function (item, equalsFn) {
if (!item) return this;
var node = this.data,
@@ -165,7 +222,7 @@
}
if (node.leaf) { // check current node
index = node.children.indexOf(item);
index = findItem(item, node.children, equalsFn);
if (index !== -1) {
// item found, remove the item and condense tree upwards
@@ -176,7 +233,7 @@
}
}
if (!goingUp && !node.leaf && contains(node.bbox, bbox)) { // go down
if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
path.push(node);
indexes.push(i);
i = 0;
@@ -196,8 +253,8 @@
toBBox: function (item) { return item; },
compareMinX: function (a, b) { return a[0] - b[0]; },
compareMinY: function (a, b) { return a[1] - b[1]; },
compareMinX: compareNodeMinX,
compareMinY: compareNodeMinY,
toJSON: function () { return this.data; },
@@ -225,12 +282,7 @@
if (N <= M) {
// reached leaf level; return leaf
node = {
children: items.slice(left, right + 1),
height: 1,
bbox: null,
leaf: true
};
node = createNode(items.slice(left, right + 1));
calcBBox(node, this.toBBox);
return node;
}
@@ -243,12 +295,9 @@
M = Math.ceil(N / Math.pow(M, height - 1));
}
node = {
children: [],
height: height,
bbox: null,
leaf: false
};
node = createNode([]);
node.leaf = false;
node.height = height;
// split the items into M mostly square tiles
@@ -291,8 +340,8 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
area = bboxArea(child.bbox);
enlargement = enlargedArea(bbox, child.bbox) - area;
area = bboxArea(child);
enlargement = enlargedArea(bbox, child) - area;
// choose entry with the least area enlargement
if (enlargement < minEnlargement) {
@@ -318,7 +367,7 @@
_insert: function (item, level, isNode) {
var toBBox = this.toBBox,
bbox = isNode ? item.bbox : toBBox(item),
bbox = isNode ? item : toBBox(item),
insertPath = [];
// find the best node for accommodating the item, saving all nodes along the path too
@@ -326,7 +375,7 @@
// put the item into the node
node.children.push(item);
extend(node.bbox, bbox);
extend(node, bbox);
// split on node overflow; propagate upwards if necessary
while (level >= 0) {
@@ -351,14 +400,9 @@
var splitIndex = this._chooseSplitIndex(node, m, M);
var newNode = {
children: node.children.splice(splitIndex, node.children.length - splitIndex),
height: node.height,
bbox: null,
leaf: false
};
if (node.leaf) newNode.leaf = true;
var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
newNode.height = node.height;
newNode.leaf = node.leaf;
calcBBox(node, this.toBBox);
calcBBox(newNode, this.toBBox);
@@ -369,12 +413,9 @@
_splitRoot: function (node, newNode) {
// split root node
this.data = {
children: [node, newNode],
height: node.height + 1,
bbox: null,
leaf: false
};
this.data = createNode([node, newNode]);
this.data.height = node.height + 1;
this.data.leaf = false;
calcBBox(this.data, this.toBBox);
},
@@ -436,13 +477,13 @@
for (i = m; i < M - m; i++) {
child = node.children[i];
extend(leftBBox, node.leaf ? toBBox(child) : child.bbox);
extend(leftBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(leftBBox);
}
for (i = M - m - 1; i >= m; i--) {
child = node.children[i];
extend(rightBBox, node.leaf ? toBBox(child) : child.bbox);
extend(rightBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(rightBBox);
}
@@ -452,7 +493,7 @@
_adjustParentBBoxes: function (bbox, path, level) {
// adjust bboxes along the given tree path
for (var i = level; i >= 0; i--) {
extend(path[i].bbox, bbox);
extend(path[i], bbox);
}
},
@@ -482,71 +523,97 @@
this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
this.toBBox = new Function('a', 'return [a' + format.join(', a') + '];');
this.toBBox = new Function('a',
'return {minX: a' + format[0] +
', minY: a' + format[1] +
', maxX: a' + format[2] +
', maxY: a' + format[3] + '};');
}
};
function findItem(item, items, equalsFn) {
if (!equalsFn) return items.indexOf(item);
for (var i = 0; i < items.length; i++) {
if (equalsFn(item, items[i])) return i;
}
return -1;
}
// calculate node's bbox from bboxes of its children
function calcBBox(node, toBBox) {
node.bbox = distBBox(node, 0, node.children.length, toBBox);
distBBox(node, 0, node.children.length, toBBox, node);
}
// min bounding rectangle of node children from k to p-1
function distBBox(node, k, p, toBBox) {
var bbox = empty();
function distBBox(node, k, p, toBBox, destNode) {
if (!destNode) destNode = createNode(null);
destNode.minX = Infinity;
destNode.minY = Infinity;
destNode.maxX = -Infinity;
destNode.maxY = -Infinity;
for (var i = k, child; i < p; i++) {
child = node.children[i];
extend(bbox, node.leaf ? toBBox(child) : child.bbox);
extend(destNode, node.leaf ? toBBox(child) : child);
}
return bbox;
return destNode;
}
function empty() { return [Infinity, Infinity, -Infinity, -Infinity]; }
function extend(a, b) {
a[0] = Math.min(a[0], b[0]);
a[1] = Math.min(a[1], b[1]);
a[2] = Math.max(a[2], b[2]);
a[3] = Math.max(a[3], b[3]);
a.minX = Math.min(a.minX, b.minX);
a.minY = Math.min(a.minY, b.minY);
a.maxX = Math.max(a.maxX, b.maxX);
a.maxY = Math.max(a.maxY, b.maxY);
return a;
}
function compareNodeMinX(a, b) { return a.bbox[0] - b.bbox[0]; }
function compareNodeMinY(a, b) { return a.bbox[1] - b.bbox[1]; }
function compareNodeMinX(a, b) { return a.minX - b.minX; }
function compareNodeMinY(a, b) { return a.minY - b.minY; }
function bboxArea(a) { return (a[2] - a[0]) * (a[3] - a[1]); }
function bboxMargin(a) { return (a[2] - a[0]) + (a[3] - a[1]); }
function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
function enlargedArea(a, b) {
return (Math.max(b[2], a[2]) - Math.min(b[0], a[0])) *
(Math.max(b[3], a[3]) - Math.min(b[1], a[1]));
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
(Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
}
function intersectionArea(a, b) {
var minX = Math.max(a[0], b[0]),
minY = Math.max(a[1], b[1]),
maxX = Math.min(a[2], b[2]),
maxY = Math.min(a[3], b[3]);
var minX = Math.max(a.minX, b.minX),
minY = Math.max(a.minY, b.minY),
maxX = Math.min(a.maxX, b.maxX),
maxY = Math.min(a.maxY, b.maxY);
return Math.max(0, maxX - minX) *
Math.max(0, maxY - minY);
}
function contains(a, b) {
return a[0] <= b[0] &&
a[1] <= b[1] &&
b[2] <= a[2] &&
b[3] <= a[3];
return a.minX <= b.minX &&
a.minY <= b.minY &&
b.maxX <= a.maxX &&
b.maxY <= a.maxY;
}
function intersects(a, b) {
return b[0] <= a[2] &&
b[1] <= a[3] &&
b[2] >= a[0] &&
b[3] >= a[1];
return b.minX <= a.maxX &&
b.minY <= a.maxY &&
b.maxX >= a.minX &&
b.maxY >= a.minY;
}
function createNode(children) {
return {
children: children,
height: 1,
leaf: true,
minX: Infinity,
minY: Infinity,
maxX: -Infinity,
maxY: -Infinity
};
}
// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
@@ -563,72 +630,14 @@
if (right - left <= n) continue;
mid = left + Math.ceil((right - left) / n / 2) * n;
select(arr, left, right, mid, compare);
quickselect(arr, mid, left, right, compare);
stack.push(left, mid, mid, right);
}
}
// Floyd-Rivest selection algorithm:
// sort an array between left and right (inclusive) so that the smallest k elements come first (unordered)
function select(arr, left, right, k, compare) {
var n, i, z, s, sd, newLeft, newRight, t, j;
while (right > left) {
if (right - left > 600) {
n = right - left + 1;
i = k - left + 1;
z = Math.log(n);
s = 0.5 * Math.exp(2 * z / 3);
sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (i - n / 2 < 0 ? -1 : 1);
newLeft = Math.max(left, Math.floor(k - i * s / n + sd));
newRight = Math.min(right, Math.floor(k + (n - i) * s / n + sd));
select(arr, newLeft, newRight, k, compare);
}
t = arr[k];
i = left;
j = right;
swap(arr, left, k);
if (compare(arr[right], t) > 0) swap(arr, left, right);
while (i < j) {
swap(arr, i, j);
i++;
j--;
while (compare(arr[i], t) < 0) i++;
while (compare(arr[j], t) > 0) j--;
}
if (compare(arr[left], t) === 0) swap(arr, left, j);
else {
j++;
swap(arr, j, right);
}
if (j <= k) left = j + 1;
if (k <= j) right = j - 1;
}
}
function swap(arr, i, j) {
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
// export as AMD/CommonJS module or global variable
if (typeof define === 'function' && define.amd) define('rbush', function () { return rbush; });
else if (typeof module !== 'undefined') module.exports = rbush;
else if (typeof self !== 'undefined') self.rbush = rbush;
else window.rbush = rbush;
})();
});
var rbush$1 = (rbush && typeof rbush === 'object' && 'default' in rbush ? rbush['default'] : rbush);
var rbush = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);
function mapillary() {
var mapillary = {},
@@ -828,7 +837,7 @@
if (which === 'images') d.ca = feature.properties.ca;
if (which === 'signs') d.signs = feature.properties.rects;
features.push([loc[0], loc[1], loc[0], loc[1], d]);
features.push({minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1], data: d});
}
cache.rtree.load(features);
@@ -885,9 +894,9 @@
var partitions = partitionViewport(psize, projection, dimensions);
return _.flatten(_.compact(_.map(partitions, function(extent) {
return rtree.search(extent.rectangle())
return rtree.search(extent.bbox())
.slice(0, limit)
.map(function(d) { return d[4]; });
.map(function(d) { return d.data; });
})));
}
@@ -1009,8 +1018,8 @@
}
iD.services.mapillary.cache = {
images: { inflight: {}, loaded: {}, rtree: rbush$1() },
signs: { inflight: {}, loaded: {}, rtree: rbush$1() }
images: { inflight: {}, loaded: {}, rtree: rbush() },
signs: { inflight: {}, loaded: {}, rtree: rbush() }
};
iD.services.mapillary.image = null;
@@ -1034,10 +1043,10 @@
nominatim.countryCode = function(location, callback) {
var cache = iD.services.nominatim.cache,
countryCodes = cache.search([location[0], location[1], location[0], location[1]]);
countryCodes = cache.search({ minX: location[0], minY: location[1], maxX: location[0], maxY: location[1] });
if (countryCodes.length > 0)
return callback(null, countryCodes[0][4]);
return callback(null, countryCodes[0].data);
d3.json(endpoint +
iD.util.qsString({
@@ -1053,14 +1062,14 @@
var extent = iD.geo.Extent(location).padByMeters(1000);
cache.insert(extent.rectangle().concat(result.address.country_code));
cache.insert(Object.assign(extent.bbox(), { data: result.address.country_code }));
callback(null, result.address.country_code);
});
};
nominatim.reset = function() {
iD.services.nominatim.cache = rbush$1();
iD.services.nominatim.cache = rbush();
return this;
};
+185 -177
View File
@@ -569,16 +569,78 @@
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var rbush = createCommonjsModule(function (module) {
/*
(c) 2015, Vladimir Agafonkin
RBush, a JavaScript library for high-performance 2D spatial indexing of points and rectangles.
https://github.com/mourner/rbush
*/
(function () {
var index$1 = createCommonjsModule(function (module) {
'use strict';
module.exports = partialSort;
// Floyd-Rivest selection algorithm:
// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right];
// The k-th element will have the (k - left + 1)th smallest value in [left, right]
function partialSort(arr, k, left, right, compare) {
left = left || 0;
right = right || (arr.length - 1);
compare = compare || defaultCompare;
while (right > left) {
if (right - left > 600) {
var n = right - left + 1;
var m = k - left + 1;
var z = Math.log(n);
var s = 0.5 * Math.exp(2 * z / 3);
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
partialSort(arr, k, newLeft, newRight, compare);
}
var t = arr[k];
var i = left;
var j = right;
swap(arr, left, k);
if (compare(arr[right], t) > 0) swap(arr, left, right);
while (i < j) {
swap(arr, i, j);
i++;
j--;
while (compare(arr[i], t) < 0) i++;
while (compare(arr[j], t) > 0) j--;
}
if (compare(arr[left], t) === 0) swap(arr, left, j);
else {
j++;
swap(arr, j, right);
}
if (j <= k) left = j + 1;
if (k <= j) right = j - 1;
}
}
function swap(arr, i, j) {
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
function defaultCompare(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
});
var require$$0 = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
var index = createCommonjsModule(function (module) {
'use strict';
module.exports = rbush;
var quickselect = require$$0;
function rbush(maxEntries, format) {
if (!(this instanceof rbush)) return new rbush(maxEntries, format);
@@ -605,7 +667,7 @@
result = [],
toBBox = this.toBBox;
if (!intersects(bbox, node.bbox)) return result;
if (!intersects(bbox, node)) return result;
var nodesToSearch = [],
i, len, child, childBBox;
@@ -614,7 +676,7 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child.bbox;
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf) result.push(child);
@@ -633,7 +695,7 @@
var node = this.data,
toBBox = this.toBBox;
if (!intersects(bbox, node.bbox)) return false;
if (!intersects(bbox, node)) return false;
var nodesToSearch = [],
i, len, child, childBBox;
@@ -642,7 +704,7 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
childBBox = node.leaf ? toBBox(child) : child.bbox;
childBBox = node.leaf ? toBBox(child) : child;
if (intersects(bbox, childBBox)) {
if (node.leaf || contains(bbox, childBBox)) return true;
@@ -697,16 +759,11 @@
},
clear: function () {
this.data = {
children: [],
height: 1,
bbox: empty(),
leaf: true
};
this.data = createNode([]);
return this;
},
remove: function (item) {
remove: function (item, equalsFn) {
if (!item) return this;
var node = this.data,
@@ -726,7 +783,7 @@
}
if (node.leaf) { // check current node
index = node.children.indexOf(item);
index = findItem(item, node.children, equalsFn);
if (index !== -1) {
// item found, remove the item and condense tree upwards
@@ -737,7 +794,7 @@
}
}
if (!goingUp && !node.leaf && contains(node.bbox, bbox)) { // go down
if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
path.push(node);
indexes.push(i);
i = 0;
@@ -757,8 +814,8 @@
toBBox: function (item) { return item; },
compareMinX: function (a, b) { return a[0] - b[0]; },
compareMinY: function (a, b) { return a[1] - b[1]; },
compareMinX: compareNodeMinX,
compareMinY: compareNodeMinY,
toJSON: function () { return this.data; },
@@ -786,12 +843,7 @@
if (N <= M) {
// reached leaf level; return leaf
node = {
children: items.slice(left, right + 1),
height: 1,
bbox: null,
leaf: true
};
node = createNode(items.slice(left, right + 1));
calcBBox(node, this.toBBox);
return node;
}
@@ -804,12 +856,9 @@
M = Math.ceil(N / Math.pow(M, height - 1));
}
node = {
children: [],
height: height,
bbox: null,
leaf: false
};
node = createNode([]);
node.leaf = false;
node.height = height;
// split the items into M mostly square tiles
@@ -852,8 +901,8 @@
for (i = 0, len = node.children.length; i < len; i++) {
child = node.children[i];
area = bboxArea(child.bbox);
enlargement = enlargedArea(bbox, child.bbox) - area;
area = bboxArea(child);
enlargement = enlargedArea(bbox, child) - area;
// choose entry with the least area enlargement
if (enlargement < minEnlargement) {
@@ -879,7 +928,7 @@
_insert: function (item, level, isNode) {
var toBBox = this.toBBox,
bbox = isNode ? item.bbox : toBBox(item),
bbox = isNode ? item : toBBox(item),
insertPath = [];
// find the best node for accommodating the item, saving all nodes along the path too
@@ -887,7 +936,7 @@
// put the item into the node
node.children.push(item);
extend(node.bbox, bbox);
extend(node, bbox);
// split on node overflow; propagate upwards if necessary
while (level >= 0) {
@@ -912,14 +961,9 @@
var splitIndex = this._chooseSplitIndex(node, m, M);
var newNode = {
children: node.children.splice(splitIndex, node.children.length - splitIndex),
height: node.height,
bbox: null,
leaf: false
};
if (node.leaf) newNode.leaf = true;
var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
newNode.height = node.height;
newNode.leaf = node.leaf;
calcBBox(node, this.toBBox);
calcBBox(newNode, this.toBBox);
@@ -930,12 +974,9 @@
_splitRoot: function (node, newNode) {
// split root node
this.data = {
children: [node, newNode],
height: node.height + 1,
bbox: null,
leaf: false
};
this.data = createNode([node, newNode]);
this.data.height = node.height + 1;
this.data.leaf = false;
calcBBox(this.data, this.toBBox);
},
@@ -997,13 +1038,13 @@
for (i = m; i < M - m; i++) {
child = node.children[i];
extend(leftBBox, node.leaf ? toBBox(child) : child.bbox);
extend(leftBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(leftBBox);
}
for (i = M - m - 1; i >= m; i--) {
child = node.children[i];
extend(rightBBox, node.leaf ? toBBox(child) : child.bbox);
extend(rightBBox, node.leaf ? toBBox(child) : child);
margin += bboxMargin(rightBBox);
}
@@ -1013,7 +1054,7 @@
_adjustParentBBoxes: function (bbox, path, level) {
// adjust bboxes along the given tree path
for (var i = level; i >= 0; i--) {
extend(path[i].bbox, bbox);
extend(path[i], bbox);
}
},
@@ -1043,71 +1084,97 @@
this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
this.toBBox = new Function('a', 'return [a' + format.join(', a') + '];');
this.toBBox = new Function('a',
'return {minX: a' + format[0] +
', minY: a' + format[1] +
', maxX: a' + format[2] +
', maxY: a' + format[3] + '};');
}
};
function findItem(item, items, equalsFn) {
if (!equalsFn) return items.indexOf(item);
for (var i = 0; i < items.length; i++) {
if (equalsFn(item, items[i])) return i;
}
return -1;
}
// calculate node's bbox from bboxes of its children
function calcBBox(node, toBBox) {
node.bbox = distBBox(node, 0, node.children.length, toBBox);
distBBox(node, 0, node.children.length, toBBox, node);
}
// min bounding rectangle of node children from k to p-1
function distBBox(node, k, p, toBBox) {
var bbox = empty();
function distBBox(node, k, p, toBBox, destNode) {
if (!destNode) destNode = createNode(null);
destNode.minX = Infinity;
destNode.minY = Infinity;
destNode.maxX = -Infinity;
destNode.maxY = -Infinity;
for (var i = k, child; i < p; i++) {
child = node.children[i];
extend(bbox, node.leaf ? toBBox(child) : child.bbox);
extend(destNode, node.leaf ? toBBox(child) : child);
}
return bbox;
return destNode;
}
function empty() { return [Infinity, Infinity, -Infinity, -Infinity]; }
function extend(a, b) {
a[0] = Math.min(a[0], b[0]);
a[1] = Math.min(a[1], b[1]);
a[2] = Math.max(a[2], b[2]);
a[3] = Math.max(a[3], b[3]);
a.minX = Math.min(a.minX, b.minX);
a.minY = Math.min(a.minY, b.minY);
a.maxX = Math.max(a.maxX, b.maxX);
a.maxY = Math.max(a.maxY, b.maxY);
return a;
}
function compareNodeMinX(a, b) { return a.bbox[0] - b.bbox[0]; }
function compareNodeMinY(a, b) { return a.bbox[1] - b.bbox[1]; }
function compareNodeMinX(a, b) { return a.minX - b.minX; }
function compareNodeMinY(a, b) { return a.minY - b.minY; }
function bboxArea(a) { return (a[2] - a[0]) * (a[3] - a[1]); }
function bboxMargin(a) { return (a[2] - a[0]) + (a[3] - a[1]); }
function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
function enlargedArea(a, b) {
return (Math.max(b[2], a[2]) - Math.min(b[0], a[0])) *
(Math.max(b[3], a[3]) - Math.min(b[1], a[1]));
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
(Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
}
function intersectionArea(a, b) {
var minX = Math.max(a[0], b[0]),
minY = Math.max(a[1], b[1]),
maxX = Math.min(a[2], b[2]),
maxY = Math.min(a[3], b[3]);
var minX = Math.max(a.minX, b.minX),
minY = Math.max(a.minY, b.minY),
maxX = Math.min(a.maxX, b.maxX),
maxY = Math.min(a.maxY, b.maxY);
return Math.max(0, maxX - minX) *
Math.max(0, maxY - minY);
}
function contains(a, b) {
return a[0] <= b[0] &&
a[1] <= b[1] &&
b[2] <= a[2] &&
b[3] <= a[3];
return a.minX <= b.minX &&
a.minY <= b.minY &&
b.maxX <= a.maxX &&
b.maxY <= a.maxY;
}
function intersects(a, b) {
return b[0] <= a[2] &&
b[1] <= a[3] &&
b[2] >= a[0] &&
b[3] >= a[1];
return b.minX <= a.maxX &&
b.minY <= a.maxY &&
b.maxX >= a.minX &&
b.maxY >= a.minY;
}
function createNode(children) {
return {
children: children,
height: 1,
leaf: true,
minX: Infinity,
minY: Infinity,
maxX: -Infinity,
maxY: -Infinity
};
}
// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
@@ -1124,72 +1191,14 @@
if (right - left <= n) continue;
mid = left + Math.ceil((right - left) / n / 2) * n;
select(arr, left, right, mid, compare);
quickselect(arr, mid, left, right, compare);
stack.push(left, mid, mid, right);
}
}
// Floyd-Rivest selection algorithm:
// sort an array between left and right (inclusive) so that the smallest k elements come first (unordered)
function select(arr, left, right, k, compare) {
var n, i, z, s, sd, newLeft, newRight, t, j;
while (right > left) {
if (right - left > 600) {
n = right - left + 1;
i = k - left + 1;
z = Math.log(n);
s = 0.5 * Math.exp(2 * z / 3);
sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (i - n / 2 < 0 ? -1 : 1);
newLeft = Math.max(left, Math.floor(k - i * s / n + sd));
newRight = Math.min(right, Math.floor(k + (n - i) * s / n + sd));
select(arr, newLeft, newRight, k, compare);
}
t = arr[k];
i = left;
j = right;
swap(arr, left, k);
if (compare(arr[right], t) > 0) swap(arr, left, right);
while (i < j) {
swap(arr, i, j);
i++;
j--;
while (compare(arr[i], t) < 0) i++;
while (compare(arr[j], t) > 0) j--;
}
if (compare(arr[left], t) === 0) swap(arr, left, j);
else {
j++;
swap(arr, j, right);
}
if (j <= k) left = j + 1;
if (k <= j) right = j - 1;
}
}
function swap(arr, i, j) {
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
// export as AMD/CommonJS module or global variable
if (typeof define === 'function' && define.amd) define('rbush', function () { return rbush; });
else if (typeof module !== 'undefined') module.exports = rbush;
else if (typeof self !== 'undefined') self.rbush = rbush;
else window.rbush = rbush;
})();
});
var rbush$1 = (rbush && typeof rbush === 'object' && 'default' in rbush ? rbush['default'] : rbush);
var rbush = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);
function Labels(projection, context) {
var path = d3.geo.path().projection(projection);
@@ -1429,16 +1438,16 @@
var mouse = context.mouse(),
pad = 50,
rect = [mouse[0] - pad, mouse[1] - pad, mouse[0] + pad, mouse[1] + pad],
ids = _.map(rtree.search(rect), 'id');
bbox = { minX: mouse[0] - pad, minY: mouse[1] - pad, maxX: mouse[0] + pad, maxY: mouse[1] + pad },
ids = _.map(rtree.search(bbox), 'id');
if (!ids.length) return;
layers.selectAll('.' + ids.join(', .'))
.classed('proximate', true);
}
var rtree = rbush$1(),
rectangles = {};
var rtree = rbush(),
bboxes = {};
function drawLabels(surface, graph, entities, filter, dimensions, fullRedraw) {
var hidePoints = !surface.selectAll('.node.point').node();
@@ -1448,10 +1457,10 @@
if (fullRedraw) {
rtree.clear();
rectangles = {};
bboxes = {};
} else {
for (i = 0; i < entities.length; i++) {
rtree.remove(rectangles[entities[i].id]);
rtree.remove(bboxes[entities[i].id]);
}
}
@@ -1525,8 +1534,8 @@
y: coord[1] + offset[1],
textAnchor: offset[2]
};
var rect = [p.x - m, p.y - m, p.x + width + m, p.y + height + m];
if (tryInsert(rect, entity.id)) return p;
var bbox = { minX: p.x - m, minY: p.y - m, maxX: p.x + width + m, maxY: p.y + height + m };
if (tryInsert(bbox, entity.id)) return p;
}
@@ -1542,14 +1551,14 @@
if (start < 0 || start + width > length) continue;
var sub = subpath(nodes, start, start + width),
rev = reverse(sub),
rect = [
Math.min(sub[0][0], sub[sub.length - 1][0]) - 10,
Math.min(sub[0][1], sub[sub.length - 1][1]) - 10,
Math.max(sub[0][0], sub[sub.length - 1][0]) + 20,
Math.max(sub[0][1], sub[sub.length - 1][1]) + 30
];
bbox = {
minX: Math.min(sub[0][0], sub[sub.length - 1][0]) - 10,
minY: Math.min(sub[0][1], sub[sub.length - 1][1]) - 10,
maxX: Math.max(sub[0][0], sub[sub.length - 1][0]) + 20,
maxY: Math.max(sub[0][1], sub[sub.length - 1][1]) + 30
};
if (rev) sub = sub.reverse();
if (tryInsert(rect, entity.id)) return {
if (tryInsert(bbox, entity.id)) return {
'font-size': height + 2,
lineString: lineString(sub),
startOffset: offset + '%'
@@ -1561,7 +1570,7 @@
var centroid = path.centroid(entity.asGeoJSON(graph, true)),
extent = entity.extent(graph),
entitywidth = projection(extent[1])[0] - projection(extent[0])[0],
rect;
bbox;
if (isNaN(centroid[0]) || entitywidth < 20) return;
@@ -1578,24 +1587,23 @@
p.y = centroid[1] + textOffset;
p.textAnchor = 'middle';
p.height = height;
rect = [p.x - width/2, p.y, p.x + width/2, p.y + height + textOffset];
bbox = { minX: p.x - width/2, minY: p.y, maxX: p.x + width/2, maxY: p.y + height + textOffset };
} else {
rect = [iconX, iconY, iconX + iconSize, iconY + iconSize];
bbox = { minX: iconX, minY: iconY, maxX: iconX + iconSize, maxY: iconY + iconSize };
}
if (tryInsert(rect, entity.id)) return p;
if (tryInsert(bbox, entity.id)) return p;
}
function tryInsert(rect, id) {
function tryInsert(bbox, id) {
// Check that label is visible
if (rect[0] < 0 || rect[1] < 0 || rect[2] > dimensions[0] ||
rect[3] > dimensions[1]) return false;
var v = rtree.search(rect).length === 0;
if (bbox.minX < 0 || bbox.minY < 0 || bbox.maxX > dimensions[0] || bbox.maxY > dimensions[1]) return false;
var v = rtree.search(bbox).length === 0;
if (v) {
rect.id = id;
rtree.insert(rect);
rectangles[id] = rect;
bbox.id = id;
rtree.insert(bbox);
bboxes[id] = bbox;
}
return v;
}
@@ -1632,11 +1640,11 @@
if (showDebug) {
var gj = rtree.all().map(function(d) {
return { type: 'Polygon', coordinates: [[
[d[0], d[1]],
[d[2], d[1]],
[d[2], d[3]],
[d[0], d[3]],
[d[0], d[1]]
[d.minX, d.minY],
[d.maxX, d.minY],
[d.maxX, d.maxY],
[d.minX, d.maxY],
[d.minX, d.minY]
]]};
});
-272
View File
@@ -1,272 +0,0 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.iD = global.iD || {}, global.iD.util = global.iD.util || {})));
}(this, function (exports) { 'use strict';
function tagText(entity) {
return d3.entries(entity.tags).map(function(e) {
return e.key + '=' + e.value;
}).join(', ');
}
function entitySelector(ids) {
return ids.length ? '.' + ids.join(',.') : 'nothing';
}
function entityOrMemberSelector(ids, graph) {
var s = entitySelector(ids);
ids.forEach(function(id) {
var entity = graph.hasEntity(id);
if (entity && entity.type === 'relation') {
entity.members.forEach(function(member) {
s += ',.' + member.id;
});
}
});
return s;
}
function displayName(entity) {
var localeName = 'name:' + iD.detect().locale.toLowerCase().split('-')[0];
return entity.tags[localeName] || entity.tags.name || entity.tags.ref;
}
function displayType(id) {
return {
n: t('inspector.node'),
w: t('inspector.way'),
r: t('inspector.relation')
}[id.charAt(0)];
}
function stringQs(str) {
return str.split('&').reduce(function(obj, pair){
var parts = pair.split('=');
if (parts.length === 2) {
obj[parts[0]] = (null === parts[1]) ? '' : decodeURIComponent(parts[1]);
}
return obj;
}, {});
}
function qsString(obj, noencode) {
function softEncode(s) {
// encode everything except special characters used in certain hash parameters:
// "/" in map states, ":", ",", {" and "}" in background
return encodeURIComponent(s).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
}
return Object.keys(obj).sort().map(function(key) {
return encodeURIComponent(key) + '=' + (
noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
}).join('&');
}
function prefixDOMProperty(property) {
var prefixes = ['webkit', 'ms', 'moz', 'o'],
i = -1,
n = prefixes.length,
s = document.body;
if (property in s)
return property;
property = property.substr(0, 1).toUpperCase() + property.substr(1);
while (++i < n)
if (prefixes[i] + property in s)
return prefixes[i] + property;
return false;
}
function prefixCSSProperty(property) {
var prefixes = ['webkit', 'ms', 'Moz', 'O'],
i = -1,
n = prefixes.length,
s = document.body.style;
if (property.toLowerCase() in s)
return property.toLowerCase();
while (++i < n)
if (prefixes[i] + property in s)
return '-' + prefixes[i].toLowerCase() + property.replace(/([A-Z])/g, '-$1').toLowerCase();
return false;
}
var transformProperty;
function setTransform(el, x, y, scale) {
var prop = transformProperty = transformProperty || prefixCSSProperty('Transform'),
translate = iD.detect().opera ?
'translate(' + x + 'px,' + y + 'px)' :
'translate3d(' + x + 'px,' + y + 'px,0)';
return el.style(prop, translate + (scale ? ' scale(' + scale + ')' : ''));
}
function getStyle(selector) {
for (var i = 0; i < document.styleSheets.length; i++) {
var rules = document.styleSheets[i].rules || document.styleSheets[i].cssRules || [];
for (var k = 0; k < rules.length; k++) {
var selectorText = rules[k].selectorText && rules[k].selectorText.split(', ');
if (_.includes(selectorText, selector)) {
return rules[k];
}
}
}
}
function editDistance(a, b) {
if (a.length === 0) return b.length;
if (b.length === 0) return a.length;
var matrix = [];
for (var i = 0; i <= b.length; i++) { matrix[i] = [i]; }
for (var j = 0; j <= a.length; j++) { matrix[0][j] = j; }
for (i = 1; i <= b.length; i++) {
for (j = 1; j <= a.length; j++) {
if (b.charAt(i-1) === a.charAt(j-1)) {
matrix[i][j] = matrix[i-1][j-1];
} else {
matrix[i][j] = Math.min(matrix[i-1][j-1] + 1, // substitution
Math.min(matrix[i][j-1] + 1, // insertion
matrix[i-1][j] + 1)); // deletion
}
}
}
return matrix[b.length][a.length];
}
// a d3.mouse-alike which
// 1. Only works on HTML elements, not SVG
// 2. Does not cause style recalculation
function fastMouse(container) {
var rect = container.getBoundingClientRect(),
rectLeft = rect.left,
rectTop = rect.top,
clientLeft = +container.clientLeft,
clientTop = +container.clientTop;
return function(e) {
return [
e.clientX - rectLeft - clientLeft,
e.clientY - rectTop - clientTop];
};
}
/* eslint-disable no-proto */
var getPrototypeOf = Object.getPrototypeOf || function(obj) { return obj.__proto__; };
/* eslint-enable no-proto */
function asyncMap(inputs, func, callback) {
var remaining = inputs.length,
results = [],
errors = [];
inputs.forEach(function(d, i) {
func(d, function done(err, data) {
errors[i] = err;
results[i] = data;
remaining--;
if (!remaining) callback(errors, results);
});
});
}
// wraps an index to an interval [0..length-1]
function wrap(index, length) {
if (index < 0)
index += Math.ceil(-index/length)*length;
return index % length;
}
// A per-domain session mutex backed by a cookie and dead man's
// switch. If the session crashes, the mutex will auto-release
// after 5 seconds.
function SessionMutex(name) {
var mutex = {},
intervalID;
function renew() {
var expires = new Date();
expires.setSeconds(expires.getSeconds() + 5);
document.cookie = name + '=1; expires=' + expires.toUTCString();
}
mutex.lock = function() {
if (intervalID) return true;
var cookie = document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + name + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1');
if (cookie) return false;
renew();
intervalID = window.setInterval(renew, 4000);
return true;
};
mutex.unlock = function() {
if (!intervalID) return;
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT';
clearInterval(intervalID);
intervalID = null;
};
mutex.locked = function() {
return !!intervalID;
};
return mutex;
}
function SuggestNames(preset, suggestions) {
preset = preset.id.split('/', 2);
var k = preset[0],
v = preset[1];
return function(value, callback) {
var result = [];
if (value && value.length > 2) {
if (suggestions[k] && suggestions[k][v]) {
for (var sugg in suggestions[k][v]) {
var dist = iD.util.editDistance(value, sugg.substring(0, value.length));
if (dist < 3) {
result.push({
title: sugg,
value: sugg,
dist: dist
});
}
}
}
result.sort(function(a, b) {
return a.dist - b.dist;
});
}
result = result.slice(0,3);
callback(result);
};
}
exports.tagText = tagText;
exports.entitySelector = entitySelector;
exports.entityOrMemberSelector = entityOrMemberSelector;
exports.displayName = displayName;
exports.displayType = displayType;
exports.stringQs = stringQs;
exports.qsString = qsString;
exports.prefixDOMProperty = prefixDOMProperty;
exports.prefixCSSProperty = prefixCSSProperty;
exports.setTransform = setTransform;
exports.getStyle = getStyle;
exports.editDistance = editDistance;
exports.fastMouse = fastMouse;
exports.getPrototypeOf = getPrototypeOf;
exports.asyncMap = asyncMap;
exports.wrap = wrap;
exports.SessionMutex = SessionMutex;
exports.SuggestNames = SuggestNames;
Object.defineProperty(exports, '__esModule', { value: true });
}));
-121
View File
@@ -1,121 +0,0 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.iD = global.iD || {}, global.iD.validations = global.iD.validations || {})));
}(this, function (exports) { 'use strict';
function DeprecatedTag() {
var validation = function(changes) {
var warnings = [];
for (var i = 0; i < changes.created.length; i++) {
var change = changes.created[i],
deprecatedTags = change.deprecatedTags();
if (!_.isEmpty(deprecatedTags)) {
var tags = iD.util.tagText({ tags: deprecatedTags });
warnings.push({
id: 'deprecated_tags',
message: t('validations.deprecated_tags', { tags: tags }),
entity: change
});
}
}
return warnings;
};
return validation;
}
function ManyDeletions() {
var threshold = 100;
var validation = function(changes) {
var warnings = [];
if (changes.deleted.length > threshold) {
warnings.push({
id: 'many_deletions',
message: t('validations.many_deletions', { n: changes.deleted.length })
});
}
return warnings;
};
return validation;
}
function MissingTag() {
// Slightly stricter check than Entity#isUsed (#3091)
function hasTags(entity, graph) {
return _.without(Object.keys(entity.tags), 'area', 'name').length > 0 ||
graph.parentRelations(entity).length > 0;
}
var validation = function(changes, graph) {
var warnings = [];
for (var i = 0; i < changes.created.length; i++) {
var change = changes.created[i],
geometry = change.geometry(graph);
if ((geometry === 'point' || geometry === 'line' || geometry === 'area') && !hasTags(change, graph)) {
warnings.push({
id: 'missing_tag',
message: t('validations.untagged_' + geometry),
tooltip: t('validations.untagged_' + geometry + '_tooltip'),
entity: change
});
}
}
return warnings;
};
return validation;
}
function TagSuggestsArea() {
// https://github.com/openstreetmap/josm/blob/mirror/src/org/
// openstreetmap/josm/data/validation/tests/UnclosedWays.java#L80
function tagSuggestsArea(tags) {
if (_.isEmpty(tags)) return false;
var presence = ['landuse', 'amenities', 'tourism', 'shop'];
for (var i = 0; i < presence.length; i++) {
if (tags[presence[i]] !== undefined) {
return presence[i] + '=' + tags[presence[i]];
}
}
if (tags.building && tags.building === 'yes') return 'building=yes';
}
var validation = function(changes, graph) {
var warnings = [];
for (var i = 0; i < changes.created.length; i++) {
var change = changes.created[i],
geometry = change.geometry(graph),
suggestion = (geometry === 'line' ? tagSuggestsArea(change.tags) : undefined);
if (suggestion) {
warnings.push({
id: 'tag_suggests_area',
message: t('validations.tag_suggests_area', { tag: suggestion }),
entity: change
});
}
}
return warnings;
};
return validation;
}
exports.DeprecatedTag = DeprecatedTag;
exports.ManyDeletions = ManyDeletions;
exports.MissingTag = MissingTag;
exports.TagSuggestsArea = TagSuggestsArea;
Object.defineProperty(exports, '__esModule', { value: true });
}));
+20 -20
View File
@@ -3,19 +3,19 @@ import rbush from 'rbush';
export function Tree(head) {
var rtree = rbush(),
rectangles = {};
bboxes = {};
function entityRectangle(entity) {
var rect = entity.extent(head).rectangle();
rect.id = entity.id;
rectangles[entity.id] = rect;
return rect;
function entityBBox(entity) {
var bbox = entity.extent(head).bbox();
bbox.id = entity.id;
bboxes[entity.id] = bbox;
return bbox;
}
function updateParents(entity, insertions, memo) {
head.parentWays(entity).forEach(function(way) {
if (rectangles[way.id]) {
rtree.remove(rectangles[way.id]);
if (bboxes[way.id]) {
rtree.remove(bboxes[way.id]);
insertions[way.id] = way;
}
updateParents(way, insertions, memo);
@@ -24,8 +24,8 @@ export function Tree(head) {
head.parentRelations(entity).forEach(function(relation) {
if (memo[entity.id]) return;
memo[entity.id] = true;
if (rectangles[relation.id]) {
rtree.remove(rectangles[relation.id]);
if (bboxes[relation.id]) {
rtree.remove(bboxes[relation.id]);
insertions[relation.id] = relation;
}
updateParents(relation, insertions, memo);
@@ -43,11 +43,11 @@ export function Tree(head) {
if (!entity.visible)
continue;
if (head.entities.hasOwnProperty(entity.id) || rectangles[entity.id]) {
if (head.entities.hasOwnProperty(entity.id) || bboxes[entity.id]) {
if (!force) {
continue;
} else if (rectangles[entity.id]) {
rtree.remove(rectangles[entity.id]);
} else if (bboxes[entity.id]) {
rtree.remove(bboxes[entity.id]);
}
}
@@ -55,7 +55,7 @@ export function Tree(head) {
updateParents(entity, insertions, {});
}
rtree.load(_.map(insertions, entityRectangle));
rtree.load(_.map(insertions, entityBBox));
return tree;
};
@@ -68,12 +68,12 @@ export function Tree(head) {
head = graph;
diff.deleted().forEach(function(entity) {
rtree.remove(rectangles[entity.id]);
delete rectangles[entity.id];
rtree.remove(bboxes[entity.id]);
delete bboxes[entity.id];
});
diff.modified().forEach(function(entity) {
rtree.remove(rectangles[entity.id]);
rtree.remove(bboxes[entity.id]);
insertions[entity.id] = entity;
updateParents(entity, insertions, {});
});
@@ -82,11 +82,11 @@ export function Tree(head) {
insertions[entity.id] = entity;
});
rtree.load(_.map(insertions, entityRectangle));
rtree.load(_.map(insertions, entityBBox));
}
return rtree.search(extent.rectangle()).map(function(rect) {
return head.entity(rect.id);
return rtree.search(extent.bbox()).map(function(bbox) {
return head.entity(bbox.id);
});
};
+4
View File
@@ -50,6 +50,10 @@ _.extend(Extent.prototype, {
return [this[0][0], this[0][1], this[1][0], this[1][1]];
},
bbox: function() {
return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
},
polygon: function() {
return [
[this[0][0], this[0][1]],
+3 -3
View File
@@ -198,7 +198,7 @@ export function mapillary() {
if (which === 'images') d.ca = feature.properties.ca;
if (which === 'signs') d.signs = feature.properties.rects;
features.push([loc[0], loc[1], loc[0], loc[1], d]);
features.push({minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1], data: d});
}
cache.rtree.load(features);
@@ -255,9 +255,9 @@ export function mapillary() {
var partitions = partitionViewport(psize, projection, dimensions);
return _.flatten(_.compact(_.map(partitions, function(extent) {
return rtree.search(extent.rectangle())
return rtree.search(extent.bbox())
.slice(0, limit)
.map(function(d) { return d[4]; });
.map(function(d) { return d.data; });
})));
}
+3 -3
View File
@@ -7,10 +7,10 @@ export function nominatim() {
nominatim.countryCode = function(location, callback) {
var cache = iD.services.nominatim.cache,
countryCodes = cache.search([location[0], location[1], location[0], location[1]]);
countryCodes = cache.search({ minX: location[0], minY: location[1], maxX: location[0], maxY: location[1] });
if (countryCodes.length > 0)
return callback(null, countryCodes[0][4]);
return callback(null, countryCodes[0].data);
d3.json(endpoint +
iD.util.qsString({
@@ -26,7 +26,7 @@ export function nominatim() {
var extent = iD.geo.Extent(location).padByMeters(1000);
cache.insert(extent.rectangle().concat(result.address.country_code));
cache.insert(Object.assign(extent.bbox(), { data: result.address.country_code }));
callback(null, result.address.country_code);
});
+29 -30
View File
@@ -238,8 +238,8 @@ export function Labels(projection, context) {
var mouse = context.mouse(),
pad = 50,
rect = [mouse[0] - pad, mouse[1] - pad, mouse[0] + pad, mouse[1] + pad],
ids = _.map(rtree.search(rect), 'id');
bbox = { minX: mouse[0] - pad, minY: mouse[1] - pad, maxX: mouse[0] + pad, maxY: mouse[1] + pad },
ids = _.map(rtree.search(bbox), 'id');
if (!ids.length) return;
layers.selectAll('.' + ids.join(', .'))
@@ -247,7 +247,7 @@ export function Labels(projection, context) {
}
var rtree = rbush(),
rectangles = {};
bboxes = {};
function drawLabels(surface, graph, entities, filter, dimensions, fullRedraw) {
var hidePoints = !surface.selectAll('.node.point').node();
@@ -257,10 +257,10 @@ export function Labels(projection, context) {
if (fullRedraw) {
rtree.clear();
rectangles = {};
bboxes = {};
} else {
for (i = 0; i < entities.length; i++) {
rtree.remove(rectangles[entities[i].id]);
rtree.remove(bboxes[entities[i].id]);
}
}
@@ -334,8 +334,8 @@ export function Labels(projection, context) {
y: coord[1] + offset[1],
textAnchor: offset[2]
};
var rect = [p.x - m, p.y - m, p.x + width + m, p.y + height + m];
if (tryInsert(rect, entity.id)) return p;
var bbox = { minX: p.x - m, minY: p.y - m, maxX: p.x + width + m, maxY: p.y + height + m };
if (tryInsert(bbox, entity.id)) return p;
}
@@ -351,14 +351,14 @@ export function Labels(projection, context) {
if (start < 0 || start + width > length) continue;
var sub = subpath(nodes, start, start + width),
rev = reverse(sub),
rect = [
Math.min(sub[0][0], sub[sub.length - 1][0]) - 10,
Math.min(sub[0][1], sub[sub.length - 1][1]) - 10,
Math.max(sub[0][0], sub[sub.length - 1][0]) + 20,
Math.max(sub[0][1], sub[sub.length - 1][1]) + 30
];
bbox = {
minX: Math.min(sub[0][0], sub[sub.length - 1][0]) - 10,
minY: Math.min(sub[0][1], sub[sub.length - 1][1]) - 10,
maxX: Math.max(sub[0][0], sub[sub.length - 1][0]) + 20,
maxY: Math.max(sub[0][1], sub[sub.length - 1][1]) + 30
};
if (rev) sub = sub.reverse();
if (tryInsert(rect, entity.id)) return {
if (tryInsert(bbox, entity.id)) return {
'font-size': height + 2,
lineString: lineString(sub),
startOffset: offset + '%'
@@ -370,7 +370,7 @@ export function Labels(projection, context) {
var centroid = path.centroid(entity.asGeoJSON(graph, true)),
extent = entity.extent(graph),
entitywidth = projection(extent[1])[0] - projection(extent[0])[0],
rect;
bbox;
if (isNaN(centroid[0]) || entitywidth < 20) return;
@@ -387,24 +387,23 @@ export function Labels(projection, context) {
p.y = centroid[1] + textOffset;
p.textAnchor = 'middle';
p.height = height;
rect = [p.x - width/2, p.y, p.x + width/2, p.y + height + textOffset];
bbox = { minX: p.x - width/2, minY: p.y, maxX: p.x + width/2, maxY: p.y + height + textOffset };
} else {
rect = [iconX, iconY, iconX + iconSize, iconY + iconSize];
bbox = { minX: iconX, minY: iconY, maxX: iconX + iconSize, maxY: iconY + iconSize };
}
if (tryInsert(rect, entity.id)) return p;
if (tryInsert(bbox, entity.id)) return p;
}
function tryInsert(rect, id) {
function tryInsert(bbox, id) {
// Check that label is visible
if (rect[0] < 0 || rect[1] < 0 || rect[2] > dimensions[0] ||
rect[3] > dimensions[1]) return false;
var v = rtree.search(rect).length === 0;
if (bbox.minX < 0 || bbox.minY < 0 || bbox.maxX > dimensions[0] || bbox.maxY > dimensions[1]) return false;
var v = rtree.search(bbox).length === 0;
if (v) {
rect.id = id;
rtree.insert(rect);
rectangles[id] = rect;
bbox.id = id;
rtree.insert(bbox);
bboxes[id] = bbox;
}
return v;
}
@@ -441,11 +440,11 @@ export function Labels(projection, context) {
if (showDebug) {
var gj = rtree.all().map(function(d) {
return { type: 'Polygon', coordinates: [[
[d[0], d[1]],
[d[2], d[1]],
[d[2], d[3]],
[d[0], d[3]],
[d[0], d[1]]
[d.minX, d.minY],
[d.maxX, d.minY],
[d.maxX, d.maxY],
[d.minX, d.maxY],
[d.minX, d.minY]
]]};
});
+7 -8
View File
@@ -22,15 +22,15 @@
],
"license": "ISC",
"dependencies": {
"rbush": "1.4.3",
"rbush": "2.0.1",
"sexagesimal": "0.5.0"
},
"devDependencies": {
"chai": "3.5.0",
"d3": "3.5.5",
"editor-layer-index": "git://github.com/osmlab/editor-layer-index.git#gh-pages",
"eslint": "2.13.1",
"eslint-plugin-import": "^1.9.2",
"eslint": "3.0.1",
"eslint-plugin-import": "1.10.2",
"glob": "7.0.5",
"happen": "0.3.1",
"http-server": "0.9.0",
@@ -51,8 +51,8 @@
"sinon-chai": "2.8.0",
"smash": "0.0",
"svg-sprite": "1.3.3",
"uglify-js": "2.6.4",
"xml2js": "0.4.16",
"uglify-js": "2.7.0",
"xml2js": "0.4.17",
"xmlbuilder": "8.2.2"
},
"greenkeeper": {
@@ -62,7 +62,6 @@
]
},
"engines": {
"node": ">=0.10.0"
},
"engineStrict": true
"node": ">=4.0.0"
}
}
+87 -87
View File
@@ -71,43 +71,43 @@ describe('iD.services.mapillary', function() {
expect(spy).to.have.been.not.called;
});
// it('loads multiple pages of image results', function() {
// var spy = sinon.spy();
// mapillary.on('loadedImages', spy);
// mapillary.loadImages(context.projection, dimensions);
it.skip('loads multiple pages of image results', function() {
var spy = sinon.spy();
mapillary.on('loadedImages', spy);
mapillary.loadImages(context.projection, dimensions);
// var features0 = [],
// features1 = [],
// i;
var features0 = [],
features1 = [],
i;
// for (i = 0; i < 1000; i++) {
// features0.push({
// type: 'Feature',
// geometry: { type: 'Point', coordinates: [10,0] },
// properties: { ca: 90, key: String(i) }
// });
// }
// for (i = 0; i < 500; i++) {
// features1.push({
// type: 'Feature',
// geometry: { type: 'Point', coordinates: [10,0] },
// properties: { ca: 90, key: String(1000 + i) }
// });
// }
for (i = 0; i < 1000; i++) {
features0.push({
type: 'Feature',
geometry: { type: 'Point', coordinates: [10,0] },
properties: { ca: 90, key: String(i) }
});
}
for (i = 0; i < 500; i++) {
features1.push({
type: 'Feature',
geometry: { type: 'Point', coordinates: [10,0] },
properties: { ca: 90, key: String(1000 + i) }
});
}
// var match0 = /page=0/,
// response0 = { type: 'FeatureCollection', features: features0 },
// match1 = /page=1/,
// response1 = { type: 'FeatureCollection', features: features1 };
var match0 = /page=0/,
response0 = { type: 'FeatureCollection', features: features0 },
match1 = /page=1/,
response1 = { type: 'FeatureCollection', features: features1 };
// server.respondWith('GET', match0,
// [200, { 'Content-Type': 'application/json' }, JSON.stringify(response0) ]);
// server.respondWith('GET', match1,
// [200, { 'Content-Type': 'application/json' }, JSON.stringify(response1) ]);
// server.respond();
server.respondWith('GET', match0,
[200, { 'Content-Type': 'application/json' }, JSON.stringify(response0) ]);
server.respondWith('GET', match1,
[200, { 'Content-Type': 'application/json' }, JSON.stringify(response1) ]);
server.respond();
// expect(spy).to.have.been.calledTwice;
// });
expect(spy).to.have.been.calledTwice;
});
});
describe('#loadSigns', function() {
@@ -197,59 +197,59 @@ describe('iD.services.mapillary', function() {
expect(spy).to.have.been.not.called;
});
// it('loads multiple pages of signs results', function() {
// var spy = sinon.spy();
// mapillary.on('loadedSigns', spy);
// mapillary.loadSigns(context, context.projection, dimensions);
it.skip('loads multiple pages of signs results', function() {
var spy = sinon.spy();
mapillary.on('loadedSigns', spy);
mapillary.loadSigns(context, context.projection, dimensions);
// var rects = [{
// 'package': 'trafficsign_us_3.0',
// rect: [ 0.805, 0.463, 0.833, 0.502 ],
// length: 4,
// score: '1.27',
// type: 'regulatory--maximum-speed-limit-65--us'
// }],
// features0 = [],
// features1 = [],
// i;
var rects = [{
'package': 'trafficsign_us_3.0',
rect: [ 0.805, 0.463, 0.833, 0.502 ],
length: 4,
score: '1.27',
type: 'regulatory--maximum-speed-limit-65--us'
}],
features0 = [],
features1 = [],
i;
// for (i = 0; i < 1000; i++) {
// features0.push({
// type: 'Feature',
// geometry: { type: 'Point', coordinates: [10,0] },
// properties: { rects: rects, key: String(i) }
// });
// }
// for (i = 0; i < 500; i++) {
// features1.push({
// type: 'Feature',
// geometry: { type: 'Point', coordinates: [10,0] },
// properties: { rects: rects, key: String(1000 + i) }
// });
// }
for (i = 0; i < 1000; i++) {
features0.push({
type: 'Feature',
geometry: { type: 'Point', coordinates: [10,0] },
properties: { rects: rects, key: String(i) }
});
}
for (i = 0; i < 500; i++) {
features1.push({
type: 'Feature',
geometry: { type: 'Point', coordinates: [10,0] },
properties: { rects: rects, key: String(1000 + i) }
});
}
// var match0 = /page=0/,
// response0 = { type: 'FeatureCollection', features: features0 },
// match1 = /page=1/,
// response1 = { type: 'FeatureCollection', features: features1 };
var match0 = /page=0/,
response0 = { type: 'FeatureCollection', features: features0 },
match1 = /page=1/,
response1 = { type: 'FeatureCollection', features: features1 };
// server.respondWith('GET', match0,
// [200, { 'Content-Type': 'application/json' }, JSON.stringify(response0) ]);
// server.respondWith('GET', match1,
// [200, { 'Content-Type': 'application/json' }, JSON.stringify(response1) ]);
// server.respond();
server.respondWith('GET', match0,
[200, { 'Content-Type': 'application/json' }, JSON.stringify(response0) ]);
server.respondWith('GET', match1,
[200, { 'Content-Type': 'application/json' }, JSON.stringify(response1) ]);
server.respond();
// expect(spy).to.have.been.calledTwice;
// });
expect(spy).to.have.been.calledTwice;
});
});
describe('#images', function() {
it('returns images in the visible map area', function() {
var features = [
[10, 0, 10, 0, { key: '0', loc: [10,0], ca: 90 }],
[10, 0, 10, 0, { key: '1', loc: [10,0], ca: 90 }],
[10, 1, 10, 1, { key: '2', loc: [10,1], ca: 90 }]
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '0', loc: [10,0], ca: 90 } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '1', loc: [10,0], ca: 90 } },
{ minX: 10, minY: 1, maxX: 10, maxY: 1, data: { key: '2', loc: [10,1], ca: 90 } }
];
iD.services.mapillary.cache.images.rtree.load(features);
@@ -263,11 +263,11 @@ describe('iD.services.mapillary', function() {
it('limits results no more than 3 stacked images in one spot', function() {
var features = [
[10, 0, 10, 0, { key: '0', loc: [10,0], ca: 90 }],
[10, 0, 10, 0, { key: '1', loc: [10,0], ca: 90 }],
[10, 0, 10, 0, { key: '2', loc: [10,0], ca: 90 }],
[10, 0, 10, 0, { key: '3', loc: [10,0], ca: 90 }],
[10, 0, 10, 0, { key: '4', loc: [10,0], ca: 90 }]
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '0', loc: [10,0], ca: 90 } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '1', loc: [10,0], ca: 90 } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '2', loc: [10,0], ca: 90 } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '3', loc: [10,0], ca: 90 } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], ca: 90 } }
];
iD.services.mapillary.cache.images.rtree.load(features);
@@ -286,9 +286,9 @@ describe('iD.services.mapillary', function() {
type: 'regulatory--maximum-speed-limit-65--us'
}],
features = [
[10, 0, 10, 0, { key: '0', loc: [10,0], signs: signs }],
[10, 0, 10, 0, { key: '1', loc: [10,0], signs: signs }],
[10, 1, 10, 1, { key: '2', loc: [10,1], signs: signs }]
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '0', loc: [10,0], signs: signs } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '1', loc: [10,0], signs: signs } },
{ minX: 10, minY: 1, maxX: 10, maxY: 1, data: { key: '2', loc: [10,1], signs: signs } }
];
iD.services.mapillary.cache.signs.rtree.load(features);
@@ -309,11 +309,11 @@ describe('iD.services.mapillary', function() {
type: 'regulatory--maximum-speed-limit-65--us'
}],
features = [
[10, 0, 10, 0, { key: '0', loc: [10,0], signs: signs }],
[10, 0, 10, 0, { key: '1', loc: [10,0], signs: signs }],
[10, 0, 10, 0, { key: '2', loc: [10,0], signs: signs }],
[10, 0, 10, 0, { key: '3', loc: [10,0], signs: signs }],
[10, 0, 10, 0, { key: '4', loc: [10,0], signs: signs }]
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '0', loc: [10,0], signs: signs } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '1', loc: [10,0], signs: signs } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '2', loc: [10,0], signs: signs } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '3', loc: [10,0], signs: signs } },
{ minX: 10, minY: 0, maxX: 10, maxY: 0, data: { key: '4', loc: [10,0], signs: signs } }
];
iD.services.mapillary.cache.signs.rtree.load(features);
+1 -1
View File
@@ -15,7 +15,7 @@ describe('iD.services.nominatim', function() {
return iD.util.stringQs(url.substring(url.indexOf('?') + 1));
}
describe('#countryCode', function() {
describe.skip('#countryCode', function() {
it('calls the given callback with the results of the country code query', function() {
var callback = sinon.spy();
nominatim.countryCode([16, 48], callback);