欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Java實現(xiàn)經(jīng)緯度坐標(biāo)轉(zhuǎn)換的示例代碼

 更新時間:2025年07月21日 09:58:57   作者:Charge8  
坐標(biāo)系統(tǒng)是描述物質(zhì)存在的空間位置(坐標(biāo))的參照系,通過定義特定基準(zhǔn)及其參數(shù)形式來實現(xiàn),下面我們就來看看如何使用Java實現(xiàn)經(jīng)緯度坐標(biāo)轉(zhuǎn)換功能吧

一、坐標(biāo)系統(tǒng)簡介

坐標(biāo)系統(tǒng),是描述物質(zhì)存在的空間位置(坐標(biāo))的參照系,通過定義特定基準(zhǔn)及其參數(shù)形式來實現(xiàn)。

坐標(biāo)是描述位置的一組數(shù)值,按坐標(biāo)的維度一般分為一維坐標(biāo)(公路里程碑)和二維坐標(biāo)(笛卡爾平面直角坐標(biāo)、高斯平面直角坐標(biāo))、三維坐標(biāo)(大地坐標(biāo)、空間直角坐標(biāo))。

為了描述或確定位置,必須建立坐標(biāo)系統(tǒng),坐標(biāo)只有存在于某個坐標(biāo)系統(tǒng)才有實際的意義與具體的位置。

地球是一個球體,球面上的位置,是以經(jīng)緯度來表示,它稱為“球面坐標(biāo)系統(tǒng)”或“地理坐標(biāo)系統(tǒng)”。
在球面上計算角度距離十分麻煩,而且地圖是印刷在平面紙張上,要將球面上的物體畫到紙上,就必須展平,這種將球面轉(zhuǎn)化為平面的過程,稱為“投影”。

1、經(jīng)緯度坐標(biāo)系

經(jīng)緯度坐標(biāo)系是一種地理坐標(biāo)系統(tǒng),用于描述地球表面上任意位置的坐標(biāo)。它是基于地球的自轉(zhuǎn)和赤道的劃分而建立的。

  • 經(jīng)度(Longitude):表示地球表面上一個點相對于本初子午線的東西方向的位置。經(jīng)度的度量單位是度(°),范圍從0°到180°,以東經(jīng)為正值,西經(jīng)為負(fù)值。本初子午線位于英國倫敦的皇家格林尼治天文臺,它被定義為經(jīng)度0°。
  • 緯度(Latitude):表示地球表面上一個點相對于赤道的北南方向的位置。緯度的度量單位也是度(°),范圍從0°到90°,以北緯為正值,南緯為負(fù)值。赤道位于緯度0°。

經(jīng)緯度坐標(biāo)系統(tǒng)是全球通用的地理坐標(biāo)系統(tǒng)。

經(jīng)緯度坐標(biāo)系統(tǒng)使用經(jīng)度和緯度的組合來確定地球表面上的特定位置。一個點的經(jīng)緯度坐標(biāo)表示為兩個數(shù)值的組合,例如:40°N,120°E 表示北緯40度,東經(jīng)120度的位置。

2、坐標(biāo)系統(tǒng)

(1)WGS84(World Geodetic System 1984,GPS標(biāo)準(zhǔn))

  • 定義:WWGS84,全稱“世界大地坐標(biāo)系統(tǒng)1984”,是一個國際廣泛接受的地心地固坐標(biāo)系統(tǒng),也是全球定位系統(tǒng)(GPS)的標(biāo)準(zhǔn)坐標(biāo)系。WGS84是基于地球橢球體模型,提供全球統(tǒng)一的地理坐標(biāo)框架,是開放和透明的,適用于全球范圍內(nèi)的導(dǎo)航、定位和地圖制作。
  • 歷史:經(jīng)歷了多次精化,包括WGS84(G730)、WGS84(G873)和WGS84(G1150)。
  • 參數(shù):長半軸為6378137.0米,扁率為1/298.257223563。
  • 應(yīng)用場景:全球范圍內(nèi)的GPS定位、地圖繪制等。

(2)GCJ-02(國測局坐標(biāo)系,也被稱為火星坐標(biāo)系)

  • 定義:GCJ-02,全稱“中國國測局坐標(biāo)系統(tǒng)”,也稱為“火星坐標(biāo)”或“火星加密算法”。它是中國國家測繪局制定的一種地理坐標(biāo)系,用于對中國大陸的地理位置進(jìn)行偏移加密處理。
  • 特點:它是中國政府為了安全而對公開的WGS84坐標(biāo)數(shù)據(jù)進(jìn)行了加密處理,使得在未授權(quán)的情況下難以直接使用全球定位系統(tǒng)(GPS)獲得精確的位置信息。相對于WGS84坐標(biāo)系進(jìn)行了加密處理,用于保護(hù)安全。
  • 應(yīng)用場景:在國內(nèi)的地圖服務(wù)、導(dǎo)航系統(tǒng)、地理信息系統(tǒng)等應(yīng)用中得到廣泛使用,例如高德地圖、騰訊地圖等。手機上的地圖導(dǎo)航軟件利用GCJ-02坐標(biāo)系實現(xiàn)了高精度的定位和導(dǎo)航功能。

(3)BD-09(Baidu Coordinate System)

  • 定義:BD-09是百度地圖使用的一種坐標(biāo)系。
  • BD-09是百度地圖使用的坐標(biāo)系統(tǒng),它是在GCJ-02的基礎(chǔ)上進(jìn)行的二次加密。
  • 特點:由于百度地圖在中國提供服務(wù),它需要遵守GCJ-02的加密規(guī)則,但為了增強定位精度和防止第三方直接解密GCJ-02坐標(biāo),百度在其服務(wù)中采用了更復(fù)雜的加密算法。即基于GCJ-02坐標(biāo)系進(jìn)行了加密偏移,提供了更好的數(shù)據(jù)保護(hù)性能。因此,從WGS84到BD-09,需要經(jīng)過兩次轉(zhuǎn)換,先由WGS84轉(zhuǎn)為GCJ-02,然后再轉(zhuǎn)為BD-09。
  • 應(yīng)用場景:主要用于中國境內(nèi)各種位置服務(wù)應(yīng)用,如百度地圖的定位和導(dǎo)航服務(wù)。

