@deck.gl/carto 8.7.0-alpha.9 → 8.7.0-beta.4

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.
Files changed (48) hide show
  1. package/dist/dist.dev.js +1373 -2897
  2. package/dist/es5/api/index.js +6 -0
  3. package/dist/es5/api/index.js.map +1 -1
  4. package/dist/es5/api/layer-map.js +67 -42
  5. package/dist/es5/api/layer-map.js.map +1 -1
  6. package/dist/es5/api/maps-api-common.js +7 -1
  7. package/dist/es5/api/maps-api-common.js.map +1 -1
  8. package/dist/es5/api/maps-v3-client.js +33 -26
  9. package/dist/es5/api/maps-v3-client.js.map +1 -1
  10. package/dist/es5/api/parseMap.js +23 -18
  11. package/dist/es5/api/parseMap.js.map +1 -1
  12. package/dist/es5/index.js +14 -0
  13. package/dist/es5/index.js.map +1 -1
  14. package/dist/es5/layers/carto-dynamic-tile-layer.js +56 -13
  15. package/dist/es5/layers/carto-dynamic-tile-layer.js.map +1 -1
  16. package/dist/es5/layers/carto-layer.js +13 -5
  17. package/dist/es5/layers/carto-layer.js.map +1 -1
  18. package/dist/es5/layers/schema/carto-dynamic-tile.js +197 -0
  19. package/dist/es5/layers/schema/carto-dynamic-tile.js.map +1 -0
  20. package/dist/esm/api/index.js +1 -1
  21. package/dist/esm/api/index.js.map +1 -1
  22. package/dist/esm/api/layer-map.js +50 -35
  23. package/dist/esm/api/layer-map.js.map +1 -1
  24. package/dist/esm/api/maps-api-common.js +5 -0
  25. package/dist/esm/api/maps-api-common.js.map +1 -1
  26. package/dist/esm/api/maps-v3-client.js +29 -17
  27. package/dist/esm/api/maps-v3-client.js.map +1 -1
  28. package/dist/esm/api/parseMap.js +31 -27
  29. package/dist/esm/api/parseMap.js.map +1 -1
  30. package/dist/esm/index.js +2 -1
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/layers/carto-dynamic-tile-layer.js +51 -10
  33. package/dist/esm/layers/carto-dynamic-tile-layer.js.map +1 -1
  34. package/dist/esm/layers/carto-layer.js +11 -2
  35. package/dist/esm/layers/carto-layer.js.map +1 -1
  36. package/dist/esm/layers/schema/carto-dynamic-tile.js +190 -0
  37. package/dist/esm/layers/schema/carto-dynamic-tile.js.map +1 -0
  38. package/dist.min.js +14 -14
  39. package/package.json +10 -9
  40. package/src/api/index.js +1 -1
  41. package/src/api/layer-map.js +47 -26
  42. package/src/api/maps-api-common.js +7 -0
  43. package/src/api/maps-v3-client.js +35 -18
  44. package/src/api/parseMap.js +23 -21
  45. package/src/index.js +2 -0
  46. package/src/layers/carto-dynamic-tile-layer.js +41 -11
  47. package/src/layers/carto-layer.js +22 -6
  48. package/src/layers/schema/carto-dynamic-tile.js +195 -0
