mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Move Entity subclasses to separate files
This commit is contained in:
@@ -85,6 +85,10 @@
|
||||
<script src='js/id/graph/entity.js'></script>
|
||||
<script src='js/id/graph/graph.js'></script>
|
||||
<script src='js/id/graph/history.js'></script>
|
||||
<script src='js/id/graph/node.js'></script>
|
||||
<script src='js/id/graph/relation.js'></script>
|
||||
<script src='js/id/graph/way.js'></script>
|
||||
|
||||
<script src='js/id/connection.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -119,39 +119,3 @@ iD.Entity.extend = function(properties) {
|
||||
|
||||
return Subclass;
|
||||
};
|
||||
|
||||
iD.Node = iD.Entity.extend({
|
||||
type: "node"
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
iD.Relation = iD.Entity.extend({
|
||||
type: "relation",
|
||||
members: []
|
||||
});
|
||||
|
||||
3
js/id/graph/node.js
Normal file
3
js/id/graph/node.js
Normal file
@@ -0,0 +1,3 @@
|
||||
iD.Node = iD.Entity.extend({
|
||||
type: "node"
|
||||
});
|
||||
4
js/id/graph/relation.js
Normal file
4
js/id/graph/relation.js
Normal file
@@ -0,0 +1,4 @@
|
||||
iD.Relation = iD.Entity.extend({
|
||||
type: "relation",
|
||||
members: []
|
||||
});
|
||||
26
js/id/graph/way.js
Normal file
26
js/id/graph/way.js
Normal file
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
});
|
||||
@@ -84,6 +84,10 @@
|
||||
<script src='../js/id/graph/entity.js'></script>
|
||||
<script src='../js/id/graph/graph.js'></script>
|
||||
<script src='../js/id/graph/history.js'></script>
|
||||
<script src='../js/id/graph/node.js'></script>
|
||||
<script src='../js/id/graph/relation.js'></script>
|
||||
<script src='../js/id/graph/way.js'></script>
|
||||
|
||||
<script src='../js/id/connection.js'></script>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user