Hook up relation icons

This commit is contained in:
John Firebaugh
2013-05-23 22:03:59 -07:00
parent 6f0b727d88
commit ab10f8ac38
25 changed files with 387 additions and 13 deletions
+7 -3
View File
@@ -4,7 +4,8 @@ all: \
dist/iD.css \
dist/iD.js \
dist/iD.min.js \
dist/img/line-presets.png
dist/img/line-presets.png \
dist/img/relation-presets.png
DATA_FILES = $(shell find data -type f -name '*.json' -o -name '*.md')
data/data.js: $(DATA_FILES) dist/locales/en.json dist/img/maki-sprite.png
@@ -82,10 +83,13 @@ clean:
translations:
node data/update_locales
SPRITE = inkscape --export-area-page --export-png=dist/img/line-presets.png svg/line-presets.svg
SPRITE = inkscape --export-area-page
dist/img/line-presets.png: svg/line-presets.svg
if [ `which inkscape` ]; then $(SPRITE); else echo "Inkscape is not installed"; fi;
if [ `which inkscape` ]; then $(SPRITE) --export-png=$@ $<; else echo "Inkscape is not installed"; fi;
dist/img/relation-presets.png: svg/relation-presets.svg
if [ `which inkscape` ]; then $(SPRITE) --export-png=$@ $<; else echo "Inkscape is not installed"; fi;
dist/img/maki-sprite.png: $(wildcard node_modules/maki/renders/*.png)
node data/maki_sprite
+2 -1
View File
@@ -739,7 +739,8 @@ a:hover .icon.out-link { background-position: -500px -14px;}
margin: auto;
}
.preset-icon-line {
.preset-icon-line,
.preset-icon-relation {
top: 0;
left: 0;
}
+16
View File
@@ -2,6 +2,7 @@
.preset-icon{background-image:url(img/maki-sprite.png);background-repeat:no-repeat;width:24px;height:24px;}
.preset-icon-line{background-image:url(img/line-presets.png);background-repeat:no-repeat;width:60px;height:60px;}
.preset-icon-relation{background-image:url(img/relation-presets.png);background-repeat:no-repeat;width:60px;height:60px;}
.feature-airfield{background-position:-0px -34px;}
.feature-airport{background-position:-0px -94px;}
.feature-alcohol-shop{background-position:-0px -154px;}
@@ -132,3 +133,18 @@
.preset-icon-line.feature-category-rail{background-position:-2060px -25px;}
.preset-icon-line.feature-category-path{background-position:-2120px -25px;}
.preset-icon-line.feature-category-water{background-position:-2180px -25px;}
.preset-icon-relation.feature-relation{background-position:-20px -25px;}
.preset-icon-relation.feature-restriction{background-position:-80px -25px;}
.preset-icon-relation.feature-multipolygon{background-position:-140px -25px;}
.preset-icon-relation.feature-boundary{background-position:-200px -25px;}
.preset-icon-relation.feature-route{background-position:-260px -25px;}
.preset-icon-relation.feature-route-road{background-position:-320px -25px;}
.preset-icon-relation.feature-route-bicycle{background-position:-380px -25px;}
.preset-icon-relation.feature-route-foot{background-position:-440px -25px;}
.preset-icon-relation.feature-route-bus{background-position:-500px -25px;}
.preset-icon-relation.feature-route-train{background-position:-560px -25px;}
.preset-icon-relation.feature-route-detour{background-position:-620px -25px;}
.preset-icon-relation.feature-route-tram{background-position:-680px -25px;}
.preset-icon-relation.feature-route-ferry{background-position:-740px -25px;}
.preset-icon-relation.feature-route-power{background-position:-800px -25px;}
.preset-icon-relation.feature-route-pipeline{background-position:-860px -25px;}
File diff suppressed because one or more lines are too long
+13
View File
@@ -5,6 +5,7 @@ var _ = require('../js/lib/lodash');
var makipath = './node_modules/maki';
var lineIcons = require('./line-icons.json');
var relationIcons = require('./relation-icons.json');
sprite.sprite('renders', { path: makipath }, function(err, makiSprite) {
if (err) process.exit(1);
@@ -17,6 +18,7 @@ sprite.sprite('renders', { path: makipath }, function(err, makiSprite) {
var css = "/* This file is generated by make. Do NOT edit manually. */\n\n";
css += ".preset-icon{background-image:url(img/maki-sprite.png);background-repeat:no-repeat;width:24px;height:24px;}\n";
css += ".preset-icon-line{background-image:url(img/line-presets.png);background-repeat:no-repeat;width:60px;height:60px;}\n";
css += ".preset-icon-relation{background-image:url(img/relation-presets.png);background-repeat:no-repeat;width:60px;height:60px;}\n";
var images = {};
@@ -45,6 +47,17 @@ sprite.sprite('renders', { path: makipath }, function(err, makiSprite) {
images[name].line = position;
});
template = '.preset-icon-relation.feature-{name}{background-position:-{x}px -{y}px;}\n';
_.forEach(relationIcons, function(position, name) {
css += template.replace('{name}', name)
.replace('{x}', position[0])
.replace('{y}', position[1]);
images[name] = images[name] || {};
images[name].relation = position;
});
fs.writeFileSync('./css/feature-icons.css', css);
fs.writeFileSync('./data/feature-icons.json', JSON.stringify(images));
});
+33
View File
@@ -1057,12 +1057,45 @@ en:
type/boundary:
name: Boundary
terms: ""
type/multipolygon:
name: Multipolygon
terms: ""
type/restriction:
name: Restriction
terms: ""
type/route:
name: Route
terms: ""
type/route/bicycle:
name: Cycle Route
terms: ""
type/route/bus:
name: Bus Route
terms: ""
type/route/detour:
name: Detour Route
terms: ""
type/route/ferry:
name: Ferry Route
terms: ""
type/route/foot:
name: Foot Route
terms: ""
type/route/pipeline:
name: Pipeline Route
terms: ""
type/route/power:
name: Power Route
terms: ""
type/route/road:
name: Road Route
terms: ""
type/route/train:
name: Train Route
terms: ""
type/route/tram:
name: Tram Route
terms: ""
waterway:
name: Waterway
terms: ""
+126 -3
View File
@@ -4477,7 +4477,18 @@
"tags": {
"type": "boundary"
},
"name": "Boundary"
"name": "Boundary",
"icon": "boundary"
},
"type/multipolygon": {
"geometry": [
"relation"
],
"tags": {
"type": "multipolygon"
},
"name": "Multipolygon",
"icon": "multipolygon"
},
"type/restriction": {
"geometry": [
@@ -4486,7 +4497,8 @@
"tags": {
"type": "restriction"
},
"name": "Restriction"
"name": "Restriction",
"icon": "restriction"
},
"type/route": {
"geometry": [
@@ -4495,7 +4507,118 @@
"tags": {
"type": "route"
},
"name": "Route"
"name": "Route",
"icon": "route"
},
"type/route/bicycle": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "bicycle"
},
"name": "Cycle Route",
"icon": "route-bicycle"
},
"type/route/bus": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "bus"
},
"name": "Bus Route",
"icon": "route-bus"
},
"type/route/detour": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "detour"
},
"name": "Detour Route",
"icon": "route-detour"
},
"type/route/ferry": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "ferry"
},
"name": "Ferry Route",
"icon": "route-ferry"
},
"type/route/foot": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "foot"
},
"name": "Foot Route",
"icon": "route-foot"
},
"type/route/pipeline": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "pipeline"
},
"name": "Pipeline Route",
"icon": "route-pipeline"
},
"type/route/power": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "power"
},
"name": "Power Route",
"icon": "route-power"
},
"type/route/road": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "road"
},
"name": "Road Route",
"icon": "route-road"
},
"type/route/train": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "train"
},
"name": "Train Route",
"icon": "route-train"
},
"type/route/tram": {
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "tram"
},
"name": "Tram Route",
"icon": "route-tram"
},
"waterway": {
"fields": [
+2 -1
View File
@@ -5,5 +5,6 @@
"tags": {
"type": "boundary"
},
"name": "Boundary"
"name": "Boundary",
"icon": "boundary"
}
@@ -0,0 +1,10 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "multipolygon"
},
"name": "Multipolygon",
"icon": "multipolygon"
}
+2 -1
View File
@@ -5,5 +5,6 @@
"tags": {
"type": "restriction"
},
"name": "Restriction"
"name": "Restriction",
"icon": "restriction"
}
+2 -1
View File
@@ -5,5 +5,6 @@
"tags": {
"type": "route"
},
"name": "Route"
"name": "Route",
"icon": "route"
}
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "bicycle"
},
"name": "Cycle Route",
"icon": "route-bicycle"
}
+11
View File
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "bus"
},
"name": "Bus Route",
"icon": "route-bus"
}
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "detour"
},
"name": "Detour Route",
"icon": "route-detour"
}
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "ferry"
},
"name": "Ferry Route",
"icon": "route-ferry"
}
+11
View File
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "foot"
},
"name": "Foot Route",
"icon": "route-foot"
}
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "pipeline"
},
"name": "Pipeline Route",
"icon": "route-pipeline"
}
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "power"
},
"name": "Power Route",
"icon": "route-power"
}
+11
View File
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "road"
},
"name": "Road Route",
"icon": "route-road"
}
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "train"
},
"name": "Train Route",
"icon": "route-train"
}
+11
View File
@@ -0,0 +1,11 @@
{
"geometry": [
"relation"
],
"tags": {
"type": "route",
"route": "tram"
},
"name": "Tram Route",
"icon": "route-tram"
}
+17
View File
@@ -0,0 +1,17 @@
{
"relation": [20, 25],
"restriction": [80, 25],
"multipolygon": [140, 25],
"boundary": [200, 25],
"route": [260, 25],
"route-road": [320, 25],
"route-bicycle": [380, 25],
"route-foot": [440, 25],
"route-bus": [500, 25],
"route-train": [560, 25],
"route-detour": [620, 25],
"route-tram": [680, 25],
"route-ferry": [740, 25],
"route-power": [800, 25],
"route-pipeline": [860, 25]
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+44
View File
@@ -1787,6 +1787,10 @@
"name": "Boundary",
"terms": ""
},
"type/multipolygon": {
"name": "Multipolygon",
"terms": ""
},
"type/restriction": {
"name": "Restriction",
"terms": ""
@@ -1795,6 +1799,46 @@
"name": "Route",
"terms": ""
},
"type/route/bicycle": {
"name": "Cycle Route",
"terms": ""
},
"type/route/bus": {
"name": "Bus Route",
"terms": ""
},
"type/route/detour": {
"name": "Detour Route",
"terms": ""
},
"type/route/ferry": {
"name": "Ferry Route",
"terms": ""
},
"type/route/foot": {
"name": "Foot Route",
"terms": ""
},
"type/route/pipeline": {
"name": "Pipeline Route",
"terms": ""
},
"type/route/power": {
"name": "Power Route",
"terms": ""
},
"type/route/road": {
"name": "Road Route",
"terms": ""
},
"type/route/train": {
"name": "Train Route",
"terms": ""
},
"type/route/tram": {
"name": "Tram Route",
"terms": ""
},
"waterway": {
"name": "Waterway",
"terms": ""
+2 -2
View File
@@ -17,8 +17,8 @@ iD.ui.PresetIcon = function(geometry) {
klass = 'feature-' + icon + ' preset-icon';
icon = iD.data.featureIcons[icon];
if (geometry === 'line' && icon && icon.line) {
klass += ' preset-icon-line';
if (icon && icon[geometry]) {
klass += ' preset-icon-' + geometry;
}
return klass;