mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-06 19:31:41 +00:00
Merge branch 'master' of github.com:openstreetmap/iD
This commit is contained in:
@@ -1542,6 +1542,11 @@ input[type=number] {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.form-field-restrictions svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.form-field-restrictions .restriction-help {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
|
||||
@@ -112,6 +112,10 @@ iD.Entity.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
isHighwayIntersection: function() {
|
||||
return false;
|
||||
},
|
||||
|
||||
deprecatedTags: function() {
|
||||
var tags = _.pairs(this.tags);
|
||||
var deprecated = {};
|
||||
|
||||
@@ -37,6 +37,14 @@ _.extend(iD.Node.prototype, {
|
||||
});
|
||||
},
|
||||
|
||||
isHighwayIntersection: function(resolver) {
|
||||
return resolver.transient(this, 'isHighwayIntersection', function() {
|
||||
return resolver.parentWays(this).filter(function(parent) {
|
||||
return parent.tags.highway && parent.geometry(resolver) === 'line';
|
||||
}).length > 1;
|
||||
});
|
||||
},
|
||||
|
||||
asJXON: function(changeset_id) {
|
||||
var r = {
|
||||
node: {
|
||||
|
||||
@@ -35,7 +35,7 @@ iD.ui.Inspector = function(context) {
|
||||
entity = context.entity(entityID),
|
||||
showEditor = state === 'hover' ||
|
||||
entity.isUsed(graph) ||
|
||||
(entity.type === 'node' && entity.isIntersection(graph));
|
||||
entity.isHighwayIntersection(graph);
|
||||
|
||||
if (showEditor) {
|
||||
$wrap.style('right', '0%');
|
||||
|
||||
@@ -72,7 +72,7 @@ iD.ui.preset = function(context) {
|
||||
}
|
||||
});
|
||||
|
||||
if (geometry === 'vertex' && entity.isIntersection(context.graph())) {
|
||||
if (entity.isHighwayIntersection(context.graph())) {
|
||||
fields.push(UIField(context.presets().field('restrictions'), entity, true));
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,9 @@ iD.ui.preset.restrictions = function(field, context) {
|
||||
}
|
||||
|
||||
function render() {
|
||||
restrictions(selection);
|
||||
if (context.hasEntity(vertexID)) {
|
||||
restrictions(selection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,12 +52,30 @@ describe('iD.Node', function () {
|
||||
expect(node.isIntersection(graph)).to.equal(true);
|
||||
});
|
||||
|
||||
it("returns true for a node shared by more two non-highways", function () {
|
||||
it("returns true for a node shared by more than one waterway", function () {
|
||||
var node = iD.Node(),
|
||||
w1 = iD.Way({nodes: [node.id]}),
|
||||
w2 = iD.Way({nodes: [node.id]}),
|
||||
w1 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
|
||||
w2 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
|
||||
graph = iD.Graph([node, w1, w2]);
|
||||
expect(node.isIntersection(graph)).to.equal(false);
|
||||
expect(node.isIntersection(graph)).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#isHighwayIntersection", function () {
|
||||
it("returns true for a node shared by more than one highway", function () {
|
||||
var node = iD.Node(),
|
||||
w1 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
|
||||
w2 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
|
||||
graph = iD.Graph([node, w1, w2]);
|
||||
expect(node.isHighwayIntersection(graph)).to.equal(true);
|
||||
});
|
||||
|
||||
it("returns false for a node shared by more than one waterway", function () {
|
||||
var node = iD.Node(),
|
||||
w1 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
|
||||
w2 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
|
||||
graph = iD.Graph([node, w1, w2]);
|
||||
expect(node.isHighwayIntersection(graph)).to.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user