Files
iD/js/id/graph/way.js
2012-12-28 22:17:09 -08:00

27 lines
636 B
JavaScript

iD.Way = iD.Entity.extend({
type: "way",
nodes: [],
isOneWay: function() {
return this.tags.oneway === 'yes';
},
isClosed: function() {
return this.nodes.length > 0 && this.nodes[this.nodes.length - 1] === this.nodes[0];
},
// a way is an area if:
//
// - area=yes
// - closed and
// - doesn't have area=no
// - doesn't have highway tag
isArea: function() {
return this.tags.area === 'yes' ||
(this.isClosed() &&
this.tags.area !== 'no' &&
!this.tags.highway &&
!this.tags.barrier);
}
});