MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / zOrder

Function zOrder

libs/mapv/mapv.js:2039–2055  ·  view source on GitHub ↗
(x, y, minX, minY, size)

Source from the content-addressed store, hash-verified

2037
2038// z-order of a point given coords and size of the data bounding box
2039function zOrder(x, y, minX, minY, size) {
2040 // coords are transformed into non-negative 15-bit integer range
2041 x = 32767 * (x - minX) / size;
2042 y = 32767 * (y - minY) / size;
2043
2044 x = (x | x << 8) & 0x00FF00FF;
2045 x = (x | x << 4) & 0x0F0F0F0F;
2046 x = (x | x << 2) & 0x33333333;
2047 x = (x | x << 1) & 0x55555555;
2048
2049 y = (y | y << 8) & 0x00FF00FF;
2050 y = (y | y << 4) & 0x0F0F0F0F;
2051 y = (y | y << 2) & 0x33333333;
2052 y = (y | y << 1) & 0x55555555;
2053
2054 return x | y << 1;
2055}
2056
2057// find the leftmost node of a polygon ring
2058function getLeftmost(start) {

Callers 2

isEarHashedFunction · 0.85
indexCurveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected