// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "BFL_Coordinate.generated.h"

/**
 * 
 */
UCLASS()
class IOC_TEMPLATE_API UBFL_Coordinate : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
	

public:
	/** 将GCJ-02坐标转换为WGS84坐标 */
	UFUNCTION(BlueprintCallable, Category = "Geo|Coordinate Conversion", meta = (Keywords = "GCJ02 WGS84"))
	static FVector2D GCJ02ToWGS84(double Longitude, double Latitude);

	UFUNCTION(BlueprintCallable, Category = "Color")
	static FColor HexToColor(FString HexString);
	UFUNCTION(BlueprintCallable, Category = "Color")
	static FString ColorToHex(FColor Color);

private:
	static constexpr double a = 6378245.0;        // WGS84长半轴
	static constexpr double ee = 0.00669342162296594323;  // 偏心率平方

	static bool IsOutOfChina(const FVector2D& Coord);
	static double TransformLatitude(double lng, double lat);
	static double TransformLongitude(double lng, double lat);
};