(4)CGCS2000(中國2000國家大地坐標(biāo)系)

  • 定義:CGCS2000,全稱“2000國家大地坐標(biāo)系統(tǒng)”,是中國最新的地心地固坐標(biāo)系統(tǒng),替代了之前的北京54和西安80坐標(biāo)系。以ITRF 97為參考框架,以2000.0作為參考?xì)v元。
  • 特點:原點設(shè)定在地球的質(zhì)量中心,Z軸指向IERS參考極,X軸和Y軸通過右手規(guī)則確定。
  • CGCS2000基于地球橢球體模型,與國際標(biāo)準(zhǔn)兼容,尤其與北斗衛(wèi)星導(dǎo)航系統(tǒng)配合使用時,提供高精度的定位服務(wù)。它是中國自主的全球定位系統(tǒng),與WGS84類似,但更適合中國的地理特性。
  • 與WGS84的關(guān)系:在定義上與WGS84非常相似,包括原點、尺度和定向。但在扁率上的差異會導(dǎo)致橢球面上的緯度和高度產(chǎn)生微小的變化。
  • 應(yīng)用場景:作為國家基礎(chǔ)坐標(biāo)系,用于各種測繪和地理信息系統(tǒng)工作。

3、坐標(biāo)轉(zhuǎn)換簡介

在地圖應(yīng)用中,不同的地圖服務(wù)商通常使用不同的坐標(biāo)系,坐標(biāo)轉(zhuǎn)換就是將一個地圖服務(wù)商的坐標(biāo)系轉(zhuǎn)換為另一個地圖服務(wù)商的坐標(biāo)系,以便在不同的地圖上顯示相同的位置信息。

GPS(谷歌地圖)|高德|百度地圖對坐標(biāo)系統(tǒng)的使用:

  • WGS84:地理坐標(biāo)系統(tǒng),GPS儀器記錄的經(jīng)緯度信息。Google Earth采用,Google Map中國范圍外使用,高德地圖中國范圍外使用。
  • GCJ-02:投影坐標(biāo)系統(tǒng),火星坐標(biāo)系,中國國家測繪局制定的坐標(biāo)系統(tǒng),由 WGS-84加密后的坐標(biāo)。適用于高德地圖。
  • BD-09:投影坐標(biāo)系統(tǒng),百度坐標(biāo)系,GCJ-02加密后的坐標(biāo)系,只適用于百度地圖。
  • CS2000:中國2000國家大地坐標(biāo)系統(tǒng),與WG-S84類似,只適用于北斗衛(wèi)星。

注意:

  • WGS84、GCJ-02和BD-09之間通過轉(zhuǎn)換算法或者API可以實現(xiàn)互轉(zhuǎn)。
  • GCS2000與GCJ-02和BD-09之間沒有直接的轉(zhuǎn)換關(guān)系,通常需要將 GCS2000轉(zhuǎn)換為 WGS84,然后通過這個中間坐標(biāo)系(WGS84)來進(jìn)行間接轉(zhuǎn)換。
  • 在國內(nèi)是不允許直接用 WGS84坐標(biāo)系標(biāo)注經(jīng)緯度的,必須經(jīng)過加密后才能用。所以必須至少使用 GCJ-02坐標(biāo)系,或者使用在GCJ-02加密后再進(jìn)行加密的 BD-09坐標(biāo)系。

不同地圖服務(wù)商有提供其豐富的 API文檔功能,包括經(jīng)緯度坐標(biāo)轉(zhuǎn)換功能。有的地圖服務(wù)商API需要收費。

二、地圖經(jīng)緯度轉(zhuǎn)換工具類

對于 CGCS2000 需要引入 proj4j依賴:

<dependency>
  <groupId>org.locationtech.proj4j</groupId>
  <artifactId>proj4j</artifactId>
  <version>1.3.0</version>
</dependency>
<dependency>
  <groupId>org.locationtech.proj4j</groupId>
  <artifactId>proj4j-epsg</artifactId>
  <version>1.3.0</version>
</dependency>
/**
 * 坐標(biāo)轉(zhuǎn)換工具類
 * <p>
 * 參考文章-實現(xiàn)的Java版本:https://github.com/wandergis/coordtransform
 */
@Slf4j
public class CoordinateTransformUtil {


    static double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
    // π
    static double pi = 3.1415926535897932384626;
    // 長半軸
    static double a = 6378245.0;
    // 扁率
    static double ee = 0.00669342162296594323;

