mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 15:08:23 +02: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/entity.js'></script>
|
||||||
<script src='js/id/graph/graph.js'></script>
|
<script src='js/id/graph/graph.js'></script>
|
||||||
<script src='js/id/graph/history.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 src='js/id/connection.js'></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -119,39 +119,3 @@ iD.Entity.extend = function(properties) {
|
|||||||
|
|
||||||
return Subclass;
|
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: []
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
iD.Node = iD.Entity.extend({
|
||||||
|
type: "node"
|
||||||
|
});
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
iD.Relation = iD.Entity.extend({
|
||||||
|
type: "relation",
|
||||||
|
members: []
|
||||||
|
});
|
||||||
@@ -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/entity.js'></script>
|
||||||
<script src='../js/id/graph/graph.js'></script>
|
<script src='../js/id/graph/graph.js'></script>
|
||||||
<script src='../js/id/graph/history.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 src='../js/id/connection.js'></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Reference in New Issue
Block a user