-
Notifications
You must be signed in to change notification settings - Fork 0
/
arc-layer.html
72 lines (63 loc) · 2.19 KB
/
arc-layer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="./deck-gl-layer-behavior.html">
<dom-module id="arc-layer">
<script>
/*
* The `arc-layer` wraps around the [Arc Layer](https://uber.github.io/deck.gl/#/layers/core-layers/arc-layer) in deck.gl.
*
* The Arc Layer takes in paired latitude and longitude coordinated points and render them as arcs that links the starting and ending points.
*
* @demo demo/arc-layer.html
*/
Polymer({
is: 'arc-layer',
behaviors: [
DeckGLPolymer.BaseLayer
],
properties: {
/*
* The stroke width used to draw each line.
*/
strokeWidth: {
type: Number,
value: 1
},
/*
* A map of accessor functions to retrieve specific data from the
* dataset. The following accessors are available for LineLayer:
* - getSourcePosition (default: object => object.sourcePosition)
* - getTargetPosition (default: object => object.targetPosition)
* - getSourceColor (default: object => object.color)
* - getTargetColor (default: object => object.color)
*/
accessorFunctions: {
type: Object,
value: null
}
},
observers: [
'_updateProps(strokeWidth, accessorFunctions)',
'_updateLayer(_props)'
],
get layer() {
return new DeckGL.ArcLayer(this._cleanObject(this._props));
},
_updateProps: function() {
if (!this.data) return;
var props = this._getBaseProps();
props.strokeWidth = this.strokeWidth;
if (this.accessorFunctions) {
props.getSourcePosition = this.accessorFunctions.getSourcePosition;
props.getTargetPosition = this.accessorFunctions.getTargetPosition;
props.getSourceColor = this.accessorFunctions.getSourceColor ;
props.getTargetColor = this.accessorFunctions.getTargetColor ;
}
this._props = props;
},
_updateLayer: function(_props) {
if (!_props) return;
this.fire('layer-updated', this.layer, {node: this.parentNode});
}
});
</script>
</dom-module>