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

Function decodeRing

test/data/map/decode.js:70–92  ·  view source on GitHub ↗
(coordinate, encodeOffsets, encodeScale)

Source from the content-addressed store, hash-verified

68}
69
70function decodeRing(coordinate, encodeOffsets, encodeScale) {
71 var result = [];
72 var prevX = encodeOffsets[0];
73 var prevY = encodeOffsets[1];
74
75 for (var i = 0; i < coordinate.length; i += 2) {
76 var x = coordinate.charCodeAt(i) - 64;
77 var y = coordinate.charCodeAt(i + 1) - 64;
78 // ZigZag decoding
79 x = (x >> 1) ^ (-(x & 1));
80 y = (y >> 1) ^ (-(y & 1));
81 // Delta decoding
82 x += prevX;
83 y += prevY;
84
85 prevX = x;
86 prevY = y;
87 // Dequantize
88 result.push([x / encodeScale, y / encodeScale]);
89 }
90
91 return result;
92}
93
94// Export for testing.
95if (typeof module !== 'undefined') {

Callers 2

decodeFunction · 0.70
decodeRingsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…