@wemap/osm 2.7.8 → 2.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/model/OsmNode.js +8 -0
- package/src/model/OsmNode.spec.js +16 -0
- package/src/model/OsmWay.js +15 -0
- package/src/model/OsmWay.spec.js +59 -0
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/osm"
|
|
12
12
|
},
|
|
13
13
|
"name": "@wemap/osm",
|
|
14
|
-
"version": "2.7.
|
|
14
|
+
"version": "2.7.11",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
17
17
|
},
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@wemap/geo": "^2.7.
|
|
30
|
-
"@wemap/graph": "^2.7.
|
|
29
|
+
"@wemap/geo": "^2.7.9",
|
|
30
|
+
"@wemap/graph": "^2.7.9",
|
|
31
31
|
"@wemap/logger": "^2.7.7",
|
|
32
32
|
"lodash.isnumber": "^3.0.3",
|
|
33
33
|
"sax": "^1.2.4"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "933f7fe5b16feed45fb06f9501981b1119b2c7af"
|
|
36
36
|
}
|
package/src/model/OsmNode.js
CHANGED
|
@@ -9,6 +9,14 @@ class OsmNode extends OsmElement {
|
|
|
9
9
|
super(id, tags);
|
|
10
10
|
this.coords = coords;
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
get isElevator() {
|
|
14
|
+
return this.tags.highway === 'elevator';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get isConveying() {
|
|
18
|
+
return this.isElevator;
|
|
19
|
+
}
|
|
12
20
|
}
|
|
13
21
|
|
|
14
22
|
export default OsmNode;
|
|
@@ -11,4 +11,20 @@ describe('OsmNode', () => {
|
|
|
11
11
|
expect(() => new OsmNode(0, new WGS84(0, 0))).not.throw(Error);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
it('getters', () => {
|
|
15
|
+
let node;
|
|
16
|
+
|
|
17
|
+
node = new OsmNode(0);
|
|
18
|
+
expect(node.isElevator).is.false;
|
|
19
|
+
expect(node.isConveying).is.false;
|
|
20
|
+
|
|
21
|
+
node = new OsmNode(0, null, { highway: 'elevator' });
|
|
22
|
+
expect(node.isElevator).is.true;
|
|
23
|
+
expect(node.isConveying).is.true;
|
|
24
|
+
|
|
25
|
+
node = new OsmNode(0, null, { highway: 'stop' });
|
|
26
|
+
expect(node.isElevator).is.false;
|
|
27
|
+
expect(node.isConveying).is.false;
|
|
28
|
+
});
|
|
29
|
+
|
|
14
30
|
});
|
package/src/model/OsmWay.js
CHANGED
|
@@ -9,6 +9,21 @@ class OsmWay extends OsmElement {
|
|
|
9
9
|
super(id, tags);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
get areStairs() {
|
|
13
|
+
return this.tags.highway === 'steps';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get isConveying() {
|
|
17
|
+
return this.tags.hasOwnProperty('conveying');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get isEscalator() {
|
|
21
|
+
return this.areStairs && this.isConveying;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get isMovingWalkway() {
|
|
25
|
+
return !this.areStairs && this.isConveying;
|
|
26
|
+
}
|
|
12
27
|
}
|
|
13
28
|
|
|
14
29
|
export default OsmWay;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable max-statements */
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
|
|
4
|
+
import OsmWay from './OsmWay';
|
|
5
|
+
|
|
6
|
+
describe('OsmNode', () => {
|
|
7
|
+
|
|
8
|
+
it('creation', () => {
|
|
9
|
+
expect(() => new OsmWay(0)).not.throw(Error);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('getters', () => {
|
|
13
|
+
let way;
|
|
14
|
+
|
|
15
|
+
way = new OsmWay(0);
|
|
16
|
+
expect(way.areStairs).is.false;
|
|
17
|
+
expect(way.isConveying).is.false;
|
|
18
|
+
expect(way.isEscalator).is.false;
|
|
19
|
+
expect(way.isMovingWalkway).is.false;
|
|
20
|
+
|
|
21
|
+
way = new OsmWay(0, { highway: 'stop' });
|
|
22
|
+
expect(way.areStairs).is.false;
|
|
23
|
+
expect(way.isConveying).is.false;
|
|
24
|
+
expect(way.isEscalator).is.false;
|
|
25
|
+
expect(way.isMovingWalkway).is.false;
|
|
26
|
+
|
|
27
|
+
way = new OsmWay(0, { highway: 'steps' });
|
|
28
|
+
expect(way.areStairs).is.true;
|
|
29
|
+
expect(way.isConveying).is.false;
|
|
30
|
+
expect(way.isEscalator).is.false;
|
|
31
|
+
expect(way.isMovingWalkway).is.false;
|
|
32
|
+
|
|
33
|
+
way = new OsmWay(0, {
|
|
34
|
+
highway: 'steps',
|
|
35
|
+
conveying: 'yes'
|
|
36
|
+
});
|
|
37
|
+
expect(way.areStairs).is.true;
|
|
38
|
+
expect(way.isConveying).is.true;
|
|
39
|
+
expect(way.isEscalator).is.true;
|
|
40
|
+
expect(way.isMovingWalkway).is.false;
|
|
41
|
+
|
|
42
|
+
way = new OsmWay(0, { highway: 'footway' });
|
|
43
|
+
expect(way.areStairs).is.false;
|
|
44
|
+
expect(way.isConveying).is.false;
|
|
45
|
+
expect(way.isEscalator).is.false;
|
|
46
|
+
expect(way.isMovingWalkway).is.false;
|
|
47
|
+
|
|
48
|
+
way = new OsmWay(0, {
|
|
49
|
+
highway: 'footway',
|
|
50
|
+
conveying: 'yes'
|
|
51
|
+
});
|
|
52
|
+
expect(way.areStairs).is.false;
|
|
53
|
+
expect(way.isConveying).is.true;
|
|
54
|
+
expect(way.isEscalator).is.false;
|
|
55
|
+
expect(way.isMovingWalkway).is.true;
|
|
56
|
+
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
});
|