mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Merge branch 'master' of github.com:systemed/iD
This commit is contained in:
18
README.md
18
README.md
@@ -2,30 +2,28 @@
|
||||
|
||||
[](https://travis-ci.org/systemed/iD)
|
||||
|
||||
[](http://geowiki.com/iD/)
|
||||
|
||||
[Try the online demo of the most recent code.](http://geowiki.com/iD/) and
|
||||
[open issues for bugs and ideas!](https://github.com/systemed/iD/issues)
|
||||
[](http://ideditor.com/)
|
||||
|
||||
## Basics
|
||||
|
||||
* iD is a JavaScript [OpenStreetMap](http://www.openstreetmap.org/) editor.
|
||||
* It's intentionally simple. It lets you do the most basic tasks while
|
||||
not breaking other people's data.
|
||||
* We support modern browsers. Data is rendered with [d3](http://d3js.org/).
|
||||
* It supports modern browsers. Data is rendered with [d3](http://d3js.org/).
|
||||
|
||||
## Participate!
|
||||
|
||||
* [Try out the latest stable release](http://geowiki.com/iD/)
|
||||
* [Read up on Contributing and the code style of iD](CONTRIBUTING.md)
|
||||
* See [open issues in the issue tracker if you're looking for something to do](https://github.com/systemed/iD/issues?state=open)
|
||||
* See [open issues in the issue tracker](https://github.com/systemed/iD/issues?state=open) if you're looking for something to do
|
||||
|
||||
To run the code locally, just fork this project and run it from a local webserver.
|
||||
With a Mac, you can enable Web Sharing and drop this in your website directory.
|
||||
|
||||
If you have Python handy, just `cd` into `iD` and run
|
||||
To run the current development version, fork this project and serve it locally.
|
||||
If you have Python handy, just `cd` into the project root directory and run
|
||||
|
||||
python -m SimpleHTTPServer
|
||||
|
||||
Or, with a Mac, you can enable Web Sharing and clone iD into your website directory.
|
||||
|
||||
Come on in, the water's lovely. More help? Ping RichardF, tmcw, or jfire on IRC
|
||||
(`irc.oftc.net`, in `#osm-dev` or `#osm`), on the OSM mailing lists or at
|
||||
richard@systemeD.net.
|
||||
|
||||
11
css/app.css
11
css/app.css
@@ -273,7 +273,12 @@ button.active {
|
||||
cursor:url(../img/cursor-pointing.png) 6 1, auto;
|
||||
}
|
||||
|
||||
button.active:not([disabled]) {
|
||||
button.disabled {
|
||||
background: #6c6c6c;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
button.active:not([disabled]):not(.disabled) {
|
||||
background: #6bc641;
|
||||
}
|
||||
|
||||
@@ -450,8 +455,8 @@ button[disabled] .icon.browse { background-position: 0px -40px;}
|
||||
button[disabled] .icon.add-point { background-position: -20px -40px;}
|
||||
button[disabled] .icon.add-line { background-position: -40px -40px;}
|
||||
button[disabled] .icon.add-area { background-position: -60px -40px;}
|
||||
button[disabled] .icon.undo { background-position: -80px -40px;}
|
||||
button[disabled] .icon.redo { background-position: -100px -40px;}
|
||||
button.disabled .icon.undo { background-position: -80px -40px;}
|
||||
button.disabled .icon.redo { background-position: -100px -40px;}
|
||||
button[disabled] .apply.icon { background-position: -120px -40px;}
|
||||
button[disabled] .save.icon { background-position: -140px -40px;}
|
||||
button[disabled] .close.icon { background-position: -160px -40px;}
|
||||
|
||||
10
css/map.css
10
css/map.css
@@ -119,6 +119,14 @@ g.vertex.selected .shadow {
|
||||
|
||||
/* midpoints */
|
||||
|
||||
.mode-draw-area g.midpoint,
|
||||
.mode-draw-line g.midpoint,
|
||||
.mode-add-area g.midpoint,
|
||||
.mode-add-line g.midpoint,
|
||||
.mode-add-point g.midpoint {
|
||||
display: none;
|
||||
}
|
||||
|
||||
g.midpoint .fill {
|
||||
fill:#ddd;
|
||||
stroke:black;
|
||||
@@ -635,7 +643,7 @@ text.pointlabel {
|
||||
}
|
||||
|
||||
.pathlabel .textpath {
|
||||
dominant-baseline: middle;
|
||||
baseline-shift: -33%;
|
||||
}
|
||||
|
||||
.pointlabel-halo,
|
||||
|
||||
1
data/data.js
Normal file
1
data/data.js
Normal file
@@ -0,0 +1 @@
|
||||
iD.data = {};
|
||||
120
data/deprecated.js
Normal file
120
data/deprecated.js
Normal file
@@ -0,0 +1,120 @@
|
||||
// from http://wiki.openstreetmap.org/wiki/Deprecated_features
|
||||
// TODO: deal with deprecated 'class' tag
|
||||
// does not deal with landuse=wood because of indecision
|
||||
// we will not care about http://taginfo.openstreetmap.org/tags/bicycle_parking=sheffield
|
||||
iD.data.deprecated = [
|
||||
{
|
||||
old: { barrier: 'wire_fence' },
|
||||
replace: {
|
||||
barrier: 'fence',
|
||||
fence_type: 'chain'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { barrier: 'wood_fence' },
|
||||
replace: {
|
||||
barrier: 'fence',
|
||||
fence_type: 'wood'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'ford' },
|
||||
replace: {
|
||||
ford: 'yes'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'ford' },
|
||||
replace: {
|
||||
ford: 'yes'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'ford' },
|
||||
replace: {
|
||||
ford: 'yes'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'stile' },
|
||||
replace: {
|
||||
barrier: 'stile'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'incline' },
|
||||
replace: {
|
||||
highway: 'road',
|
||||
incline: 'up'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'incline_steep' },
|
||||
replace: {
|
||||
highway: 'road',
|
||||
incline: 'up'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'unsurfaced' },
|
||||
replace: {
|
||||
highway: 'road',
|
||||
incline: 'unpaved'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { highway: 'unsurfaced' },
|
||||
replace: {
|
||||
highway: 'road',
|
||||
incline: 'unpaved'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { landuse: 'wood' },
|
||||
replace: {
|
||||
highway: 'road',
|
||||
incline: 'unpaved'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { natural: 'marsh' },
|
||||
replace: {
|
||||
natural: 'wetland',
|
||||
wetland: 'marsh'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { shop: 'organic' },
|
||||
replace: {
|
||||
shop: 'supermarket',
|
||||
organic: 'only'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { power_source: '*' },
|
||||
replace: {
|
||||
'generator:source': '$1'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { power_rating: '*' },
|
||||
replace: {
|
||||
'generator:output': '$1'
|
||||
}
|
||||
},
|
||||
{
|
||||
old: { bicycle_parking: 'organic' },
|
||||
replace: {
|
||||
shop: 'supermarket',
|
||||
organic: 'only'
|
||||
}
|
||||
},
|
||||
// entirely discarded tags
|
||||
{ old: { 'tiger:upload_uuid': '*' } },
|
||||
{ old: { 'tiger:tlid': '*' } },
|
||||
{ old: { 'tiger:source': '*' } },
|
||||
{ old: { 'tiger:separated': '*' } },
|
||||
{ old: { 'geobase:datasetName': '*' } },
|
||||
{ old: { 'geobase:uuid': '*' } },
|
||||
{ old: { 'sub_sea:type': '*' } }
|
||||
];
|
||||
490
data/imagery.json
Normal file
490
data/imagery.json
Normal file
@@ -0,0 +1,490 @@
|
||||
[
|
||||
{
|
||||
"name": "Bing aerial imagery",
|
||||
"url": "http://ecn.t0.tiles.virtualearth.net/tiles/a{q}uadkey.jpeg?g=587&mkt=en-gb&n=z",
|
||||
"sourcetag": "Bing",
|
||||
"logo": "bing_maps.png",
|
||||
"logo_url": "http://www.bing.com/maps",
|
||||
"terms_url": "http://opengeodata.org/microsoft-imagery-details"
|
||||
},
|
||||
{
|
||||
"name": "MapBox Satellite",
|
||||
"url": "http://{t}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MapQuest Open Aerial",
|
||||
"url": "http://oatile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg"
|
||||
},
|
||||
{
|
||||
"name": "OSM - Mapnik",
|
||||
"url": "http://{t}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM - OpenCycleMap",
|
||||
"url": "http://tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"
|
||||
},
|
||||
{
|
||||
"name": "OSM - MapQuest",
|
||||
"url": "http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg"
|
||||
},
|
||||
{
|
||||
"name": "OSM - Tiger Edited Map",
|
||||
"url": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
24.055,
|
||||
-124.81,
|
||||
49.386,
|
||||
-66.865
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM - Tiger Edited Map",
|
||||
"url": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
50.858,
|
||||
-179.754,
|
||||
71.463,
|
||||
-129.899
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM - Tiger Edited Map",
|
||||
"url": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
18.702,
|
||||
-174.46,
|
||||
26.501,
|
||||
-154.516
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM US TIGER 2012 Roads Overlay",
|
||||
"url": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
24.055,
|
||||
-124.81,
|
||||
49.386,
|
||||
-66.865
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM US TIGER 2012 Roads Overlay",
|
||||
"url": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
50.858,
|
||||
-179.754,
|
||||
71.463,
|
||||
-129.899
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM US TIGER 2012 Roads Overlay",
|
||||
"url": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
18.702,
|
||||
-174.46,
|
||||
26.501,
|
||||
-154.516
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM US USGS Topographic Maps",
|
||||
"url": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
24.005,
|
||||
-125.991,
|
||||
50.009,
|
||||
-65.988
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM US USGS Topographic Maps",
|
||||
"url": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
18.902,
|
||||
-160.579,
|
||||
22.508,
|
||||
-154.793
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM US USGS Topographic Maps",
|
||||
"url": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
51.255,
|
||||
-178.001,
|
||||
71.999,
|
||||
-130.004
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "OSM US USGS Large Scale Aerial Imagery",
|
||||
"url": "http://{t}.tile.openstreetmap.us/usgs_large_scale/{z}/{x}/{y}.jpg",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
24.496,
|
||||
-124.819,
|
||||
49.443,
|
||||
-66.931
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "British Columbia bc_mosaic",
|
||||
"url": "http://{t}.imagery.paulnorman.ca/tiles/bc_mosaic/{z}/{x}/{y}.png",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d"
|
||||
],
|
||||
"extent": [
|
||||
48.995,
|
||||
-123.441,
|
||||
50.426,
|
||||
-121.346
|
||||
],
|
||||
"sourcetag": "bc_mosaic",
|
||||
"terms_url": "http://imagery.paulnorman.ca/tiles/about.html"
|
||||
},
|
||||
{
|
||||
"name": "OS OpenData Streetview",
|
||||
"url": "http://os.openstreetmap.org/sv/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
49.86,
|
||||
-8.72,
|
||||
60.92,
|
||||
1.84
|
||||
],
|
||||
"sourcetag": "OS_OpenData_StreetView"
|
||||
},
|
||||
{
|
||||
"name": "OS OpenData Locator",
|
||||
"url": "http://tiles.itoworld.com/os_locator/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
49.8,
|
||||
-9,
|
||||
61.1,
|
||||
1.9
|
||||
],
|
||||
"sourcetag": "OS_OpenData_Locator"
|
||||
},
|
||||
{
|
||||
"name": "OS 1:25k historic (OSM)",
|
||||
"url": "http://ooc.openstreetmap.org/os1/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
49.8,
|
||||
-9,
|
||||
61.1,
|
||||
1.9
|
||||
],
|
||||
"sourcetag": "OS 1:25k"
|
||||
},
|
||||
{
|
||||
"name": "OS 1:25k historic (NLS)",
|
||||
"url": "http://geo.nls.uk/mapdata2/os/25000/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
49.8,
|
||||
-9,
|
||||
61.1,
|
||||
1.9
|
||||
],
|
||||
"sourcetag": "OS 1:25k",
|
||||
"logo": "icons/logo_nls70-nq8.png",
|
||||
"logo_url": "http://geo.nls.uk/maps/"
|
||||
},
|
||||
{
|
||||
"name": "OS 7th Series historic (OSM)",
|
||||
"url": "http://ooc.openstreetmap.org/os7/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
49.8,
|
||||
-9,
|
||||
61.1,
|
||||
1.9
|
||||
],
|
||||
"sourcetag": "OS7"
|
||||
},
|
||||
{
|
||||
"name": "OS 7th Series historic (NLS)",
|
||||
"url": "http://geo.nls.uk/mapdata2/os/seventh/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
49.8,
|
||||
-9,
|
||||
61.1,
|
||||
1.9
|
||||
],
|
||||
"sourcetag": "OS7",
|
||||
"logo": "icons/logo_nls70-nq8.png",
|
||||
"logo_url": "http://geo.nls.uk/maps/"
|
||||
},
|
||||
{
|
||||
"name": "OS New Popular Edition historic",
|
||||
"url": "http://ooc.openstreetmap.org/npe/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
49.8,
|
||||
-5.8,
|
||||
55.8,
|
||||
1.9
|
||||
],
|
||||
"sourcetag": "NPE"
|
||||
},
|
||||
{
|
||||
"name": "OS Scottish Popular historic",
|
||||
"url": "http://ooc.openstreetmap.org/npescotland/tiles/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
54.5,
|
||||
-7.8,
|
||||
61.1,
|
||||
-1.1
|
||||
],
|
||||
"sourcetag": "NPE"
|
||||
},
|
||||
{
|
||||
"name": "Surrey aerial",
|
||||
"url": "http://gravitystorm.dev.openstreetmap.org/surrey/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
51.071,
|
||||
-0.856,
|
||||
51.473,
|
||||
0.062
|
||||
],
|
||||
"sourcetag": "Surrey aerial"
|
||||
},
|
||||
{
|
||||
"name": "Haiti - GeoEye Jan 13",
|
||||
"url": "http://gravitystorm.dev.openstreetmap.org/imagery/haiti/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
17.95,
|
||||
-74.5,
|
||||
20.12,
|
||||
-71.58
|
||||
],
|
||||
"sourcetag": "Haiti GeoEye"
|
||||
},
|
||||
{
|
||||
"name": "Haiti - GeoEye Jan 13+",
|
||||
"url": "http://maps.nypl.org/tilecache/1/geoeye/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
17.95,
|
||||
-74.5,
|
||||
20.12,
|
||||
-71.58
|
||||
],
|
||||
"sourcetag": "Haiti GeoEye"
|
||||
},
|
||||
{
|
||||
"name": "Haiti - DigitalGlobe",
|
||||
"url": "http://maps.nypl.org/tilecache/1/dg_crisis/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
17.95,
|
||||
-74.5,
|
||||
20.12,
|
||||
-71.58
|
||||
],
|
||||
"sourcetag": "Haiti DigitalGlobe"
|
||||
},
|
||||
{
|
||||
"name": "Haiti - Street names",
|
||||
"url": "http://hypercube.telascience.org/tiles/1.0.0/haiti-city/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
17.95,
|
||||
-74.5,
|
||||
20.12,
|
||||
-71.58
|
||||
],
|
||||
"sourcetag": "Haiti streetnames"
|
||||
},
|
||||
{
|
||||
"name": "National Agriculture Imagery Program",
|
||||
"url": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
24.2,
|
||||
-125.8,
|
||||
49.5,
|
||||
-62.3
|
||||
],
|
||||
"sourcetag": "NAIP"
|
||||
},
|
||||
{
|
||||
"name": "National Agriculture Imagery Program",
|
||||
"url": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
55.3,
|
||||
-168.5,
|
||||
71.5,
|
||||
-140
|
||||
],
|
||||
"sourcetag": "NAIP"
|
||||
},
|
||||
{
|
||||
"name": "Ireland - NLS Historic Maps",
|
||||
"url": "http://geo.nls.uk/maps/ireland/gsgs4136/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
51.32,
|
||||
-10.71,
|
||||
55.46,
|
||||
-5.37
|
||||
],
|
||||
"sourcetag": "NLS Historic Maps",
|
||||
"logo": "icons/logo_nls70-nq8.png",
|
||||
"logo_url": "http://geo.nls.uk/maps/"
|
||||
},
|
||||
{
|
||||
"name": "Denmark - Fugro Aerial Imagery",
|
||||
"url": "http://tile.openstreetmap.dk/fugro2005/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
54.44,
|
||||
7.81,
|
||||
57.86,
|
||||
15.49
|
||||
],
|
||||
"sourcetag": "Fugro (2005)"
|
||||
},
|
||||
{
|
||||
"name": "Denmark - Stevns Kommune",
|
||||
"url": "http://tile.openstreetmap.dk/stevns/2009/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
55.23403,
|
||||
12.09144,
|
||||
55.43647,
|
||||
12.47712
|
||||
],
|
||||
"sourcetag": "Stevns Kommune (2009)"
|
||||
},
|
||||
{
|
||||
"name": "Austria - geoimage.at",
|
||||
"url": "http://geoimage.openstreetmap.at/4d80de696cd562a63ce463a58a61488d/{z}/{x}/{y}.jpg",
|
||||
"extent": [
|
||||
46.33,
|
||||
9.36,
|
||||
49.09,
|
||||
17.28
|
||||
],
|
||||
"sourcetag": "geoimage.at"
|
||||
},
|
||||
{
|
||||
"name": "Russia - Kosmosnimki.ru IRS Satellite",
|
||||
"url": "http://irs.gis-lab.info/?layers=irs&request=GetTile&z={z}&x={x}&y={y}",
|
||||
"extent": [
|
||||
40.96,
|
||||
19.02,
|
||||
70.48,
|
||||
77.34
|
||||
],
|
||||
"sourcetag": "Kosmosnimki.ru IRS"
|
||||
},
|
||||
{
|
||||
"name": "Belarus - Kosmosnimki.ru SPOT4 Satellite",
|
||||
"url": "http://irs.gis-lab.info/?layers=spot&request=GetTile&z={z}&x={x}&y={y}",
|
||||
"extent": [
|
||||
51.25,
|
||||
23.16,
|
||||
56.19,
|
||||
32.83
|
||||
],
|
||||
"sourcetag": "Kosmosnimki.ru SPOT4"
|
||||
},
|
||||
{
|
||||
"name": "Australia - Geographic Reference Image",
|
||||
"url": "http://agri.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
-44,
|
||||
96,
|
||||
-9,
|
||||
168
|
||||
],
|
||||
"sourcetag": "AGRI"
|
||||
},
|
||||
{
|
||||
"name": "Switzerland - Canton Aargau - AGIS 25cm 2011",
|
||||
"url": "http://tiles.poole.ch/AGIS/OF2011/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
47.13,
|
||||
7.69,
|
||||
47.63,
|
||||
8.48
|
||||
],
|
||||
"sourcetag": "AGIS OF2011"
|
||||
},
|
||||
{
|
||||
"name": "Switzerland - Canton Solothurn - SOGIS 2007",
|
||||
"url": "http://mapproxy.sosm.ch:8080/tiles/sogis2007/EPSG900913/{z}/{x}/{y}.png?origin=nw",
|
||||
"extent": [
|
||||
47.06,
|
||||
7.33,
|
||||
47.5,
|
||||
8.04
|
||||
],
|
||||
"sourcetag": "Orthofoto 2007 WMS Solothurn"
|
||||
},
|
||||
{
|
||||
"name": "Poland - Media-Lab fleet GPS masstracks",
|
||||
"url": "http://masstracks.media-lab.com.pl/{z}/{x}/{y}.png",
|
||||
"extent": [
|
||||
48.9,
|
||||
14,
|
||||
55,
|
||||
24.2
|
||||
],
|
||||
"sourcetag": "masstracks"
|
||||
},
|
||||
{
|
||||
"name": "South Africa - CD:NGI Aerial",
|
||||
"url": "http://{t}.aerial.openstreetmap.org.za/ngi-aerial/{z}/{x}/{y}.jpg",
|
||||
"subdomains": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
],
|
||||
"extent": [
|
||||
-34.95,
|
||||
17.64,
|
||||
-22.05,
|
||||
32.87
|
||||
],
|
||||
"sourcetag": "ngi-aerial"
|
||||
}
|
||||
]
|
||||
231
data/imagery.xml
Normal file
231
data/imagery.xml
Normal file
@@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<imagery>
|
||||
<set>
|
||||
<name>Bing aerial imagery</name>
|
||||
<url>http://ecn.t0.tiles.virtualearth.net/tiles/a$quadkey.jpeg?g=587&mkt=en-gb&n=z</url>
|
||||
<scheme>microsoft</scheme>
|
||||
<sourcetag>Bing</sourcetag>
|
||||
<attribution_url>http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial/0,0?zl=1&mapVersion=v1&key=Arzdiw4nlOJzRwOz__qailc8NiR31Tt51dN2D7cm57NrnceZnCpgOkmJhNpGoppU&include=ImageryProviders&output=xml</attribution_url>
|
||||
<logo>bing_maps.png</logo>
|
||||
<logo_url>http://www.bing.com/maps</logo_url>
|
||||
<terms_url>http://opengeodata.org/microsoft-imagery-details</terms_url>
|
||||
<default>yes</default>
|
||||
</set>
|
||||
<set>
|
||||
<name>MapBox Satellite</name>
|
||||
<url>http://${a|b|c}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set>
|
||||
<name>MapQuest Open Aerial</name>
|
||||
<url>http://oatile1.mqcdn.com/tiles/1.0.0/sat/$z/$x/$y.jpg</url>
|
||||
</set>
|
||||
<set>
|
||||
<name>OSM - Mapnik</name>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.org/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set>
|
||||
<name>OSM - OpenCycleMap</name>
|
||||
<url>http://tile.opencyclemap.org/cycle/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set>
|
||||
<name>OSM - MapQuest</name>
|
||||
<url>http://otile1.mqcdn.com/tiles/1.0.0/osm/$z/$x/$y.jpg</url>
|
||||
</set>
|
||||
<set minlat="24.055" minlon="-124.810" maxlat="49.386" maxlon="-66.865">
|
||||
<name>OSM - Tiger Edited Map</name>
|
||||
<type>900913</type>
|
||||
<url>http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="50.858" minlon="-179.754" maxlat="71.463" maxlon="-129.899">
|
||||
<name>OSM - Tiger Edited Map</name>
|
||||
<type>900913</type>
|
||||
<url>http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="18.702" minlon="-174.460" maxlat="26.501" maxlon="-154.516">
|
||||
<name>OSM - Tiger Edited Map</name>
|
||||
<type>900913</type>
|
||||
<url>http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="24.055" minlon="-124.810" maxlat="49.386" maxlon="-66.865">
|
||||
<name>OSM US TIGER 2012 Roads Overlay</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.us/tiger2012_roads_expanded/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="50.858" minlon="-179.754" maxlat="71.463" maxlon="-129.899">
|
||||
<name>OSM US TIGER 2012 Roads Overlay</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.us/tiger2012_roads_expanded/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="18.702" minlon="-174.460" maxlat="26.501" maxlon="-154.516">
|
||||
<name>OSM US TIGER 2012 Roads Overlay</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.us/tiger2012_roads_expanded/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="24.005" minlon="-125.991" maxlat="50.009" maxlon="-65.988">
|
||||
<name>OSM US USGS Topographic Maps</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.us/usgs_scanned_topos/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="18.902" minlon="-160.579" maxlat="22.508" maxlon="-154.793">
|
||||
<name>OSM US USGS Topographic Maps</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.us/usgs_scanned_topos/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="51.255" minlon="-178.001" maxlat="71.999" maxlon="-130.004">
|
||||
<name>OSM US USGS Topographic Maps</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.us/usgs_scanned_topos/$z/$x/$y.png</url>
|
||||
</set>
|
||||
<set minlat="24.496" minlon="-124.819" maxlat="49.443" maxlon="-66.931">
|
||||
<name>OSM US USGS Large Scale Aerial Imagery</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c}.tile.openstreetmap.us/usgs_large_scale/$z/$x/$y.jpg</url>
|
||||
</set>
|
||||
<set minlat="48.995" minlon="-123.441" maxlat="50.426" maxlon="-121.346">
|
||||
<name>British Columbia bc_mosaic</name>
|
||||
<type>900913</type>
|
||||
<url>http://${a|b|c|d}.imagery.paulnorman.ca/tiles/bc_mosaic/$z/$x/$y.png</url>
|
||||
<terms_url>http://imagery.paulnorman.ca/tiles/about.html</terms_url>
|
||||
<sourcetag>bc_mosaic</sourcetag>
|
||||
</set>
|
||||
<set minlat="49.86" minlon="-8.72" maxlat="60.92" maxlon="1.84">
|
||||
<name>OS OpenData Streetview</name>
|
||||
<url>http://os.openstreetmap.org/sv/$z/$x/$y.png</url>
|
||||
<sourcetag>OS_OpenData_StreetView</sourcetag>
|
||||
</set>
|
||||
<set minlat="49.8" minlon="-9" maxlat="61.1" maxlon="1.9">
|
||||
<name>OS OpenData Locator</name>
|
||||
<url>http://tiles.itoworld.com/os_locator/$z/$x/$y.png</url>
|
||||
<sourcetag>OS_OpenData_Locator</sourcetag>
|
||||
<sourcekey>source:name</sourcekey>
|
||||
</set>
|
||||
<set minlat="49.8" minlon="-9" maxlat="61.1" maxlon="1.9">
|
||||
<name>OS 1:25k historic (OSM)</name>
|
||||
<url>http://ooc.openstreetmap.org/os1/$z/$x/$y.jpg</url>
|
||||
<sourcetag>OS 1:25k</sourcetag>
|
||||
</set>
|
||||
<set minlat="49.8" minlon="-9" maxlat="61.1" maxlon="1.9">
|
||||
<name>OS 1:25k historic (NLS)</name>
|
||||
<scheme>tms</scheme>
|
||||
<url>http://geo.nls.uk/mapdata2/os/25000/$z/$x/$y.png</url>
|
||||
<logo>icons/logo_nls70-nq8.png</logo>
|
||||
<logo_url>http://geo.nls.uk/maps/</logo_url>
|
||||
<sourcetag>OS 1:25k</sourcetag>
|
||||
</set>
|
||||
<set minlat="49.8" minlon="-9" maxlat="61.1" maxlon="1.9">
|
||||
<name>OS 7th Series historic (OSM)</name>
|
||||
<url>http://ooc.openstreetmap.org/os7/$z/$x/$y.jpg</url>
|
||||
<sourcetag>OS7</sourcetag>
|
||||
</set>
|
||||
<set minlat="49.8" minlon="-9" maxlat="61.1" maxlon="1.9">
|
||||
<name>OS 7th Series historic (NLS)</name>
|
||||
<scheme>tms</scheme>
|
||||
<url>http://geo.nls.uk/mapdata2/os/seventh/$z/$x/$y.png</url>
|
||||
<logo>icons/logo_nls70-nq8.png</logo>
|
||||
<logo_url>http://geo.nls.uk/maps/</logo_url>
|
||||
<sourcetag>OS7</sourcetag>
|
||||
</set>
|
||||
<set minlat="49.8" minlon="-5.8" maxlat="55.8" maxlon="1.9">
|
||||
<name>OS New Popular Edition historic</name>
|
||||
<url>http://ooc.openstreetmap.org/npe/$z/$x/$y.png</url>
|
||||
<sourcetag>NPE</sourcetag>
|
||||
</set>
|
||||
<set minlat="54.5" minlon="-7.8" maxlat="61.1" maxlon="-1.1">
|
||||
<name>OS Scottish Popular historic</name>
|
||||
<url>http://ooc.openstreetmap.org/npescotland/tiles/$z/$x/$y.jpg</url>
|
||||
<sourcetag>NPE</sourcetag>
|
||||
</set>
|
||||
<set minlat="51.071" minlon="-0.856" maxlat="51.473" maxlon="0.062">
|
||||
<name>Surrey aerial</name>
|
||||
<url>http://gravitystorm.dev.openstreetmap.org/surrey/$z/$x/$y.png</url>
|
||||
<sourcetag>Surrey aerial</sourcetag>
|
||||
</set>
|
||||
<set minlat="17.95" minlon="-74.5" maxlat="20.12" maxlon="-71.58">
|
||||
<name>Haiti - GeoEye Jan 13</name>
|
||||
<url>http://gravitystorm.dev.openstreetmap.org/imagery/haiti/$z/$x/$y.jpg</url>
|
||||
<sourcetag>Haiti GeoEye</sourcetag>
|
||||
</set>
|
||||
<set minlat="17.95" minlon="-74.5" maxlat="20.12" maxlon="-71.58">
|
||||
<name>Haiti - GeoEye Jan 13+</name>
|
||||
<url>http://maps.nypl.org/tilecache/1/geoeye/$z/$x/$y.jpg</url>
|
||||
<sourcetag>Haiti GeoEye</sourcetag>
|
||||
</set>
|
||||
<set minlat="17.95" minlon="-74.5" maxlat="20.12" maxlon="-71.58">
|
||||
<name>Haiti - DigitalGlobe</name>
|
||||
<url>http://maps.nypl.org/tilecache/1/dg_crisis/$z/$x/$y.jpg</url>
|
||||
<sourcetag>Haiti DigitalGlobe</sourcetag>
|
||||
</set>
|
||||
<set minlat="17.95" minlon="-74.5" maxlat="20.12" maxlon="-71.58">
|
||||
<name>Haiti - Street names</name>
|
||||
<url>http://hypercube.telascience.org/tiles/1.0.0/haiti-city/$z/$x/$y.jpg</url>
|
||||
<sourcetag>Haiti streetnames</sourcetag>
|
||||
</set>
|
||||
<set minlat="24.2" minlon="-125.8" maxlat="49.5" maxlon="-62.3">
|
||||
<name>National Agriculture Imagery Program</name>
|
||||
<url>http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/$z/$x/$y.png</url>
|
||||
<sourcetag>NAIP</sourcetag>
|
||||
</set>
|
||||
<set minlat="55.3" minlon="-168.5" maxlat="71.5" maxlon="-140">
|
||||
<name>National Agriculture Imagery Program</name>
|
||||
<url>http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/$z/$x/$y.png</url>
|
||||
<sourcetag>NAIP</sourcetag>
|
||||
</set>
|
||||
<set minlat="51.32" minlon="-10.71" maxlat="55.46" maxlon="-5.37">
|
||||
<name>Ireland - NLS Historic Maps</name>
|
||||
<scheme>tms</scheme>
|
||||
<sourcetag>NLS Historic Maps</sourcetag>
|
||||
<url>http://geo.nls.uk/maps/ireland/gsgs4136/$z/$x/$y.png</url>
|
||||
<logo>icons/logo_nls70-nq8.png</logo>
|
||||
<logo_url>http://geo.nls.uk/maps/</logo_url>
|
||||
</set>
|
||||
<set minlat="54.44" minlon="7.81" maxlat="57.86" maxlon="15.49">
|
||||
<name>Denmark - Fugro Aerial Imagery</name>
|
||||
<url>http://tile.openstreetmap.dk/fugro2005/$z/$x/$y.jpg</url>
|
||||
<sourcetag>Fugro (2005)</sourcetag>
|
||||
</set>
|
||||
<set minlat="55.23403" minlon="12.09144" maxlat="55.43647" maxlon="12.47712">
|
||||
<name>Denmark - Stevns Kommune</name>
|
||||
<url>http://tile.openstreetmap.dk/stevns/2009/$z/$x/$y.jpg</url>
|
||||
<sourcetag>Stevns Kommune (2009)</sourcetag>
|
||||
</set>
|
||||
<set minlat="46.33" minlon="9.36" maxlat="49.09" maxlon="17.28">
|
||||
<name>Austria - geoimage.at</name>
|
||||
<url>http://geoimage.openstreetmap.at/4d80de696cd562a63ce463a58a61488d/$z/$x/$y.jpg</url>
|
||||
<sourcetag>geoimage.at</sourcetag>
|
||||
</set>
|
||||
<set minlon="19.02" minlat="40.96" maxlon="77.34" maxlat="70.48">
|
||||
<name>Russia - Kosmosnimki.ru IRS Satellite</name>
|
||||
<url>http://irs.gis-lab.info/?layers=irs&request=GetTile&z=$z&x=$x&y=$y</url>
|
||||
<sourcetag>Kosmosnimki.ru IRS</sourcetag>
|
||||
</set>
|
||||
<set minlon="23.16" minlat="51.25" maxlon="32.83" maxlat="56.19">
|
||||
<name>Belarus - Kosmosnimki.ru SPOT4 Satellite</name>
|
||||
<url>http://irs.gis-lab.info/?layers=spot&request=GetTile&z=$z&x=$x&y=$y</url>
|
||||
<sourcetag>Kosmosnimki.ru SPOT4</sourcetag>
|
||||
</set>
|
||||
<set minlon="96" minlat="-44" maxlon="168" maxlat="-9">
|
||||
<name>Australia - Geographic Reference Image</name>
|
||||
<url>http://agri.openstreetmap.org/$z/$x/$y.png</url>
|
||||
<sourcetag>AGRI</sourcetag>
|
||||
</set>
|
||||
<set minlat="47.13" minlon="7.69" maxlat="47.63" maxlon="8.48">
|
||||
<name>Switzerland - Canton Aargau - AGIS 25cm 2011</name>
|
||||
<url>http://tiles.poole.ch/AGIS/OF2011/$z/$x/$y.png</url>
|
||||
<sourcetag>AGIS OF2011</sourcetag>
|
||||
</set>
|
||||
<set minlat="47.06" minlon="7.33" maxlat="47.5" maxlon="8.04">
|
||||
<name>Switzerland - Canton Solothurn - SOGIS 2007</name>
|
||||
<url>http://mapproxy.sosm.ch:8080/tiles/sogis2007/EPSG900913/$z/$x/$y.png?origin=nw</url>
|
||||
<sourcetag>Orthofoto 2007 WMS Solothurn</sourcetag>
|
||||
</set>
|
||||
<set minlat="48.9" minlon="14" maxlat="55" maxlon="24.2">
|
||||
<name>Poland - Media-Lab fleet GPS masstracks</name>
|
||||
<url>http://masstracks.media-lab.com.pl/$z/$x/$y.png</url>
|
||||
<sourcetag>masstracks</sourcetag>
|
||||
</set>
|
||||
<set minlat="-34.95" minlon="17.64" maxlat="-22.05" maxlon="32.87">
|
||||
<name>South Africa - CD:NGI Aerial</name>
|
||||
<url>http://${a|b|c}.aerial.openstreetmap.org.za/ngi-aerial/$z/$x/$y.jpg</url>
|
||||
<sourcetag>ngi-aerial</sourcetag>
|
||||
</set>
|
||||
</imagery>
|
||||
45
data/imagery_convert.js
Normal file
45
data/imagery_convert.js
Normal file
@@ -0,0 +1,45 @@
|
||||
var fs = require('fs'),
|
||||
cheerio = require('cheerio');
|
||||
|
||||
$ = cheerio.load(fs.readFileSync('imagery.xml'));
|
||||
|
||||
var imagery = [];
|
||||
|
||||
$('set').each(function(i) {
|
||||
var elem = $(this);
|
||||
|
||||
var im = {
|
||||
name: $(this).find('name').first().text(),
|
||||
url: $(this).find('url').first().text()
|
||||
};
|
||||
|
||||
var subdomains = [];
|
||||
|
||||
im.url = im.url
|
||||
.replace(/\$(\w)/g, function(m) {
|
||||
return '{' + m[1] + '}';
|
||||
})
|
||||
.replace(/\$\{([^}.]+)\}/g, function(m) {
|
||||
subdomains = m.slice(2, m.length - 1).split('|');
|
||||
return '{t}';
|
||||
});
|
||||
|
||||
if (subdomains.length) im.subdomains = subdomains;
|
||||
|
||||
if (elem.attr('minlat')) {
|
||||
im.extent = [
|
||||
+elem.attr('minlat'),
|
||||
+elem.attr('minlon'),
|
||||
+elem.attr('maxlat'),
|
||||
+elem.attr('maxlon')];
|
||||
}
|
||||
|
||||
['sourcetag', 'logo', 'logo_url', 'terms_url'].forEach(function(a) {
|
||||
if (elem.find(a).length) {
|
||||
im[a] = elem.find(a).first().text();
|
||||
}
|
||||
});
|
||||
imagery.push(im);
|
||||
});
|
||||
|
||||
fs.writeFileSync('imagery.json', JSON.stringify(imagery, null, 4));
|
||||
@@ -134,6 +134,9 @@
|
||||
|
||||
<script src='locale/locale.js'></script>
|
||||
<script src='locale/en.js'></script>
|
||||
|
||||
<script src='data/data.js'></script>
|
||||
<script src='data/deprecated.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="iD"></div><script>
|
||||
|
||||
36
js/id/actions/deprecate_tags.js
Normal file
36
js/id/actions/deprecate_tags.js
Normal file
@@ -0,0 +1,36 @@
|
||||
iD.actions.DeprecateTags = function(entityId) {
|
||||
return function(graph) {
|
||||
var entity = graph.entity(entityId),
|
||||
newtags = _.clone(entity.tags),
|
||||
change = false,
|
||||
rule;
|
||||
|
||||
// This handles deprecated tags with a single condition
|
||||
for (var i = 0; i < iD.data.deprecated.length; i++) {
|
||||
|
||||
rule = iD.data.deprecated[i];
|
||||
var match = _.pairs(rule.old)[0],
|
||||
replacements = rule.replace ? _.pairs(rule.replace) : null;
|
||||
|
||||
if (entity.tags[match[0]] && match[1] === '*') {
|
||||
|
||||
var value = entity.tags[match[0]];
|
||||
if (replacements && !newtags[replacements[0][0]]) {
|
||||
newtags[replacements[0][0]] = value;
|
||||
}
|
||||
delete newtags[match[0]];
|
||||
change = true;
|
||||
|
||||
} else if (entity.tags[match[0]] === match[1]) {
|
||||
newtags = _.assign({}, rule.replace || {}, _.omit(newtags, match[0]));
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (change) {
|
||||
return graph.replace(entity.update({tags: newtags}));
|
||||
} else {
|
||||
return graph;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -1,12 +1,11 @@
|
||||
iD.behavior.AddWay = function(context) {
|
||||
var event = d3.dispatch('start', 'startFromWay', 'startFromNode', 'startFromMidpoint'),
|
||||
var event = d3.dispatch('start', 'startFromWay', 'startFromNode')
|
||||
draw = iD.behavior.Draw(context);
|
||||
|
||||
var addWay = function(surface) {
|
||||
draw.on('click', event.start)
|
||||
.on('clickWay', event.startFromWay)
|
||||
.on('clickNode', event.startFromNode)
|
||||
.on('clickMidpoint', event.startFromMidpoint)
|
||||
.on('cancel', addWay.cancel)
|
||||
.on('finish', addWay.cancel);
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
iD.behavior.DragNode = function(context) {
|
||||
var size = context.map().size(),
|
||||
nudgeInterval;
|
||||
var nudgeInterval;
|
||||
|
||||
function edge(point) {
|
||||
function edge(point, size) {
|
||||
var pad = [30, 100, 30, 100];
|
||||
if (point[0] > size[0] - pad[0]) return [-10, 0];
|
||||
else if (point[0] < pad[2]) return [10, 0];
|
||||
@@ -39,7 +38,7 @@ iD.behavior.DragNode = function(context) {
|
||||
.on('move', function(entity) {
|
||||
d3.event.sourceEvent.stopPropagation();
|
||||
|
||||
var nudge = edge(d3.event.point);
|
||||
var nudge = edge(d3.event.point, context.map().size());
|
||||
if (nudge) startNudge(nudge);
|
||||
else stopNudge();
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
iD.behavior.Draw = function(context) {
|
||||
var event = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'clickMidpoint', 'undo', 'cancel', 'finish'),
|
||||
var event = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'undo', 'cancel', 'finish'),
|
||||
keybinding = d3.keybinding('draw'),
|
||||
hover = iD.behavior.Hover(),
|
||||
down;
|
||||
hover = iD.behavior.Hover();
|
||||
|
||||
function datum() {
|
||||
if (d3.event.altKey) {
|
||||
@@ -13,17 +12,17 @@ iD.behavior.Draw = function(context) {
|
||||
}
|
||||
|
||||
function mousedown() {
|
||||
down = true;
|
||||
}
|
||||
var selection = d3.select(this);
|
||||
selection.on('mousemove.draw', null);
|
||||
|
||||
function mouseup() {
|
||||
down = false;
|
||||
d3.select(window)
|
||||
.on('mouseup.draw', function() {
|
||||
selection.on('mousemove.draw', mousemove);
|
||||
});
|
||||
}
|
||||
|
||||
function mousemove() {
|
||||
if (!down) {
|
||||
event.move(datum());
|
||||
}
|
||||
event.move(datum());
|
||||
}
|
||||
|
||||
function click() {
|
||||
@@ -35,9 +34,6 @@ iD.behavior.Draw = function(context) {
|
||||
} else if (d.type === 'node') {
|
||||
event.clickNode(d);
|
||||
|
||||
} else if (d.type === 'midpoint') {
|
||||
event.clickMidpoint(d);
|
||||
|
||||
} else {
|
||||
event.click(context.map().mouseCoordinates());
|
||||
}
|
||||
@@ -81,7 +77,6 @@ iD.behavior.Draw = function(context) {
|
||||
|
||||
selection
|
||||
.on('mousedown.draw', mousedown)
|
||||
.on('mouseup.draw', mouseup)
|
||||
.on('mousemove.draw', mousemove)
|
||||
.on('click.draw', click);
|
||||
|
||||
@@ -98,10 +93,11 @@ iD.behavior.Draw = function(context) {
|
||||
|
||||
selection
|
||||
.on('mousedown.draw', null)
|
||||
.on('mouseup.draw', null)
|
||||
.on('mousemove.draw', null)
|
||||
.on('click.draw', null);
|
||||
|
||||
d3.select(window).on('mouseup.draw', null);
|
||||
|
||||
d3.select(document)
|
||||
.call(keybinding.off)
|
||||
.on('keydown.draw', null)
|
||||
|
||||
@@ -1,31 +1,40 @@
|
||||
iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
|
||||
var way = context.entity(wayId),
|
||||
isArea = way.geometry() === 'area',
|
||||
finished = false,
|
||||
annotation = t((way.isDegenerate() ?
|
||||
'operations.start.annotation.' :
|
||||
'operations.continue.annotation.') + context.geometry(wayId)),
|
||||
draw = iD.behavior.Draw(context);
|
||||
|
||||
var node = iD.Node({loc: context.map().mouseCoordinates()}),
|
||||
nodeId = node.id;
|
||||
var startIndex = typeof index === 'undefined' ? way.nodes.length - 1 : 0,
|
||||
start = iD.Node({loc: context.graph().entity(way.nodes[startIndex]).loc}),
|
||||
end = iD.Node({loc: context.map().mouseCoordinates()}),
|
||||
segment = iD.Way({
|
||||
nodes: [start.id, end.id],
|
||||
tags: _.clone(way.tags)
|
||||
});
|
||||
|
||||
context[way.isDegenerate() ? 'replace' : 'perform'](
|
||||
iD.actions.AddEntity(node),
|
||||
iD.actions.AddVertex(wayId, node.id, index));
|
||||
var f = context[way.isDegenerate() ? 'replace' : 'perform'];
|
||||
if (isArea) {
|
||||
f(iD.actions.AddEntity(end),
|
||||
iD.actions.AddVertex(wayId, end.id, index));
|
||||
} else {
|
||||
f(iD.actions.AddEntity(start),
|
||||
iD.actions.AddEntity(end),
|
||||
iD.actions.AddEntity(segment));
|
||||
}
|
||||
|
||||
function move(datum) {
|
||||
var loc = context.map().mouseCoordinates();
|
||||
|
||||
if (datum.type === 'node') {
|
||||
loc = datum.loc;
|
||||
} else if (datum.type === 'midpoint' || datum.type === 'way') {
|
||||
var way = datum.type === 'way' ?
|
||||
datum :
|
||||
context.entity(datum.ways[0].id);
|
||||
loc = iD.geo.chooseIndex(way, d3.mouse(context.surface().node()), context).loc;
|
||||
} else if (datum.type === 'way') {
|
||||
loc = iD.geo.chooseIndex(datum, d3.mouse(context.surface().node()), context).loc;
|
||||
}
|
||||
|
||||
context.replace(iD.actions.MoveNode(nodeId, loc));
|
||||
context.replace(iD.actions.MoveNode(end.id, loc));
|
||||
}
|
||||
|
||||
function undone() {
|
||||
@@ -37,7 +46,6 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
|
||||
.on('click', drawWay.add)
|
||||
.on('clickWay', drawWay.addWay)
|
||||
.on('clickNode', drawWay.addNode)
|
||||
.on('clickMidpoint', drawWay.addMidpoint)
|
||||
.on('undo', context.undo)
|
||||
.on('cancel', drawWay.cancel)
|
||||
.on('finish', drawWay.finish);
|
||||
@@ -49,7 +57,7 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
|
||||
|
||||
surface.call(draw)
|
||||
.selectAll('.way, .node')
|
||||
.filter(function (d) { return d.id === wayId || d.id === nodeId; })
|
||||
.filter(function (d) { return d.id === segment.id || d.id === start.id || d.id === end.id; })
|
||||
.classed('active', true);
|
||||
|
||||
context.history()
|
||||
@@ -79,9 +87,18 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
|
||||
|
||||
function ReplaceTemporaryNode(newNode) {
|
||||
return function(graph) {
|
||||
return graph
|
||||
.replace(way.removeNode(nodeId).addNode(newNode.id, index))
|
||||
.remove(node);
|
||||
if (isArea) {
|
||||
return graph
|
||||
.replace(way.removeNode(end.id).addNode(newNode.id, index))
|
||||
.remove(end);
|
||||
|
||||
} else {
|
||||
return graph
|
||||
.replace(graph.entity(wayId).addNode(newNode.id, index))
|
||||
.remove(end)
|
||||
.remove(segment)
|
||||
.remove(start);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -122,19 +139,6 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
|
||||
context.enter(mode);
|
||||
};
|
||||
|
||||
// Add a midpoint, connect the way to it, and continue drawing.
|
||||
drawWay.addMidpoint = function(midpoint) {
|
||||
var node = iD.Node();
|
||||
|
||||
context.perform(
|
||||
iD.actions.AddMidpoint(midpoint, node),
|
||||
ReplaceTemporaryNode(node),
|
||||
annotation);
|
||||
|
||||
finished = true;
|
||||
context.enter(mode);
|
||||
};
|
||||
|
||||
// Finish the draw operation, removing the temporary node. If the way has enough
|
||||
// nodes to be valid, it's selected. Otherwise, return to browse mode.
|
||||
drawWay.finish = function() {
|
||||
@@ -159,5 +163,5 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
|
||||
context.enter(iD.modes.Browse(context));
|
||||
};
|
||||
|
||||
return d3.rebind(drawWay, event, 'on');
|
||||
return drawWay;
|
||||
};
|
||||
|
||||
@@ -208,6 +208,7 @@ iD.Connection = function(context) {
|
||||
|
||||
function userDetails(callback) {
|
||||
function done(err, user_details) {
|
||||
if (err) return callback(err);
|
||||
var u = user_details.getElementsByTagName('user')[0],
|
||||
img = u.getElementsByTagName('img'),
|
||||
image_url = '';
|
||||
|
||||
@@ -9,22 +9,22 @@ iD.Entity = function(attrs) {
|
||||
return (new iD.Entity()).initialize(arguments);
|
||||
};
|
||||
|
||||
iD.Entity.id = function (type) {
|
||||
iD.Entity.id = function(type) {
|
||||
return iD.Entity.id.fromOSM(type, iD.Entity.id.next[type]--);
|
||||
};
|
||||
|
||||
iD.Entity.id.next = {node: -1, way: -1, relation: -1};
|
||||
|
||||
iD.Entity.id.fromOSM = function (type, id) {
|
||||
iD.Entity.id.fromOSM = function(type, id) {
|
||||
return type[0] + id;
|
||||
};
|
||||
|
||||
iD.Entity.id.toOSM = function (id) {
|
||||
iD.Entity.id.toOSM = function(id) {
|
||||
return id.slice(1);
|
||||
};
|
||||
|
||||
// A function suitable for use as the second argument to d3.selection#data().
|
||||
iD.Entity.key = function (entity) {
|
||||
iD.Entity.key = function(entity) {
|
||||
return entity.id;
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ iD.Entity.prototype = {
|
||||
},
|
||||
|
||||
hasInterestingTags: function() {
|
||||
return _.keys(this.tags).some(function (key) {
|
||||
return _.keys(this.tags).some(function(key) {
|
||||
return key != "attribution" &&
|
||||
key != "created_by" &&
|
||||
key != "source" &&
|
||||
@@ -93,6 +93,23 @@ iD.Entity.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
deprecatedTags: function() {
|
||||
var tags = _.pairs(this.tags);
|
||||
var deprecated = {};
|
||||
|
||||
iD.data.deprecated.forEach(function(d) {
|
||||
var match = _.pairs(d.old)[0];
|
||||
tags.forEach(function(t) {
|
||||
if (t[0] == match[0] &&
|
||||
(t[1] == match[1] || match[1] == '*')) {
|
||||
deprecated[t[0]] = t[1];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return deprecated;
|
||||
},
|
||||
|
||||
friendlyName: function() {
|
||||
// Generate a string such as 'river' or 'Fred's House' for an entity.
|
||||
if (!this.tags || !Object.keys(this.tags).length) { return ''; }
|
||||
|
||||
@@ -27,11 +27,11 @@ iD.History = function() {
|
||||
}
|
||||
|
||||
var history = {
|
||||
graph: function () {
|
||||
graph: function() {
|
||||
return stack[index].graph;
|
||||
},
|
||||
|
||||
merge: function (entities) {
|
||||
merge: function(entities) {
|
||||
for (var i = 0; i < stack.length; i++) {
|
||||
stack[i].graph.rebase(entities);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ iD.History = function() {
|
||||
dispatch.change();
|
||||
},
|
||||
|
||||
perform: function () {
|
||||
perform: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
stack = stack.slice(0, index + 1);
|
||||
@@ -49,7 +49,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
replace: function () {
|
||||
replace: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
// assert(index == stack.length - 1)
|
||||
@@ -58,7 +58,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
pop: function () {
|
||||
pop: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
if (index > 0) {
|
||||
@@ -68,7 +68,7 @@ iD.History = function() {
|
||||
}
|
||||
},
|
||||
|
||||
undo: function () {
|
||||
undo: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
// Pop to the first annotated state.
|
||||
@@ -87,7 +87,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
redo: function () {
|
||||
redo: function() {
|
||||
var previous = stack[index].graph;
|
||||
|
||||
while (index < stack.length - 1) {
|
||||
@@ -99,7 +99,7 @@ iD.History = function() {
|
||||
return change(previous);
|
||||
},
|
||||
|
||||
undoAnnotation: function () {
|
||||
undoAnnotation: function() {
|
||||
var i = index;
|
||||
while (i >= 0) {
|
||||
if (stack[i].annotation) return stack[i].annotation;
|
||||
@@ -107,7 +107,7 @@ iD.History = function() {
|
||||
}
|
||||
},
|
||||
|
||||
redoAnnotation: function () {
|
||||
redoAnnotation: function() {
|
||||
var i = index + 1;
|
||||
while (i <= stack.length - 1) {
|
||||
if (stack[i].annotation) return stack[i].annotation;
|
||||
@@ -115,13 +115,13 @@ iD.History = function() {
|
||||
}
|
||||
},
|
||||
|
||||
difference: function () {
|
||||
difference: function() {
|
||||
var base = stack[0].graph,
|
||||
head = stack[index].graph;
|
||||
return iD.Difference(base, head);
|
||||
},
|
||||
|
||||
changes: function () {
|
||||
changes: function() {
|
||||
var difference = history.difference();
|
||||
return {
|
||||
modified: difference.modified(),
|
||||
@@ -145,7 +145,7 @@ iD.History = function() {
|
||||
undefined, 'Custom');
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
reset: function() {
|
||||
stack = [{graph: iD.Graph()}];
|
||||
index = 0;
|
||||
dispatch.change();
|
||||
|
||||
@@ -11,7 +11,6 @@ iD.modes.AddArea = function(context) {
|
||||
.on('start', start)
|
||||
.on('startFromWay', startFromWay)
|
||||
.on('startFromNode', startFromNode)
|
||||
.on('startFromMidpoint', startFromMidpoint),
|
||||
defaultTags = {area: 'yes'};
|
||||
|
||||
function start(loc) {
|
||||
@@ -55,20 +54,6 @@ iD.modes.AddArea = function(context) {
|
||||
context.enter(iD.modes.DrawArea(context, way.id, graph));
|
||||
}
|
||||
|
||||
function startFromMidpoint(midpoint) {
|
||||
var graph = context.graph(),
|
||||
node = iD.Node(),
|
||||
way = iD.Way({tags: defaultTags});
|
||||
|
||||
context.perform(
|
||||
iD.actions.AddMidpoint(midpoint, node),
|
||||
iD.actions.AddEntity(way),
|
||||
iD.actions.AddVertex(way.id, node.id),
|
||||
iD.actions.AddVertex(way.id, node.id));
|
||||
|
||||
context.enter(iD.modes.DrawArea(context, way.id, graph));
|
||||
}
|
||||
|
||||
mode.enter = function() {
|
||||
context.install(behavior);
|
||||
context.tail(t('modes.add_area.tail'));
|
||||
|
||||
@@ -11,7 +11,6 @@ iD.modes.AddLine = function(context) {
|
||||
.on('start', start)
|
||||
.on('startFromWay', startFromWay)
|
||||
.on('startFromNode', startFromNode)
|
||||
.on('startFromMidpoint', startFromMidpoint),
|
||||
defaultTags = {highway: 'residential'};
|
||||
|
||||
function start(loc) {
|
||||
@@ -63,19 +62,6 @@ iD.modes.AddLine = function(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function startFromMidpoint(midpoint) {
|
||||
var graph = context.graph(),
|
||||
node = iD.Node(),
|
||||
way = iD.Way({tags: defaultTags});
|
||||
|
||||
context.perform(
|
||||
iD.actions.AddMidpoint(midpoint, node),
|
||||
iD.actions.AddEntity(way),
|
||||
iD.actions.AddVertex(way.id, node.id));
|
||||
|
||||
context.enter(iD.modes.DrawLine(context, way.id, 'forward', graph));
|
||||
}
|
||||
|
||||
mode.enter = function() {
|
||||
context.install(behavior);
|
||||
context.tail(t('modes.add_line.tail'));
|
||||
|
||||
@@ -10,7 +10,6 @@ iD.modes.AddPoint = function(context) {
|
||||
.on('click', add)
|
||||
.on('clickWay', addWay)
|
||||
.on('clickNode', addNode)
|
||||
.on('clickMidpoint', addNode)
|
||||
.on('cancel', cancel)
|
||||
.on('finish', cancel);
|
||||
|
||||
|
||||
@@ -39,11 +39,11 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
});
|
||||
|
||||
var operations = d3.values(iD.operations)
|
||||
.map(function (o) { return o(selection, context); })
|
||||
.filter(function (o) { return o.available(); });
|
||||
.map(function(o) { return o(selection, context); })
|
||||
.filter(function(o) { return o.available(); });
|
||||
|
||||
operations.forEach(function(operation) {
|
||||
keybinding.on(operation.key, function () {
|
||||
keybinding.on(operation.key, function() {
|
||||
if (operation.enabled()) {
|
||||
operation();
|
||||
}
|
||||
@@ -87,7 +87,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
context.history().on('change.select', function() {
|
||||
context.surface().call(radialMenu.close);
|
||||
|
||||
if (_.any(selection, function (id) { return !context.entity(id); })) {
|
||||
if (_.any(selection, function(id) { return !context.entity(id); })) {
|
||||
// Exit mode if selected entity gets undone
|
||||
context.enter(iD.modes.Browse(context));
|
||||
|
||||
@@ -128,7 +128,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
context.surface()
|
||||
.on('dblclick.select', dblclick)
|
||||
.selectAll("*")
|
||||
.filter(function (d) { return d && selection.indexOf(d.id) >= 0; })
|
||||
.filter(function(d) { return d && selection.indexOf(d.id) >= 0; })
|
||||
.classed('selected', true);
|
||||
|
||||
radialMenu = iD.ui.RadialMenu(operations);
|
||||
@@ -144,7 +144,7 @@ iD.modes.Select = function(context, selection, initial) {
|
||||
}
|
||||
};
|
||||
|
||||
mode.exit = function () {
|
||||
mode.exit = function() {
|
||||
if (singular()) {
|
||||
changeTags(singular(), inspector.tags());
|
||||
}
|
||||
|
||||
@@ -33,8 +33,11 @@ iD.svg.Labels = function(projection) {
|
||||
var font_sizes = label_stack.map(function(d) {
|
||||
var style = iD.util.getStyle('text.' + d[0] + '.tag-' + d[1]);
|
||||
var m = style && style.cssText.match("font-size: ([0-9]{1,2})px;");
|
||||
if (!m) return default_size;
|
||||
return parseInt(m[1], 10);
|
||||
if (m) return parseInt(m[1], 10);
|
||||
style = iD.util.getStyle('text.' + d[0]);
|
||||
m = style && style.cssText.match("font-size: ([0-9]{1,2})px;");
|
||||
if (m) return parseInt(m[1], 10);
|
||||
return default_size;
|
||||
});
|
||||
|
||||
var pointOffsets = [
|
||||
@@ -281,7 +284,7 @@ iD.svg.Labels = function(projection) {
|
||||
p = getAreaLabel(entity, width, font_size);
|
||||
}
|
||||
if (p) {
|
||||
p.classes = entity.geometry(graph) + ' tag-' + label_stack[k].slice(1).join('-');
|
||||
p.classes = entity.geometry(graph) + ' tag-' + label_stack[k][1];
|
||||
positions[entity.geometry(graph)].push(p);
|
||||
labelled[entity.geometry(graph)].push(entity);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ iD.svg.Midpoints = function(projection) {
|
||||
return function drawMidpoints(surface, graph, entities, filter) {
|
||||
var midpoints = {};
|
||||
|
||||
if (!surface.select('.layer-hit g.vertex').node()) {
|
||||
return surface.selectAll('.layer-hit g.midpoint').remove();
|
||||
}
|
||||
|
||||
for (var i = 0; i < entities.length; i++) {
|
||||
if (entities[i].type !== 'way') continue;
|
||||
|
||||
|
||||
28
js/id/ui.js
28
js/id/ui.js
@@ -1,4 +1,4 @@
|
||||
iD.ui = function (context) {
|
||||
iD.ui = function(context) {
|
||||
return function(container) {
|
||||
context.container(container);
|
||||
|
||||
@@ -42,12 +42,12 @@ iD.ui = function (context) {
|
||||
.data(modes)
|
||||
.enter().append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', function (mode) { return mode.title + ' add-button col3'; })
|
||||
.attr('class', function(mode) { return mode.title + ' add-button col3'; })
|
||||
.call(bootstrap.tooltip().placement('bottom').html(true))
|
||||
.attr('data-original-title', function (mode) {
|
||||
.attr('data-original-title', function(mode) {
|
||||
return hintprefix(mode.key, mode.description);
|
||||
})
|
||||
.on('click.editor', function (mode) { context.enter(mode); });
|
||||
.on('click.editor', function(mode) { context.enter(mode); });
|
||||
|
||||
function disableTooHigh() {
|
||||
if (map.editable()) {
|
||||
@@ -74,14 +74,14 @@ iD.ui = function (context) {
|
||||
return d.id + ' icon icon-pre-text';
|
||||
});
|
||||
|
||||
buttons.append('span').attr('class', 'label').text(function (mode) { return mode.title; });
|
||||
buttons.append('span').attr('class', 'label').text(function(mode) { return mode.title; });
|
||||
|
||||
context.on('enter.editor', function (entered) {
|
||||
buttons.classed('active', function (mode) { return entered.button === mode.button; });
|
||||
context.on('enter.editor', function(entered) {
|
||||
buttons.classed('active', function(mode) { return entered.button === mode.button; });
|
||||
container.classed("mode-" + entered.id, true);
|
||||
});
|
||||
|
||||
context.on('exit.editor', function (exited) {
|
||||
context.on('exit.editor', function(exited) {
|
||||
container.classed("mode-" + exited.id, false);
|
||||
});
|
||||
|
||||
@@ -91,14 +91,14 @@ iD.ui = function (context) {
|
||||
|
||||
undo_buttons.append('button')
|
||||
.attr({ id: 'undo', 'class': 'col6' })
|
||||
.property('disabled', true)
|
||||
.classed('disabled', true)
|
||||
.html("<span class='undo icon'></span><small></small>")
|
||||
.on('click.editor', history.undo)
|
||||
.call(undo_tooltip);
|
||||
|
||||
undo_buttons.append('button')
|
||||
.attr({ id: 'redo', 'class': 'col6' })
|
||||
.property('disabled', true)
|
||||
.classed('disabled', true)
|
||||
.html("<span class='redo icon'><small></small>")
|
||||
.on('click.editor', history.redo)
|
||||
.call(undo_tooltip);
|
||||
@@ -209,13 +209,13 @@ iD.ui = function (context) {
|
||||
}
|
||||
|
||||
limiter.select('#undo')
|
||||
.property('disabled', !undo)
|
||||
.attr('data-original-title', hintprefix('⌘ + Z', undo))
|
||||
.classed('disabled', !undo)
|
||||
.attr('data-original-title', hintprefix('⌘ + Z', undo || t('nothing_to_undo')))
|
||||
.call(refreshTooltip);
|
||||
|
||||
limiter.select('#redo')
|
||||
.property('disabled', !redo)
|
||||
.attr('data-original-title', hintprefix('⌘ + ⇧ + Z', redo))
|
||||
.classed('disabled', !redo)
|
||||
.attr('data-original-title', hintprefix('⌘ + ⇧ + Z', redo || t('nothing_to_redo')))
|
||||
.call(refreshTooltip);
|
||||
});
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ iD.ui.layerswitcher = function(context) {
|
||||
.append('button')
|
||||
.attr('tabindex', -1)
|
||||
.attr('class', 'fillD')
|
||||
.attr('title', t('layer_settings'))
|
||||
.attr('title', t('layerswitcher.description'))
|
||||
.html("<span class='layers icon'></span>")
|
||||
.on('click.layerswitcher-toggle', toggle);
|
||||
|
||||
@@ -59,7 +59,7 @@ iD.ui.layerswitcher = function(context) {
|
||||
.append('div')
|
||||
.attr('class', 'opacity-options-wrapper');
|
||||
|
||||
opa.append('h4').text(t('layerswitcher.layers'));
|
||||
opa.append('h4').text(t('layerswitcher.title'));
|
||||
|
||||
var opacityList = opa.append('ul')
|
||||
.attr('class', 'opacity-options');
|
||||
@@ -151,7 +151,7 @@ iD.ui.layerswitcher = function(context) {
|
||||
}
|
||||
|
||||
adjustments.append('a')
|
||||
.text('Fix misalignment')
|
||||
.text(t('layerswitcher.fix_misalignment'))
|
||||
.attr('href', '#')
|
||||
.classed('alignment-toggle', true)
|
||||
.classed('expanded', false)
|
||||
@@ -179,7 +179,7 @@ iD.ui.layerswitcher = function(context) {
|
||||
.on('click', nudge);
|
||||
|
||||
nudge_container.append('button')
|
||||
.text('reset')
|
||||
.text(t('layerswitcher.reset'))
|
||||
.attr('class', 'reset')
|
||||
.on('click', function() {
|
||||
context.background().offset([0, 0]);
|
||||
|
||||
@@ -17,7 +17,10 @@ iD.ui.save = function(context) {
|
||||
|
||||
d3.select('.shaded').remove();
|
||||
var l = iD.ui.loading(t('uploading_changes'), true);
|
||||
connection.putChangeset(history.changes(), e.comment, history.imagery_used(), function(err, changeset_id) {
|
||||
|
||||
connection.putChangeset(history.changes(),
|
||||
e.comment,
|
||||
history.imagery_used(), function(err, changeset_id) {
|
||||
l.remove();
|
||||
history.reset();
|
||||
map.flush().redraw();
|
||||
|
||||
@@ -5,10 +5,12 @@ iD.ui.userpanel = function(connection) {
|
||||
function update() {
|
||||
if (connection.authenticated()) {
|
||||
selection.style('display', 'block');
|
||||
connection.userDetails(function(user_details) {
|
||||
connection.userDetails(function(err, user_details) {
|
||||
|
||||
selection.html('');
|
||||
|
||||
if (err) return;
|
||||
|
||||
// Link
|
||||
var userLink = selection.append('a')
|
||||
.attr('href', connection.url() + '/user/' +
|
||||
|
||||
@@ -8,8 +8,8 @@ iD.util.trueObj = function(arr) {
|
||||
|
||||
iD.util.tagText = function(entity) {
|
||||
return d3.entries(entity.tags).map(function(e) {
|
||||
return e.key + ': ' + e.value;
|
||||
}).join('\n');
|
||||
return e.key + '=' + e.value;
|
||||
}).join(', ');
|
||||
};
|
||||
|
||||
iD.util.stringQs = function(str) {
|
||||
|
||||
@@ -29,6 +29,14 @@ iD.validate = function(changes, graph) {
|
||||
warnings.push({ message: t('validations.untagged_line'), entity: change });
|
||||
}
|
||||
|
||||
var deprecatedTags = change.deprecatedTags();
|
||||
if (!_.isEmpty(deprecatedTags)) {
|
||||
warnings.push({
|
||||
message: t('validations.deprecated_tags', {
|
||||
tags: iD.util.tagText({ tags: deprecatedTags })
|
||||
}), entity: change });
|
||||
}
|
||||
|
||||
if (change.geometry(graph) === 'area' && _.isEmpty(change.tags)) {
|
||||
warnings.push({ message: t('validations.untagged_area'), entity: change });
|
||||
}
|
||||
|
||||
20
locale/en.js
20
locale/en.js
@@ -44,7 +44,7 @@ locale.en = {
|
||||
area: "Started an area."
|
||||
}
|
||||
},
|
||||
continue: {
|
||||
'continue': {
|
||||
annotation: {
|
||||
line: "Continued a line.",
|
||||
area: "Continued an area."
|
||||
@@ -74,7 +74,7 @@ locale.en = {
|
||||
area: "Squared the corners of an area."
|
||||
}
|
||||
},
|
||||
delete: {
|
||||
'delete': {
|
||||
title: "Delete",
|
||||
description: "Remove this from the map.",
|
||||
key: "⌫",
|
||||
@@ -127,7 +127,8 @@ locale.en = {
|
||||
untagged_point: "Untagged point which is not part of a line or area",
|
||||
untagged_line: "Untagged line",
|
||||
untagged_area: "Untagged area",
|
||||
tag_suggests_area: "The tag {tag} suggests line should be area, but it is not an area"
|
||||
tag_suggests_area: "The tag {tag} suggests line should be area, but it is not an area",
|
||||
deprecated_tags: "Deprecated tags: {tags}"
|
||||
},
|
||||
|
||||
"save": "Save",
|
||||
@@ -141,9 +142,10 @@ locale.en = {
|
||||
"zoom-in": "Zoom In",
|
||||
"zoom-out": "Zoom Out",
|
||||
|
||||
"browser_notice": "This editor is supported in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. Please upgrade your browser or use Potlatch 2 to edit the map.",
|
||||
nothing_to_undo: "Nothing to undo.",
|
||||
nothing_to_redo: "Nothing to redo.",
|
||||
|
||||
"layer_settings": "Layer Settings",
|
||||
"browser_notice": "This editor is supported in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. Please upgrade your browser or use Potlatch 2 to edit the map.",
|
||||
|
||||
inspector: {
|
||||
no_documentation_combination: "This is no documentation available for this tag combination",
|
||||
@@ -165,8 +167,12 @@ locale.en = {
|
||||
"description": "Description",
|
||||
|
||||
"logout": "logout",
|
||||
|
||||
layerswitcher: {
|
||||
layers: "Layers",
|
||||
percent_brightness: "{opacity}% brightness"
|
||||
title: "Background",
|
||||
description: "Background Settings",
|
||||
percent_brightness: "{opacity}% brightness",
|
||||
fix_misalignment: "Fix misalignment",
|
||||
reset: "reset"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
<script src='../js/id/actions/move_way.js'></script>
|
||||
<script src='../js/id/actions/noop.js'></script>
|
||||
<script src='../js/id/actions/reverse.js'></script>
|
||||
<script src='../js/id/actions/deprecate_tags.js'></script>
|
||||
<script src='../js/id/actions/split.js'></script>
|
||||
|
||||
<script src='../js/id/behavior.js'></script>
|
||||
@@ -130,6 +131,9 @@
|
||||
<script src='../locale/locale.js'></script>
|
||||
<script src='../locale/en.js'></script>
|
||||
|
||||
<script src='../data/data.js'></script>
|
||||
<script src='../data/deprecated.js'></script>
|
||||
|
||||
<script>
|
||||
iD.debug = true;
|
||||
mocha.setup({
|
||||
@@ -158,6 +162,7 @@
|
||||
<script src="spec/actions/noop.js"></script>
|
||||
<script src="spec/actions/reverse.js"></script>
|
||||
<script src="spec/actions/split.js"></script>
|
||||
<script src="spec/actions/deprecate_tags.js"></script>
|
||||
|
||||
<script src="spec/geo/extent.js"></script>
|
||||
|
||||
|
||||
47
test/spec/actions/deprecate_tags.js
Normal file
47
test/spec/actions/deprecate_tags.js
Normal file
@@ -0,0 +1,47 @@
|
||||
describe('iD.actions.DeprecateTags', function () {
|
||||
it('deprecates tags', function () {
|
||||
var entity = iD.Entity({ tags: { barrier: 'wire_fence' } }),
|
||||
graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])),
|
||||
undeprecated = {
|
||||
barrier: 'fence',
|
||||
fence_type: 'chain'
|
||||
};
|
||||
expect(graph.entity(entity.id).tags).to.eql(undeprecated);
|
||||
});
|
||||
|
||||
it('does not overwrite explicit tags', function () {
|
||||
var entity = iD.Entity({ tags: { barrier: 'wire_fence', fence_type: 'foo' } }),
|
||||
graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])),
|
||||
undeprecated = {
|
||||
barrier: 'fence',
|
||||
fence_type: 'foo'
|
||||
};
|
||||
expect(graph.entity(entity.id).tags).to.eql(undeprecated);
|
||||
});
|
||||
|
||||
it('leaves other tags alone', function () {
|
||||
var entity = iD.Entity({ tags: { highway: 'ford', name: 'Foo' } }),
|
||||
graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])),
|
||||
undeprecated = {
|
||||
ford: 'yes',
|
||||
name: 'Foo'
|
||||
};
|
||||
expect(graph.entity(entity.id).tags).to.eql(undeprecated);
|
||||
});
|
||||
|
||||
it('wipes out tags that should be entirely removed', function () {
|
||||
var entity = iD.Entity({ tags: { 'tiger:source': 'foo' } }),
|
||||
graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])),
|
||||
undeprecated = { };
|
||||
expect(graph.entity(entity.id).tags).to.eql(undeprecated);
|
||||
});
|
||||
|
||||
it('replaces keys', function () {
|
||||
var entity = iD.Entity({ tags: { power_rating: '1 billion volts' } }),
|
||||
graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])),
|
||||
undeprecated = {
|
||||
'generator:output': '1 billion volts'
|
||||
};
|
||||
expect(graph.entity(entity.id).tags).to.eql(undeprecated);
|
||||
});
|
||||
});
|
||||
@@ -114,6 +114,16 @@ describe('iD.Entity', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#hasDeprecatedTags", function () {
|
||||
it("returns false if entity has no tags", function () {
|
||||
expect(iD.Entity().deprecatedTags()).to.eql({});
|
||||
});
|
||||
|
||||
it("returns true if entity has deprecated tags", function () {
|
||||
expect(iD.Entity({ tags: { barrier: 'wire_fence' } }).deprecatedTags()).to.eql({ barrier: 'wire_fence' });
|
||||
});
|
||||
});
|
||||
|
||||
describe("#hasInterestingTags", function () {
|
||||
it("returns false if the entity has no tags", function () {
|
||||
expect(iD.Entity().hasInterestingTags()).to.equal(false);
|
||||
|
||||
@@ -6,8 +6,8 @@ describe('iD.Util', function() {
|
||||
|
||||
it('.tagText', function() {
|
||||
expect(iD.util.tagText({})).to.eql('');
|
||||
expect(iD.util.tagText({tags:{foo:'bar'}})).to.eql('foo: bar');
|
||||
expect(iD.util.tagText({tags:{foo:'bar',two:'three'}})).to.eql('foo: bar\ntwo: three');
|
||||
expect(iD.util.tagText({tags:{foo:'bar'}})).to.eql('foo=bar');
|
||||
expect(iD.util.tagText({tags:{foo:'bar',two:'three'}})).to.eql('foo=bar, two=three');
|
||||
});
|
||||
|
||||
it('.stringQs', function() {
|
||||
|
||||
Reference in New Issue
Block a user