@@ -0,0 +1,195 @@
1
+ // KeyValueObject ========================================
2
+
3
+ const KeyValueObject = {};
4
+
5
+ KeyValueObject.read = function (pbf, end) {
6
+ return pbf.readFields(KeyValueObject._readField, {key: '', value: ''}, end);
7
+ };
8
+ KeyValueObject._readField = function (tag, obj, pbf) {
9
+ if (tag === 1) obj.key = pbf.readString();
10
+ else if (tag === 2) obj.value = pbf.readString();
11
+ };
12
+
13
+ // Properties ========================================
14
+
15
+ const Properties = {};
16
+
17
+ Properties.read = function (pbf, end) {
18
+ return pbf.readFields(Properties._readField, {data: []}, end);
19
+ };
20
+ Properties._readField = function (tag, obj, pbf) {
21
+ if (tag === 1) obj.data.push(KeyValueObject.read(pbf, pbf.readVarint() + pbf.pos));
22
+ };
23
+
24
+ // Doubles ========================================
25
+
26
+ const Doubles = {};
27
+
28
+ Doubles.read = function (pbf, end) {
29
+ // TODO perhaps we can do better and directly map from the source
30
+ // ArrayBuffer using ArrayBuffer.slice()
31
+ const {value, size} = pbf.readFields(Doubles._readField, {value: [], size: 0}, end);
32
+ return {value: new Float32Array(value), size};
33
+ };
34
+ Doubles._readField = function (tag, obj, pbf) {
35
+ if (tag === 1) pbf.readPackedDouble(obj.value);
36
+ else if (tag === 2) obj.size = pbf.readVarint(true);
37
+ };
38
+
39
+ // Ints ========================================
40
+
41
+ const Ints = {};
42
+
43
+ Ints.read = function (pbf, end) {
44
+ const {value, size} = pbf.readFields(Ints._readField, {value: [], size: 0}, end);
45
+ return {value: new Uint32Array(value), size};
46
+ };
47
+ Ints._readField = function (tag, obj, pbf) {
48
+ if (tag === 1) pbf.readPackedVarint(obj.value);
49
+ else if (tag === 2) obj.size = pbf.readVarint(true);
50
+ };
51
+
52
+ // NumericProp ========================================
53
+
54
+ const NumericProp = {};
55
+
56
+ NumericProp.read = function (pbf, end) {
57
+ return pbf.readFields(NumericProp._readField, {value: []}, end);
58
+ };
59
+ NumericProp._readField = function (tag, obj, pbf) {
60
+ if (tag === 1) pbf.readPackedDouble(obj.value);
61
+ };
62
+
63
+ // NumericPropKeyValue ========================================
64
+
65
+ const NumericPropKeyValue = {};
66
+
67
+ NumericPropKeyValue.read = function (pbf, end) {
68
+ return pbf.readFields(NumericPropKeyValue._readField, {key: '', value: null}, end);
69
+ };
70
+ NumericPropKeyValue._readField = function (tag, obj, pbf) {
71
+ if (tag === 1) obj.key = pbf.readString();
72
+ else if (tag === 2) obj.value = NumericProp.read(pbf, pbf.readVarint() + pbf.pos);
73
+ };
74
+
75
+ // NumericProp._FieldEntry1 ========================================
76
+
77
+ NumericProp._FieldEntry1 = {};
78
+
79
+ NumericProp._FieldEntry1.read = function (pbf, end) {
80
+ return pbf.readFields(NumericProp._FieldEntry1._readField, {key: '', value: 0}, end);
81
+ };
82
+ NumericProp._FieldEntry1._readField = function (tag, obj, pbf) {
83
+ if (tag === 1) obj.key = pbf.readString();
84
+ else if (tag === 2) obj.value = pbf.readDouble();
85
+ };
86
+
87
+ // StringProp ========================================
88
+
89
+ const StringProp = {};
90
+
91
+ StringProp.read = function (pbf, end) {
92
+ return pbf.readFields(StringProp._readField, {value: []}, end);
93
+ };
94
+ StringProp._readField = function (tag, obj, pbf) {
95
+ if (tag === 1) obj.value.push(pbf.readString());
96
+ };
97
+
98
+ // Points ========================================
99
+
100
+ const Points = {};
101
+
102
+ Points.read = function (pbf, end) {
103
+ return pbf.readFields(
104
+ Points._readField,
105
+ {positions: null, globalFeatureIds: null, featureIds: null, properties: [], numericProps: {}},
106
+ end
107
+ );
108
+ };
109
+ Points._readField = function (tag, obj, pbf) {
110
+ if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);
111
+ else if (tag === 2) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);
112
+ else if (tag === 3) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);
113
+ else if (tag === 4) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));
114
+ else if (tag === 5) {
115
+ const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
116
+ obj.numericProps[entry.key] = entry.value;
117
+ }
118
+ };
119
+
120
+ // Lines ========================================
121
+
122
+ const Lines = {};
123
+
124
+ Lines.read = function (pbf, end) {
125
+ return pbf.readFields(
126
+ Lines._readField,
127
+ {
128
+ positions: null,
129
+ pathIndices: null,
130
+ globalFeatureIds: null,
131
+ featureIds: null,
132
+ properties: [],
133
+ numericProps: {}
134
+ },
135
+ end
136
+ );
137
+ };
138
+ Lines._readField = function (tag, obj, pbf) {
139
+ if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);
140
+ else if (tag === 2) obj.pathIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);
141
+ else if (tag === 3) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);
142
+ else if (tag === 4) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);
143
+ else if (tag === 5) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));
144
+ else if (tag === 6) {
145
+ const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
146
+ obj.numericProps[entry.key] = entry.value;
147
+ }
148
+ };
149
+
150
+ // Polygons ========================================
151
+
152
+ const Polygons = {};
153
+
154
+ Polygons.read = function (pbf, end) {
155
+ return pbf.readFields(
156
+ Polygons._readField,
157
+ {
158
+ positions: null,
159
+ polygonIndices: null,
160
+ globalFeatureIds: null,
161
+ featureIds: null,
162
+ primitivePolygonIndices: null,
163
+ triangles: null,
164
+ properties: [],
165
+ numericProps: {}
166
+ },
167
+ end
168
+ );
169
+ };
170
+ Polygons._readField = function (tag, obj, pbf) {
171
+ if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);
172
+ else if (tag === 2) obj.polygonIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);
173
+ else if (tag === 3) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);
174
+ else if (tag === 4) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);
175
+ else if (tag === 5) obj.primitivePolygonIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);
176
+ else if (tag === 6) obj.triangles = Ints.read(pbf, pbf.readVarint() + pbf.pos);
177
+ else if (tag === 7) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));
178
+ else if (tag === 8) {
179
+ const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
180
+ obj.numericProps[entry.key] = entry.value;
181
+ }
182
+ };
183
+
184
+ // Tile ========================================
185
+
186
+ export const Tile = {};
187
+
188
+ Tile.read = function (pbf, end) {
189
+ return pbf.readFields(Tile._readField, {points: null, lines: null, polygons: null}, end);
190
+ };
191
+ Tile._readField = function (tag, obj, pbf) {
192
+ if (tag === 1) obj.points = Points.read(pbf, pbf.readVarint() + pbf.pos);
193
+ else if (tag === 2) obj.lines = Lines.read(pbf, pbf.readVarint() + pbf.pos);
194
+ else if (tag === 3) obj.polygons = Polygons.read(pbf, pbf.readVarint() + pbf.pos);
195
+ };