    /**
     * WGS84 轉(zhuǎn) GCJ-02
     *
     * @param lng WGS84經(jīng)度
     * @param lat WGS84緯度
     * @return
     */
    public static Coordinate wgs84ToGcj02(double lng, double lat) {
        if (outOfChina(lng, lat)) {
            return new Coordinate(lng, lat);
        }
        double dlat = transformlat(lng - 105.0, lat - 35.0);
        double dlng = transformlng(lng - 105.0, lat - 35.0);
        double radlat = lat / 180.0 * pi;
        double magic = Math.sin(radlat);
        magic = 1 - ee * magic * magic;
        double sqrtmagic = Math.sqrt(magic);
        dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi);
        dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * pi);
        double mgLat = lat + dlat;
        double mgLng = lng + dlng;
        return new Coordinate(mgLng, mgLat);
    }

    /**
     * GCJ-02 轉(zhuǎn) WGS84
     *
     * @param lng GCJ-02經(jīng)度
     * @param lat GCJ-02緯度
     * @return
     */
    public static Coordinate gcj02ToWgs84(double lng, double lat) {
        if (outOfChina(lng, lat)) {
            return new Coordinate(lng, lat);
        }
        double dlat = transformlat(lng - 105.0, lat - 35.0);
        double dlng = transformlng(lng - 105.0, lat - 35.0);
        double radlat = lat / 180.0 * pi;
        double magic = Math.sin(radlat);
        magic = 1 - ee * magic * magic;
        double sqrtmagic = Math.sqrt(magic);
        dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi);
        dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * pi);
        double mgLat = lat + dlat;
        double mgLng = lng + dlng;
        return new Coordinate(lng * 2 - mgLng, lat * 2 - mgLat);
    }

    /**
     * GCJ-02 轉(zhuǎn) BD-09
     *
     * @param lng GCJ-02經(jīng)度
     * @param lat GCJ-02緯度
     * @return
     */
    public static Coordinate gcj02ToBd09(double lng, double lat) {
        double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_pi);
        double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_pi);
        double bd_lng = z * Math.cos(theta) + 0.0065;
        double bd_lat = z * Math.sin(theta) + 0.006;
        return new Coordinate(bd_lng, bd_lat);
    }


    /**
     * BD-09 轉(zhuǎn) GCJ-02
     *
     * @param lng BD-09經(jīng)度
     * @param lat BD-09緯度
     */
    public static Coordinate bd09ToGcj02(double lng, double lat) {
        double x = lng - 0.0065;
        double y = lat - 0.006;
        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
        double gg_lng = z * Math.cos(theta);
        double gg_lat = z * Math.sin(theta);
        return new Coordinate(gg_lng, gg_lat);
    }

    /**
     * BD-09 轉(zhuǎn) WGS84
     *
     * @param lng BD-09經(jīng)度
     * @param lat BD-09緯度
     * @return
     */
    public static Coordinate bd09ToWgs84(double lng, double lat) {
        Coordinate gcj02 = bd09ToGcj02(lng, lat);
        Coordinate wgs84 = gcj02ToWgs84(gcj02.longitude, gcj02.latitude);
        return wgs84;
    }


    /**
     * WGS84 轉(zhuǎn) BD-09
     *
     * @param lng WGS84經(jīng)度
     * @param lat WGS84緯度
     * @return
     */
    public static Coordinate wgs84ToBd09(double lng, double lat) {
        Coordinate gcj02 = wgs84ToGcj02(lng, lat);
        Coordinate bd09 = gcj02ToBd09(gcj02.longitude, gcj02.latitude);
        return bd09;
    }


    /**
     * 緯度轉(zhuǎn)換
     *
     * @param lng
     * @param lat
     * @return
     */
    public static double transformlat(double lng, double lat) {
        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
        ret += (20.0 * Math.sin(6.0 * lng * pi) + 20.0 * Math.sin(2.0 * lng * pi)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(lat * pi) + 40.0 * Math.sin(lat / 3.0 * pi)) * 2.0 / 3.0;
        ret += (160.0 * Math.sin(lat / 12.0 * pi) + 320 * Math.sin(lat * pi / 30.0)) * 2.0 / 3.0;
        return ret;
    }

    /**
     * 經(jīng)度轉(zhuǎn)換
     *
     * @param lng
     * @param lat
     * @return
     */
    public static double transformlng(double lng, double lat) {
        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
        ret += (20.0 * Math.sin(6.0 * lng * pi) + 20.0 * Math.sin(2.0 * lng * pi)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(lng * pi) + 40.0 * Math.sin(lng / 3.0 * pi)) * 2.0 / 3.0;
        ret += (150.0 * Math.sin(lng / 12.0 * pi) + 300.0 * Math.sin(lng / 30.0 * pi)) * 2.0 / 3.0;
        return ret;
    }

    /**
     * 判斷是否在國內(nèi),不在國內(nèi)不做偏移
     *
     * @param lng
     * @param lat
     * @return
     */
    public static boolean outOfChina(double lng, double lat) {
        if (lng < 72.004 || lng > 137.8347) {
            return true;
        } else if (lat < 0.8293 || lat > 55.8271) {
            return true;
        }
        return false;
    }

    /**
     * 坐標(biāo)類
     */
    @Data
    public static class Coordinate {
        /**
         * 經(jīng)度
         */
        private double longitude;

        /**
         * 維度
         */
        private double latitude;

        public Coordinate(double longitude, double latitude) {
            // 保留6位小數(shù),四舍五入模式
            //BigDecimal latBigDecimal = new BigDecimal(latitude).setScale(6, RoundingMode.HALF_UP);
            //BigDecimal lonBigDecimal = new BigDecimal(longitude).setScale(6, RoundingMode.HALF_UP);
            //this.longitude = lonBigDecimal.doubleValue();
            //this.latitude = latBigDecimal.doubleValue();
            this.longitude = longitude;
            this.latitude = latitude;
        }
    }

    // 定義CGCS2000的坐標(biāo)系
    private final static String CGCS2000 = "EPSG:4490";
    // 定義WGS84的坐標(biāo)系
    final static String WGS84 = "EPSG:4326";

    /**
     * CGCS2000 轉(zhuǎn) WGS84
     *
     * @param lng CGCS2000經(jīng)度
     * @param lat CGCS2000緯度
     * @return
     */
    public static Coordinate cgcs2000ToWgs84(double lng, double lat) {

        CRSFactory crsFactory = new CRSFactory();
        // 創(chuàng)建CGCS2000的坐標(biāo)參考系統(tǒng)
        CoordinateReferenceSystem sourceCRS = crsFactory.createFromName(CGCS2000);
        // 創(chuàng)建WGS84的坐標(biāo)參考系統(tǒng)
        CoordinateReferenceSystem targetCRS = crsFactory.createFromName(WGS84);

        // 定義坐標(biāo)轉(zhuǎn)換器
        CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
        // 創(chuàng)建轉(zhuǎn)換器
        CoordinateTransform transform = ctFactory.createTransform(sourceCRS, targetCRS);
        // 執(zhí)行坐標(biāo)轉(zhuǎn)換
        ProjCoordinate srcCoord = new ProjCoordinate(lng, lat);
        ProjCoordinate targetCoord = new ProjCoordinate();
        transform.transform(srcCoord, targetCoord);
        // 4. 輸出轉(zhuǎn)換后的正常經(jīng)緯度坐標(biāo)
        return new Coordinate(targetCoord.x, targetCoord.y);
    }

    /**
     * WGS84 轉(zhuǎn) CGCS2000
     *
     * @param lng WGS84經(jīng)度
     * @param lat WGS84緯度
     * @return
     */
    public static Coordinate wgs84ToCgcs2000(double lng, double lat) {
        CRSFactory crsFactory = new CRSFactory();
        // 定義源和目標(biāo)投影
        CoordinateReferenceSystem sourceCRS = crsFactory.createFromName(WGS84);
        CoordinateReferenceSystem targetCRS = crsFactory.createFromName(CGCS2000);

        // 定義坐標(biāo)轉(zhuǎn)換器
        CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
        // 創(chuàng)建轉(zhuǎn)換器
        CoordinateTransform transform = ctFactory.createTransform(sourceCRS, targetCRS);
        // 執(zhí)行坐標(biāo)轉(zhuǎn)換
        ProjCoordinate srcCoord = new ProjCoordinate(lng, lat);
        ProjCoordinate targetCoord = new ProjCoordinate();
        transform.transform(srcCoord, targetCoord);
        // 輸出轉(zhuǎn)換后的正常經(jīng)緯度坐標(biāo)
        return new Coordinate(targetCoord.x, targetCoord.y);
    }

    public static void main(String[] args) {
        double GPSLon = 108.876152;
        double GPSLat = 34.226685;
        CoordinateTransformUtil.Coordinate wgs84ToGcj02 = CoordinateTransformUtil.wgs84ToGcj02(GPSLon, GPSLat);
        CoordinateTransformUtil.Coordinate wgs84ToBd09 = CoordinateTransformUtil.wgs84ToBd09(GPSLon, GPSLat);
        log.info("GPS wgs84ToGcj02 : longitude={}, latitude={}", wgs84ToGcj02.longitude, wgs84ToGcj02.latitude);
        log.info("GPS wgs84ToBd09  : longitude={}, latitude={}", wgs84ToBd09.longitude, wgs84ToBd09.latitude);

        double aMapLon2 = 108.880753;
        double aMapLat2 = 34.225075;
        CoordinateTransformUtil.Coordinate gcj02ToWgs84 = CoordinateTransformUtil.gcj02ToWgs84(aMapLon2, aMapLat2);
        CoordinateTransformUtil.Coordinate gcj02ToBd09 = CoordinateTransformUtil.gcj02ToBd09(aMapLon2, aMapLat2);
        log.info("高德 gcj02ToWgs84 : longitude={}, latitude={}", gcj02ToWgs84.longitude, gcj02ToWgs84.latitude);
        log.info("高德 gcj02ToBd09  : longitude={}, latitude={}", gcj02ToBd09.longitude, gcj02ToBd09.latitude);

        double baiduLon3 = 108.887314;
        double baiduLat3 = 34.230897;
        CoordinateTransformUtil.Coordinate bd09ToWgs84 = CoordinateTransformUtil.bd09ToWgs84(baiduLon3, baiduLat3);
        CoordinateTransformUtil.Coordinate bd09ToGcj02 = CoordinateTransformUtil.bd09ToGcj02(baiduLon3, baiduLat3);
        log.info("百度 gcj02ToWgs84 : longitude={}, latitude={}", bd09ToWgs84.longitude, bd09ToWgs84.latitude);
        log.info("百度 gcj02ToBd09  : longitude={}, latitude={}", bd09ToGcj02.longitude, bd09ToGcj02.latitude);

        /**
         * CGCS2000
         */
        double CGCS2000Lon4 = 108.887314;
        double CGCS2000Lat4 = 34.230897;
        CoordinateTransformUtil.Coordinate CGCS2000ToWgs84 = CoordinateTransformUtil.cgcs2000ToWgs84(CGCS2000Lon4, CGCS2000Lat4);
        CoordinateTransformUtil.Coordinate CGCS2000ToBd09 = CoordinateTransformUtil.wgs84ToCgcs2000(CGCS2000Lon4, CGCS2000Lat4);
        log.info("中國2000 CGCS2000ToWgs84 : longitude={}, latitude={}", CGCS2000ToWgs84.longitude, CGCS2000ToWgs84.latitude);
        log.info("中國2000 CGCS2000ToBd09  : longitude={}, latitude={}", CGCS2000ToBd09.longitude, CGCS2000ToBd09.latitude);
    }

}

