MCPcopy Index your code
hub / github.com/apache/echarts / encodeRing

Function encodeRing

test/data/map/encode.js:60–80  ·  view source on GitHub ↗
(coordinates, encodeOffsets)

Source from the content-addressed store, hash-verified

58}
59
60function encodeRing(coordinates, encodeOffsets) {
61
62 var result = '';
63
64 var prevX = quantize(coordinates[0][0]);
65 var prevY = quantize(coordinates[0][1]);
66 // Store the origin offset
67 encodeOffsets[0] = prevX;
68 encodeOffsets[1] = prevY;
69
70 for (var i = 0; i < coordinates.length; i++) {
71 var point = coordinates[i];
72 result += encodePoint(point[0], prevX);
73 result += encodePoint(point[1], prevY);
74
75 prevX = quantize(point[0]);
76 prevY = quantize(point[1]);
77 }
78
79 return result;
80}
81
82function quantize(val) {
83 return Math.ceil(val * 1024);

Callers 1

encodeFunction · 0.85

Calls 2

quantizeFunction · 0.85
encodePointFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…