MCPcopy
hub / github.com/apache/echarts / decode

Function decode

test/data/map/decode.js:20–58  ·  view source on GitHub ↗
(json)

Source from the content-addressed store, hash-verified

18*/
19
20function decode(json) {
21 if (json.UTF8Encoding) {
22 return;
23 }
24 var jsonCompressed = json;
25 var encodeScale = jsonCompressed.UTF8Scale;
26 if (encodeScale == null) {
27 encodeScale = 1024;
28 }
29
30 var features = jsonCompressed.features;
31 features.forEach(function (feature) {
32 var geometry = feature.geometry;
33 var encodeOffsets = geometry.encodeOffsets;
34 var coordinates = geometry.coordinates;
35
36 // Geometry may be appended manually in the script after json loaded.
37 // In this case this geometry is usually not encoded.
38 if (!encodeOffsets) {
39 return;
40 }
41
42 switch (geometry.type) {
43 case 'LineString':
44 geometry.coordinates = decodeRing(coordinates, encodeOffsets, encodeScale);
45 break;
46 case 'Polygon':
47 case 'MultiLineString':
48 decodeRings(coordinates, encodeOffsets, encodeScale);
49 break;
50 case 'MultiPolygon':
51 zrUtil.each(coordinates, function (rings, idx) {
52 return decodeRings(rings, encodeOffsets[idx], encodeScale)
53 });
54 }
55 });
56 // Has been decoded
57 jsonCompressed.UTF8Encoding = false;
58}
59
60function decodeRings(rings, encodeOffsets, encodeScale) {
61 for (var c = 0; c < rings.length; c++) {

Callers 1

cli.jsFile · 0.70

Calls 3

decodeRingFunction · 0.70
decodeRingsFunction · 0.70
eachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…