三、方法補充

Java實現(xiàn)WGS84、百度、騰訊、高德等主流的地理坐標(biāo)轉(zhuǎn)換

主要是WGS84(大地坐標(biāo)系)、GCJ02(國測局坐標(biāo)系,如高德地圖、騰訊地圖、谷歌中國范圍地圖)、BD09(百度坐標(biāo)系)三種主流坐標(biāo)系之間的轉(zhuǎn)換。

注意:如果經(jīng)緯度8位數(shù)字的需要進(jìn)行轉(zhuǎn)換:例如:69857065/600000=“116.428441” 即是真實的WGS84坐標(biāo)

完整代碼

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * 常用地圖轉(zhuǎn)換工具類(各個地圖API采用的坐標(biāo)系(WGS84坐標(biāo)系:即地球坐標(biāo)系,國際上通用的坐標(biāo)系。谷歌地圖用此坐標(biāo)))
 * 百度地圖API            百度坐標(biāo) (BD09坐標(biāo)系:即百度坐標(biāo)系,GCJ02坐標(biāo)系經(jīng)加密后的坐標(biāo)系。)
 * 騰訊搜搜地圖API            火星坐標(biāo) (GCJ02坐標(biāo)系:即火星坐標(biāo)系,WGS84坐標(biāo)系經(jīng)加密后的坐標(biāo)系。)
 * 阿里云地圖API            火星坐標(biāo) (GCJ02坐標(biāo)系:即火星坐標(biāo)系,WGS84坐標(biāo)系經(jīng)加密后的坐標(biāo)系。)
 * 高德MapABC地圖API    火星坐標(biāo) (GCJ02坐標(biāo)系:即火星坐標(biāo)系,WGS84坐標(biāo)系經(jīng)加密后的坐標(biāo)系。)
 */
