溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

怎么進(jìn)行echart Coordinate內(nèi)容解碼

發(fā)布時(shí)間:2021-10-20 16:51:59 來源:億速云 閱讀:110 作者:柒染 欄目:大數(shù)據(jù)

這篇文章將為大家詳細(xì)講解有關(guān)怎么進(jìn)行echart Coordinate內(nèi)容解碼,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

代碼翻自JavaScript版本 

public static List<double[]> decodePolygon(String coordinate, double[] encodeOffsets){
        List<double[]> result = new ArrayList<>();
        double prevX = encodeOffsets[0];
        double prevY = encodeOffsets[1];

        for (int i = 0; i < coordinate.length(); i += 2) {
            int x = coordinate.charAt(i) - 64;
            int y = coordinate.charAt(i + 1) - 64;
            x = (x >> 1) ^ (-(x & 1));
            y = (y >> 1) ^ (-(y & 1));
            x += prevX;
            y += prevY;

            prevX = x;
            prevY = y;
            result.add(new double[]{x / 1024d, y / 1024d});
        }
        return result;
    }

關(guān)于怎么進(jìn)行echart Coordinate內(nèi)容解碼就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI