mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Render "semi-paved" roads like cobblestone, paving stones, and wood with a solider line than unpaved roads (close #7466)
This commit is contained in:
+3
-12
@@ -356,11 +356,7 @@ path.line.stroke.tag-pedestrian {
|
||||
path.line.casing.tag-highway-corridor,
|
||||
path.line.casing.tag-highway-pedestrian,
|
||||
path.line.casing.tag-corridor,
|
||||
path.line.casing.tag-pedestrian,
|
||||
path.line.casing.tag-highway-corridor.tag-unpaved,
|
||||
path.line.casing.tag-highway-pedestrian.tag-unpaved,
|
||||
path.line.casing.tag-corridor.tag-unpaved,
|
||||
path.line.casing.tag-pedestrian.tag-unpaved {
|
||||
path.line.casing.tag-pedestrian {
|
||||
stroke: #8cd05f;
|
||||
stroke-linecap: round;
|
||||
stroke-dasharray: none;
|
||||
@@ -449,7 +445,6 @@ path.line.stroke.tag-man_made-pier {
|
||||
}
|
||||
|
||||
path.line.casing.tag-highway-path,
|
||||
path.line.casing.tag-highway-path.tag-unpaved,
|
||||
path.line.casing.tag-highway-footway.tag-public_transport-platform,
|
||||
path.line.casing.tag-highway-footway.tag-man_made-pier,
|
||||
path.line.casing.tag-highway.tag-crossing,
|
||||
@@ -460,10 +455,7 @@ path.line.casing.tag-highway.tag-footway-access_aisle {
|
||||
}
|
||||
path.line.casing.tag-highway-footway,
|
||||
path.line.casing.tag-highway-cycleway,
|
||||
path.line.casing.tag-highway-bridleway,
|
||||
path.line.casing.tag-highway-footway.tag-unpaved,
|
||||
path.line.casing.tag-highway-cycleway.tag-unpaved,
|
||||
path.line.casing.tag-highway-bridleway.tag-unpaved {
|
||||
path.line.casing.tag-highway-bridleway {
|
||||
stroke: #fff;
|
||||
stroke-linecap: round;
|
||||
stroke-dasharray: none;
|
||||
@@ -554,8 +546,7 @@ path.line.stroke.tag-highway-steps {
|
||||
.low-zoom path.line.stroke.tag-highway-steps {
|
||||
stroke-dasharray: 2, 2;
|
||||
}
|
||||
path.line.casing.tag-highway-steps,
|
||||
path.line.casing.tag-highway-steps.tag-unpaved {
|
||||
path.line.casing.tag-highway-steps {
|
||||
stroke: #fff;
|
||||
stroke-linecap: round;
|
||||
stroke-dasharray: none;
|
||||
|
||||
+11
-5
@@ -352,18 +352,24 @@ path.line.casing.tag-cutting {
|
||||
path.line.casing.tag-unpaved {
|
||||
stroke: #ccc;
|
||||
stroke-linecap: butt;
|
||||
stroke-dasharray: 4, 3;
|
||||
stroke-dasharray: 4, 4;
|
||||
}
|
||||
.low-zoom path.line.casing.tag-unpaved {
|
||||
stroke-dasharray: 3, 2;
|
||||
stroke-dasharray: 3, 3;
|
||||
}
|
||||
path.line.casing.tag-bridge.tag-unpaved {
|
||||
stroke: #000;
|
||||
stroke-dasharray: 4, 3;
|
||||
}
|
||||
.low-zoom path.line.casing.tag-bridge.tag-unpaved {
|
||||
/* Surface - semipaved */
|
||||
path.line.casing.tag-semipaved {
|
||||
stroke-linecap: butt;
|
||||
stroke-dasharray: 6, 2;
|
||||
}
|
||||
.low-zoom path.line.casing.tag-semipaved {
|
||||
stroke-dasharray: 5, 2;
|
||||
}
|
||||
path.line.casing.tag-bridge.tag-semipaved {
|
||||
stroke: #000;
|
||||
stroke-dasharray: 3, 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+14
-1
@@ -116,7 +116,7 @@ export var osmOneWayTags = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// solid and smooth surfaces akin to the assumed default road surface in OSM
|
||||
export var osmPavedTags = {
|
||||
'surface': {
|
||||
'paved': true,
|
||||
@@ -130,6 +130,19 @@ export var osmPavedTags = {
|
||||
}
|
||||
};
|
||||
|
||||
// solid, if somewhat uncommon surfaces with a high range of smoothness
|
||||
export var osmSemipavedTags = {
|
||||
'surface': {
|
||||
'cobblestone': true,
|
||||
'cobblestone:flattened': true,
|
||||
'unhewn_cobblestone': true,
|
||||
'sett': true,
|
||||
'paving_stones': true,
|
||||
'metal': true,
|
||||
'wood': true
|
||||
}
|
||||
};
|
||||
|
||||
export var osmRightSideIsInsideTags = {
|
||||
'natural': {
|
||||
'cliff': true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { osmPavedTags } from '../osm/tags';
|
||||
import { osmPathHighwayTagValues, osmPavedTags, osmSemipavedTags } from '../osm/tags';
|
||||
|
||||
|
||||
export function svgTagClasses() {
|
||||
@@ -146,18 +146,18 @@ export function svgTagClasses() {
|
||||
}
|
||||
|
||||
// For highways, look for surface tagging..
|
||||
if (primary === 'highway' || primary === 'aeroway') {
|
||||
var paved = (t.highway !== 'track');
|
||||
if ((primary === 'highway' && !osmPathHighwayTagValues[t.highway]) || primary === 'aeroway') {
|
||||
var surface = t.highway === 'track' ? 'unpaved' : 'paved';
|
||||
for (k in t) {
|
||||
v = t[k];
|
||||
if (k in osmPavedTags) {
|
||||
paved = !!osmPavedTags[k][v];
|
||||
break;
|
||||
surface = !!osmPavedTags[k][v] ? 'paved' : 'unpaved';
|
||||
}
|
||||
if (k in osmSemipavedTags && !!osmSemipavedTags[k][v]) {
|
||||
surface = 'semipaved';
|
||||
}
|
||||
}
|
||||
if (!paved) {
|
||||
classes.push('tag-unpaved');
|
||||
}
|
||||
classes.push('tag-' + surface);
|
||||
}
|
||||
|
||||
// If this is a wikidata-tagged item, add a class for that..
|
||||
|
||||
@@ -113,7 +113,7 @@ describe('iD.svgTagClasses', function () {
|
||||
expect(selection.classed('tag-unpaved')).to.be.true;
|
||||
});
|
||||
|
||||
it('does not add tag-unpaved for other highway types with no surface tagging', function() {
|
||||
it('does not add tag-unpaved for non-track highways with no surface tagging', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {highway: 'tertiary'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
@@ -125,7 +125,7 @@ describe('iD.svgTagClasses', function () {
|
||||
expect(selection.classed('tag-unpaved')).to.be.false;
|
||||
});
|
||||
|
||||
it('does not add tag-unpaved for other highway types with explicit paved surface tagging', function() {
|
||||
it('does not add tag-unpaved for non-track highways with explicit paved surface tagging', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {highway: 'tertiary', surface: 'asphalt'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
@@ -137,7 +137,7 @@ describe('iD.svgTagClasses', function () {
|
||||
expect(selection.classed('tag-unpaved')).to.be.false;
|
||||
});
|
||||
|
||||
it('does not add tag-unpaved for other aeroway types with explicit paved surface tagging', function() {
|
||||
it('does not add tag-unpaved for aeroways with explicit paved surface tagging', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {aeroway: 'taxiway', surface: 'asphalt'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
@@ -149,7 +149,7 @@ describe('iD.svgTagClasses', function () {
|
||||
expect(selection.classed('tag-unpaved')).to.be.false;
|
||||
});
|
||||
|
||||
it('adds tag-unpaved for other highway types with explicit unpaved surface tagging', function() {
|
||||
it('adds tag-unpaved for non-track highways with explicit unpaved surface tagging', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {highway: 'tertiary', surface: 'dirt'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
@@ -161,7 +161,21 @@ describe('iD.svgTagClasses', function () {
|
||||
expect(selection.classed('tag-unpaved')).to.be.true;
|
||||
});
|
||||
|
||||
it('adds tag-unpaved for other aeroway types with explicit unpaved surface tagging', function() {
|
||||
it('adds tag-semipaved for non-track highways with explicit semipaved surface tagging', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {highway: 'tertiary', surface: 'paving_stones'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
expect(selection.classed('tag-unpaved')).to.be.false;
|
||||
expect(selection.classed('tag-semipaved')).to.be.true;
|
||||
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {highway: 'foo', surface: 'wood'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
expect(selection.classed('tag-unpaved')).to.be.false;
|
||||
expect(selection.classed('tag-semipaved')).to.be.true;
|
||||
});
|
||||
|
||||
it('adds tag-unpaved for aeroways with explicit unpaved surface tagging', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {aeroway: 'taxiway', surface: 'dirt'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
@@ -173,6 +187,20 @@ describe('iD.svgTagClasses', function () {
|
||||
expect(selection.classed('tag-unpaved')).to.be.true;
|
||||
});
|
||||
|
||||
it('adds tag-semipaved for aeroways with explicit semipaved surface tagging', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {aeroway: 'taxiway', surface: 'paving_stones'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
expect(selection.classed('tag-unpaved')).to.be.false;
|
||||
expect(selection.classed('tag-semipaved')).to.be.true;
|
||||
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {aeroway: 'runway', surface: 'wood'}}))
|
||||
.call(iD.svgTagClasses());
|
||||
expect(selection.classed('tag-unpaved')).to.be.false;
|
||||
expect(selection.classed('tag-semipaved')).to.be.true;
|
||||
});
|
||||
|
||||
it('does not add tag-unpaved for non-highways/aeroways', function() {
|
||||
selection
|
||||
.datum(iD.osmEntity({tags: {railway: 'abandoned', surface: 'gravel'}}))
|
||||
|
||||
Reference in New Issue
Block a user