public class MapUtils {
    public static final double r2d = 57.2957795131;
    public static final double PI = 3.1415926535897932384626433832795;
    public static final double rearth = 6371006.84;
 
    /**
     * wgs84坐標(biāo)轉(zhuǎn)上海城市坐標(biāo)
     * @param lat 維度
     * @param lon 經(jīng)度
     * @return
     */
    public static Map<String, Double> wgs84Tosh(Double lat, Double lon) {
        double tolat = (31 + (14.0 + 7.55996 / 60.0) / 60.0) / r2d;
        double tolon = (121.0 + (28.0 + 1.80651 / 60.0) / 60) / r2d;
 
        Double frlat = lat / r2d;
        Double frlon = lon / r2d;
        Double clatt = Math.cos(frlat);
        Double clatf = Math.cos(tolat);
        Double slatt = Math.sin(frlat);
        Double slatf = Math.sin(tolat);
        Double dlon = frlon - tolon;
        Double cdlon = Math.cos(dlon);
        Double sdlon = Math.sin(dlon);
        Double cdist = slatf * slatt + clatf * clatt * cdlon;
        Double temp = (clatt * sdlon) * (clatt * sdlon) + (clatf * slatt - slatf * clatt * cdlon) * (clatf * slatt - slatf * clatt * cdlon);
        Double sdist = Math.sqrt(Math.abs(temp));
 
        Double gcdist = 0.0;
 
        if ((Math.abs(sdist) > 1e-7) || (Math.abs(cdist) > 1e-7))
            gcdist = Math.atan2(sdist, cdist);
 
        Double sbrg = sdlon * clatt;
        Double cbrg = (clatf * slatt - slatf * clatt * cdlon);
 
        if ((Math.abs(sbrg) > 1e-7) || (Math.abs(cbrg) > 1e-7)) {
            temp = Math.atan2(sbrg, cbrg);
            while (temp < 0) {
                temp = temp + 2 * PI;
            }
        }
 
        Double hor = gcdist * rearth;
        Double xx = hor * Math.sin(temp);
        Double yy = hor * Math.cos(temp);
 
        Map<String,Double> model = new HashMap<String,Double>();
 
        model.put("lat", xx);
        model.put("lon", yy);
 
        return model;
    }
 
 
    public static final Double m_pNorthMove = -3457000.0;
    public static final Double m_pSHa = 6378245.0;
    public static final double m_pSHf = 298.3;
    public static final double m_pWGS84a = 6371006.84;
    public static final double m_pWGS84f = 298.25722356300003;
    /**
     * 上海城市坐標(biāo)轉(zhuǎn)WGS84坐標(biāo)
     * @param East 經(jīng)(東部)
     * @param North 緯(北部)
     * @param InH  內(nèi)部高度(默認(rèn)可以用 0.0)
     * @return
     */
    public static Map<String, Double> ShToWGS84(Double East, Double North, Double InH) {
        North = North - m_pNorthMove;
 
        List<Double> a = AntiGaussProjectionConst(m_pSHa, m_pSHf, East, North);
        Double rB = a.get(0);
        Double rl = a.get(1);
        Double m_pCenterL = DMSToDegree(121.0, 28.0, 0.0);
        Double dL = RadianToDegree(rl) + m_pCenterL;
        Double tB = rB;
        Double tL = DegreeToRadian(dL);
        Double tH = InH;
/*        Double sB = 0.0;
        Double sL = 0.0;
        Double sH = 0.0;*/
 
        ArrayList<Double> m_pPara = new ArrayList<Double>();
        m_pPara.add(-39.208938);
        m_pPara.add(65.046547);
        m_pPara.add(49.410739);
        m_pPara.add(SecondToRadian(6.125483));
        m_pPara.add(SecondToRadian(-1.281548));
        m_pPara.add(SecondToRadian(-0.861599));
        m_pPara.add(2.916036 * 1e-6);
        List<Double> b = LBH7ParameterSelf(tL, tB, tH, m_pSHa, 1.0 / m_pSHf, m_pPara.get(0),
                m_pPara.get(1), m_pPara.get(2), m_pPara.get(3),
                m_pPara.get(4), m_pPara.get(5), m_pPara.get(6),
                m_pWGS84a, 1.0 / m_pWGS84f);
 
 
        ArrayList<Double> a1 = RadianToDMS(b.get(0));
        ArrayList<Double> a2 = RadianToDMS(b.get(1));
 
        Double b1 = a1.get(0) + a1.get(1) / 60 + a1.get(2) / 3600;
        Double b2 = a2.get(0) + a2.get(1) / 60 + a2.get(2) / 3600;
 
        /*百度偏移*/
        /*谷歌偏移*/
        b1 = b1 + 0.000935;
        b2 = b2 + 0.002651;
 
        Map<String,Double> model = new HashMap<String,Double>();
 
        model.put("lat", b1);
        model.put("lon", b2);
 
        return model;
    }
 
    /**
     * WGS-84轉(zhuǎn)GCJ坐標(biāo)
     * @param wgsLat
     * @param wgsLon
     * @return
     */
    public static Map<String, Double> gcj_encrypt(Double wgsLat, Double wgsLon) {
        Map<String,Double> model = new HashMap<String,Double>();
 
        if (outOfChina(wgsLat, wgsLon)) {
 
            model.put("lat", wgsLat);
            model.put("lon", wgsLon);
 
            return model;
        }
 
        Map<String, Double> d = delta(wgsLat, wgsLon);
 
        model.put("lat", wgsLat + (Double) d.get("lat"));
        model.put("lon", wgsLon + (Double) d.get("lon"));
 
        return model;
    }
 
