<commit_before>//
//  CLLocation+RGAppTools.swift
//  RGAppTools
//
//  Created by RAIN on 2017/8/18.
//  Copyright © 2017年 Smartech. All rights reserved.
//

import CoreLocation

private let TransPI: CLLocationDegrees = .pi * 3000.0 / 180.0

extension RGAppTools where Base: CLLocation {
    /// 百度坐标 ---> 火星坐标
    ///
    /// - Parameter baiduCoordinate: 记录百度坐标经纬度的结构体
    /// - Returns: 记录火星坐标经纬度的结构体
    public static func locationMars(fromBaidu baiduCoordinate: CLLocationCoordinate2D) -> CLLocationCoordinate2D {
        let x = baiduCoordinate.longitude - 0.0065;
        let y = baiduCoordinate.latitude - 0.006
        let z = sqrt(x * x + y * y) - 0.00002 * sin(y * TransPI)
        let theta = atan2(y, x) - 0.000003 * cos(x * TransPI)
        let gg_longitude = z * cos(theta)
        let gg_latitude = z * sin(theta)
        return CLLocationCoordinate2DMake(gg_latitude, gg_longitude)
    }

    /// 火星坐标 ---> 百度坐标
    ///
    /// - Parameter marsCoordinate: 记录火星坐标经纬度的结构体
    /// - Returns: 记录百度坐标经纬度的结构体
    public static func locationBaidu(fromMars marsCoordinate: CLLocationCoordinate2D) -> CLLocationCoordinate2D {
        let x = marsCoordinate.longitude
        let y = marsCoordinate.latitude
        let z = sqrt(x * x + y * y) + 0.00002 * sin(y * TransPI)
        let theta = atan2(y, x) + 0.000003 * cos(x * TransPI)
        let bd_longitude = z * cos(theta) + 0.0065
        let bd_latitude = z * sin(theta) + 0.006
        return CLLocationCoordinate2DMake(bd_latitude, bd_longitude)
    }
}<commit_msg>style (Core Location) : update style<commit_after>//
//  CLLocation+RGAppTools.swift
//  RGAppTools
//
//  Created by RAIN on 2017/8/18.
//  Copyright © 2017年 Smartech. All rights reserved.
//

import CoreLocation

private let TransPI: CLLocationDegrees = .pi * 3000.0 / 180.0

extension RGAppTools where Base: CLLocation {

  /// 百度坐标 ---> 火星坐标
  ///
  /// - Parameter baiduCoordinate: 记录百度坐标经纬度的结构体
  /// - Returns: 记录火星坐标经纬度的结构体
  public static func locationMars(fromBaidu baiduCoordinate: CLLocationCoordinate2D) -> CLLocationCoordinate2D {
    let x = baiduCoordinate.longitude - 0.0065;
    let y = baiduCoordinate.latitude - 0.006
    let z = sqrt(x * x + y * y) - 0.00002 * sin(y * TransPI)
    let theta = atan2(y, x) - 0.000003 * cos(x * TransPI)
    let gg_longitude = z * cos(theta)
    let gg_latitude = z * sin(theta)
    return CLLocationCoordinate2DMake(gg_latitude, gg_longitude)
  }

  /// 火星坐标 ---> 百度坐标
  ///
  /// - Parameter marsCoordinate: 记录火星坐标经纬度的结构体
  /// - Returns: 记录百度坐标经纬度的结构体
  public static func locationBaidu(fromMars marsCoordinate: CLLocationCoordinate2D) -> CLLocationCoordinate2D {
    let x = marsCoordinate.longitude
    let y = marsCoordinate.latitude
    let z = sqrt(x * x + y * y) + 0.00002 * sin(y * TransPI)
    let theta = atan2(y, x) + 0.000003 * cos(x * TransPI)
    let bd_longitude = z * cos(theta) + 0.0065
    let bd_latitude = z * sin(theta) + 0.006
    return CLLocationCoordinate2DMake(bd_latitude, bd_longitude)
  }

}
{'fraction_non_alphanumeric': 0.11547420965058236, 'fraction_numerical': 0.04792013311148086, 'mean_word_length': 2.729528535980149, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3869662', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1241, 'n_words': 258}