    /**
     * GCJ坐標(biāo)轉(zhuǎn)WGS-84坐標(biāo)
     * @param gcjLat
     * @param gcjLon
     * @return
     */
    public static Map<String, Double> gcj_decrypt(Double gcjLat, Double gcjLon) {
        Map<String, Double> model = new HashMap<String, Double>();
 
        if (outOfChina(gcjLat, gcjLon)) {
 
            model.put("lat", gcjLat);
            model.put("lon", gcjLon);
 
            return model;
        }
 
        Map<String, Double> d = delta(gcjLat, gcjLon);
 
        model.put("lat", gcjLat - (Double) d.get("lat"));
        model.put("lon", gcjLon - (Double) d.get("lon"));
 
        return model;
    }
 
    public static final double x_pi = PI * 3000.0 / 180.0;
    /**
     * GCJ-02坐標(biāo)轉(zhuǎn)百度BD-09坐標(biāo)
     * @param gcjLat
     * @param gcjLon
     * @return
     */
    public static Map<String, Double> bd_encrypt(Double gcjLat, Double gcjLon) {
        Map<String, Double> model = new HashMap<String, Double>();
 
        Double x = gcjLon, y = gcjLat;
        Double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
        Double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
        Double bdLon = z * Math.cos(theta) + 0.0065;
        Double bdLat = z * Math.sin(theta) + 0.006;
 
        model.put("lat", bdLat);
        model.put("lon", bdLon);
 
        return model;
    }
 
    /**
     * 百度BD-09坐標(biāo)轉(zhuǎn)GCJ-02坐標(biāo)
     * @param bdLat
     * @param bdLon
     * @return
     */
    public static Map<String, Double> bd_decrypt(Double bdLat, Double bdLon) {
        Map<String, Double> model = new HashMap<String, Double>();
 
        Double x = bdLon - 0.0065, y = bdLat - 0.006;
        Double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
        Double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
        Double gcjLon = z * Math.cos(theta);
        Double gcjLat = z * Math.sin(theta);
 
        model.put("lat", gcjLat);
        model.put("lon", gcjLon);
 
        return model;
    }
 
 
    public static Boolean outOfChina(Double lat, Double lon) {
        if (lon < 72.004 || lon > 137.8347)
            return true;
        if (lat < 0.8293 || lat > 55.8271)
            return true;
 
        return false;
    }
    public static Map<String, Double> delta(Double lat, Double lon) {
        Double a = 6378245.0; //  a: 衛(wèi)星橢球坐標(biāo)投影到平面地圖坐標(biāo)系的投影因子。
        Double ee = 0.00669342162296594323; //  ee: 橢球的偏心率。
        Double dLat = transformLat(lon - 105.0, lat - 35.0);
        Double dLon = transformLon(lon - 105.0, lat - 35.0);
        Double radLat = lat / 180.0 * PI;
        Double magic = Math.sin(radLat);
        magic = 1 - ee * magic * magic;
        Double sqrtMagic = Math.sqrt(magic);
        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * PI);
        dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * PI);
 
        Map<String,Double> model = new HashMap<String,Double>();
 
        model.put("lat", dLat);
        model.put("lon", dLon);
 
        return model;
    }
    public static Double transformLat(Double x, Double y) {
        Double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
        ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(y * PI) + 40.0 * Math.sin(y / 3.0 * PI)) * 2.0 / 3.0;
        ret += (160.0 * Math.sin(y / 12.0 * PI) + 320 * Math.sin(y * PI / 30.0)) * 2.0 / 3.0;
 
        return ret;
    }
    public static Double transformLon(Double x, Double y) {
        Double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
        ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(x * PI) + 40.0 * Math.sin(x / 3.0 * PI)) * 2.0 / 3.0;
        ret += (150.0 * Math.sin(x / 12.0 * PI) + 300.0 * Math.sin(x / 30.0 * PI)) * 2.0 / 3.0;
 
        return ret;
    }
 
 
    public static final double MPD = 60.0;
    public static final double SPD = 3600.0;
    public static final double SPM = 60.0;
    public static ArrayList<Double> RadianToDMS(Double radian) {
        Boolean isNegative;
 
        Double degree = 0.0;
        Double minute = 0.0;
        Double second = 0.0;
 
        isNegative = false;
        if (radian < 0.0) {
            isNegative = false;
            radian = Math.abs(radian);
        } else {
            isNegative = false;
            degree = radian * DPR;
            minute = (degree - Math.floor(degree)) * MPD;
 
            degree = Math.floor(degree);
            second = (minute - Math.floor(minute)) * SPM;
            minute = Math.floor(minute);
 
            if (isNegative) {
                degree = -degree;
                minute = -minute;
                second = -second;
            }
        }
 
        ArrayList<Double> datalist = new ArrayList<Double>();
 
        datalist.add(degree);
        datalist.add(minute);
        datalist.add(second);
 
        return datalist;
    }
    public static ArrayList<Double> LBH7ParameterSelf(Double Ls, Double Bs, Double Hs, Double fA, Double fF, Double dX,
                                                      Double dY, Double dZ, Double ex, Double ey, Double ez, Double m, Double at, Double ft) {
        Double Xs, Ys, Zs, Xt, Yt, Zt, Lt, Bt, Ht;
        ArrayList<Double> datalist = new ArrayList<Double>();
 
        ArrayList<Double> a = LBHToXYZ(fA, 1.0 / fF, Ls, Bs, Hs);
 
        Xs = a.get(0);
        Ys = a.get(1);
        Zs = a.get(2);
 
        ArrayList<Double> b = XYZ7Parameter(Xs, Ys, Zs, dX, dY, dZ, ex, ey, ez, m);
 
        Xt = b.get(0);
        Yt = b.get(1);
        Zt = b.get(2);
 
        ArrayList<Double> c = XYZToLBHBowring(at, 1.0 / ft, Xt, Yt, Zt);
 
        Lt = c.get(0);
        Bt = c.get(1);
        Ht = c.get(2);
 
        datalist.add(Lt);
        datalist.add(Bt);
        datalist.add(Ht);
 
        return datalist;
    }
 
    public static final double EQUALDE = 0.00000000000001;
    public static ArrayList<Double> AntiGaussProjectionConst(Double curra, Double currinvf, Double East, Double North) {
        Double currf, currb, curre12, curre22, curre14, curre16, curre18, currAp, currBp, currCp, currDp, currEp;
        Double A2, A4, A6, A8, currB2, currB4, currB6, currB8, phi, Bf, Nf, tf, cosBf, etaf2;
        Double B, l;
 
        ArrayList<Double> datalist = new ArrayList<Double>();
 
        if ((Math.abs(East) < EQUALDE) && (Math.abs(North) < EQUALDE)) {
            B = 0.0;
            l = 0.0;
        }
 
        currf = 1 / currinvf;
        currb = curra * (1 - currf);
        curre12 = (curra * curra - currb * currb) / (curra * curra);
        curre22 = (curra * curra - currb * currb) / (currb * currb);
        curre14 = curre12 * curre12;
        curre16 = curre14 * curre12;
        curre18 = curre14 * curre14;
 
        currAp = 1 + 3.0 / 4.0 * curre12 + 45.0 / 64.0 * curre14 + 175.0 / 256.0 * curre16 + 11025.0 / 16384.0 * curre18;
        currBp = 3.0 / 4.0 * curre12 + 15.0 / 16.0 * curre14 + 525.0 / 512.0 * curre16 + 2205.0 / 2048.0 * curre18;
        currCp = 15.0 / 64.0 * curre14 + 105.0 / 256.0 * curre16 + 2205.0 / 4096.0 * curre18;
        currDp = 35.0 / 512.0 * curre16 + 315.0 / 2048.0 * curre18;
        currEp = 315.0 / 16384.0 * curre18;
        A2 = currBp / (2 * currAp);
        A4 = -currCp / (4 * currAp);
        A6 = currDp / (6 * currAp);
        A8 = -currEp / (8 * currAp);
 
        currB2 = A2 - A2 * A4 - A4 * A6 - 0.5 * A2 * A2 * A2 - A2 * A4 * A4 + 0.5 * A2 * A2 * A6 - 18.3 * A2 * A2 * A2 * A4;
        currB4 = A4 + A2 * A2 - 2.0 * A2 * A6 - 4.0 * A2 * A2 * A4 - 1.3 * A2 * A2 * A2 * A2;
        currB6 = A6 + 3.0 * A2 * A4 - 3.0 * A2 * A8 + 1.5 * A2 * A2 * A2 - 4.5 * A2 * A4 * A4 - 9.0 * A2 * A2 * A6 - 12.5 * A2 * A2 * A2 * A4;
        currB8 = A8 + 2.0 * A4 * A4 + 4.0 * A2 * A6 + 8.0 * A2 * A2 * A4 + 2.7 * A2 * A2 * A2 * A2;
 
        phi = North / (curra * (1 - curre12) * currAp);
        Bf = phi + currB2 * Math.sin(2 * phi) + currB4 * Math.sin(4 * phi) + currB6 * Math.sin(6 * phi) + currB8 * Math.sin(8 * phi);
 
        if (Math.abs(Math.abs(Bf) - PI / 2.0) < EQUALDE) {
            B = Bf;
            l = 0.0;
 
            datalist.add(B);
            datalist.add(l);
 
            return datalist;
        }
 
        Nf = curra / Math.sqrt(1 - curre12 * Math.sin(Bf) * Math.sin(Bf));
        tf = Math.tan(Bf);
        cosBf = Math.cos(Bf);
        etaf2 = curre22 * cosBf * cosBf;
 
        B = Bf + tf * (-1 - etaf2) * East * East / (2 * Nf * Nf)
                + tf * (5 + 3 * tf * tf + 6 * etaf2 - 6 * tf * tf * etaf2 - 3 * etaf2 * etaf2 - 9 * tf * tf * etaf2 * etaf2) * East * East * East * East / (24 * Nf * Nf * Nf * Nf)
                + tf * (-61 - 90 * tf * tf - 45 * tf * tf * tf * tf - 107 * etaf2 + 162 * tf * tf * etaf2 + 45 * tf * tf * tf * tf * etaf2) * East * East * East * East * East * East / (720 * Nf * Nf * Nf * Nf * Nf * Nf);
        l = East / (Nf * cosBf)
                + (-1 - 2 * tf * tf - etaf2) * East * East * East / (6 * Nf * Nf * Nf * cosBf)
                + (5 + 28 * tf * tf + 24 * tf * tf * tf * tf + 6 * etaf2 + 8 * tf * tf * etaf2) * East * East * East * East * East / (120 * Nf * Nf * Nf * Nf * Nf * cosBf);
 
        datalist.add(B);
        datalist.add(l);
 
        return datalist;
 
    }
    public static final double DPM = 0.016666666666666666666666666666667;
    public static final double DPS = 0.00027777777777777777777777777777778;
    public static Double DMSToDegree(Double degree, Double minute, Double second) {
        Boolean isNegative;
 
        if ((degree < 0.0) || (minute < 0.0) || (second < 0.0)) {
            isNegative = true;
            degree = Math.abs(degree);
            minute = Math.abs(minute);
            second = Math.abs(second);
        } else
            isNegative = false;
 
        degree = degree + minute * DPM + second * DPS;
 
        if (isNegative) {
            return -degree;
        } else
            return degree;
    }
 
    public static final double DPR = 57.295779513082320876798154814105;
    public static final double RPD = 0.017453292519943295769236907684886;
    public static final double RPS = 0.0000048481368110953599358991410235795;
    public static Double RadianToDegree(Double radian) {
        return radian * DPR;
    }
    public static Double DegreeToRadian(Double degree) {
        return degree * RPD;
    }
    public static Double SecondToRadian(Double second) {
        return second * RPS;
    }
 
    public static ArrayList<Double> XYZToLBHBowring(Double curra, Double currinvf, Double X, Double Y, Double Z) {
        Double L, B, H;
        Double Rxy, f, e12, e22, tanu, cosu, sinu, temp;
        Double sinB;
        ArrayList<Double> datalist = new ArrayList<Double>();
 
        if ((X == 0) && (Y == 0)) {
            if (Z < 0) {
                L = 0.0;
                B = -PI / 2;
                H = -(Z + curra * (1 - 1 / currinvf));
            } else if (Z > 0) {
                L = 0.0;
                B = PI / 2;
                H = Z - curra * (1 - 1 / currinvf);
            } else {
                L = 0.0;
                B = 0.0;
                H = -curra;
            }
        }
 
        Rxy = Math.sqrt(X * X + Y * Y);
        //Get L
        L = Math.acos(X / Rxy);
        if (Y < 0) L = -L;
        //Get B
        f = 1 / currinvf;
        e12 = (2 - f) * f;
        e22 = e12 / (1 - e12);
        tanu = Z * Math.sqrt(1 + e22) / Rxy;
        cosu = 1 / Math.sqrt(1 + tanu * tanu);
        sinu = tanu * cosu;
        temp = Rxy - curra * e12 * cosu * cosu * cosu;
        if (temp == 0) {
            if (Z < 0)
                B = -PI / 2;
            else
                B = PI / 2;
        } else
            B = Math.atan((Z + curra * (1 - f) * e22 * sinu * sinu * sinu) / temp);
        //Get H
        sinB = Math.sin(B);
        if (Math.abs(B) < 4.8e-10)
            H = Rxy / Math.cos(B) - curra / Math.sqrt(1 - e12 * sinB * sinB);
        else
            H = Z / sinB - curra / Math.sqrt(1 - e12 * sinB * sinB) * (1 - e12);
 
        datalist.add(L);
        datalist.add(B);
        datalist.add(H);
 
        return datalist;
    }
 
    public static ArrayList<Double> LBHToXYZ(Double curra, Double currinvf, Double L, Double B, Double H) {
        Double e12, N, X, Y, Z;
        ArrayList<Double> datalist = new ArrayList<Double>();
 
        e12 = (2.0 - 1.0 / currinvf) / currinvf;
        N = curra / Math.sqrt(1 - e12 * Math.sin(B) * Math.sin(B));
        X = (N + H) * Math.cos(B) * Math.cos(L);
        Y = (N + H) * Math.cos(B) * Math.sin(L);
        Z = (N * (1 - e12) + H) * Math.sin(B);
 
        datalist.add(X);
        datalist.add(Y);
        datalist.add(Z);
 
        return datalist;
    }
 
    public static ArrayList<Double> XYZ7Parameter(Double Xs, Double Ys, Double Zs, Double dX, Double dY, Double dZ, Double ex,
                                                  Double ey, Double ez, Double m) {
        Double Xt, Yt, Zt;
        ArrayList<Double> datalist = new ArrayList<Double>();
 
        Xt = Xs * (1 + m) + Ys * ez - Zs * ey + dX;
        Yt = Ys * (1 + m) - Xs * ez + Zs * ex + dY;
        Zt = Zs * (1 + m) + Xs * ey - Ys * ex + dZ;
 
        datalist.add(Xt);
        datalist.add(Yt);
        datalist.add(Zt);
 
        return datalist;
    }
 
 
}

以上就是Java實現(xiàn)經(jīng)緯度坐標(biāo)轉(zhuǎn)換的示例代碼的詳細(xì)內(nèi)容,更多關(guān)于Java坐標(biāo)轉(zhuǎn)換的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • 在Eclipse中運行Solr 基礎(chǔ)知識

    在Eclipse中運行Solr 基礎(chǔ)知識

    Solr我還是個菜鳥,寫這一些文章只是記錄一下最近一段時間學(xué)習(xí)Solr的心得,望各位同仁不要見笑,還希望多多指點
    2012-11-11
  • feign?打印日志不顯示的問題及解決

    feign?打印日志不顯示的問題及解決

    這篇文章主要介紹了feign?打印日志不顯示的問題及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-06-06
  • SpringBoot @JsonDeserialize自定義Json序列化方式

    SpringBoot @JsonDeserialize自定義Json序列化方式

    這篇文章主要介紹了SpringBoot @JsonDeserialize自定義Json序列化方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-10-10
  • Netty分布式Future與Promise執(zhí)行回調(diào)相關(guān)邏輯剖析

    Netty分布式Future與Promise執(zhí)行回調(diào)相關(guān)邏輯剖析

    這篇文章主要為大家介紹了Netty分布式Future與Promise執(zhí)行回調(diào)相關(guān)邏輯剖析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步
    2022-03-03
  • Java中的回調(diào)

    Java中的回調(diào)

    這篇文章主要介紹了Java中回調(diào)的相關(guān)資料,幫助大家更好的理解和學(xué)習(xí)java,感興趣的朋友可以了解下
    2020-08-08
  • JAVA利用泛型返回類型不同的對象方法

    JAVA利用泛型返回類型不同的對象方法

    下面小編就為大家?guī)硪黄狫AVA利用泛型返回類型不同的對象方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-02-02
  • SpringBoot整合Elasticsearch7.2.0的實現(xiàn)方法

    SpringBoot整合Elasticsearch7.2.0的實現(xiàn)方法

    這篇文章主要介紹了SpringBoot整合Elasticsearch7.2.0的實現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-08-08
  • Java實現(xiàn)五子棋網(wǎng)絡(luò)版

    Java實現(xiàn)五子棋網(wǎng)絡(luò)版

    這篇文章主要為大家詳細(xì)介紹了基于Java編寫的網(wǎng)絡(luò)五子棋,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-03-03
  • 詳解Java編程的Observer觀察者設(shè)計模式

    詳解Java編程的Observer觀察者設(shè)計模式

    這篇文章主要介紹了Java編程的Observer觀察者設(shè)計模式,觀察者模式定義了一個一對多的依賴關(guān)系,讓一個或多個觀察者對象監(jiān)察一個主題對象,需要的朋友可以參考下
    2016-01-01
  • plantuml畫圖實現(xiàn)代碼畫時序圖UML用例圖

    plantuml畫圖實現(xiàn)代碼畫時序圖UML用例圖

    這篇文章主要為大家介紹了plantuml畫圖實現(xiàn)代碼畫時序圖示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-07-07

最新評論